com.ibm.di.config.interfaces
Class TDIPropertyStore

java.lang.Object
  extended by com.ibm.di.config.interfaces.TDIPropertyStore
All Implemented Interfaces:
Serializable, Iterator

public class TDIPropertyStore
extends Object
implements Iterator, Serializable

Represents a property store

See Also:
Serialized Form

Field Summary
static Log logger
          This is the logger object used by this class and other configuration drivers.
static String PROTECT_VAL_PREFIX
           
 
Constructor Summary
TDIPropertyStore()
           
TDIPropertyStore(PropertyStoreConfig psc)
          Constructor for the TDIPropertyStore object
TDIPropertyStore(PropertyStoreConfig psc, TDIProperties context)
          Constructor for the TDIPropertyStore object
 
Method Summary
 boolean accepts(String propertyName)
          Returns true if we accept this propertyname.
 boolean canDelete()
          Returns true if the connector supports Delete mode and is not readonly
 boolean canIterate()
          Returns true if the connector supports Iterator mode
 boolean canRead()
          Returns true if the connector supports Lookup mode
 boolean canWrite()
          Returns true if the connector supports Update mode and is not readonly
 void commit()
          Flushes cached changes to target system
 Iterator entries()
          Returns an Iterator over all property Entries
 RawConnectorConfig getConnectionConfig()
          Return the config for the underlying Connector.
 Exception getException()
          Returns the last Exception thrown by the connector while iterating
 String getName()
          Gets the short name of this TDIPropertyStore
 Object getProperty(String key)
          Returns the named property
 Entry getPropertyEntry(String key)
          Returns the Entry object for a key.
 boolean hasNext()
          Returns true if the Iterator has more values.
 void initialize(TDIProperties context)
          Initializes data structures.
 boolean isModified()
          Returns true if the properties have been modified, but not saved yet
 Iterator keys()
          Returns an Iterator over all property keys
 void log(String msg)
          Logs a message.
 void logerror(String msg, Exception err)
          Logs an error message.
 Object next()
          Return the next value from an Iterator.
 void reconnect()
          Reinitializes the connector.
 void reload()
          Reloads the information from the connector
 void remove()
          Dummy method to implement Iterator.
 void removeProperty(String key)
          Removes a named property.
 void setModified(boolean modified)
          Sets the modified flag.
 void setProperty(Entry entry)
          Sets a named property to the given value.
 void setProperty(String key, Object value)
          Sets the named property to the given value
 void setProperty(String key, Object value, boolean protect)
          Sets the named property to the given value, with optional protection
 boolean supportsMode(String mode)
          Returns true if the connector supports this mode
 void terminate()
          Terminates the connector
 Iterator values()
          Returns an Iterator over all property values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 String PROTECT_VAL_PREFIX
See Also:
Constant Field Values
Constructor Detail

TDIPropertyStore

public TDIPropertyStore()

TDIPropertyStore

public TDIPropertyStore(PropertyStoreConfig psc)
                 throws Exception
Constructor for the TDIPropertyStore object

Parameters:
psc - Configuration of the property store
Throws:
Exception - if the operation does not succeed

TDIPropertyStore

public TDIPropertyStore(PropertyStoreConfig psc,
                        TDIProperties context)
                 throws Exception
Constructor for the TDIPropertyStore object

Parameters:
psc - The PropertyStoreConfig
context - The TDIProperties context
Throws:
Exception
Method Detail

initialize

public void initialize(TDIProperties context)
                throws 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:
Exception - If any problem occurs during loading or initializing the connector.

log

public void log(String msg)
Logs a message.

Parameters:
msg - The message to log

logerror

public void logerror(String msg,
                     Exception err)
Logs an error message.

Parameters:
msg - The message to log
err - The Exception

reload

public void reload()
Reloads the information from the connector


reconnect

public void reconnect()
               throws Exception
Reinitializes the connector.

Throws:
Exception - If there is any problem with initializing the connector

terminate

public void terminate()
               throws Exception
Terminates the connector

Throws:
Exception - If there is a problem with terminating the connector

commit

public void commit()
            throws Exception
Flushes cached changes to target system

Throws:
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(String propertyName)
Returns true if we accept this propertyname.

Parameters:
propertyName - Property name to check
Returns:
true if we accept this propertyname

getName

public String getName()
Gets the short name of this TDIPropertyStore

Returns:
The name value

supportsMode

public boolean supportsMode(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 Object getProperty(String key)
                   throws Exception
Returns the named property

Parameters:
key - The property name to find
Returns:
The property value or null if not found
Throws:
Exception - Any Exception thrown by the connector

getPropertyEntry

public Entry getPropertyEntry(String key)
                       throws 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:
Exception - Any Exception thrown by the connector

setProperty

public void setProperty(String key,
                        Object value)
                 throws Exception
Sets the named property to the given value

Parameters:
key - The name of the property
value - The new property value, null means delete
Throws:
Exception - If key is missing, or any Exception thrown by the connector

setProperty

public void setProperty(String key,
                        Object value,
                        boolean protect)
                 throws Exception
Sets the named property to the given value, with optional protection

Parameters:
key - The name of the property
value - The new property value, null means delete
protect - True if the value should be protected (encrypted)
Throws:
Exception - If key is missing, or any Exception thrown by the connector

setProperty

public void setProperty(Entry entry)
                 throws 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:
Exception - If key is missing, or any Exception thrown by the connector

removeProperty

public void removeProperty(String key)
                    throws Exception
Removes a named property.

Parameters:
key - The name of the property to remove
Throws:
Exception - If key is missing, or the Property store is readonly, or any Exception thrown by the connector

keys

public Iterator keys()
Returns an Iterator over all property keys

Returns:
an Iterator over all property keys

values

public Iterator values()
Returns an Iterator over all property values

Returns:
an Iterator over all property values

entries

public 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:
hasNext in interface Iterator
Returns:
true if the Iterator has a next

next

public 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:
next in interface 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:
remove in interface Iterator

getException

public 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: