com.ibm.di.connector
Class TimerConnector

java.lang.Object
  extended by com.ibm.di.connector.Connector
      extended by 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
TimerConnector()
          Class constructor
 
Method Summary
 void calcNextRun()
          Calculates the next run
 void checkDate(java.lang.String[] checkTime, int dateNum, int whichDate)
          Checks if the date specified is correct
 void checkDay(java.lang.String month, int dateNum, java.lang.String[] checkTime)
          Checks if the specified day options are correct
 void doWait(long p1, long p2)
          Connector waits for the specified difference in the parameters
 java.lang.String getMaskSchedule()
          Retrieves the schedule to next run
 java.lang.String getMonthValue(java.lang.String strMonth)
          Translates month of the year to number
 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.
 java.lang.String getVersion()
          Return version information
 java.lang.String getWeekValue(java.lang.String strWeekDay)
          Translates day of the week to number
 void initialize(java.lang.Object o)
          Initialize the connector.
 void selectEntries()
          Default implementation
 void setNextEntry(Entry e)
          Sets next entry for server mode
 boolean sleepSeconds(long p1)
          This function is not used directly, but maybe some old configurations use this.Connector sleeps for the specified time
 void 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
 

Constructor Detail

TimerConnector

public TimerConnector()
Class constructor

Method Detail

selectEntries

public void selectEntries()
                   throws java.lang.Exception
Default implementation

Specified by:
selectEntries in interface ConnectorInterface
Overrides:
selectEntries in class Connector
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 interface ConnectorInterface
Overrides:
initialize in class Connector
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 interface ConnectorInterface
Overrides:
getNextEntry in class Connector
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 interface ConnectorInterface
Overrides:
getNextClient in class Connector
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 name
dateNum - date number
checkTime - 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 - time
dateNum - month number
whichDate - 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 until
p2 - 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 interface VersionInfoInterface
Returns:
version info