com.ibm.di.connector
Class Connector

java.lang.Object
  extended by com.ibm.di.connector.Connector
All Implemented Interfaces:
ConnectorInterface, VersionInfoInterface
Direct Known Subclasses:
AssemblyLineConnector, Axis2WSServerConnector, CCMDBConnector, CommandLineConnector, ConnectorDelegate, DeployedAssetsConnector, DominoChangeDetectionConnector, DominoConnector, DominoUsersConnector, DSMLv2SOAPConnector, DSMLv2SOAPServerConnector, EIFConnector, FileConnector, FileManagementConnector, FormEntryConnector, FTPClientConnector, GLAConnector, HTTPClientConnector, HTTPServerConnector, IdMLConnector, ITIMAgentConnector, ITRegistryConnector, JDBCConnector, JMSConnector, JMXConnector, JNDIConnector, LDAPConnector, LDAPServerConnector, LogConnector, MailboxConnector, MemQConnector, NT4UserMetaDataConnector, OldHTTPCLient, OldHTTPServer, PESConnector, PropertiesConnector, RACConnector, SapALEIDocConnector, SapR3BorConnector, ScriptConnector, ServerNotificationsConnector, SimpleTpaeIFConnector, SNMPConnector, SNMPServerConnector, StreamConnector, SystemQueueConnector, TAMConnector, TCPConnector, TCPServerConnector, TimerConnector, TpaeIFCDConnector, URLConnector, UserRegistryConnector, WSReceiverServerConnector

public abstract class Connector
extends Object
implements ConnectorInterface, VersionInfoInterface

The Connector class provides a default implementation of the ConnectorInterface.

Overview

This class includes useful methods for sub-classing connectors. In general, you should sub-class this class when you write new connectors since it provides a default implementation for most methods. You only have to override data access methods (e.g. getNextEntry etc..) to build a complete connector that handles logging and configuration management. If for some reason you cannot sub-class you could implement the ConnectorInterface instead. This requires more coding though.

Search Criteria

Worth mentioning is the usage of the SearchCriteria class. This class is used as a parameter to various methods (findEntry, deleteEntry ...) and is meant to provide enough information for the connector to identify a single entry in the connected data source. However, some connectors, because of their inner semantics, may not use this parameter if the entry object passed to it contains enough information to identify the target entry. The LDAP connector will typically use the provided distinguished name ($dn) rather than performing a search to obtain the $dn. It is all about unique identifiers really. If the provided Entry object contains a unique identifier the connector should use this, if no unique identifier is provided the connector should resort to the information passed in the search entry to locate the target entry.

Dealing with multiple entries

Methods like modEntry and deleteEntry are supposed to modify and delete exactly one single entry. However, there is nothing that prevents a connector from deleting multiple entries but this should be made thoroughly clear in the documentation for the connector. A connector could either delete a single entry if the entry object passed to it contained a unique identifier or the connector could delete all entries found by the search criteria if no unique identifier was passed to it. Again, this kind of connector behavior should be documented well since existing components assume single entry behavior.

If the entry/search results in multiple candidates for modify, delete etc the connector should use the clearFindEntries and addFindEntry methods to signal that the connector was unable to identify a single target entry. For example, the getFindEntryCount method is used by the AssemblyLine to detect this condition and branch off to the Multiple Entries Found hook so the user can deal with those situations. You should also use the getMaxDuplicateEntries method to obtain the maximum number of entries the user wants back in this case.

Using Parsers

If the connector is a transport connector the connector also needs a parser. One such connector is the FileSystem connector that only provides input and output streams. You can use parsers explicitly by loading them or you could include a connector parameter called parser in which case this class will do the loading and initialization of the parser. You only have to call the initParser method and pass the input and/or output streams the parser should use. Then, in your getNextEntry method you call the getParser().readEntry() or getParser().writeEntry(entry) methods. You can also intercept the parser before and after it has read/written an entry. The parser uses buffered readers and writers so if you read or write to the streams used by the parser you should always get the reader/writer objects and use them (e.g. getParser().getWriter() and getParser().getReader()). If not, you may accidently write data to the output stream before the buffered writer has flushed its data to the output stream. See the ParserImpl class for input/output stream behavior.


Field Summary
static String[] ALL_MODES
          String array containing all of the available modes.
protected  Log myLog
          The log object for logging messages
static String PROPERTY_MESSAGE
           
static String PROPERTY_READER
           
static String PROPERTY_WRITER
           
 
Constructor Summary
Connector()
          Default constructor.
 
Method Summary
 boolean addFindEntry(Object entry)
          Adds an entry to the list of duplicate entries found.
static Vector<String> allModes()
          Returns all Modes
 void clearFindEntries()
          Removes all entries from the duplicate entry list.
 void debug(String msg)
          Log a debug message to the connector's log
 boolean debugMode()
          Returns whether debug mode is set or not.
 void deleteEntry(Entry entry, SearchCriteria search)
          Deletes an existing entry.
 Entry findEntry(Object key, Object value)
          Locates an entry based on a key/value pair.
 Entry findEntry(SearchCriteria search)
          Finds an existing entry.
 Boolean getBoolean(Object p1)
          Returns the value of a config parameter as a Boolean
static Object getClassInstance(String className)
          Returns a class instance of the specified class name
 Object getConfiguration()
          Returns the current configuration for this connector
 Object getContext()
          Returns the parent task of the connector - an AssemblyLine object.
 int getFindEntryCount()
          Returns the number of duplicate entries in the list.
 Entry getFirstFindEntry()
          Returns the first entry from the list of duplicate entries found.
 Log getLog()
          Returns the current Log object.
 int getMaxDuplicateEntries()
          Returns the current maximum number of duplicate entries buffered up by the connector.
 Vector<String> getModes()
          Returns the connector's modes.
 Vector<String> getModes(ConnectorConfig config)
          Returns the connector's modes.
 String getName()
          Returns the name for this connector.
 ConnectorInterface getNextClient()
          Server mode - return a clone of self that handles the next client instance when running in server mode.
 Entry getNextEntry()
          Returns the next Entry from the connector.
 Entry getNextFindEntry()
          Returns the next entry from the list of duplicate entries found.
 String getParam(String param)
          Returns the value of a parameter as a java.lang.String object.
 ParserInterface getParser()
          Returns the parser interface used by this connector.
 Object getProperty(Object p1)
          Return a connector property.
 Entry getPushbackEntry()
          Returns the pushed back entry for the connector.
 BaseConfiguration getRawConnectorConfiguration()
          Returns the current configuration for the raw connector
 RSInterface getRSInterface()
          Returns the current RSInterface object in use by this connector.
 JComponent getUI()
          This method returns the user interface component presented to the user to configure the connector.
 boolean hasConfigValue(Object p1)
          Return true if we have a configuration value for configName.
 boolean hasParser()
          Check if the configuration includes a parser.
 void initialize(Object o)
          Initialize the connector.
 void initParser(Object is, Object os)
          Initialize the connector's parser with input and output streams.
 boolean isDeltaSupported()
          Returns true if this connector is able to perform delta updates
 boolean isExceptionFatal(Exception e)
          Returns true if the exception is considered to be fatal.
 boolean isIOException(Throwable e)
          Returns true if this connector considers the Throwable to be an IOException.
 void logError(String msg)
          Log an error message to the connector's log
 void logmsg(String msg)
          Log a message to the connector's log.
 void modEntry(Entry entry, SearchCriteria search)
          Modifies an existing entry.
 void modEntry(Entry entry, SearchCriteria search, Entry old)
          Modifies an existing entry.
 void pushback(Entry e)
          Make an entry the next entry to be iterated from the connector.
 void putEntry(Entry entry)
          Adds a new entry to the data source
 void queryOperations(ConnectorConfig config)
          Discover the operations for a connection given the provided configuration.
 Entry queryReply(Entry entry)
          Performs a query/reply operations.
 Object querySchema(Object source)
          This function translates to whatever means a connector has to discover schema for a connection.
 Vector<String> queryTables()
          This function translates to whatever means a connector have to discover "tables" for a connection.
 void reconnect()
          Reconnect to the underlying data source.
 void reconnect(Object o)
          Reconnect to the underlying data source
 void registerScriptBeans(ScriptEngine se)
          This method is called to register specific objects in the script context.
 void replyEntry(Entry entry)
          Send a reply to the connector.
 void selectEntries()
          Prepare the Connector for sequential read.
 void setConfiguration(Object config)
          Sets the configuration for use by this connector.
 void setContext(Object aContext)
          Sets the parent task of the connector - an AssemblyLine object.
 void setCurrent(Entry entry, SearchCriteria search)
          Change the SearchCriteria search to find the entry sent as a parameter.
 void setDebugMode(boolean debug)
           Modify the debug mode of the component.
 void setLog(Log logger)
          Sets the Log object to use for logging messages
 void setMaxDuplicateEntries(int mde)
          Sets the maximum number of duplicate entries to buffer up.
 void setModes(String[] modes)
          Sets the connector's modes.
 void setModes(Vector<String> modes)
          Sets the connector's modes.
 void setName(String name)
          Set the name for the connector.
 void setParam(String param, String value)
          Adds or replaces a connector configuration parameter.
 void setParser(ParserInterface parser)
          Sets the connector's parser.
 void setProperty(Object p1, Object p2)
          Set connector property.
 void setRSInterface(RSInterface rsi)
          Sets the RSInterface for this connector to use.
 void terminate()
          Terminate the connector.
 void terminateServer()
          Interrupts and shuts down the Connector if it runs in Server Mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.di.server.VersionInfoInterface
getVersion
 

Field Detail

PROPERTY_MESSAGE

public static final String PROPERTY_MESSAGE
See Also:
Constant Field Values

PROPERTY_READER

public static final String PROPERTY_READER
See Also:
Constant Field Values

PROPERTY_WRITER

public static final String PROPERTY_WRITER
See Also:
Constant Field Values

ALL_MODES

public static final String[] ALL_MODES
String array containing all of the available modes.


myLog

protected Log myLog
The log object for logging messages

Constructor Detail

Connector

public Connector()
Default constructor. Allocates the properties table for use by getProperty/setProperty methods.

Method Detail

setLog

public void setLog(Log logger)
Sets the Log object to use for logging messages

Specified by:
setLog in interface ConnectorInterface
Parameters:
logger - The Log object
See Also:
RSInterface.logmsg(String)

getLog

public Log getLog()
Returns the current Log object.

Returns:
The current Log object or null if no log object exists.
See Also:
Log

getBoolean

public Boolean getBoolean(Object p1)
Returns the value of a config parameter as a Boolean

Parameters:
p1 - the key that boolean value is mapped under.
Returns:
the Boolean value or null if not found.

hasConfigValue

public boolean hasConfigValue(Object p1)
Return true if we have a configuration value for configName. The value must be present and have a value not equal to the empty string.

Parameters:
p1 - the key name of the value
Returns:
true if a value with that key is present, false otherwise.

setMaxDuplicateEntries

public void setMaxDuplicateEntries(int mde)
Sets the maximum number of duplicate entries to buffer up. This is used by the lookup functions when a lookup returns more than one entry.

Specified by:
setMaxDuplicateEntries in interface ConnectorInterface
Parameters:
mde - The maximum number of entries to buffer up

getMaxDuplicateEntries

public int getMaxDuplicateEntries()
Returns the current maximum number of duplicate entries buffered up by the connector.

Specified by:
getMaxDuplicateEntries in interface ConnectorInterface
Returns:
Max number of duplicate entries

getPushbackEntry

public Entry getPushbackEntry()
Returns the pushed back entry for the connector.

Specified by:
getPushbackEntry in interface ConnectorInterface
Returns:
The pushed back entry or null if no such entry exists.
See Also:
ConnectorInterface.pushback( Entry )

pushback

public void pushback(Entry e)
Make an entry the next entry to be iterated from the connector. This method along with getPushbackEntry is used by the AssemblyLineComponent when it iterates the connector. A connector may read one record and then push it back for the subsequent ConnectorInterface.getNextEntry() call. The task component first checks if there is a pushback entry available, and if so, returns that entry as the next input entry.

Specified by:
pushback in interface ConnectorInterface
Parameters:
e - The entry to be returned at the next ConnectorInterface.getNextEntry() call

logmsg

public void logmsg(String msg)
Log a message to the connector's log. The message is prefixed by the connector's name.

Parameters:
msg - The message to write to the log

debug

public void debug(String msg)
Log a debug message to the connector's log

Parameters:
msg - The message to write to the log

logError

public void logError(String msg)
Log an error message to the connector's log

Parameters:
msg - The message to write to the log
Since:
7.0

setName

public void setName(String name)
Set the name for the connector. This name is used by the logmsg/debug functions.

Specified by:
setName in interface ConnectorInterface
Parameters:
name - The name for the connector

getName

public String getName()
Returns the name for this connector.

Specified by:
getName in interface ConnectorInterface
Returns:
The connector's name

setModes

public void setModes(Vector<String> modes)
Sets the connector's modes.

Parameters:
modes - The connector's modes

setModes

public void setModes(String[] modes)
Sets the connector's modes.

Parameters:
modes - The connector's modes

getModes

public Vector<String> getModes()
Returns the connector's modes.

Returns:
The connector's modes

getModes

public Vector<String> getModes(ConnectorConfig config)
Returns the connector's modes.

Parameters:
config - return the modes given this configuration
Returns:
The connector's modes

allModes

public static Vector<String> allModes()
Returns all Modes

Returns:
All possible modes

setParam

public void setParam(String param,
                     String value)
Adds or replaces a connector configuration parameter.

Specified by:
setParam in interface ConnectorInterface
Parameters:
param - The parameter name
value - The parameter value

getParam

public String getParam(String param)
Returns the value of a parameter as a java.lang.String object.

Specified by:
getParam in interface ConnectorInterface
Parameters:
param - The connector configuration parameter name
Returns:
The parameter's value or null if no such parameter exists

setConfiguration

public void setConfiguration(Object config)
Sets the configuration for use by this connector.

Specified by:
setConfiguration in interface ConnectorInterface
Parameters:
config - The configuration object (an instance of ConnectorConfig)

getConfiguration

public Object getConfiguration()
Returns the current configuration for this connector

Specified by:
getConfiguration in interface ConnectorInterface
Returns:
The configuration object (an instance of ConnectorConfig), or null if the configuration is not established

getRawConnectorConfiguration

public BaseConfiguration getRawConnectorConfiguration()
Returns the current configuration for the raw connector

Specified by:
getRawConnectorConfiguration in interface ConnectorInterface
Returns:
The configuration object or null if the configuration is not established

setRSInterface

public void setRSInterface(RSInterface rsi)
Sets the RSInterface for this connector to use. The RSInterface object is used to get access system wide parameters such as parser configurations.

Specified by:
setRSInterface in interface ConnectorInterface
Parameters:
rsi - The RSInterface object

getRSInterface

public RSInterface getRSInterface()
Returns the current RSInterface object in use by this connector. If not set, return com.ibm.di.server.RS.getServer()

Returns:
Connector's RSInterface object

debugMode

public boolean debugMode()
Returns whether debug mode is set or not. May be accessed by different threads.

Returns:
True if debug mode is set

setDebugMode

public void setDebugMode(boolean debug)

Modify the debug mode of the component. Also modifies the debug mode of the associated Parser. May be accessed by different threads.

This method is for internal use only. Do not call it from user code.

Parameters:
debug - the debug mode setting

isExceptionFatal

public boolean isExceptionFatal(Exception e)
Returns true if the exception is considered to be fatal. This governs whether the AssemblyLine logs the error as a warning or terminates. By default all exceptions are fatal.

Specified by:
isExceptionFatal in interface ConnectorInterface
Parameters:
e - The exception object
Returns:
whether the exception is fatal or not

getClassInstance

public static Object getClassInstance(String className)
                               throws Exception
Returns a class instance of the specified class name

Parameters:
className - The fully qualified Java class name
Returns:
A class object for the class
Throws:
Exception - exception thrown by the class loader

initialize

public void initialize(Object o)
                throws Exception
Initialize the connector. The connector may be passed a parameter of any kind by the user. It is up to the connector to determine whether this object can be used or not. The parameter is typically provided by a user script. When an AssemblyLine initializes it's Connectors, they are passed a ConnectorMode object.

Specified by:
initialize in interface ConnectorInterface
Parameters:
o - User provided parameter
Throws:
Exception - if the initialization of this connector fails.

hasParser

public boolean hasParser()
Check if the configuration includes a parser.

Returns:
True if a parser is specified

initParser

public void initParser(Object is,
                       Object os)
                throws Exception
Initialize the connector's parser with input and output streams. If the parser has not been loaded then an attempt is made to load it. The input and output objects may be one of InputStream, OutputStream or Socket.

Parameters:
is - The input object.
os - the output object.
Throws:
Exception - if a parser is not configured or the exception is derived from the parser
See Also:
getParser()

setParser

public void setParser(ParserInterface parser)
               throws IOException
Sets the connector's parser.

Parameters:
parser - The parser interface to use
Throws:
IOException - if an error occurs.

getParser

public ParserInterface getParser()
Returns the parser interface used by this connector.

Returns:
The parser interface object or null if no parser exists

terminate

public void terminate()
               throws Exception
Terminate the connector. This function closes all connection and releases all resources used by the connector. This function also calls the parser's closeParser() method if a parser is active.

Specified by:
terminate in interface ConnectorInterface
Throws:
Exception - if an error occurs.

selectEntries

public void selectEntries()
                   throws Exception
Prepare the Connector for sequential read. If necessary, create a result set to be used for getNextEntry(). When the Connector is used as an Iterator in an AssemblyLine, this method will be called. Default is an empty method.

Specified by:
selectEntries in interface ConnectorInterface
Throws:
Exception - if an error occurs.

getNextEntry

public Entry getNextEntry()
                   throws Exception
Returns the next Entry from the connector. The entry is populated with attributes and values from the next entry in the input set.

Example:

 var ctor = input.getConnector();
 var entry = ctor.getNextEntry();
 
 for (; entry != null; entry = ctor.getNextEntry()) {
        main.logmsg("Read entry...");
        main.dumpEntry(entry);
 }
 

Specified by:
getNextEntry in interface ConnectorInterface
Returns:
- the next Entry, or null if no more data
Throws:
Exception - if an error occurs.
See Also:
ConnectorInterface.selectEntries()

getNextClient

public ConnectorInterface getNextClient()
                                 throws Exception
Server mode - return a clone of self that handles the next client instance when running in server mode. The returned connector may be used in its own thread to handle a "client" request so if the returned instance is returned more than once it must be thread safe.

Specified by:
getNextClient in interface ConnectorInterface
Returns:
the clone of itself
Throws:
Exception - if an error occurs.

replyEntry

public void replyEntry(Entry entry)
                throws Exception
Send a reply to the connector.

Specified by:
replyEntry in interface ConnectorInterface
Parameters:
entry - the information as an Entry
Throws:
Exception - if an error occurs.

modEntry

public void modEntry(Entry entry,
                     SearchCriteria search)
              throws Exception
Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.

Specified by:
modEntry in interface ConnectorInterface
Parameters:
entry - The entry data
search - The search criteria used to locate the entry to be modified
Throws:
Exception - if an error occurs.

modEntry

public void modEntry(Entry entry,
                     SearchCriteria search,
                     Entry old)
              throws Exception
Modifies an existing entry. The new entry data is given by the entry parameter and the search criteria specifies which entry to modify.

Specified by:
modEntry in interface ConnectorInterface
Parameters:
entry - The entry data
search - The search criteria used to locate the entry to be modified
old - The old entry found by the search criteria
Throws:
Exception - if an error occurs.

deleteEntry

public void deleteEntry(Entry entry,
                        SearchCriteria search)
                 throws Exception
Deletes an existing entry. The search criteria specifies which entry to modify. Some connectors may silently ignore the search criteria. For example, the LDAP connector will use the distinguished name ($dn) from the entry parameter (if it exists) rather than expanding the search criteria and search for the entry. Each connector's inner semantics governs whether the search parameter is used or not.

Specified by:
deleteEntry in interface ConnectorInterface
Parameters:
entry - The entry data
search - The search criteria used to locate the entry to be deleted
Throws:
Exception - if an error occurs.

findEntry

public Entry findEntry(SearchCriteria search)
                throws Exception
Finds an existing entry. The search criteria specifies which entry to locate

Here is an example of how to find all people with names starting with 'J' which are from IBM organization in US.

Example:

 var ctor = input.getConnector();
 var crit = new com.ibm.di.SearchCriteria("$dn",
                com.ibm.di.SearchCriteria.SUBSTRING, "c=US,o=IBM");
 crit.addCriteria("name", com.ibm.di.SearchCriteria.INITIAL_STRING, "J");
 crit.addCriteria("objectclass", com.ibm.di.SearchCriteria.SUBSTRING, "person");
 
 var res = ctor.findEntry(crit);
 if (res != null) {
        main.logmsg("Found entry:");
        main.dumpEntry(res);
 } else {
  if( getFindEntryCount()> 1 ){
   main.logmsg("Found these entries:");
   while ( (entry = ctor.getNextFindEntry()) != null ) {
     main.dumpEntry(entry);
   }
  }
  else {
         main.logmsg("Entry not found!");
  }
 }
 

Specified by:
findEntry in interface ConnectorInterface
Parameters:
search - The search criteria used to locate the entry to be modified
Returns:
The entry found, or null if no or multiple entries found
Throws:
Exception - if an error occurs.

putEntry

public void putEntry(Entry entry)
              throws Exception
Adds a new entry to the data source

Example:

 var ctor = write.getConnector();
 
 for (i = 0; i < 10; i++) {
        var entry = system.newEntry();
        entry.setAttribute("linenumber", i);
        entry.setAttribute("line", i + " line of text...");
 
        main.logmsg("Writes entry to output...");
        main.dumpEntry(entry);
        ctor.putEntry(entry);
 }
 

Specified by:
putEntry in interface ConnectorInterface
Parameters:
entry - The entry data to add
Throws:
Exception - if an error occurs.

queryReply

public Entry queryReply(Entry entry)
                 throws Exception
Performs a query/reply operations.

Specified by:
queryReply in interface ConnectorInterface
Parameters:
entry - The data used in outgoing call
Returns:
The entry returned by the peer
Throws:
Exception - if an error occurs.

getFirstFindEntry

public Entry getFirstFindEntry()
                        throws Exception
Returns the first entry from the list of duplicate entries found. Also resets the counter for getNextFindEntry

Specified by:
getFirstFindEntry in interface ConnectorInterface
Returns:
The first entry from the list or null if list is empty
Throws:
Exception - if an error occurs.

getNextFindEntry

public Entry getNextFindEntry()
                       throws Exception
Returns the next entry from the list of duplicate entries found.

Specified by:
getNextFindEntry in interface ConnectorInterface
Returns:
The next entry from the list or null if list is empty or at the end
Throws:
Exception - if an error occurs.

findEntry

public Entry findEntry(Object key,
                       Object value)
Locates an entry based on a key/value pair. The search is translated to the connector's format for searching.

Parameters:
key - The attribute name
value - The attribute value match
Returns:
The entry found or null if no entries were found

getFindEntryCount

public int getFindEntryCount()
Returns the number of duplicate entries in the list.

Specified by:
getFindEntryCount in interface ConnectorInterface
Returns:
Number of duplicate entries in the list

clearFindEntries

public void clearFindEntries()
Removes all entries from the duplicate entry list.


addFindEntry

public boolean addFindEntry(Object entry)
Adds an entry to the list of duplicate entries found.

Parameters:
entry - The entry object to add
Returns:
true if the entry was successfully added, false if the passed entry is null or the found entries are more than the maximumDuplicatEntriesReturned limit.

setCurrent

public void setCurrent(Entry entry,
                       SearchCriteria search)
Change the SearchCriteria search to find the entry sent as a parameter. Used when multiple entries found, and you want to modify or delete one of them. Only a few connectors need to implement this.

Specified by:
setCurrent in interface ConnectorInterface
Parameters:
entry - The entry we want to find for modification/delete
search - The SearchCriteria we want to change

queryOperations

public void queryOperations(ConnectorConfig config)
                     throws Exception
Discover the operations for a connection given the provided configuration. The implementation should update the configuration object with available operations. If this method requires the connector to be initialized then the connector must perform init/terminate operations itself.

Specified by:
queryOperations in interface ConnectorInterface
Parameters:
config - The configuration
Throws:
Exception - if an error occurs in the derived class implementation.

querySchema

public Object querySchema(Object source)
                   throws Exception
This function translates to whatever means a connector has to discover schema for a connection. The connector may implement this, in which case a Vector of Entry objects is returned for each column/attribute it discovered. For a database connector this would typically be column names and their attributes.

Each Entry in the Vector returned should contain the following attributes:

Name Value
name The name of the column/attribute/field ....
syntax The syntax or expected value type
size If specified this will give the user a hint as to how long the field may be

Specified by:
querySchema in interface ConnectorInterface
Parameters:
source - The object on which to discover schema. This may be an Entry or a string value
Returns:
A Vector of com.ibm.di.entry.Entry objects describing each entity
Throws:
Exception - if an error while retrieving the schema occurs.
See Also:
Entry, Vector

queryTables

public Vector<String> queryTables()
                           throws Exception
This function translates to whatever means a connector have to discover "tables" for a connection. The connector may implement this in which case a Vector of strings is returned. For a database connector this would typically be a list of table/view names the user can access with the current set of parameters. For other connectors this might translate to different concepts.

Returns:
A list of table names
Throws:
Exception - if an error occurs.
See Also:
Vector

getProperty

public Object getProperty(Object p1)
Return a connector property. Each connector may have static or runtime properties which can be accessed with this method. Note that connector properties are very different from the connector configuration.

Parameters:
p1 - The property name
Returns:
The property value/object

setProperty

public void setProperty(Object p1,
                        Object p2)
Set connector property. This method sets a named property to a given value. Note that connector properties are very different from the connector configuration.

Parameters:
p1 - The property name
p2 - The property value

registerScriptBeans

public void registerScriptBeans(ScriptEngine se)
                         throws Exception
This method is called to register specific objects in the script context. If the connector has a parser, the parser's registerScriptBeans method is also called.

Specified by:
registerScriptBeans in interface ConnectorInterface
Parameters:
se - The script engine context
Throws:
Exception - if an error occurs.

reconnect

public void reconnect(Object o)
               throws Exception
Reconnect to the underlying data source

Specified by:
reconnect in interface ConnectorInterface
Parameters:
o - User provided parameter, which is sent to initialize()
Throws:
Exception - if an error occurs.
See Also:
ConnectorInterface.initialize(Object)

reconnect

public void reconnect()
               throws Exception
Reconnect to the underlying data source.

The following code could be placed in the 'On Connection lost' hook to change the connector's ldapUrl to another server in case the connection is lost.

Example:

 thisConnector.setParam("ldapURL", "ldap://backupserver.acme.com:389");
 
 // reconnect to backup server
 thisConnector.reconnect();
 

Throws:
Exception - if an error occurs.
See Also:
initialize(Object)

isDeltaSupported

public boolean isDeltaSupported()
Returns true if this connector is able to perform delta updates

Specified by:
isDeltaSupported in interface ConnectorInterface
Returns:
true if delta updates are supported, false otherwise

isIOException

public boolean isIOException(Throwable e)
Returns true if this connector considers the Throwable to be an IOException. This is needed because we only try reconnection for IO Exceptions, and some Connectors do not return an IOException for an IO Exception.

Specified by:
isIOException in interface ConnectorInterface
Parameters:
e - The Throwable to be determined
Returns:
true if this Throwable is an IO Exception

terminateServer

public void terminateServer()
                     throws Exception
Interrupts and shuts down the Connector if it runs in Server Mode. Does not have effect if the Connector is not running in Server Mode.

Specified by:
terminateServer in interface ConnectorInterface
Throws:
Exception - if an error occurs

getContext

public Object getContext()
Returns the parent task of the connector - an AssemblyLine object.

Here is an example hook of how to print the names of all enabled or passive components in the current running assembly line.

Example:

 var ctx = thisConnector.getConnector().getContext();
 var clist = ctx.getConnectors();
 
 for (i = 0; i < clist.size(); i++)
        main.logmsg(clist.get(i).getName());
 

Specified by:
getContext in interface ConnectorInterface
Returns:
the context to which the connector belongs

setContext

public void setContext(Object aContext)
Sets the parent task of the connector - an AssemblyLine object.

Specified by:
setContext in interface ConnectorInterface
Parameters:
aContext - the new context to which the connector will belong.

getUI

public JComponent getUI()
This method returns the user interface component presented to the user to configure the connector.

Returns:
null by default, indicating no special user interface.
Since:
7.0