Class TimerConnector

    • Constructor Detail

      • TimerConnector

        public TimerConnector()
        Class constructor
    • Method Detail

      • 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