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

## com.novell.service.qms
Interface QMSJob

public interface QMSJob

Represents a job in the queue that can represent almost any application task. It is up to the developer to define the job service protocol.

The attribute IDs of a QueueJob include the following:

- ClientID
- ClientStation
- ClientTask
- ControlFlags
- Description
- EntryTime
- ID
- Position
- TargetExecutionTime
- TargetServerID
- Type

The following is an example of how a queue job is created and submitted:

        import java.util.Hashtable;
        import javax.naming.*;
        import javax.naming.directory.*;
        import com.novell.utility.naming.Environment;
        import com.novell.service.qms.*;
        ...
        public void createAJob (String serverName, String queueName)
        {
           DirContext dirCtx;
           Hashtable hash;
           QMSQueue queue;
           QMSJob job;
           QMSOutputStream out;

           try
           {
              hash = new Hashtable ();
              hash.put (
                    Context.INITIAL_CONTEXT_FACTORY,
                    Environment.QMS_INITIAL_CONTEXT_FACTORY);
              hash.put (Context.PROVIDER_URL, serverName);
              hash.put (QMSEnvironment.QUEUE_NAME, queueName);
              hash.put (QMSEnvironment.QUEUE_TYPE, queueName);
              dirCtx = new InitialDirContext (hash);
              queue = (QMSQueue) dirCtx.lookup ("");
              job = queue.createJob ();
              job.setDescription ("Test job");
              out = job.submit ();
              out.close ();        // We don't put anything in the file
           } catch (Exception e)
           {
             System.out.println ("Exception occurred:" + e);
           }
        }

See Also:
  `QMSQueue`, `QMSOutputStream`

Field Summary
`static int` | `JOB_ALREADY_OPEN` Queue control flag indicating that a job is already open.
`static int` | `QF_AUTO_START` Queue control flag indicating that a job can be released for servicing automatically, even if the connection is broken.
`static int` | `QF_ENTRY_OPEN` Queue control flag that is set by the queue and remains set as long as the client has not released the queue job entry for servicing.
`static int` | `QF_ENTRY_RESTART` Queue control flag indicating that a job can be restarted in the event of a service failure.
`static int` | `QF_OPERATOR_HOLD` Queue control flag indicating that a job is on hold.
`static int` | `QF_USER_HOLD` Queue control flag indicating that a job is on hold.

Method Summary
`void` | `cancel()` Cancels the job, removes it from the queue, and aborts the output stream if it is open.
`int` | `getClientID()` Returns the attribute ID of the client that created the queue job.
`byte[]` | `getClientRecordArea()` Returns the user defined client record area for this job.
`int` | `getClientStation()` Returns the attribute ID of the client station that created the queue job.
`int` | `getClientTask()` Returns the attribute ID of the client task of the originating process that was active when the queue job was created.
`int` | `getControlFlags()` Returns the attribute ID of the job control flags.
`java.lang.String` | `getDescription()` Returns the attribute ID of the user defined description string for this job.
`java.util.Date` | `getEntryTime()` Returns the attribute ID of the job entry time.
`byte[]` | `getFileName()` Returns the queue job file name.
`int` | `getID()` Returns the attribute ID of the queue job.
`int` | `getPosition()` Returns the attribute ID of the job position in the queue.
`int` | `getServicingServerID()` Returns the object ID of the server servicing this job.
`int` | `getServicingServerStation()` Returns the connection number of the server servicing this job.
`int` | `getServicingServerTask()` Returns the task number of the application servicing this job.
`java.util.Date` | `getTargetExecutionTime()` Returns the attribute ID of the target execution time.
`int` | `getTargetServerID()` Returns the attribute ID of the target server.
`int` | `getType()` Returns the attribute ID of the queue job type.
`void` | `setClientRecordArea(byte[] clientRecordArea)` Sets the user defined client record area for this job.
`void` | `setControlFlags(int controlFlags)` Sets the attribute ID of the job control flags, which indicate the current status of the job in the queue.
`void` | `setDescription(java.lang.String description)` Sets the user defined description string for this job.
`void` | `setPosition(int newPosition)` Sets the attribute ID of the position for the job within the queue.
`void` | `setTargetExecutionTime(java.util.Date targetExecutionTime)` Sets the attribute ID of the target execution time.
`void` | `setTargetServerID(int targetServerID)` Sets the attribute ID of the target server.
`void` | `setType(int type)` Sets the attribute ID of the job type.
`QMSOutputStream` | `submit()` Submits a job into the queue and gets an OutputStream back.

Field Detail

### QF_AUTO_START

    public static final int QF_AUTO_START

  Queue control flag indicating that a job can be released for servicing automatically, even if the connection is broken. If not set, a job is automatically removed if the connection is broken. This flag is part of the QueueJob ControlFlags attribute.

  (QF_AUTO_START = 0x08)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

### QF_ENTRY_RESTART

    public static final int QF_ENTRY_RESTART

  Queue control flag indicating that a job can be restarted in the event of a service failure. The job will be attempted again when service to the queue resumes. Clearing this bit allows the job entry to be removed from the queue if it is not serviced successfully. This flag is part of the QueueJob ControlFlags attribute.

  (QF_ENTRY_RESTART = 0x10)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

### QF_ENTRY_OPEN

    public static final int QF_ENTRY_OPEN

  Queue control flag that is set by the queue and remains set as long as the client has not released the queue job entry for servicing. When the client has released the job, QMS clears the bit. This flag is part of the QueueJob ControlFlags attribute.

  (QF_ENTRY_OPEN = 0x20)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

### QF_USER_HOLD

    public static final int QF_USER_HOLD

  Queue control flag indicating that a job is on hold. The job will continue to advance in the queue, but will not be serviced until this bit is cleared. This flag can be set by the object that placed the job in the queue. This flag is part of the QueueJob ControlFlags attribute.

  (QF_USER_HOLD = 0x40)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

### QF_OPERATOR_HOLD

    public static final int QF_OPERATOR_HOLD

  Queue control flag indicating that a job is on hold. The job will continue to advance in the queue, but will not be serviced until this bit is cleared. This flag can be set only by an object that has queue operator privileges. This flag is part of the QueueJob ControlFlags attribute.

  (QF_OPERATOR_HOLD = 0x80)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

### JOB_ALREADY_OPEN

    public static final int JOB_ALREADY_OPEN

  Queue control flag indicating that a job is already open.

  (JOB_ALREADY_OPEN = 0x882B)

  See Also:
    `setControlFlags(int)`, `getControlFlags()`

Method Detail

### submit

    public QMSOutputStream submit()
                           throws java.io.IOException,
                                  com.novell.service.jncp.NSIException

  Submits a job into the queue and gets an OutputStream back. It does not support re-submitting an already submitted job.
  Returns:
    An output stream on which to write data.
  Throws:
    java.io.IOException - An I/O error occurred.
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `cancel()`

### cancel

    public void cancel()
                throws java.io.IOException,
                       com.novell.service.jncp.NSIException

  Cancels the job, removes it from the queue, and aborts the output stream if it is open.
  Throws:
    java.io.IOException - An I/O error occurred.
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `submit()`

### getClientStation

    public int getClientStation()

  Returns the attribute ID of the client station that created the queue job.
  Returns:
    The originating client station attribute ID.

### getClientTask

    public int getClientTask()

  Returns the attribute ID of the client task of the originating process that was active when the queue job was created.
  Returns:
    The originating client task attribute ID.

### getClientID

    public int getClientID()

  Returns the attribute ID of the client that created the queue job.
  Returns:
    The originating client attribute ID.

### getTargetServerID

    public int getTargetServerID()

  Returns the attribute ID of the target server.

  A value of -1 (0xFFFFFFFF) indicates that any server can service the job.

  Returns:
    The target server attribute ID.
  See Also:
    `setTargetServerID(int)`

### getTargetExecutionTime

    public java.util.Date getTargetExecutionTime()

  Returns the attribute ID of the target execution time.

  If the target time is equal to the entry time then the job may be serviced immediately.

  Returns:
    The attribute ID of the target execution time.
  See Also:
    `setTargetExecutionTime(java.util.Date)`

### getEntryTime

    public java.util.Date getEntryTime()

  Returns the attribute ID of the job entry time.
  Returns:
    The attribute ID of the job entry time.

### getID

    public int getID()

  Returns the attribute ID of the queue job.

  The queue job ID is assigned by the queue when the job is submitted.

  Returns:
    The attribute ID of the queue job.

### getType

    public int getType()

  Returns the attribute ID of the queue job type.

  The queue job type is defined by the job service protocol, which is developer defined. If not used, the job type should be set to 0. A -1 should not be used as a job type because it is used by the job server to indicate that it will service any job type.

  Returns:
    The attribute ID of the queue job type.
  See Also:
    `setType(int)`

### getPosition

    public int getPosition()
                    throws com.novell.service.jncp.NSIException

  Returns the attribute ID of the job position in the queue.

  The entry at the top of the queue is assigned a position of 1. The next entry in the queue is position 2, and so forth. Position 0 is returned if the job has not been submitted to the queue.

  Returns:
    The attribute ID of the job's position in the queue.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `setPosition(int)`

### getControlFlags

    public int getControlFlags()

  Returns the attribute ID of the job control flags.

  The control flags indicate the current status of the job.

  Returns:
    The attribute ID of the control flags for this job.
  See Also:
    `QF_AUTO_START`, `QF_ENTRY_RESTART`, `QF_ENTRY_OPEN`, `QF_USER_HOLD`, `QF_OPERATOR_HOLD`, `setControlFlags(int)`

### getFileName

    public byte[] getFileName()

  Returns the queue job file name.

  The queue associates a file with a queue job when it is submitted. This file can be used for storing additional information beyond that in the client record area for the job.

  Returns:
    The queue job file name.
  See Also:
    `submit()`

### getServicingServerStation

    public int getServicingServerStation()

  Returns the connection number of the server servicing this job.
  Returns:
    The connection number of the server servicing this job.

### getServicingServerTask

    public int getServicingServerTask()

  Returns the task number of the application servicing this job.
  Returns:
    The task number of the application servicing this job.

### getServicingServerID

    public int getServicingServerID()

  Returns the object ID of the server servicing this job.
  Returns:
    The object ID of the server servicing this job.

### getDescription

    public java.lang.String getDescription()

  Returns the attribute ID of the user defined description string for this job.
  Returns:
    The attribute ID of the user defined description String for this job.
  See Also:
    `setDescription(java.lang.String)`

### getClientRecordArea

    public byte[] getClientRecordArea()

  Returns the user defined client record area for this job.

  The format of this area is defined by the job service protocol. It is limited to 152 bytes of data.

  Returns:
    A Byte array containing the user defined client record area.
  See Also:
    `setClientRecordArea(byte[])`

### setTargetServerID

    public void setTargetServerID(int targetServerID)
                           throws com.novell.service.jncp.NSIException

  Sets the attribute ID of the target server.

  The targetServerID parameter is set to -1 if any server is allowed to service the job. Otherwise, it is set to the object ID of the job server.

  Parameters:
    `targetServerID` - The attribute ID of the target server.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getTargetServerID()`

### setTargetExecutionTime

    public void setTargetExecutionTime(java.util.Date targetExecutionTime)
                                throws com.novell.service.jncp.NSIException

  Sets the attribute ID of the target execution time.
  Parameters:
    `targetExecutionTime` - The date and time after which this job can be serviced.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getTargetExecutionTime()`

### setType

    public void setType(int type)
                 throws com.novell.service.jncp.NSIException

  Sets the attribute ID of the job type.

  The job type can be used by the job service protocol to allow multiple types of jobs to be serviced through a single queue. This should be set to 0 if not used. A -1 should not be used because that value is used by job servers to indicate that it will service any job type.

  Parameters:
    `type` - The attribute ID of the job type.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getType()`

### setPosition

    public void setPosition(int newPosition)
                     throws com.novell.service.jncp.NSIException

  Sets the attribute ID of the position for the job within the queue.

  The entry at the top of the queue is assigned a position of 1. The next entry in the queue is position 2, and so forth. Position 0 is returned if the job has not been submitted to the queue.

  Parameters:
    `newPosition` - The desired position for this queue job.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getPosition()`

### setControlFlags

    public void setControlFlags(int controlFlags)
                         throws com.novell.service.jncp.NSIException

  Sets the attribute ID of the job control flags, which indicate the current status of the job in the queue.
  Parameters:
    `controlFlags` - The attribute ID of the job control flags.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `QF_AUTO_START`, `QF_ENTRY_RESTART`, `QF_USER_HOLD`, `QF_OPERATOR_HOLD`, `setControlFlags(int)`

### setDescription

    public void setDescription(java.lang.String description)
                        throws com.novell.service.jncp.NSIException

  Sets the user defined description string for this job.
  Parameters:
    `description` - The user defined description String for this job.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getDescription()`

### setClientRecordArea

    public void setClientRecordArea(byte[] clientRecordArea)
                             throws com.novell.service.jncp.NSIException

  Sets the user defined client record area for this job.

  The format of this area is defined by the job service protocol. It is limited to 152 bytes of data.

  Parameters:
    `clientRecordArea` - A byte array containing the user defined client record area.
  Throws:
    com.novell.service.jncp.NSIException - A network exception occurred.
  See Also:
    `getClientRecordArea()`

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