|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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:
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);
}
}
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 |
public static final int QF_AUTO_START
(QF_AUTO_START = 0x08)
setControlFlags(int)
,
getControlFlags()
public static final int QF_ENTRY_RESTART
(QF_ENTRY_RESTART = 0x10)
setControlFlags(int)
,
getControlFlags()
public static final int QF_ENTRY_OPEN
(QF_ENTRY_OPEN = 0x20)
setControlFlags(int)
,
getControlFlags()
public static final int QF_USER_HOLD
(QF_USER_HOLD = 0x40)
setControlFlags(int)
,
getControlFlags()
public static final int QF_OPERATOR_HOLD
(QF_OPERATOR_HOLD = 0x80)
setControlFlags(int)
,
getControlFlags()
public static final int JOB_ALREADY_OPEN
(JOB_ALREADY_OPEN = 0x882B)
setControlFlags(int)
,
getControlFlags()
Method Detail |
public QMSOutputStream submit() throws java.io.IOException, com.novell.service.jncp.NSIException
cancel()
public void cancel() throws java.io.IOException, com.novell.service.jncp.NSIException
submit()
public int getClientStation()
public int getClientTask()
public int getClientID()
public int getTargetServerID()
A value of -1 (0xFFFFFFFF) indicates that any server can service the job.
setTargetServerID(int)
public java.util.Date getTargetExecutionTime()
If the target time is equal to the entry time then the job may be serviced immediately.
setTargetExecutionTime(java.util.Date)
public java.util.Date getEntryTime()
public int getID()
The queue job ID is assigned by the queue when the job is submitted.
public int getType()
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.
setType(int)
public int getPosition() throws com.novell.service.jncp.NSIException
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.
setPosition(int)
public int getControlFlags()
The control flags indicate the current status of the job.
QF_AUTO_START
,
QF_ENTRY_RESTART
,
QF_ENTRY_OPEN
,
QF_USER_HOLD
,
QF_OPERATOR_HOLD
,
setControlFlags(int)
public byte[] getFileName()
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.
submit()
public int getServicingServerStation()
public int getServicingServerTask()
public int getServicingServerID()
public java.lang.String getDescription()
setDescription(java.lang.String)
public byte[] getClientRecordArea()
The format of this area is defined by the job service protocol. It is limited to 152 bytes of data.
setClientRecordArea(byte[])
public void setTargetServerID(int targetServerID) throws com.novell.service.jncp.NSIException
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.
targetServerID
- The attribute ID of the target server.getTargetServerID()
public void setTargetExecutionTime(java.util.Date targetExecutionTime) throws com.novell.service.jncp.NSIException
targetExecutionTime
- The date and time after which this
job can be serviced.getTargetExecutionTime()
public void setType(int type) throws com.novell.service.jncp.NSIException
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.
type
- The attribute ID of the job type.getType()
public void setPosition(int newPosition) throws com.novell.service.jncp.NSIException
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.
newPosition
- The desired position for this queue job.getPosition()
public void setControlFlags(int controlFlags) throws com.novell.service.jncp.NSIException
controlFlags
- The attribute ID of the job control flags.QF_AUTO_START
,
QF_ENTRY_RESTART
,
QF_USER_HOLD
,
QF_OPERATOR_HOLD
,
setControlFlags(int)
public void setDescription(java.lang.String description) throws com.novell.service.jncp.NSIException
description
- The user defined description String for
this job.getDescription()
public void setClientRecordArea(byte[] clientRecordArea) throws com.novell.service.jncp.NSIException
The format of this area is defined by the job service protocol. It is limited to 152 bytes of data.
clientRecordArea
- A byte array containing the user defined
client record area.getClientRecordArea()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |