psdi.server

Interface CronTask

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method and Description
      void beforeRemoval()
      Method to implement when there are actions involved when the crontask instance is about to be removed by the crontask manager when the crontask instance is auto removal and it is time to remove it.
      void cronAction()
      This is the "main" method of the CronTask interface.
      java.lang.String getCronTaskHistoryMsg()
      Get message to be written to crontaskhistory.
      CrontaskInstanceRemote getCrontaskInstance()
      This method will return the Crontask instance associated with this crontask object.
      int getDBLastSeed()
      Gets the last seed for the server for a task in database
      java.util.Vector getEnteredValueVector()
      Gets the vector containg individual time values
      java.util.Date getLastRunDate()
      Gets the last Run Time for a task in database
      int getLastSeed()
      Gets the last seed for the server for a task
      CrontaskParamInfo[] getParameters()
      This method provides an array of CrontaskParamInfo() object to describe all the parameters of the crontask.
      MboRemote getParameterValidationMbo(CrontaskInstanceRemote instance)
      The non-persistent MBO returned by this method will be used to validate the value for the parameter of the crontask instance.
      long getSleepTime()
      Gets the time for the server to sleep before the next task
      void init()
      Called the very first time when the crontask instance is loaded by Crontask manager.
      boolean isOKToRun(MXServerRemote server)
      This method informs the crontask manager whether the crontask instance associated to this crontask object should be running on the specified server.
      boolean isShutdown()
      Responds back with true indicating the CronTask has done any last minute processing it needs to do; or false if it hasn't.
      void setCronTaskHistoryMsg(java.lang.String val)
      Set message to be written to CronTaskHistory.
      void setCrontaskInstance(CrontaskInstanceRemote inst)
      This method will be called by the crontask manager to tell the crontask object which CrontaskInstanceRemote object it is instantiated for.
      void setDBLastSeed(int seed)
      Sets the last seed for the server for a task in database
      void setEnteredValueVector(java.util.Vector v)
      Sets the vector containg invidual time values
      void setLastRunDate(java.util.Date d)
      Sets the last Run Time for a task in database
      void setLastSeed(int seed)
      Sets the last seed for the server for a task
      void setSleepTime(long time)
      Sets the time for the server to sleep before the next task
      void shutdown()
      Called when the CronService is being shut down.
      void start()
      Called only when the crontask instance is first loaded and active or when it is reloaded and active.
      void stop()
      Called when an active crontask instance is interupted by a reload request, or when the contask manager is shutting down.
    • Method Detail

      • getSleepTime

        long getSleepTime()
        Gets the time for the server to sleep before the next task
      • setSleepTime

        void setSleepTime(long time)
        Sets the time for the server to sleep before the next task
      • setLastSeed

        void setLastSeed(int seed)
        Sets the last seed for the server for a task
      • getLastSeed

        int getLastSeed()
        Gets the last seed for the server for a task
      • setDBLastSeed

        void setDBLastSeed(int seed)
        Sets the last seed for the server for a task in database
      • getDBLastSeed

        int getDBLastSeed()
        Gets the last seed for the server for a task in database
      • setLastRunDate

        void setLastRunDate(java.util.Date d)
        Sets the last Run Time for a task in database
      • getLastRunDate

        java.util.Date getLastRunDate()
        Gets the last Run Time for a task in database
      • setEnteredValueVector

        void setEnteredValueVector(java.util.Vector v)
        Sets the vector containg invidual time values
      • getEnteredValueVector

        java.util.Vector getEnteredValueVector()
        Gets the vector containg individual time values
      • setCronTaskHistoryMsg

        void setCronTaskHistoryMsg(java.lang.String val)
        Set message to be written to CronTaskHistory. If the cron task is flagged for history to be written, then if an error is thrown to CronTaskManager it will be included in history; otherwise if a history message has been set on the cron task, then it will be written to history.
      • start

        void start()
        Called only when the crontask instance is first loaded and active or when it is reloaded and active. This method will not be called when the crontask instance's reload request is issued but the status of the crontask instance is becoming inactive. For each start() method, there will be a stop() method called down the road in the processing of the crontask.
        See Also:
        CronTask.stop(), startup()
      • init

        void init()
           throws MXException
        Called the very first time when the crontask instance is loaded by Crontask manager. It is only called once for this crontask instance in the lifetime of the crontask manager on the server. This is the place where you want to put the initialization of the crontask which only needed to happen once and won't alter later on when reload request is issued. Don't cache the UserInfo object in this method since if user's profile has changed, or database connection is lost and recovered, the server has to be restarted to have this crontask function again.
        Throws:
        MXException
      • stop

        void stop()
        Called when an active crontask instance is interupted by a reload request, or when the contask manager is shutting down. This method always called after a start() method is called on a crontask instance.
      • cronAction

        void cronAction()
                 throws java.lang.Exception
        This is the "main" method of the CronTask interface. This is where the primary functionality of the CronTask should be implemented.
        Throws:
        java.lang.Exception
      • shutdown

        void shutdown()
        Called when the CronService is being shut down. Indicates one last opportunity to clean up the crontask upon its termination.
      • isShutdown

        boolean isShutdown()
        Responds back with true indicating the CronTask has done any last minute processing it needs to do; or false if it hasn't. The person writing a CronTask should make every effort to make the shutdown() method "short and sweet" or risk having the MXServer exit before it is done. There are no guarantees that the MXServer will wait for all registered CronTasks to return true from isShutdown() before exiting.
      • getParameterValidationMbo

        MboRemote getParameterValidationMbo(CrontaskInstanceRemote instance)
                                     throws MXException,
                                            java.rmi.RemoteException
        The non-persistent MBO returned by this method will be used to validate the value for the parameter of the crontask instance. If it returns null, no validation will be done. When the parameter value of the crontask is set, the field with the name same as the parameter name of the non-persistent MBO will be set before the the value is set to the crontaskparameter record. The returned non-persistent MBO should be properly registered to MAXIMO. All the parameters should be present as attributes of this non-persistent MBO. You can attach field validation to the field in order to do more complicated validation and action. If there is no action associated with setting the parameter value, all instances of the same crontask can share the same non-persistent MBO. In this case, the method returns the reference to the same MBO disregard the passed in instance parameter.
        Parameters:
        instance -
        Returns:
        Non-persistent MBO remote
        Throws:
        MXException
        java.rmi.RemoteException
      • getParameters

        CrontaskParamInfo[] getParameters()
                                   throws MXException,
                                          java.rmi.RemoteException
        This method provides an array of CrontaskParamInfo() object to describe all the parameters of the crontask. Parameter name, default values and the description of the parameter should be set to the CrontaskParamInfo object for each parameter. If default value and description is not set, null will be the values.
        Returns:
        Throws:
        MXException
        java.rmi.RemoteException
        See Also:
        CrontaskParamInfo
      • isOKToRun

        boolean isOKToRun(MXServerRemote server)
        This method informs the crontask manager whether the crontask instance associated to this crontask object should be running on the specified server. If the decision is crontask instance related, then the instance reference passed down to the c crontask by the crontask manager needs to be cached by overwriting the setCrontaskInstance() method. If your class is derived from SimpleCrontask class, this is already implemented.
        Parameters:
        server -
        Returns:
        true if it is OK to run, false otherwise.
      • setCrontaskInstance

        void setCrontaskInstance(CrontaskInstanceRemote inst)
        This method will be called by the crontask manager to tell the crontask object which CrontaskInstanceRemote object it is instantiated for. It is the crontask's decision whether to cache this information or not.
        Parameters:
        inst -
      • getCrontaskInstance

        CrontaskInstanceRemote getCrontaskInstance()
        This method will return the Crontask instance associated with this crontask object. It should return the cached instance obtained when it is set by the crontask manager through setCrontaskInstance() method.
        Returns:
      • beforeRemoval

        void beforeRemoval()
                    throws MXException,
                           java.rmi.RemoteException
        Method to implement when there are actions involved when the crontask instance is about to be removed by the crontask manager when the crontask instance is auto removal and it is time to remove it. Method is called right before the crontask instance and parameters are marked for deletion. The DB operations implemented in this method will be in the same transaction as deleting the crontask instance.
        Throws:
        MXException
        java.rmi.RemoteException