Package com.ibm.di.config.interfaces
Class TDIPropertyStore
- java.lang.Object
-
- com.ibm.di.config.interfaces.TDIPropertyStore
-
- All Implemented Interfaces:
java.io.Serializable,java.util.Iterator
public class TDIPropertyStore extends java.lang.Object implements java.util.Iterator, java.io.SerializableRepresents a property store- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static LogloggerThis is the logger object used by this class and other configuration drivers.static java.lang.StringPROTECT_VAL_PREFIX
-
Constructor Summary
Constructors Constructor Description TDIPropertyStore()TDIPropertyStore(PropertyStoreConfig psc)Constructor for the TDIPropertyStore objectTDIPropertyStore(PropertyStoreConfig psc, TDIProperties context)Constructor for the TDIPropertyStore object
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaccepts(java.lang.String propertyName)Returns true if we accept this propertyname.booleancanDelete()Returns true if the connector supports Delete mode and is not readonlybooleancanIterate()Returns true if the connector supports Iterator modebooleancanRead()Returns true if the connector supports Lookup modebooleancanWrite()Returns true if the connector supports Update mode and is not readonlyvoidcommit()Flushes changes to target systemjava.util.Iteratorentries()Returns an Iterator over all property EntriesRawConnectorConfiggetConnectionConfig()Return the config for the underlying Connector.java.lang.ExceptiongetException()Returns the last Exception thrown by the connector while iteratingjava.lang.StringgetName()Gets the short name of this TDIPropertyStorejava.lang.ObjectgetProperty(java.lang.String key)Returns the named propertyEntrygetPropertyEntry(java.lang.String key)Returns the Entry object for a key.booleanhasNext()Returns true if the Iterator has more values.voidinitialize(TDIProperties context)Initializes data structures.booleanisModified()Returns true if the properties have been modified, but not saved yetjava.util.Iteratorkeys()Returns an Iterator over all property keysvoidlog(java.lang.String msg)Logs a message.voidlogerror(java.lang.String msg, java.lang.Exception err)Logs an error message.java.lang.Objectnext()Return the next value from an Iterator.voidreconnect()Reinitializes the connector.voidreload()Reloads the information from the connector into a local cache.voidremove()Dummy method to implement Iterator.voidremoveProperty(java.lang.String key)Removes a named property.voidsetModified(boolean modified)Sets the modified flag.voidsetProperty(Entry entry)Sets a named property to the given value.voidsetProperty(java.lang.String key, java.lang.Object value)Sets the named property to the given valuevoidsetProperty(java.lang.String key, java.lang.Object value, boolean protect)Sets the named property to the given value, with optional protectionbooleansupportsMode(java.lang.String mode)Returns true if the connector supports this modevoidterminate()Terminates the connectorjava.util.Iteratorvalues()Returns an Iterator over all property values
-
-
-
Field Detail
-
logger
public static final Log logger
This is the logger object used by this class and other configuration drivers.
-
PROTECT_VAL_PREFIX
public static final java.lang.String PROTECT_VAL_PREFIX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TDIPropertyStore
public TDIPropertyStore()
-
TDIPropertyStore
public TDIPropertyStore(PropertyStoreConfig psc) throws java.lang.Exception
Constructor for the TDIPropertyStore object- Parameters:
psc- Configuration of the property store- Throws:
java.lang.Exception- if the operation does not succeed
-
TDIPropertyStore
public TDIPropertyStore(PropertyStoreConfig psc, TDIProperties context) throws java.lang.Exception
Constructor for the TDIPropertyStore object- Parameters:
psc- The PropertyStoreConfigcontext- The TDIProperties context- Throws:
java.lang.Exception
-
-
Method Detail
-
initialize
public void initialize(TDIProperties context) throws java.lang.Exception
Initializes data structures. Load and initialize the connector, and read data if they should be read initially.- Parameters:
context- The TDIProperties context. Not used.- Throws:
java.lang.Exception- If any problem occurs during loading or initializing the connector.
-
log
public void log(java.lang.String msg)
Logs a message.- Parameters:
msg- The message to log
-
logerror
public void logerror(java.lang.String msg, java.lang.Exception err)Logs an error message.- Parameters:
msg- The message to logerr- The Exception
-
reload
public void reload()
Reloads the information from the connector into a local cache. Calling this will only have an effect if caching is enabled by setting Cache Timeout to a value greater than 0.
-
reconnect
public void reconnect() throws java.lang.ExceptionReinitializes the connector. This will also cause all stored information to be saved, if needed.- Throws:
java.lang.Exception- If there is any problem with initializing the connector
-
terminate
public void terminate() throws java.lang.ExceptionTerminates the connector- Throws:
java.lang.Exception- If there is a problem with terminating the connector
-
commit
public void commit() throws java.lang.ExceptionFlushes changes to target system- Throws:
java.lang.Exception
-
canIterate
public boolean canIterate()
Returns true if the connector supports Iterator mode- Returns:
- true if the connector supports Iterator mode
-
canWrite
public boolean canWrite()
Returns true if the connector supports Update mode and is not readonly- Returns:
- true if the connector supports Update mode and is not readonly
-
canDelete
public boolean canDelete()
Returns true if the connector supports Delete mode and is not readonly- Returns:
- true if the connector supports Delete mode and is not readonly
-
canRead
public boolean canRead()
Returns true if the connector supports Lookup mode- Returns:
- true if the connector supports Lookup mode
-
accepts
public boolean accepts(java.lang.String propertyName)
Returns true if we accept this propertyname.- Parameters:
propertyName- Property name to check- Returns:
- true if we accept this propertyname
-
getName
public java.lang.String getName()
Gets the short name of this TDIPropertyStore- Returns:
- The name value
-
supportsMode
public boolean supportsMode(java.lang.String mode)
Returns true if the connector supports this mode- Parameters:
mode- The mode to check- Returns:
- true if the connector supports this mode
-
getProperty
public java.lang.Object getProperty(java.lang.String key) throws java.lang.ExceptionReturns the named property- Parameters:
key- The property name to find- Returns:
- The property value or null if not found
- Throws:
java.lang.Exception- Any Exception thrown by the connector
-
getPropertyEntry
public Entry getPropertyEntry(java.lang.String key) throws java.lang.Exception
Returns the Entry object for a key. The Entry object has at least two Attributes, a "key" Attribute and a "value" Attribute. If the value is protected, there will also be a "protect" Attribute.- Parameters:
key- The name of the attribute to find- Returns:
- The Entry containing the name and value
- Throws:
java.lang.Exception- Any Exception thrown by the connector
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value) throws java.lang.ExceptionSets the named property to the given value- Parameters:
key- The name of the propertyvalue- The new property value, null means delete- Throws:
java.lang.Exception- If key is missing, or any Exception thrown by the connector
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value, boolean protect) throws java.lang.ExceptionSets the named property to the given value, with optional protection- Parameters:
key- The name of the propertyvalue- The new property value, null means deleteprotect- True if the value should be protected (encrypted)- Throws:
java.lang.Exception- If key is missing, or any Exception thrown by the connector
-
setProperty
public void setProperty(Entry entry) throws java.lang.Exception
Sets a named property to the given value. The Entry object must contains the "key" and "value" attributes and optionally "protect" (boolean)- Parameters:
entry- The Entry object containing property name and value- Throws:
java.lang.Exception- If key is missing, or any Exception thrown by the connector
-
removeProperty
public void removeProperty(java.lang.String key) throws java.lang.ExceptionRemoves a named property.- Parameters:
key- The name of the property to remove- Throws:
java.lang.Exception- If key is missing, or the Property store is readonly, or any Exception thrown by the connector
-
keys
public java.util.Iterator keys()
Returns an Iterator over all property keys- Returns:
- an Iterator over all property keys
-
values
public java.util.Iterator values()
Returns an Iterator over all property values- Returns:
- an Iterator over all property values
-
entries
public java.util.Iterator entries()
Returns an Iterator over all property Entries- Returns:
- an Iterator over all property Entries
-
hasNext
public boolean hasNext()
Returns true if the Iterator has more values. Only call this method if you have previously called keys(), values() or entries().- Specified by:
hasNextin interfacejava.util.Iterator- Returns:
- true if the Iterator has a next
-
next
public java.lang.Object next()
Return the next value from an Iterator. Only call this method if you have previously called keys(), values() or entries(), and hasNext() returns true.- Specified by:
nextin interfacejava.util.Iterator- Returns:
- The next value for the Iterator, it will be an Entry if you have called entries().
-
remove
public void remove()
Dummy method to implement Iterator. This method does nothing.- Specified by:
removein interfacejava.util.Iterator
-
getException
public java.lang.Exception getException()
Returns the last Exception thrown by the connector while iterating- Returns:
- the last Exception thrown by the connector while iterating
-
isModified
public boolean isModified()
Returns true if the properties have been modified, but not saved yet- Returns:
- true if the properties have been modified, but not saved yet
-
setModified
public void setModified(boolean modified)
Sets the modified flag. This can be useful if you want to force a save, or avoid a save
-
getConnectionConfig
public RawConnectorConfig getConnectionConfig()
Return the config for the underlying Connector. For internal use.- Returns:
-
-