|
|||||||||||
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(java.lang.String id)
|
Method Summary | |
---|---|
boolean |
addFindEntry(java.lang.Object entry)
Adds an entry to the list of duplicate entries found. |
void |
clearFindEntries()
Removes all entries from the duplicate entry list. |
protected java.lang.Object |
clone()
|
void |
debug(java.lang.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(java.lang.Object o)
|
Entry |
findEntry(java.lang.Object arg0,
java.lang.Object arg1)
Locates an entry based on a key/value pair. |
Entry |
findEntry(SearchCriteria search)
Finds an existing entry. |
java.lang.Boolean |
getBoolean(java.lang.Object p1)
Returns the value of a config parameter as a Boolean |
java.lang.Object |
getConfiguration()
Returns the current configuration for this connector |
java.lang.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. |
java.util.Vector<java.lang.String> |
getModes()
Returns the connector's modes. |
java.util.Vector<java.lang.String> |
getModes(ConnectorConfig config)
Returns the connector's modes. |
java.lang.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. |
java.lang.String |
getParam(java.lang.String param)
Returns the value of a parameter as a java.lang.String object. |
ParserInterface |
getParser()
Returns the parser interface used by this connector. |
java.lang.Object |
getProperty(java.lang.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. |
javax.swing.JComponent |
getUI()
This method returns the user interface component presented to the user to configure the connector. |
java.lang.String |
getVersion()
Version information. |
boolean |
hasConfigValue(java.lang.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(java.lang.Object o)
Initialize the connector. |
void |
initParser(java.lang.Object is,
java.lang.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(java.lang.Exception e)
Returns true if the exception is considered to be fatal. |
boolean |
isIOException(java.lang.Throwable e)
Returns true if this connector considers the
Throwable to be an IOException . |
void |
logError(java.lang.String msg)
Log an error message to the connector's log |
void |
logmsg(java.lang.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. |
java.lang.Object |
querySchema(java.lang.Object source)
This function translates to whatever means a connector has to discover schema for a connection. |
java.util.Vector<java.lang.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(java.lang.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(java.lang.Object config)
Sets the configuration for use by this connector. |
void |
setContext(java.lang.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(java.lang.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(java.lang.String[] modes)
Sets the connector's modes. |
void |
setModes(java.util.Vector<java.lang.String> modes)
Sets the connector's modes. |
void |
setName(java.lang.String name)
Set the name for the connector. |
void |
setParam(java.lang.String param,
java.lang.String value)
Adds or replaces a connector configuration parameter. |
void |
setParser(ParserInterface parser)
Sets the connector's parser. |
void |
setProperty(java.lang.Object p1,
java.lang.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. |
java.lang.String |
toString()
|
Methods inherited from class com.ibm.di.connector.Connector |
---|
allModes, extractExceptionInformation, 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(java.lang.String id) throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public java.lang.String getVersion()
VersionInfoInterface
public void initialize(java.lang.Object o) throws java.lang.Exception
Connector
initialize
in interface ConnectorInterface
initialize
in class Connector
o
- User provided parameter
java.lang.Exception
- if the initialization of this connector fails.public boolean addFindEntry(java.lang.Object entry)
Connector
addFindEntry
in class Connector
entry
- The entry object to add
null
or the found entries are more than the
maximumDuplicatEntriesReturned limit.public void clearFindEntries()
Connector
clearFindEntries
in class Connector
public void debug(java.lang.String msg)
Connector
debug
in class Connector
msg
- The message to write to the logpublic boolean debugMode()
Connector
debugMode
in class Connector
public void deleteEntry(Entry entry, SearchCriteria search) throws java.lang.Exception
Connector
deleteEntry
in interface ConnectorInterface
deleteEntry
in class Connector
entry
- The entry datasearch
- The search criteria used to locate the entry to be deleted
java.lang.Exception
- if an error occurs.public Entry findEntry(java.lang.Object arg0, java.lang.Object arg1)
Connector
findEntry
in class Connector
arg0
- The attribute namearg1
- The attribute value match
public Entry findEntry(SearchCriteria search) throws java.lang.Exception
Connector
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!"); } }
findEntry
in interface ConnectorInterface
findEntry
in class Connector
search
- The search criteria used to locate the entry to be modified
java.lang.Exception
- if an error occurs.public java.lang.Boolean getBoolean(java.lang.Object p1)
Connector
getBoolean
in class Connector
p1
- the key that boolean value is mapped under.
public java.lang.Object getConfiguration()
Connector
getConfiguration
in interface ConnectorInterface
getConfiguration
in class Connector
public java.lang.Object getContext()
Connector
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());
getContext
in interface ConnectorInterface
getContext
in class Connector
public int getFindEntryCount()
Connector
getFindEntryCount
in interface ConnectorInterface
getFindEntryCount
in class Connector
public Entry getFirstFindEntry() throws java.lang.Exception
Connector
getFirstFindEntry
in interface ConnectorInterface
getFirstFindEntry
in class Connector
java.lang.Exception
- if an error occurs.public Log getLog()
Connector
getLog
in class Connector
Log
public int getMaxDuplicateEntries()
Connector
getMaxDuplicateEntries
in interface ConnectorInterface
getMaxDuplicateEntries
in class Connector
public java.util.Vector<java.lang.String> getModes()
Connector
getModes
in class Connector
public java.util.Vector<java.lang.String> getModes(ConnectorConfig config)
Connector
getModes
in class Connector
config
- return the modes given this configuration
public java.lang.String getName()
Connector
getName
in interface ConnectorInterface
getName
in class Connector
public ConnectorInterface getNextClient() throws java.lang.Exception
Connector
getNextClient
in interface ConnectorInterface
getNextClient
in class Connector
java.lang.Exception
- if an error occurs.public Entry getNextEntry() throws java.lang.Exception
Connector
Example:
var ctor = input.getConnector(); var entry = ctor.getNextEntry(); for (; entry != null; entry = ctor.getNextEntry()) { main.logmsg("Read entry..."); main.dumpEntry(entry); }
getNextEntry
in interface ConnectorInterface
getNextEntry
in class Connector
java.lang.Exception
- if an error occurs.ConnectorInterface.selectEntries()
public Entry getNextFindEntry() throws java.lang.Exception
Connector
getNextFindEntry
in interface ConnectorInterface
getNextFindEntry
in class Connector
java.lang.Exception
- if an error occurs.public java.lang.String getParam(java.lang.String param)
Connector
getParam
in interface ConnectorInterface
getParam
in class Connector
param
- The connector configuration parameter name
public ParserInterface getParser()
Connector
getParser
in class Connector
public java.lang.Object getProperty(java.lang.Object p1)
Connector
getProperty
in class Connector
p1
- The property name
public Entry getPushbackEntry()
Connector
getPushbackEntry
in interface ConnectorInterface
getPushbackEntry
in class Connector
ConnectorInterface.pushback( Entry )
public BaseConfiguration getRawConnectorConfiguration()
Connector
getRawConnectorConfiguration
in interface ConnectorInterface
getRawConnectorConfiguration
in class Connector
public RSInterface getRSInterface()
Connector
com.ibm.di.server.RS.getServer()
getRSInterface
in class Connector
public javax.swing.JComponent getUI()
Connector
getUI
in class Connector
public boolean hasConfigValue(java.lang.Object p1)
Connector
hasConfigValue
in class Connector
p1
- the key name of the value
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean hasParser()
Connector
hasParser
in class Connector
public void initParser(java.lang.Object is, java.lang.Object os) throws java.lang.Exception
Connector
initParser
in class Connector
is
- The input object.os
- the output object.
java.lang.Exception
- if a parser is not configured or the exception is derived
from the parserConnector.getParser()
public boolean isDeltaSupported()
Connector
isDeltaSupported
in interface ConnectorInterface
isDeltaSupported
in class Connector
public boolean isExceptionFatal(java.lang.Exception e)
Connector
isExceptionFatal
in interface ConnectorInterface
isExceptionFatal
in class Connector
e
- The exception object
public boolean isIOException(java.lang.Throwable e)
Connector
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.
isIOException
in interface ConnectorInterface
isIOException
in class Connector
e
- The Throwable
to be determined
public void logError(java.lang.String msg)
Connector
logError
in class Connector
msg
- The message to write to the logpublic void logmsg(java.lang.String msg)
Connector
logmsg
in class Connector
msg
- The message to write to the logpublic void modEntry(Entry entry, SearchCriteria search) throws java.lang.Exception
Connector
modEntry
in interface ConnectorInterface
modEntry
in class Connector
entry
- The entry datasearch
- The search criteria used to locate the entry to be modified
java.lang.Exception
- if an error occurs.public void modEntry(Entry entry, SearchCriteria search, Entry old) throws java.lang.Exception
Connector
modEntry
in interface ConnectorInterface
modEntry
in class Connector
entry
- The entry datasearch
- The search criteria used to locate the entry to be modifiedold
- The old entry found by the search criteria
java.lang.Exception
- if an error occurs.public void pushback(Entry e)
Connector
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.
pushback
in interface ConnectorInterface
pushback
in class Connector
e
- The entry to be returned at the next ConnectorInterface.getNextEntry()
callpublic void putEntry(Entry entry) throws java.lang.Exception
Connector
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); }
putEntry
in interface ConnectorInterface
putEntry
in class Connector
entry
- The entry data to add
java.lang.Exception
- if an error occurs.public void queryOperations(ConnectorConfig config) throws java.lang.Exception
Connector
queryOperations
in interface ConnectorInterface
queryOperations
in class Connector
config
- The configuration
java.lang.Exception
- if an error occurs in the derived class implementation.public Entry queryReply(Entry entry) throws java.lang.Exception
Connector
queryReply
in interface ConnectorInterface
queryReply
in class Connector
entry
- The data used in outgoing call
java.lang.Exception
- if an error occurs.public java.lang.Object querySchema(java.lang.Object source) throws java.lang.Exception
Connector
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 |
querySchema
in interface ConnectorInterface
querySchema
in class Connector
source
- The object on which to discover schema. This may be an Entry
or a string value
java.lang.Exception
- if an error while retrieving the schema occurs.Entry
,
Vector
public java.util.Vector<java.lang.String> queryTables() throws java.lang.Exception
Connector
queryTables
in class Connector
java.lang.Exception
- if an error occurs.Vector
public void reconnect() throws java.lang.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 Connector
java.lang.Exception
- if an error occurs.Connector.initialize(Object)
public void reconnect(java.lang.Object o) throws java.lang.Exception
Connector
reconnect
in interface ConnectorInterface
reconnect
in class Connector
o
- User provided parameter, which is sent to initialize()
java.lang.Exception
- if an error occurs.ConnectorInterface.initialize(Object)
public void registerScriptBeans(ScriptEngine se) throws java.lang.Exception
Connector
registerScriptBeans
in interface ConnectorInterface
registerScriptBeans
in class Connector
se
- The script engine context
java.lang.Exception
- if an error occurs.public void replyEntry(Entry entry) throws java.lang.Exception
Connector
replyEntry
in interface ConnectorInterface
replyEntry
in class Connector
entry
- the information as an Entry
java.lang.Exception
- if an error occurs.public void selectEntries() throws java.lang.Exception
Connector
selectEntries
in interface ConnectorInterface
selectEntries
in class Connector
java.lang.Exception
- if an error occurs.public void setConfiguration(java.lang.Object config)
Connector
setConfiguration
in interface ConnectorInterface
setConfiguration
in class Connector
config
- The configuration object (an instance of ConnectorConfig)public void setContext(java.lang.Object aContext)
Connector
AssemblyLine
object.
setContext
in interface ConnectorInterface
setContext
in class Connector
aContext
- the new context to which the connector will belong.public void setCurrent(Entry entry, SearchCriteria search)
Connector
setCurrent
in interface ConnectorInterface
setCurrent
in class Connector
entry
- The entry we want to find for modification/deletesearch
- The SearchCriteria we want to changepublic void setDebugMode(boolean debug)
Connector
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.
setDebugMode
in class Connector
debug
- the debug mode settingpublic void setLog(Log logger)
Connector
setLog
in interface ConnectorInterface
setLog
in class Connector
logger
- The Log
objectRSInterface.logmsg(String)
public void setMaxDuplicateEntries(int mde)
Connector
setMaxDuplicateEntries
in interface ConnectorInterface
setMaxDuplicateEntries
in class Connector
mde
- The maximum number of entries to buffer uppublic void setModes(java.lang.String[] modes)
Connector
setModes
in class Connector
modes
- The connector's modespublic void setModes(java.util.Vector<java.lang.String> modes)
Connector
setModes
in class Connector
modes
- The connector's modespublic void setName(java.lang.String name)
Connector
setName
in interface ConnectorInterface
setName
in class Connector
name
- The name for the connectorpublic void setParam(java.lang.String param, java.lang.String value)
Connector
setParam
in interface ConnectorInterface
setParam
in class Connector
param
- The parameter namevalue
- The parameter valuepublic void setParser(ParserInterface parser) throws java.io.IOException
Connector
setParser
in class Connector
parser
- The parser interface to use
java.io.IOException
- if an error occurs.public void setProperty(java.lang.Object p1, java.lang.Object p2)
Connector
setProperty
in class Connector
p1
- The property namep2
- The property valuepublic void setRSInterface(RSInterface rsi)
Connector
setRSInterface
in interface ConnectorInterface
setRSInterface
in class Connector
rsi
- The RSInterface objectpublic void terminate() throws java.lang.Exception
Connector
terminate
in interface ConnectorInterface
terminate
in class Connector
java.lang.Exception
- if an error occurs.public void terminateServer() throws java.lang.Exception
Connector
terminateServer
in interface ConnectorInterface
terminateServer
in class Connector
java.lang.Exception
- if an error occurspublic java.lang.String toString()
toString
in class java.lang.Object
public ConnectorInterface getDelegate()
public void setId(java.lang.String id)
id
- the id to set
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |