Package com.ibm.di.connector
Class TimerConnector
- java.lang.Object
-
- com.ibm.di.connector.Connector
-
- com.ibm.di.connector.TimerConnector
-
- All Implemented Interfaces:
ConnectorInterface
,VersionInfoInterface
public class TimerConnector extends Connector implements ConnectorInterface
This connector provides a simplistic version of a crontab style timer.
-
-
Field Summary
-
Fields inherited from class com.ibm.di.connector.Connector
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER
-
-
Constructor Summary
Constructors Constructor Description TimerConnector()
Class constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
calcNextRun()
Calculates the next runvoid
checkDate(java.lang.String[] checkTime, int dateNum, int whichDate)
Checks if the date specified is correctvoid
checkDay(java.lang.String month, int dateNum, java.lang.String[] checkTime)
Checks if the specified day options are correctvoid
doWait(long p1, long p2)
Connector waits for the specified difference in the parametersjava.lang.String
getMaskSchedule()
Retrieves the schedule to next runjava.lang.String
getMonthValue(java.lang.String strMonth)
Translates month of the year to numberConnectorInterface
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.java.lang.String
getVersion()
Return version informationjava.lang.String
getWeekValue(java.lang.String strWeekDay)
Translates day of the week to numbervoid
initialize(java.lang.Object o)
Initialize the connector.void
selectEntries()
Default implementationvoid
setNextEntry(Entry e)
Sets next entry for server modeboolean
sleepSeconds(long p1)
This function is not used directly, but maybe some old configurations use this.Connector sleeps for the specified timevoid
validSchedule(java.lang.String[] checkTime)
Verifies the the schedule is correct-
Methods inherited from class com.ibm.di.connector.Connector
addFindEntry, allModes, clearFindEntries, debug, debugMode, deleteEntry, extractExceptionInformation, findEntry, findEntry, getBoolean, getClassInstance, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getLog, getMaxDuplicateEntries, getModes, getModes, getName, getNextFindEntry, getParam, getParser, getProperty, getPushbackEntry, getRawConnectorConfiguration, getRSInterface, getUI, hasConfigValue, hasParser, initParser, isDeltaSupported, isExceptionFatal, isIOException, logError, logmsg, modEntry, modEntry, pushback, putEntry, queryOperations, queryReply, querySchema, queryTables, reconnect, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setDebugMode, setLog, setMaxDuplicateEntries, setModes, setModes, setName, setParam, setParser, setProperty, setRSInterface, terminate, terminateServer
-
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.connector.ConnectorInterface
deleteEntry, findEntry, getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isDeltaSupported, isExceptionFatal, isIOException, modEntry, modEntry, pushback, putEntry, queryOperations, queryReply, querySchema, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setCurrent, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminate, terminateServer
-
-
-
-
Method Detail
-
selectEntries
public void selectEntries() throws java.lang.Exception
Default implementation- Specified by:
selectEntries
in interfaceConnectorInterface
- Overrides:
selectEntries
in classConnector
- Throws:
java.lang.Exception
- never
-
initialize
public void initialize(java.lang.Object o) throws java.lang.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 interfaceConnectorInterface
- Overrides:
initialize
in classConnector
- Parameters:
o
- User provided parameter- Throws:
java.lang.Exception
- if the initialization of this connector fails.
-
setNextEntry
public void setNextEntry(Entry e)
Sets next entry for server mode- Parameters:
e
- next clien
-
getNextEntry
public Entry getNextEntry() throws java.lang.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 interfaceConnectorInterface
- Overrides:
getNextEntry
in classConnector
- Returns:
- - the next Entry, or null if no more data
- Throws:
java.lang.Exception
- if an error occurs.- See Also:
ConnectorInterface.selectEntries()
-
getNextClient
public ConnectorInterface getNextClient() throws java.lang.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 interfaceConnectorInterface
- Overrides:
getNextClient
in classConnector
- Returns:
- the clone of itself
- Throws:
java.lang.Exception
- if an error occurs.
-
checkDay
public void checkDay(java.lang.String month, int dateNum, java.lang.String[] checkTime) throws java.lang.Exception
Checks if the specified day options are correct- Parameters:
month
- month namedateNum
- date numbercheckTime
- time- Throws:
java.lang.Exception
- if the day is not valid
-
checkDate
public void checkDate(java.lang.String[] checkTime, int dateNum, int whichDate) throws java.lang.Exception
Checks if the date specified is correct- Parameters:
checkTime
- timedateNum
- month numberwhichDate
- date number- Throws:
java.lang.Exception
- if an error occurs
-
validSchedule
public void validSchedule(java.lang.String[] checkTime) throws java.lang.Exception
Verifies the the schedule is correct- Parameters:
checkTime
- time to be checked- Throws:
java.lang.Exception
- if a problem occurs
-
calcNextRun
public void calcNextRun() throws java.lang.Exception
Calculates the next run- Throws:
java.lang.Exception
- if schedule is invalid or missing
-
doWait
public void doWait(long p1, long p2) throws java.lang.InterruptedException
Connector waits for the specified difference in the parameters- Parameters:
p1
- wait untilp2
- current time in milliseconds- Throws:
java.lang.InterruptedException
- if the connector is interrupted
-
sleepSeconds
public boolean sleepSeconds(long p1)
This function is not used directly, but maybe some old configurations use this.Connector sleeps for the specified time- Parameters:
p1
- time to wait- Returns:
- is connector sleeping
-
getMaskSchedule
public java.lang.String getMaskSchedule()
Retrieves the schedule to next run- Returns:
- the schedule
-
getMonthValue
public java.lang.String getMonthValue(java.lang.String strMonth)
Translates month of the year to number- Parameters:
strMonth
- string representation- Returns:
- month number
-
getWeekValue
public java.lang.String getWeekValue(java.lang.String strWeekDay)
Translates day of the week to number- Parameters:
strWeekDay
- string representation- Returns:
- day number
-
getVersion
public java.lang.String getVersion()
Return version information- Specified by:
getVersion
in interfaceVersionInfoInterface
- Returns:
- version info
-
-