Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.knowgate.scheduler
Class Job

    java.lang.Object
      com.knowgate.dataobjs.DBPersist
          com.knowgate.scheduler.Job

All Implemented Interfaces:
  java.io.Serializable, java.util.Map

Direct Known Subclasses:
  DummyJob, EmailSender, FaxSender, FileDumper, FTPPublisher, MimeSender, SMSSender

    public abstract class Job

extends DBPersist

Abstract base class for Job Commands Implementations

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map
`java.util.Map.Entry<K,V>`

Field Summary
`static java.lang.String` | `COMMAND_DUMY`
`static java.lang.String` | `COMMAND_FAX`
`static java.lang.String` | `COMMAND_FTP`
`static java.lang.String` | `COMMAND_MAIL`
`static java.lang.String` | `COMMAND_SAVE`
`static java.lang.String` | `COMMAND_SEND`
`protected int` | `iPendingAtoms`
`static short` | `STATUS_ABORTED`
`static short` | `STATUS_FINISHED`
`static short` | `STATUS_INTERRUPTED`
`static short` | `STATUS_PENDING`
`static short` | `STATUS_RUNNING`
`static short` | `STATUS_SUSPENDED`

Fields inherited from class com.knowgate.dataobjs.DBPersist
`AllVals, sAuditCls, sAuditUsr, sTransactId`

Constructor Summary
`Job()`

Method Summary
`void` | `abort(JDCConnection oConn)`
`boolean` | `delete(JDCConnection oConn)` Delete Job
`static boolean` | `delete(JDCConnection oConn, java.lang.String sJobId)` Delete Job Call k_sp_del_job stored procedure
`abstract void` | `free()` This method must free all the resource allocated by a Job
`DBBind` | `getDataBaseBind()` Get database binding for this Job
`static java.lang.String` | `getIdFromTitle(JDCConnection oConn, java.lang.String sTitle, java.lang.String sGuWorkArea)` Get a Job GUID given its title
`java.lang.String` | `getParameter(java.lang.String sParamName)` Get parameter extracted from tx_parameter field
`java.util.Properties` | `getParameters()` Get parameters extracted from tx_parameter field
`java.util.Properties` | `getProperties()` Get Environment Properties Collection
`java.lang.String` | `getProperty(java.lang.String sPropertyName)` Get Environment Property Environment properties are readed from hipergate.cnf.
`short` | `getStatus()` Get Job status
`void` | `insertRecipients(JDCConnection oConn, java.lang.String[] aRecipients, java.lang.String sRecipientTp, java.lang.String sFormat, short iStatusId)` Insert a recipients list as new atoms of this Job The recipient data is readed from k_member_address by using recipient's e-mail as key.
`static Job` | `instantiate(JDCConnection oConn, java.lang.String sJobId, java.util.Properties oEnvironmentProps)` Create an instance of a Job subclass The new object class name will be readed form k_jobs.nm_class field.
`static Job` | `instantiate(JDCConnection oConn, java.lang.String sJobId, java.lang.String sProfileName)` Create an instance of a Job subclass The new object class name will be readed form k_jobs.nm_class field.
`boolean` | `load(JDCConnection oConn, java.lang.Object[] PKVals)` Load Job
`void` | `log(java.lang.String sStr)` Write Line to Job Log File
`java.io.File` | `logFile()` Get reference to Job log file Job log file is placed at /storage/jobs/gu_workarea/
`static void` | `main(java.lang.String[] argv)`
`int` | `pending()` Count of atoms pending of processing for this Job This count is decremented upon each successfull call to process() method
`abstract java.lang.Object` | `process(Atom oAtm)` Process an atom Concrete atom processing implementation must be provided by each derived subclass.
`void` | `resolveAtomsEMails(JDCConnection oConn)` Fills atoms data from their e-mails This method call k_sp_resolve_atoms stored procedure which takes each atom mail address and looks it up at k_member_address table for completing name surname and other personalization data embedded into each atom's record
`void` | `setDataBaseBind(DBBind oDbb)` Assign a database binding to the Job
`void` | `setStatus(JDCConnection oConn, int iStatus)` Set Job Status If Status if set to Job.STATUS_FINISHED then dt_finished is set to current system date.
`boolean` | `store(JDCConnection oConn)` Store Job By default jobs are created with id_status=STATUS_PENDING

Methods inherited from class com.knowgate.dataobjs.DBPersist
`allcaps, allcaps, changelog, clear, clone, containsKey, containsValue, entrySet, exists, get, get, getAuditClassName, getCreationDate, getDate, getDateFormated, getDateShort, getDateTime, getDateTime24, getDecimal, getDecimalFormated, getDecimalFormated, getDouble, getDoubleFormated, getFloat, getFloatFormated, getInt, getInteger, getIntervalPart, getItemMap, getItems, getMoney, getShort, getSQLDate, getSQLTime, getString, getStringHtml, getStringNull, getTable, getTable, getTableName, getTime, getTimeOfDay, getTimestamp, getUIdFromName, isEmpty, isNull, iterator, keySet, load, parseXML, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, put, putAll, putAll, remove, remove, replace, replace, replace, replace, replace, replace, replace, replace, setAuditTransact, setAuditUser, setCreationDate, size, toLowerCase, toUpperCase, toXML, toXML, toXML, toXML, values`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.util.Map
`equals, hashCode`

Field Detail

### iPendingAtoms

    protected int iPendingAtoms

### STATUS_ABORTED

    public static final short STATUS_ABORTED

See Also:
  Constant Field Values

### STATUS_FINISHED

    public static final short STATUS_FINISHED

See Also:
  Constant Field Values

### STATUS_PENDING

    public static final short STATUS_PENDING

See Also:
  Constant Field Values

### STATUS_SUSPENDED

    public static final short STATUS_SUSPENDED

See Also:
  Constant Field Values

### STATUS_RUNNING

    public static final short STATUS_RUNNING

See Also:
  Constant Field Values

### STATUS_INTERRUPTED

    public static final short STATUS_INTERRUPTED

See Also:
  Constant Field Values

### COMMAND_SEND

    public static final java.lang.String COMMAND_SEND

See Also:
  Constant Field Values

### COMMAND_MAIL

    public static final java.lang.String COMMAND_MAIL

See Also:
  Constant Field Values

### COMMAND_SAVE

    public static final java.lang.String COMMAND_SAVE

See Also:
  Constant Field Values

### COMMAND_FAX

    public static final java.lang.String COMMAND_FAX

See Also:
  Constant Field Values

### COMMAND_FTP

    public static final java.lang.String COMMAND_FTP

See Also:
  Constant Field Values

### COMMAND_DUMY

    public static final java.lang.String COMMAND_DUMY

See Also:
  Constant Field Values

Constructor Detail

### Job

    public Job()

Method Detail

### process

    public abstract java.lang.Object process(Atom oAtm)
                                      throws java.sql.SQLException,
                                             java.io.FileNotFoundException,
                                             java.io.IOException,
                                             MessagingException,
                                             java.lang.NullPointerException,
                                             java.lang.ClassNotFoundException,
                                             java.lang.InstantiationException,
                                             java.lang.IllegalAccessException

  Process an atom

  Concrete atom processing implementation must be provided by each derived subclass.

  Parameters:
    `oAtm` - Atom to be processed
  Returns:
    Custom subclass defined Object
  Throws:
    `java.sql.SQLException`
    `java.io.FileNotFoundException`
    `java.io.IOException`
    `MessagingException`
    `java.lang.NullPointerException`
    `java.lang.ClassNotFoundException`
    `java.lang.InstantiationException`
    `java.lang.IllegalAccessException`

### free

    public abstract void free()

  This method must free all the resource allocated by a Job

### pending

    public int pending()

  Count of atoms pending of processing for this Job

  This count is decremented upon each successfull call to process() method

### abort

    public void abort(JDCConnection oConn)
               throws java.sql.SQLException,
                      java.lang.IllegalStateException

  Throws:
    `java.sql.SQLException`
    `java.lang.IllegalStateException`

### load

    public boolean load(JDCConnection oConn,
                        java.lang.Object[] PKVals)
                 throws java.sql.SQLException

  Load Job

  Overrides:
    `load` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
    `PKVals` - An Array with a single element containing the Job GUID
  Returns:
    true if a register was found, false if no register was found with such primary key.
  Throws:
    `java.sql.SQLException`

### delete

    public boolean delete(JDCConnection oConn)
                   throws java.sql.SQLException

  Delete Job

  Overrides:
    `delete` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    true if register was successfully erased, false if not.
  Throws:
    `java.sql.SQLException`

### store

    public boolean store(JDCConnection oConn)
                  throws java.sql.SQLException

  Store Job

  By default jobs are created with id_status=STATUS_PENDING

  Overrides:
    `store` in class `DBPersist`
  Parameters:
    `oConn` - Database Connection
  Returns:
    boolean true if register was stored for the first time, false if register already existed.
  Throws:
    `java.sql.SQLException`

### getParameters

    public java.util.Properties getParameters()

  Get parameters extracted from tx_parameter field

  Returns:
    Parameters as a java.util.Properties object

### getParameter

    public java.lang.String getParameter(java.lang.String sParamName)

  Get parameter extracted from tx_parameter field

  Parameters:
    `sParamName` - Parameter Name
  Returns:
    Parameter Value or null if not found

### getProperty

    public java.lang.String getProperty(java.lang.String sPropertyName)

  Get Environment Property

  Environment properties are readed from hipergate.cnf.

  Parameters:
    `sPropertyName` -
  Returns:

### getProperties

    public java.util.Properties getProperties()

  Get Environment Properties Collection

### logFile

    public java.io.File logFile()

  Get reference to Job log file

  Job log file is placed at /storage/jobs/gu_workarea/

  Returns:
    Reference to Job Log File Object

### log

    public void log(java.lang.String sStr)

  Write Line to Job Log File

  Parameters:
    `sStr` - Line to be written

### getDataBaseBind

    public DBBind getDataBaseBind()

  Get database binding for this Job

  Returns:
    DBBind

### setDataBaseBind

    public void setDataBaseBind(DBBind oDbb)

  Assign a database binding to the Job

  Parameters:
    `oDbb` - DBBind

### setStatus

    public void setStatus(JDCConnection oConn,
                          int iStatus)
                   throws java.sql.SQLException

  Set Job Status

  If Status if set to Job.STATUS_FINISHED then dt_finished is set to current system date.

  Parameters:
    `oConn` - Database Connection
    `iStatus` - Job Status

    Status
    STATUS_ABORTED (-1)
    STATUS_FINISHED (0)
    STATUS_PENDING (1)
    STATUS_SUSPENDED (2)
    STATUS_RUNNING (3)

  Throws:
    `java.sql.SQLException`

### getStatus

    public short getStatus()

  Get Job status

  Since:
    5.0

### resolveAtomsEMails

    public void resolveAtomsEMails(JDCConnection oConn)
                            throws java.sql.SQLException

  Fills atoms data from their e-mails

  This method call k_sp_resolve_atoms stored procedure which takes each atom mail address and looks it up at k_member_address table for completing name surname and other personalization data embedded into each atom's record

  Parameters:
    `oConn` - JDCConnection
  Throws:
    `java.sql.SQLException`

### delete

    public static boolean delete(JDCConnection oConn,
                                 java.lang.String sJobId)
                          throws java.sql.SQLException

  Delete Job

  Call k_sp_del_job stored procedure

  Parameters:
    `oConn` - Database Connection
    `sJobId` - GUID of Job to be deleted
  Throws:
    `java.sql.SQLException`

### instantiate

    public static Job instantiate(JDCConnection oConn,
                                  java.lang.String sJobId,
                                  java.util.Properties oEnvironmentProps)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.IllegalAccessException,
                                  java.sql.SQLException,
                                  java.lang.InstantiationException,
                                  java.io.FileNotFoundException

  Create an instance of a Job subclass

  The new object class name will be readed form k_jobs.nm_class field.

  Parameters:
    `oConn` - Database Connection
    `sJobId` - GUID of Job to be instantiated
    `oEnvironmentProps` - Environment properties taken from hipergate.cnf
  Returns:
    Reference to Instantiated Object
  Throws:
    `java.io.FileNotFoundException` - If any directory for Job log file could not be created
    `java.lang.ClassNotFoundException` - If no class with name k_jobs.nm_class was found
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.sql.SQLException`

### instantiate

    public static Job instantiate(JDCConnection oConn,
                                  java.lang.String sJobId,
                                  java.lang.String sProfileName)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.IllegalAccessException,
                                  java.sql.SQLException,
                                  java.lang.InstantiationException,
                                  java.io.FileNotFoundException

  Create an instance of a Job subclass

  The new object class name will be readed form k_jobs.nm_class field.

  Parameters:
    `oConn` - Database Connection
    `sJobId` - GUID of Job to be deleted
    `sProfileName` - Name without .cnf extension of the properties file to use
  Returns:
    Reference to Instantiated Object
  Throws:
    `java.io.FileNotFoundException` - If any directory for Job log file could not be created
    `java.lang.ClassNotFoundException` - If no class with name k_jobs.nm_class was found
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`
    `java.sql.SQLException`

### getIdFromTitle

    public static java.lang.String getIdFromTitle(JDCConnection oConn,
                                                  java.lang.String sTitle,
                                                  java.lang.String sGuWorkArea)
                                           throws java.sql.SQLException

  Get a Job GUID given its title

  Parameters:
    `oConn` - Database Connection
    `sTitle` - Job Title (search is case sensitive)
    `oGuWorkArea` - GUID of WorkArea to restrict search, if null then all workareas are searched
  Throws:
    `java.sql.SQLException`

### insertRecipients

    public void insertRecipients(JDCConnection oConn,
                                 java.lang.String[] aRecipients,
                                 java.lang.String sRecipientTp,
                                 java.lang.String sFormat,
                                 short iStatusId)
                          throws java.sql.SQLException

  Insert a recipients list as new atoms of this Job

  The recipient data is readed from k_member_address by using recipient's e-mail as key.

  Parameters:
    `oConn` - Database Connection
    `aRecipients` - Recipients list (e-mail addresses)
    `sRecipientTp` - Recipient Type {to,cc,bcc}
    `sFormat` - Message Format {text,html}
    `iStatusId` - {Job.STATUS_PENDING,STATUS_SUSPENDED}
  Throws:
    `java.sql.SQLException`
  Since:
    4.0

### main

    public static void main(java.lang.String[] argv)
                     throws java.sql.SQLException,
                            org.xml.sax.SAXException,
                            java.io.IOException,
                            java.lang.ClassNotFoundException,
                            java.lang.IllegalAccessException,
                            java.lang.InstantiationException

  Throws:
    `java.sql.SQLException`
    `org.xml.sax.SAXException`
    `java.io.IOException`
    `java.lang.ClassNotFoundException`
    `java.lang.IllegalAccessException`
    `java.lang.InstantiationException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD