com.ibm.as400.access
Class DataQueue
- java.lang.Object
-
- com.ibm.as400.access.BaseDataQueue
-
- com.ibm.as400.access.DataQueue
-
- All Implemented Interfaces:
- java.io.Serializable
public class DataQueue extends BaseDataQueue
The DataQueue class represents an IBM i sequential data queue object.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description DataQueue()
Constructs a DataQueue object.DataQueue(AS400 system, java.lang.String path)
Constructs a DataQueue object.
-
Method Summary
Methods Modifier and Type Method and Description void
create(DataQueueAttributes attributes)
Creates a sequential data queue on the system.void
create(int maxEntryLength)
Creates a sequential data queue on the system.void
create(int maxEntryLength, java.lang.String authority, boolean saveSenderInformation, boolean FIFO, boolean forceToAuxiliaryStorage, java.lang.String description)
Creates a sequential data queue on the system.DataQueueEntry
peek()
Reads an entry from the data queue without removing it from the queue.DataQueueEntry
peek(int wait)
Reads an entry from the data queue without removing it from the queue.DataQueueEntry
read()
Reads an entry from the data queue and removes it from the queue.DataQueueEntry
read(int wait)
Reads an entry from the data queue and removes it from the queue.java.lang.String
toString()
Returns the String representation of this data queue object.void
write(byte[] data)
Writes an entry to the data queue.void
write(java.lang.String data)
Writes a string entry to the data queue.-
Methods inherited from class com.ibm.as400.access.BaseDataQueue
addDataQueueListener, addObjectListener, addPropertyChangeListener, addVetoableChangeListener, clear, delete, exists, getCcsid, getDescription, getForceToAuxiliaryStorage, getMaxEntryLength, getName, getPath, getSaveSenderInformation, getSystem, isFIFO, refreshAttributes, removeDataQueueListener, removeObjectListener, removePropertyChangeListener, removeVetoableChangeListener, setCcsid, setPath, setSystem
-
-
-
-
Constructor Detail
-
DataQueue
public DataQueue()
Constructs a DataQueue object. The system and path properties must be set before using any method requiring a connection to the system.
-
DataQueue
public DataQueue(AS400 system, java.lang.String path)
Constructs a DataQueue object. For data queue on an IASP, the user profile of the AS400 connection must have the job description with the IASP set.- Parameters:
system
- The system object representing the system on which the data queue exists.path
- The fully qualified integrated file system path name of the data queue. The library and queue name must each be 10 characters or less.
-
-
Method Detail
-
create
public void create(DataQueueAttributes attributes) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException
Creates a sequential data queue on the system. The queue will be created with the attributes provided.- Parameters:
attributes
- The attributes of the data queue to be created.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectAlreadyExistsException
- If the object already exists on the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
create
public void create(int maxEntryLength) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException
Creates a sequential data queue on the system. The queue will be created with the following attributes: authority = *LIBCRTAUT, saveSenderInformation = false, FIFO = true, forceToAuxiliaryStorage = false, description = (50 blanks).- Parameters:
maxEntryLength
- The maximum number of bytes per data queue entry. Valid values are 1-64512.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.java.lang.InterruptedException
- If this thread is interrupted.ObjectAlreadyExistsException
- If the object already exists on the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
create
public void create(int maxEntryLength, java.lang.String authority, boolean saveSenderInformation, boolean FIFO, boolean forceToAuxiliaryStorage, java.lang.String description) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, java.lang.InterruptedException, ObjectAlreadyExistsException, ObjectDoesNotExistException
Creates a sequential data queue on the system.- Parameters:
maxEntryLength
- The maximum number of bytes per data queue entry. Valid values are 1-64512.authority
- The public authority for the data queue. Valid values are *ALL, *CHANGE, *EXCLUDE, *USE, *LIBCRTAUT.saveSenderInformation
- true if entry origin information will be saved; false otherwise.FIFO
- true if queue entries are processed in FIFO order, false if queue entries are processed in LIFO order.forceToAuxiliaryStorage
- true if writes are forced to storage before return; false otherwise.description
- The text description. This string must be 50 characters or less.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.java.lang.InterruptedException
- If this thread is interrupted.ObjectAlreadyExistsException
- If the object already exists on the system.ObjectDoesNotExistException
- If the object does not exist on the system.
-
peek
public DataQueueEntry peek() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Reads an entry from the data queue without removing it from the queue. This method will not wait for entries if none are on the queue.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
peek
public DataQueueEntry peek(int wait) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Reads an entry from the data queue without removing it from the queue.- Parameters:
wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
read
public DataQueueEntry read() throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Reads an entry from the data queue and removes it from the queue. This method will not wait for entries if none are on the queue.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
read
public DataQueueEntry read(int wait) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Reads an entry from the data queue and removes it from the queue.- Parameters:
wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
toString
public java.lang.String toString()
Returns the String representation of this data queue object.- Overrides:
toString
in classBaseDataQueue
- Returns:
- The String representation of this data queue object.
-
write
public void write(byte[] data) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Writes an entry to the data queue.- Parameters:
data
- The array of bytes to write to the queue.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
write
public void write(java.lang.String data) throws AS400SecurityException, ErrorCompletingRequestException, java.io.IOException, IllegalObjectTypeException, java.lang.InterruptedException, ObjectDoesNotExistException
Writes a string entry to the data queue.- Parameters:
data
- The string to write to the queue.- Throws:
AS400SecurityException
- If a security or authority error occurs.ErrorCompletingRequestException
- If an error occurs before the request is completed.java.io.IOException
- If an error occurs while communicating with the system.IllegalObjectTypeException
- If the object on the system is not the required type.java.lang.InterruptedException
- If this thread is interrupted.ObjectDoesNotExistException
- If the object does not exist on the system.
-
-