|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.di.connector.Connector
com.ibm.di.osgi.ConnectorDelegate
public class ConnectorDelegate
Used to act as a way for accessing ConnectorComponent services from the OSGi
layer.
Note: This class is for internal usage only. Any dependency from the
end-user will not be supported. Changes to this class will happen without a
warning.
| Field Summary | |
|---|---|
protected Connector |
worker
|
| Fields inherited from class com.ibm.di.connector.Connector |
|---|
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER |
| Constructor Summary | |
|---|---|
ConnectorDelegate()
|
|
ConnectorDelegate(String id)
|
|
| Method Summary | |
|---|---|
boolean |
addFindEntry(Object entry)
Adds an entry to the list of duplicate entries found. |
void |
clearFindEntries()
Removes all entries from the duplicate entry list. |
protected Object |
clone()
|
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. |
boolean |
equals(Object o)
|
Entry |
findEntry(Object arg0,
Object arg1)
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 |
Object |
getConfiguration()
Returns the current configuration for this connector |
Object |
getContext()
Returns the parent task of the connector - an AssemblyLine
object. |
ConnectorInterface |
getDelegate()
|
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. |
String |
getVersion()
Version information. |
boolean |
hasConfigValue(Object p1)
Return true if we have a configuration value for configName. |
int |
hashCode()
|
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 |
setId(String id)
|
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. |
String |
toString()
|
| Methods inherited from class com.ibm.di.connector.Connector |
|---|
allModes, getClassInstance |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Connector worker
| Constructor Detail |
|---|
public ConnectorDelegate()
public ConnectorDelegate(String id)
throws Exception
Exception| Method Detail |
|---|
public String getVersion()
VersionInfoInterface
public void initialize(Object o)
throws Exception
Connector
initialize in interface ConnectorInterfaceinitialize in class Connectoro - User provided parameter
Exception - if the initialization of this connector fails.public boolean addFindEntry(Object entry)
Connector
addFindEntry in class Connectorentry - The entry object to add
null or the found entries are more than the
maximumDuplicatEntriesReturned limit.public void clearFindEntries()
Connector
clearFindEntries in class Connectorpublic void debug(String msg)
Connector
debug in class Connectormsg - The message to write to the logpublic boolean debugMode()
Connector
debugMode in class Connector
public void deleteEntry(Entry entry,
SearchCriteria search)
throws Exception
Connector
deleteEntry in interface ConnectorInterfacedeleteEntry in class Connectorentry - The entry datasearch - The search criteria used to locate the entry to be deleted
Exception - if an error occurs.
public Entry findEntry(Object arg0,
Object arg1)
Connector
findEntry in class Connectorarg0 - The attribute namearg1 - The attribute value match
public Entry findEntry(SearchCriteria search)
throws Exception
ConnectorHere 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!");
}
}
findEntry in interface ConnectorInterfacefindEntry in class Connectorsearch - The search criteria used to locate the entry to be modified
Exception - if an error occurs.public Boolean getBoolean(Object p1)
Connector
getBoolean in class Connectorp1 - the key that boolean value is mapped under.
public Object getConfiguration()
Connector
getConfiguration in interface ConnectorInterfacegetConfiguration in class Connectorpublic Object getContext()
ConnectorAssemblyLine
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());
getContext in interface ConnectorInterfacegetContext in class Connectorpublic int getFindEntryCount()
Connector
getFindEntryCount in interface ConnectorInterfacegetFindEntryCount in class Connector
public Entry getFirstFindEntry()
throws Exception
Connector
getFirstFindEntry in interface ConnectorInterfacegetFirstFindEntry in class ConnectorException - if an error occurs.public Log getLog()
Connector
getLog in class ConnectorLogpublic int getMaxDuplicateEntries()
Connector
getMaxDuplicateEntries in interface ConnectorInterfacegetMaxDuplicateEntries in class Connectorpublic Vector<String> getModes()
Connector
getModes in class Connectorpublic Vector<String> getModes(ConnectorConfig config)
Connector
getModes in class Connectorconfig - return the modes given this configuration
public String getName()
Connector
getName in interface ConnectorInterfacegetName in class Connector
public ConnectorInterface getNextClient()
throws Exception
Connector
getNextClient in interface ConnectorInterfacegetNextClient in class ConnectorException - if an error occurs.
public Entry getNextEntry()
throws Exception
ConnectorExample:
var ctor = input.getConnector();
var entry = ctor.getNextEntry();
for (; entry != null; entry = ctor.getNextEntry()) {
main.logmsg("Read entry...");
main.dumpEntry(entry);
}
getNextEntry in interface ConnectorInterfacegetNextEntry in class ConnectorException - if an error occurs.ConnectorInterface.selectEntries()
public Entry getNextFindEntry()
throws Exception
Connector
getNextFindEntry in interface ConnectorInterfacegetNextFindEntry in class ConnectorException - if an error occurs.public String getParam(String param)
Connector
getParam in interface ConnectorInterfacegetParam in class Connectorparam - The connector configuration parameter name
public ParserInterface getParser()
Connector
getParser in class Connectorpublic Object getProperty(Object p1)
Connector
getProperty in class Connectorp1 - The property name
public Entry getPushbackEntry()
Connector
getPushbackEntry in interface ConnectorInterfacegetPushbackEntry in class ConnectorConnectorInterface.pushback( Entry )public BaseConfiguration getRawConnectorConfiguration()
Connector
getRawConnectorConfiguration in interface ConnectorInterfacegetRawConnectorConfiguration in class Connectorpublic RSInterface getRSInterface()
Connectorcom.ibm.di.server.RS.getServer()
getRSInterface in class Connectorpublic JComponent getUI()
Connector
getUI in class Connectorpublic boolean hasConfigValue(Object p1)
Connector
hasConfigValue in class Connectorp1 - the key name of the value
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Object
protected Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic boolean hasParser()
Connector
hasParser in class Connector
public void initParser(Object is,
Object os)
throws Exception
Connector
initParser in class Connectoris - The input object.os - the output object.
Exception - if a parser is not configured or the exception is derived
from the parserConnector.getParser()public boolean isDeltaSupported()
Connector
isDeltaSupported in interface ConnectorInterfaceisDeltaSupported in class Connectorpublic boolean isExceptionFatal(Exception e)
Connector
isExceptionFatal in interface ConnectorInterfaceisExceptionFatal in class Connectore - The exception object
public boolean isIOException(Throwable e)
Connectortrue 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.
isIOException in interface ConnectorInterfaceisIOException in class Connectore - The Throwable to be determined
public void logError(String msg)
Connector
logError in class Connectormsg - The message to write to the logpublic void logmsg(String msg)
Connector
logmsg in class Connectormsg - The message to write to the log
public void modEntry(Entry entry,
SearchCriteria search)
throws Exception
Connector
modEntry in interface ConnectorInterfacemodEntry in class Connectorentry - The entry datasearch - The search criteria used to locate the entry to be modified
Exception - if an error occurs.
public void modEntry(Entry entry,
SearchCriteria search,
Entry old)
throws Exception
Connector
modEntry in interface ConnectorInterfacemodEntry in class Connectorentry - The entry datasearch - The search criteria used to locate the entry to be modifiedold - The old entry found by the search criteria
Exception - if an error occurs.public void pushback(Entry e)
ConnectorConnectorInterface.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.
pushback in interface ConnectorInterfacepushback in class Connectore - The entry to be returned at the next ConnectorInterface.getNextEntry()
call
public void putEntry(Entry entry)
throws Exception
ConnectorExample:
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);
}
putEntry in interface ConnectorInterfaceputEntry in class Connectorentry - The entry data to add
Exception - if an error occurs.
public void queryOperations(ConnectorConfig config)
throws Exception
Connector
queryOperations in interface ConnectorInterfacequeryOperations in class Connectorconfig - The configuration
Exception - if an error occurs in the derived class implementation.
public Entry queryReply(Entry entry)
throws Exception
Connector
queryReply in interface ConnectorInterfacequeryReply in class Connectorentry - The data used in outgoing call
Exception - if an error occurs.
public Object querySchema(Object source)
throws Exception
ConnectorEach 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 |
querySchema in interface ConnectorInterfacequerySchema in class Connectorsource - The object on which to discover schema. This may be an Entry
or a string value
Exception - if an error while retrieving the schema occurs.Entry,
Vector
public Vector<String> queryTables()
throws Exception
Connector
queryTables in class ConnectorException - if an error occurs.Vector
public void reconnect()
throws Exception
Connector
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();
reconnect in class ConnectorException - if an error occurs.Connector.initialize(Object)
public void reconnect(Object o)
throws Exception
Connector
reconnect in interface ConnectorInterfacereconnect in class Connectoro - User provided parameter, which is sent to initialize()
Exception - if an error occurs.ConnectorInterface.initialize(Object)
public void registerScriptBeans(ScriptEngine se)
throws Exception
Connector
registerScriptBeans in interface ConnectorInterfaceregisterScriptBeans in class Connectorse - The script engine context
Exception - if an error occurs.
public void replyEntry(Entry entry)
throws Exception
Connector
replyEntry in interface ConnectorInterfacereplyEntry in class Connectorentry - the information as an Entry
Exception - if an error occurs.
public void selectEntries()
throws Exception
Connector
selectEntries in interface ConnectorInterfaceselectEntries in class ConnectorException - if an error occurs.public void setConfiguration(Object config)
Connector
setConfiguration in interface ConnectorInterfacesetConfiguration in class Connectorconfig - The configuration object (an instance of ConnectorConfig)public void setContext(Object aContext)
ConnectorAssemblyLine object.
setContext in interface ConnectorInterfacesetContext in class ConnectoraContext - the new context to which the connector will belong.
public void setCurrent(Entry entry,
SearchCriteria search)
Connector
setCurrent in interface ConnectorInterfacesetCurrent in class Connectorentry - The entry we want to find for modification/deletesearch - The SearchCriteria we want to changepublic void setDebugMode(boolean debug)
ConnectorModify 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.
setDebugMode in class Connectordebug - the debug mode settingpublic void setLog(Log logger)
Connector
setLog in interface ConnectorInterfacesetLog in class Connectorlogger - The Log objectRSInterface.logmsg(String)public void setMaxDuplicateEntries(int mde)
Connector
setMaxDuplicateEntries in interface ConnectorInterfacesetMaxDuplicateEntries in class Connectormde - The maximum number of entries to buffer uppublic void setModes(String[] modes)
Connector
setModes in class Connectormodes - The connector's modespublic void setModes(Vector<String> modes)
Connector
setModes in class Connectormodes - The connector's modespublic void setName(String name)
Connector
setName in interface ConnectorInterfacesetName in class Connectorname - The name for the connector
public void setParam(String param,
String value)
Connector
setParam in interface ConnectorInterfacesetParam in class Connectorparam - The parameter namevalue - The parameter value
public void setParser(ParserInterface parser)
throws IOException
Connector
setParser in class Connectorparser - The parser interface to use
IOException - if an error occurs.
public void setProperty(Object p1,
Object p2)
Connector
setProperty in class Connectorp1 - The property namep2 - The property valuepublic void setRSInterface(RSInterface rsi)
Connector
setRSInterface in interface ConnectorInterfacesetRSInterface in class Connectorrsi - The RSInterface object
public void terminate()
throws Exception
Connector
terminate in interface ConnectorInterfaceterminate in class ConnectorException - if an error occurs.
public void terminateServer()
throws Exception
Connector
terminateServer in interface ConnectorInterfaceterminateServer in class ConnectorException - if an error occurspublic String toString()
toString in class Objectpublic ConnectorInterface getDelegate()
public void setId(String id)
id - the id to set
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||