com.ibm.as400.access
Class KeyedDataQueue
java.lang.Object
|
+--com.ibm.as400.access.BaseDataQueue
|
+--com.ibm.as400.access.KeyedDataQueue
- public class KeyedDataQueue
- extends BaseDataQueue
The KeyedDataQueue class represents an AS/400 keyed data queue object.
- See Also:
- Serialized Form
Method Summary |
void |
clear(byte[] key)
Removes all entries that match the key from the data queue. |
void |
clear(java.lang.String key)
Removes all entries that match the key from the data queue. |
void |
create(int keyLength,
int maxEntryLength)
Creates a keyed data queue on the AS/400. |
void |
create(int keyLength,
int maxEntryLength,
java.lang.String authority,
boolean saveSenderInformation,
boolean forceToAuxiliaryStorage,
java.lang.String description)
Creates a keyed data queue on the AS/400. |
int |
getKeyLength()
Returns the length of the keys (in bytes) on this queue. |
KeyedDataQueueEntry |
peek(byte[] key)
Reads an entry from the data queue without removing it from the queue. |
KeyedDataQueueEntry |
peek(byte[] key,
int wait,
java.lang.String searchType)
Reads an entry from the data queue without removing it from the queue. |
KeyedDataQueueEntry |
peek(java.lang.String key)
Reads an entry from the data queue without removing it from the queue. |
KeyedDataQueueEntry |
peek(java.lang.String key,
int wait,
java.lang.String searchType)
Reads an entry from the data queue without removing it from the queue. |
KeyedDataQueueEntry |
read(byte[] key)
Reads an entry from the data queue and removes it from the queue. |
KeyedDataQueueEntry |
read(byte[] key,
int wait,
java.lang.String searchType)
Reads an entry from the data queue and removes it from the queue. |
KeyedDataQueueEntry |
read(java.lang.String key)
Reads an entry from the data queue and removes it from the queue. |
KeyedDataQueueEntry |
read(java.lang.String key,
int wait,
java.lang.String searchType)
Reads an entry from the data queue and removes it from the queue. |
java.lang.String |
toString()
Returns the String representation of this keyed data queue object. |
void |
write(byte[] key,
byte[] data)
Writes an entry to the data queue. |
void |
write(java.lang.String key,
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 |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
KeyedDataQueue
public KeyedDataQueue()
- Constructs a KeyedDataQueue object. The system and path properties will need to be set before using any method requiring a connection to the AS/400.
KeyedDataQueue
public KeyedDataQueue(AS400 system,
java.lang.String path)
- Constructs a KeyedDataQueue object. Depending on how the AS400 object was constructed, the user may need to be prompted for the system name, user ID, or password when any method requiring a connection to the AS/400 is done.
- Parameters:
system
- The AS/400 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.
clear
public void clear(byte[] key)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Removes all entries that match the key from the data queue.
- Parameters:
key
- The key with which data queue entries will be compared. All entries whose key is equal to this parameter will be removed from the queue.- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
clear
public void clear(java.lang.String key)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Removes all entries that match the key from the data queue.
- Parameters:
key
- The key with which data queue entries will be compared. All entries whose key is equal to this parameter will be removed from the queue.- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.
create
public void create(int keyLength,
int maxEntryLength)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
java.lang.InterruptedException,
ObjectAlreadyExistsException,
ObjectDoesNotExistException
- Creates a keyed data queue on the AS/400. The queue will be created with the following attributes: authority = *LIBCRTAUT, saveSenderInformation = false, forceToAuxiliaryStorage = false, description = (50 blanks).
- Parameters:
keyLength
- The number of bytes per data queue key. Valid values are 1-256.entryLength
- The maximum number of bytes per data queue entry. Valid values are 1-64512.- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectAlreadyExistsException - If the AS/400 object already exists.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
create
public void create(int keyLength,
int maxEntryLength,
java.lang.String authority,
boolean saveSenderInformation,
boolean forceToAuxiliaryStorage,
java.lang.String description)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
java.lang.InterruptedException,
ObjectAlreadyExistsException,
ObjectDoesNotExistException
- Creates a keyed data queue on the AS/400.
- Parameters:
keyLength
- The number of bytes per data queue key. Valid values are 1-256.entryLength
- 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
- Determines if entry origin information will be saved.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.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectAlreadyExistsException - If the AS/400 object already exists.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
getKeyLength
public int getKeyLength()
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Returns the length of the keys (in bytes) on this queue.
- Returns:
- The length of the keys.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- ServerStartupException - If the AS/400 server cannot be started.
- java.net.UnknownHostException - If the AS/400 system cannot be located.
peek
public KeyedDataQueueEntry peek(byte[] key)
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 there are none on the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The array that contains the key used to search for an entry. An entry must have a key equal to this value to be read.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
peek
public KeyedDataQueueEntry peek(byte[] key,
int wait,
java.lang.String searchType)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Reads an entry from the data queue without removing it from the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The array that contains the key used to search for an entry.wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available.searchType
- The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal).- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
peek
public KeyedDataQueueEntry peek(java.lang.String key)
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 there are none on the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The string that contains the key used to search for an entry. An entry must have a key equal to this value to be read.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.
peek
public KeyedDataQueueEntry peek(java.lang.String key,
int wait,
java.lang.String searchType)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Reads an entry from the data queue without removing it from the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The string that contains the key used to search for an entry.wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) means to wait until an entry is available.searchType
- The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal).- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.
read
public KeyedDataQueueEntry read(byte[] key)
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 there are none on the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The array that contains the key used to search for an entry. An entry must have a key equal to this value to be read.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
read
public KeyedDataQueueEntry read(byte[] key,
int wait,
java.lang.String searchType)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Reads an entry from the data queue and removes it from the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The array that contains the key used to search for an entry.wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available.searchType
- The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal).- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
read
public KeyedDataQueueEntry read(java.lang.String key)
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 there are none on the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The string that contains the key used to search for an entry. An entry must have a key equal to this value to be read.- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.
read
public KeyedDataQueueEntry read(java.lang.String key,
int wait,
java.lang.String searchType)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Reads an entry from the data queue and removes it from the queue. An exception is thrown when running to a pre-V4R5 server if the maximum length of a message on the queue is greater than 31744 bytes.
- Parameters:
key
- The string that contains the key used to search for an entry.wait
- The number of seconds to wait if the queue contains no entries. Negative one (-1) indicates to wait until an entry is available.searchType
- The type of comparison to use to determine if a key is a match. Valid values are EQ (equal), NE (not equal), LT (less than), LE (less than or equal), GT (greater than), and GE (greater than or equal).- Returns:
- The entry read from the queue. If no entries were available, null is returned.
- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.
toString
public java.lang.String toString()
- Returns the String representation of this keyed data queue object.
- Overrides:
- toString in class BaseDataQueue
- Returns:
- The String representation of this keyed data queue object.
write
public void write(byte[] key,
byte[] data)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Writes an entry to the data queue.
- Parameters:
key
- The array that contains the key for this entry.data
- The array of bytes to write to the queue.- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
write
public void write(java.lang.String key,
java.lang.String data)
throws AS400SecurityException,
ErrorCompletingRequestException,
java.io.IOException,
IllegalObjectTypeException,
java.lang.InterruptedException,
ObjectDoesNotExistException
- Writes a string entry to the data queue.
- Parameters:
key
- The string that contains the key for this entry.data
- The string to write to the queue.- Throws:
- AS400SecurityException - If a security or authority error occurs.
- ConnectionDroppedException - If the connection is dropped unexpectedly.
- ErrorCompletingRequestException - If an error occurs before the request is completed.
- java.io.IOException - If an error occurs while communicating with the AS/400.
- IllegalObjectTypeException - If the AS/400 object is not the required type.
- java.lang.InterruptedException - If this thread is interrupted.
- ObjectDoesNotExistException - If the AS/400 object does not exist.
- java.io.UnsupportedEncodingException - If the ccsid is not supported.