Class Schedules

java.lang.Object
COM.TIBCO.hawk.config.rbengine.schedule.Schedules
All Implemented Interfaces:
RBEConfigObject, Cloneable

public class Schedules extends Object implements RBEConfigObject, Cloneable
A Schedules contains a list of Schedule and PeriodGroup objects. The PeriodGroup is referenced in a Schedules using a PeriodGroupReference.

Unlike rulebases, All the schedules which is used by the TIBCO Hawk Agent is kept in a single file instead of individual files as in the case of rulebases. The Agent transfer the entire list of Schedule objects in a Schedules to and from a Console API application. For example to retrieve and send a Schedules to and from an agent, see SchedulesXML.

See Also:
  • Field Details

    • FILE_EXTENSION

      public static final String FILE_EXTENSION
      The default file extension of a schedule file.
      See Also:
    • SchedulesName

      public static String SchedulesName
      The default name of a schedules.
    • SchedulesFileName

      public static String SchedulesFileName
      The file name of a schedule file. This is the file name used by Agent and repository when loading and saving a schedule file.
  • Constructor Details

    • Schedules

      public Schedules()
      Creates a Schedules. The new Schedules object has no Schedule object.
    • Schedules

      public Schedules(String name)
      Deprecated.
      Creates a Schedules with the specifed name. The new schedules does not contain any Schedule object.
      Parameters:
      name - Schedules name
    • Schedules

      public Schedules(Vector schedules)
      Deprecated.
      Creates a Schedules with the specifed name and list of schedules.

      Parameters:
      schedules - a list of schedule.
    • Schedules

      public Schedules(Schedule[] schedules)
      Creates a Schedules with the specifed name and list of schedules.

      Parameters:
      schedules - a list of schedule.
      Throws:
      IllegalArgumentException - if schedules is null
    • Schedules

      public Schedules(Reader reader) throws ScheduleException
      Creates a Schedules from the reader. The reader contains a schedules in an XML format. This constructor is useful when recreating a Schedules from SchedulesXML object:
          Schedules schedules = new Schedules(aScheduleXML.getXMLReader());
       

      Parameters:
      reader - a reader which contain the schedule in XML format.
      Throws:
      ScheduleException - if not able to create schedules from the reader.
  • Method Details

    • getFileExtension

      public String getFileExtension()
      Returns file extension based on the schedules.

      Specified by:
      getFileExtension in interface RBEConfigObject
      Returns:
      the file extension of the schedules.
    • getSchedulesAsVector

      public Vector getSchedulesAsVector()
      Deprecated.
      Returns a list of schedules as vector.
    • getSchedules

      public Schedule[] getSchedules()
      Returns a list of schedules.
    • setSchedules

      public void setSchedules(Schedule[] schedules)
      Replaces the list of schedules with the specified list.

      Throws:
      IllegalArgumentException - if schedules is null
    • setSchedules

      public void setSchedules(Vector v)
      Deprecated.
      Replaces the list of schedules with the specified list.
    • getSchedule

      public Schedule getSchedule(String name)
      Returns a schedule of the specified name.

      Returns:
      the instance of Schedule in this Schedules object with the specified name.
    • getPeriodGroups

      public PeriodGroup[] getPeriodGroups()
      Returns a list of PeriodGroup in this Schedules.
    • setPeriodGroups

      public void setPeriodGroups(PeriodGroup[] periodGroups)
      Replaces a list of PeriodGroup in this Schedules with the specified list.

      Parameters:
      periodGroups - the new period groups for this Schedules.
      Throws:
      IllegalArgumentException - if schedules is null
    • addPeriodGroup

      public void addPeriodGroup(PeriodGroup periodGroup)
      Adds a period group to the current list of PeriodGroup in this Schedules. If the period group of the same name exist, it will be replaced.

      Parameters:
      periodGroup - period group to be added.
      Throws:
      IllegalArgumentException - if periodGroup is null
    • renamePeriodGroup

      public void renamePeriodGroup(String oldName, String newName)
      Renames a PeriodGroup.

      If the PeriodGroup to be renamed is referenced by a schedule, the schedule will be updated to used the new PeriodGroup name.

    • removePeriodGroup

      public void removePeriodGroup(PeriodGroup periodGroup)
      Removes a period group from the current list of PeriodGroup in this Schedules. If the period group does not exist, no action is taken.

      Parameters:
      periodGroup - period group to be removed.
      Throws:
      IllegalArgumentException - if periodGroupName is null or use by a schedule.
    • getPeriodGroup

      public PeriodGroup getPeriodGroup(String name)
      Returns a PeriodGroup of the specified name.

      Returns:
      instance of PeriodGroup in this Schedules object with the specified name.
    • getScheduleUsingPeriodGroup

      public String getScheduleUsingPeriodGroup(String periodGroupName)
      Gets the schedule that uses the specified PeriodGroup.

      Returns:
      the name of first schedule found to use the given PeriodGroup.
    • getName

      public String getName()
      Returns the Schedules name.

      Specified by:
      getName in interface RBEConfigObject
    • setAuthor

      public void setAuthor(String author)
      Deprecated.
      Sets the author of this Schedules.

      Parameters:
      name - name of the author.
    • setLastModification

      public void setLastModification(String lastModification)
      Deprecated.
      Sets the last modification time stamp of this Schedules.

      Parameters:
      lastModification - timeStamp of the last modification.

    • setComment

      public void setComment(String comment)
      Deprecated.
      Sets the comment for this Schedules.

      Parameters:
      comment - text for the comment.

    • getAuthor

      public String getAuthor()
      Deprecated.
      Returns the author for this Schedules.

    • getLastModification

      public String getLastModification()
      Deprecated.
      Returns the last modification for this Schedules.

    • getComment

      public String getComment()
      Deprecated.
      Returns the comment for this Schedules.

    • setAttributes

      public void setAttributes(Attributes attributes)
      Sets the attributes for this Schedules.

      Throws:
      IllegalArgumentException - if attributes is null
    • getAttributes

      public Attributes getAttributes()
      Returns the attributes for this Schedules. The Attributes contains attributes suchs as author, last modification record, and comment.

      See Also:
    • addSchedule

      public void addSchedule(Schedule schedule)
      Adds a schedule to the current list of schedules. If the schedule of the same name exist, it will be replaced.

      Parameters:
      schedule - schedule to be added.
      Throws:
      IllegalArgumentException - if schedule is null
    • removeSchedule

      public void removeSchedule(Schedule schedule)
      Deprecated.
      Removes a schedule from the current list of schedules. If the schedule does not exist, no action is taken.

      Parameters:
      schedule - schedule to be removed.
      Throws:
      IllegalArgumentException - if schedule is null
    • removeSchedule

      public void removeSchedule(String name)
      Removes a schedule from the current list of schedules.
    • contains

      protected boolean contains(Schedule scheduleToCheck)
      Checks to see if specified Schedule is in the current schedule list.

      Parameters:
      scheduleToCheck - The schedule to look for in the list
      Returns:
      true if scheduleToCheck is in the list.
    • getScheduleNames

      public String[] getScheduleNames()
      Deprecated.
      Returns the names of all Schedule objects.

    • toXML

      public String toXML()
      Deprecated.
      Returns an XML string that may be used to restore the Schedules using

      fromXML.

      See Also:
    • toXML

      public void toXML(Writer writer) throws RBEConfigObjectException
      Writes the Schedules object to Writer in XML format.

      Specified by:
      toXML in interface RBEConfigObject
      Parameters:
      writer - the writer where the XML output will be written.
      Throws:
      RBEConfigObjectException
    • fromXML

      public void fromXML(Reader reader) throws ScheduleException
      Deprecated.
      Restores Schedules from a reader in XML format.

      Parameters:
      reader - the reader where the XML output will be read.
      Throws:
      ScheduleException
    • equals

      public boolean equals(Object o)
      Compares the specified Schedules objects for equality.

      Overrides:
      equals in class Object
      Parameters:
      o - Schedules to be compared
      Returns:
      true if objects are equal
    • toString

      public String toString()
      Returns the string representation of the Schedules object.

      Overrides:
      toString in class Object
    • getChecksum

      public long getChecksum()
      Returns the checksum value of this Schedules object.
      Specified by:
      getChecksum in interface RBEConfigObject
      Returns:
      the checksum value of this Schedules object.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a copy of this Schedules object
      Overrides:
      clone in class Object
      Throws:
      CloneNotSupportedException
    • loadFromFile

      public static void loadFromFile(String path) throws RBEConfigObjectException
      Deprecated.
      Loads a Schedules object from an absolute fully qualified path.

      Parameters:
      path - the full path name of the file to load
      Throws:
      RBEConfigObjectException
    • saveToFile

      public void saveToFile(String filename) throws RBEConfigObjectException
      Deprecated.
      Saves Schedules object to a file.

      Parameters:
      filename - a fully qualify file name.
      Throws:
      RBEConfigObjectException - if I/O error occurs.
    • load

      public static Schedules load(String filename) throws RBEConfigObjectException
      Deprecated.
      Creates Schedules object from file
      Parameters:
      filename - filename
      Returns:
      Schedules
      Throws:
      RBEConfigObjectException