Websphere MQ Everyplace

com.ibm.mqe
Class MQe

java.lang.Object
  |
  +--com.ibm.mqe.MQe
All Implemented Interfaces:
MQeExceptionCodes
Direct Known Subclasses:
AdminModel, ExampleBase, MQeAdapter, MQeAttribute, MQeAuthenticator, MQeChannelListener, MQeChannelManager, MQeChannelTimer, MQeClient, MQeCompressor, MQeCryptor, MQeEnumeration, MQeFields, MQeGenDH, MQeKey, MQeLocalSecure, MQePrivateClient, MQePrivateServer, MQeQueueManager, MQeQueueManagerUtils, MQeRegistry, MQeRule, MQeServer

public class MQe
extends java.lang.Object
implements MQeExceptionCodes

The base class from which most of the other MQe classes inherit.

It contains various useful symbolic constant definitions and utility methods to assist with the programming of MQe.

Under normal circumstances application classes may find it useful to inherit from this class.

In previous releases of the product, many MQe_Adapter_* constants were defined in this class. These have been move to the MQeAdapter class.


Field Summary
static java.lang.String Admin_Queue_Name
          The default name given to the administration queue on a queue manager.
static java.lang.String Admin_Reply_Queue_Name
          The default name given to a local queue to which replies from admin messages can be sent to.
static java.lang.String copyright
          The copyright statement under which all MQe classes are protected.
static java.lang.String DeadLetter_Queue_Name
          The default name given to a local queue on which undeliverable messages can be deposited.
static int Event_Activate
           
static int Event_Attribute
           
static int Event_Authenticate
           
static int Event_Close
           
static int Event_Logoff
           
static int Event_Logon
           
static int Event_MiniCert_Validate
           
static int Event_Queue
           
static int Event_QueueManager
           
static int Event_UserBase
           
static java.lang.String JMS_Version
          A value indicating that an MQeMsgObject is wrapping a JMS message.
static java.lang.String MQ_Headers
          This is an array of Bytes field.
static byte MQe_Log_Audit_Failure
           
static byte MQe_Log_Audit_Success
           
static byte MQe_Log_Error
           
static byte MQe_Log_Information
           
static byte MQe_Log_Success
           
static byte MQe_Log_Warning
           
static java.lang.String Msg_BackoutCount
          The name of the field containing a backout count.
static java.lang.String Msg_CorrelID
          The name of the field in a message used to contain a correlation identifier.
static java.lang.String Msg_ExpireTime
          The name of a field in a message which indicates when the message should expire.
static java.lang.String Msg_LockID
          The name used to hold a long key value.
static java.lang.String Msg_MsgID
          The name of the field in a message used to contain a message identifier.
static java.lang.String Msg_OriginQMgr
          The name of the field in a message which contains the name of the MQe queue manager from which a message was originally put.
static java.lang.String Msg_Priority
          The name of the byte field in a message which contains the priority of the message.
static java.lang.String Msg_ReplyToQ
          The name of the Ascii field which is often used to indicate which queue a reply message should be sent.
static java.lang.String Msg_ReplyToQMgr
          The name of the Ascii field which is often used to indicate which queue manager a reply message should be sent.
static java.lang.String Msg_Resend
          The name of a boolean field which is used to indicate that a message is being re-sent.
static java.lang.String Msg_Style
          The name of an int field which is used to indicate the style of a message.
static int Msg_Style_Datagram
          A value which may be placed in the Msg_Style field of a message.
static int Msg_Style_Reply
          A value which may be placed in the Msg_Style field of a message.
static int Msg_Style_Request
          A value which may be placed in the Msg_Style field of a message.
static java.lang.String Msg_Time
          The name of a long field used in every MQe message.
static java.lang.String Msg_WrapMsg
          The name of a byte array field which is used to hold the wrapped message.
static java.lang.String sccsid
          Holds a string indicating the exact build level from which this class was taken.
static java.lang.String System_Default_Queue_Name
          The name of a local queue which is often created on a queue manager.
static short[] version
          Holds an array of short values indicating the version of the MQe product being used.
 
Fields inherited from interface com.ibm.mqe.MQeExceptionCodes
Except_Active, Except_AdapterException, Except_AdapterMissingRemoteAddress, Except_Admin_ActionNotSupported, Except_Admin_InvalidField, Except_Admin_NotAdminMsg, Except_AdminAction, Except_Authenticate, Except_BadRequest, Except_BridgeListener, Except_Chnl_Attributes, Except_Chnl_ID, Except_Chnl_Limit, Except_Chnl_Overrun, Except_Closed, Except_Con_AdapterRequired, Except_Con_AliasAlreadyExists, Except_Con_AlreadyExists, Except_Con_InvalidName, Except_Connect_Failure, Except_ConnectonType, Except_Cryptor, Except_Data, Except_Duplicate, Except_JmxProperties, Except_Listener, Except_MessageStore, Except_MiniCertReg_ActivateFailed, Except_MiniCertReg_BadPIN, Except_MiniCertReg_NotOpen, Except_NotActive, Except_NotAllowed, Except_NotFound, Except_NotSupported, Except_PrivateReg_ActivateFailed, Except_PrivateReg_BadPIN, Except_PrivateReg_NotOpen, Except_PublicReg_ActivateFailed, Except_PublicReg_InvalidAddress, Except_PublicReg_InvalidRequest, Except_Q_Full, Except_Q_InvalidName, Except_Q_InvalidPriority, Except_Q_MsgTooLarge, Except_Q_NoMatchingMsg, Except_Q_TargetRegistryRequired, Except_QMgr_Activated, Except_QMgr_AlreadyExists, Except_QMgr_InvalidQMgrName, Except_QMgr_InvalidQName, Except_QMgr_NotActive, Except_QMgr_NotBridgeEnabled, Except_QMgr_NotConfigured, Except_QMgr_QDoesNotExist, Except_QMgr_QExists, Except_QMgr_QNotEmpty, Except_QMgr_RegistryDataVersion, Except_QMgr_UnknownQMgr, Except_QMgr_WrongQType, Except_Reg_AddFailed, Except_Reg_AlreadyExists, Except_Reg_AlreadyOpen, Except_Reg_CRTKeyDecFailed, Except_Reg_CRTKeySignFailed, Except_Reg_DeleteFailed, Except_Reg_DeleteRegistryFailed, Except_Reg_DoesNotExist, Except_Reg_InvalidSession, Except_Reg_ListFailed, Except_Reg_NotDefined, Except_Reg_NotSecure, Except_Reg_NullName, Except_Reg_OpenFailed, Except_Reg_ReadFailed, Except_Reg_RenameFailed, Except_Reg_ResetPINFailed, Except_Reg_SearchFailed, Except_Reg_UpdateFailed, Except_RemoteException, Except_Rule, Except_S_BadIntegrity, Except_S_BadSubject, Except_S_CertificateExpired, Except_S_Cipher, Except_S_InvalidAttribute, Except_S_InvalidSignature, Except_S_MiniCertNotAvailable, Except_S_MissingSection, Except_S_NoPresetKeyAvailable, Except_S_RegistryNotAvailable, Except_Stopped, Except_Syntax, Except_TimeOut, Except_Transporter, Except_TriggerTransmission, Except_Trnsport_QMgr, Except_Trnsport_Request, Except_Type, Except_UdpipAdapterStateException, Except_UdpipAdapterTimeOut, Except_UdpipAdapterUnableToConfirmSuccess, Except_UnCoded, Except_Uncontactable_DontTransmit
 
Constructor Summary
MQe()
          Constructs an MQe object.
 
Method Summary
static java.lang.String abbreviate(java.lang.String className, int index)
          Resolves an abbreviated class name, or abbreviates a class name.
static void alias(java.lang.String from, java.lang.String to)
          To add or remove a class alias from a static table held within MQe.
static byte[] asciiToByte(java.lang.String data)
          To convert an String containing Ascii invariant characters to a byte array, preserving only the low byte of each character.
static java.lang.String byteToAscii(byte[] data)
          To convert a byte array to an Ascii string.
static java.lang.String byteToHex(byte[] data)
          Converts a byte array to a String containing the character Hex representation of the data.
static java.lang.String byteToHex(byte[] data, int offset, int count)
          Converts selected elements of a byte array to a String containing the character Hex representation of the data.
static int byteToInt(byte[] data, int offset)
          Converts four selected consecutive elements of a byte array to a integer value.
static long byteToLong(byte[] data, int offset)
          Converts eight selected consecutive elements of a byte array to a long value.
static short byteToShort(byte[] data, int offset)
          Convert two selected consecutive elements of a byte array to a short integer value.
static java.lang.String byteToUnicode(byte[] data)
          To convert an entire byte array to a Unicode string.
static java.lang.String fileSeparator()
          String to get file separator from System, rather than using File
static MQeEventLogInterface getEventLogHandler()
          To get the MQe Event Log handler object which was previously set using the setEventLogHandler method.
static java.lang.String hexToAscii(java.lang.String data)
          Converts a character hex array to an ascii String.
static byte[] hexToByte(java.lang.String data)
          Converts a character hex array to bytes.
static byte[] intToByte(int data)
          Converts an integer value to 4 bytes of a byte array.
static boolean isCLDC()
          Used to determine if JVM is CLDC compliant.
static java.lang.Class loadClass(java.lang.String className, boolean resolve)
          Return an instance of class Class representing the named class.
static java.lang.Object loadObject(java.lang.String className)
          Load and return an instance of the named class.
static void log(byte logType, int logNumber, java.lang.Object logData)
          Write to the registered event log handler.
static MQeEventLogInterface setEventLogHandler(MQeEventLogInterface logObj)
          Set MQe an Event Log handler object.
static MQeLoader setLoader(MQeLoader newLoader)
          Allows a solution to plug-in their own loader.
static byte[] sliceByteArray(byte[] data, int offset, int length)
          Subset of a byte array.
 java.lang.String type()
          Return the string name of the object.
static byte[] unicodeToByte(java.lang.String data)
          Converts an Unicode string to a byte array.
static long uniqueValue()
          Generate a long value which is unique within the current JVM.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static final java.lang.String copyright
The copyright statement under which all MQe classes are protected.

See Also:
Constant Field Values
Example:
 MQe myMQe = new MQe();
 
 System.out.println("MQe class is protected by this copyright statement: " + myMQe.copyright);
 
 

sccsid

public static final java.lang.String sccsid
Holds a string indicating the exact build level from which this class was taken.

This information can be used by user programs to identify the exact version of MQe in use within the solution programmatically.

See Also:
Constant Field Values
Example:
 MQe myMQe = new MQe();
 
 System.out.println("MQe class identification information : " + myMQe.sccsid);
 
 

version

public static short[] version
Holds an array of short values indicating the version of the MQe product being used.

This allows programmers to output information on the version of MQe being used in about panels, diagnostics material and other places.

Example:
 MQe myMQe = new MQe();
 short version[] = myMQe.version;
 
 String versionString = Short.toString(version[0]);
 
 for (int i = 1; i < version.length; i += 1) {
     versionString = versionString + "." + Short.toString(version[i]);
 }
 
 // versionString is now in format "x.x.x.x"
 
 

Msg_CorrelID

public static final java.lang.String Msg_CorrelID
The name of the field in a message used to contain a correlation identifier.

The field should be of type ArrayOfByte.

If the application uses this field as a filter on a queue, the filter operation may run faster than if an arbitrary named filter field is used.

See Also:
Constant Field Values
Example:
 // Create an MQeFields object we can use as a filter.
 MQeFields myFilter = new MQeFields();
 
 String myString = new String("012345");
 
 // Put the correlation identifier we want to filter on into a byte array.
 byte[] correlID = myString.getBytes();
 
 // Put the correlation identifier into the filter
 myFilter.putArrayOfByte(com.ibm.mqe.MQe.Msg_CorrelID, correlID);
 
 // Get a message which matches my filter.
 // ie: Any message with 012345 in the correl id field.
 MQeMsgObject msgReceived = myQueueManager.getMessage(
         "MsgSourceQMgr", "MsgSourceQ", myFilter, null     // No compression, encryption or authentication attributes on the queue.
         , 0        // Not going to confirm the get later.
     );
 
 

Msg_MsgID

public static final java.lang.String Msg_MsgID
The name of the field in a message used to contain a message identifier.

The field should be of type ArrayOfByte.

If the application uses this field as a filter on a queue, the filter operation may run faster than if an arbitrary named filter field is used.

See Also:
Constant Field Values
Example:
 // Create an MQeFields object we can use as a filter.
 MQeFields myFilter = new MQeFields();
 
 String myString = new String("012345");
 
 // Put the message identifier we want to filter on into a byte array.
 byte[] msgID = myString.getBytes();
 
 // Put the message identifier into the filter
 myFilter.putArrayOfByte(com.ibm.mqe.MQe.Msg_MsgID, msgID);
 
 // Get a message which matches my filter.
 // ie: Any message with 012345 in the message id field.
 MQeMsgObject msgReceived = myQueueManager.getMessage(
         "MsgSourceQMgr", "MsgSourceQ", myFilter, null     // No compression, encryption or authentication attributes on the queue.
         , 0        // Not going to confirm the get later.
     );
 
 

Msg_OriginQMgr

public static final java.lang.String Msg_OriginQMgr
The name of the field in a message which contains the name of the MQe queue manager from which a message was originally put.

The type of the field is an ASCII field.

User applications should not attempt to set this field or manipulate it in any way, though it will be available to read once a message has arrived on a queue.

The field is added to a message by the putMessage method.

To remove this field from a message object, use the com.ibm.mqe.MQeMsgObject.resetUIDFields method.

See Also:
MQeMsgObject.resetMsgUIDFields(), Constant Field Values
Example:
 // Get a message which matches any filter.
 MQeMsgObject msgReceived = myQueueManager.getMessage(
         "MsgSourceQMgr", "MsgSourceQ", null     // No filter
         , null     // No compression, encryption or authentication attributes on the queue.
         , 0        // Not going to confirm the get later.
     );
 
 // Find out who sent the message.
 String messageOrigin = msgReceived.getAscii(MQe.Msg_OriginQMgr);
 
 

Msg_Priority

public static final java.lang.String Msg_Priority
The name of the byte field in a message which contains the priority of the message.

The type of the field is a byte field.

Valid range 0 to 9. 0 being the lowest priority, 9 being the highest priority.

Messages with a higher priority may, though will not always, be delived to a target queue before some lower priority messages, even if posted after such lower-priority messages.

See Also:
Constant Field Values
Example:
 byte priority = 9; // Highest priority of a message
 MQeMsgObject msg = new MQeMsgObject();
 
 msg.putByte(MQe.Msg_Priority, priority);
 // The message will now travel as fast as it can over the network
 
 

Msg_Time

public static final java.lang.String Msg_Time
The name of a long field used in every MQe message.

The field referred to by this name holds a long millisecond timestamp taken at the time the message is created. Milliseconds elapsed since midnight, January 1, 1970 UTC.

Applications should never attempt to modify or put a field using this field name into a message, though they may read the data using the getLong method.

The timestamp inside the message cannot be removed unless the MQeMsgObject.resetMsgUIDFields method is used.

See Also:
MQeMsgObject.resetMsgUIDFields(), Constant Field Values
Example:
 // Create a new message.
 MQeMsgObject msg = new MQeMsgObject();
 
 // Extract the time the message was created.
 long timeOfCreation = msg.getLong(MQe.Msg_Time);
 
 

Msg_ReplyToQ

public static final java.lang.String Msg_ReplyToQ
The name of the Ascii field which is often used to indicate which queue a reply message should be sent.

The field is an Ascii field. If used, it should contain the name of an MQe queue. This field is used by administration messages, to inform the admnistration queue processing the message where replies should be sent.

Often used in conjunction with the MQe.Msg_ReplyToQMgr field.

See Also:
Msg_ReplyToQMgr, Constant Field Values
Example:
 // Create a new administration message to create a local queue
 MQeQueueAdminMsg msg = new MQeQueueAdminMsg();
 
 // Set the reply-to queue name in the administration message to
 // the normal place to which replies are sent.
 msg.putAscii(MQe.Msg_ReplyToQ, MQe.Admin_Reply_Queue_Name);
 
 // Set the reply-to queue manager name in the administration message
 // to indicate which queue manager the reply should be sent to.
 msg.putAscii(MQe.Msg_ReplyToQMgr, "MyQMgr");
 
 

Msg_ReplyToQMgr

public static final java.lang.String Msg_ReplyToQMgr
The name of the Ascii field which is often used to indicate which queue manager a reply message should be sent.

The field is an Ascii field. If used, it should contain the name of an MQe queue manager. This field is used by administration messages, to inform the admnistration queue processing the message where replies should be sent.

Often used in conjunction with the MQe.Msg_ReplyToQ field.

See Also:
Msg_ReplyToQ, Constant Field Values
Example:
 // Create a new administration message to create a local queue
 MQeQueueAdminMsg msg = new MQeQueueAdminMsg();
 
 // Set the reply-to queue name in the administration message to
 // the normal place to which replies are sent.
 msg.putAscii(MQe.Msg_ReplyToQ, MQe.Admin_Reply_Queue_Name);
 
 // Set the reply-to queue manager name in the administration message
 // to indicate which queue manager the reply should be sent to.
 msg.putAscii(MQe.Msg_ReplyToQMgr, "MyQMgr");
 
 

Msg_Style

public static final java.lang.String Msg_Style
The name of an int field which is used to indicate the style of a message.

Allowable values in the Msg_Style field are:

MQe.Msg_Style_Datagram
A command not requiring a reply.
MQe.Msg_Style_Request
A request that would like a reply.
MQe.Msg_Style_Reply
A reply to a request.

See Also:
Msg_Style_Datagram, Msg_Style_Request, Msg_Style_Reply, Constant Field Values
Example:
 // Create a new administration message to create a local queue
 MQeQueueAdminMsg msg = new MQeQueueAdminMsg();
 
 // Indicate that this message requires a response.
 msg.putInt(MQe.Msg_Style, MQe.Msg_Style_Request);
 
 

Msg_LockID

public static final java.lang.String Msg_LockID

The name used to hold a long key value. The key is necessary to unlock a message.

See Also:
Constant Field Values

Msg_Resend

public static final java.lang.String Msg_Resend
The name of a boolean field which is used to indicate that a message is being re-sent.

If the WebSphere MQ Everyplace application retransmits the message, it should also inform the target queue manager that this is happening. The target queue manager deletes any duplicate copy of the message that it already has. The application sets the MQe.Msg_Resend field to do this.

See Also:
Constant Field Values
Example:
 // Create a message to send.
 MQeMsgObject msg = new MQeMsgObject();
 
 // ... pack the message with data...
 
 // ... attempt to put the message...
 
 // ... attempt to put the message failed...
 
 // Mark the message as a retry before sending it again.
 msg.putBoolean(MQe.Msg_Resend, true);
 
 // ... attempt to put the message again...
 
 
 

Msg_ExpireTime

public static final java.lang.String Msg_ExpireTime

The name of a field in a message which indicates when the message should expire.

This field is optional in a message. If missing, then an expiry time attribute of a queue may cause a message to be expired.

Expired messages are removed from the system.

This field has two forms, depending on the type of the information put into the message with this name.

If the field is an Integer field, then the value represents the number of milliseconds after the message creation time at which the message will expire. A special value of 0 or less indicates that the message will never expire. The Msg_Time field holds the time the message was created.

If the field is a Long field, then the value represents the exact time after which the message will expire. This is expressed in milliseconds since midnight, January 1, 1970 UTC. A special value of 0L indicates that the message will never expire.

See Also:
MQeMsgObject, Constant Field Values

Msg_WrapMsg

public static final java.lang.String Msg_WrapMsg

The name of a byte array field which is used to hold the wrapped message. Wrapped message is to ensure data protection.

See Also:
Constant Field Values

Msg_BackoutCount

public static final java.lang.String Msg_BackoutCount
The name of the field containing a backout count. This field is added to an MQeMsgObject when an assured get is undone, and is incremented each time a subsequent assured get is undone. Note that it is not present in a message that has never been backed out.

See Also:
Constant Field Values

JMS_Version

public static final java.lang.String JMS_Version
A value indicating that an MQeMsgObject is wrapping a JMS message. See the JMS chapter of the WebSphere MQ Everyplace application programming guide for details

See Also:
Constant Field Values

Msg_Style_Datagram

public static final int Msg_Style_Datagram
A value which may be placed in the Msg_Style field of a message.

Use this value to indicate that the message contains a command not requiring a reply.

See Also:
Msg_Style, Constant Field Values

Msg_Style_Request

public static final int Msg_Style_Request
A value which may be placed in the Msg_Style field of a message.

Use this value to indicate that the message contains a command which requires a reply.

See Also:
Msg_Style, Constant Field Values
Example:
 // Create a new administration message to create a local queue
 MQeQueueAdminMsg msg = new MQeQueueAdminMsg();
 
 // Indicate that this message requires a response.
 msg.putInt(MQe.Msg_Style, MQe.Msg_Style_Request);
 
 

Msg_Style_Reply

public static final int Msg_Style_Reply
A value which may be placed in the Msg_Style field of a message.

Use this value to indicate that the message contains a reply to a previous command.

See Also:
Msg_Style, Constant Field Values

Admin_Queue_Name

public static final java.lang.String Admin_Queue_Name
The default name given to the administration queue on a queue manager.

See Also:
Constant Field Values

Admin_Reply_Queue_Name

public static final java.lang.String Admin_Reply_Queue_Name
The default name given to a local queue to which replies from admin messages can be sent to.

When administration messages are sent to a queue manager, a reply queue and queue manager name are specified. This queue and queue manager name is the target location to which a response to the administration message is sent.

Often the queue to which such responses are sent is one with a name matching the value of this constant ("AdminReplyQ").

See Also:
Constant Field Values
Example:
 // Create a new administration message to create a local queue
 MQeQueueAdminMsg msg = new MQeQueueAdminMsg();
 
 // Set the reply-to queue name in the administration message to
 // the normal place to which replies are sent.
 msg.putAscii(MQe.Msg_ReplyToQ, MQe.Admin_Reply_Queue_Name);
 
 // Set the reply-to queue manager name in the administration message
 // to indicate which queue manager the reply should be sent to.
 msg.putAscii(MQe.Msg_ReplyToQMgr, "MyQMgr");
 
 

DeadLetter_Queue_Name

public static final java.lang.String DeadLetter_Queue_Name
The default name given to a local queue on which undeliverable messages can be deposited.

See Also:
Constant Field Values

System_Default_Queue_Name

public static final java.lang.String System_Default_Queue_Name
The name of a local queue which is often created on a queue manager.

The queue with this name is often used by systems administrators to put test messages to, to verify that the transmission and routing paths between queue managers is configured correctly, and working.

See Also:
Constant Field Values

MQe_Log_Success

public static final byte MQe_Log_Success
See Also:
Constant Field Values

MQe_Log_Error

public static final byte MQe_Log_Error
See Also:
Constant Field Values

MQe_Log_Warning

public static final byte MQe_Log_Warning
See Also:
Constant Field Values

MQe_Log_Information

public static final byte MQe_Log_Information
See Also:
Constant Field Values

MQe_Log_Audit_Success

public static final byte MQe_Log_Audit_Success
See Also:
Constant Field Values

MQe_Log_Audit_Failure

public static final byte MQe_Log_Audit_Failure
See Also:
Constant Field Values

Event_Activate

public static final int Event_Activate
See Also:
Constant Field Values

Event_Close

public static final int Event_Close
See Also:
Constant Field Values

Event_Logon

public static final int Event_Logon
See Also:
Constant Field Values

Event_Logoff

public static final int Event_Logoff
See Also:
Constant Field Values

Event_QueueManager

public static final int Event_QueueManager
See Also:
Constant Field Values

Event_Queue

public static final int Event_Queue
See Also:
Constant Field Values

Event_Attribute

public static final int Event_Attribute
See Also:
Constant Field Values

Event_Authenticate

public static final int Event_Authenticate
See Also:
Constant Field Values

Event_MiniCert_Validate

public static final int Event_MiniCert_Validate
See Also:
Constant Field Values

Event_UserBase

public static final int Event_UserBase
See Also:
Constant Field Values

MQ_Headers

public static final java.lang.String MQ_Headers

This is an array of Bytes field. This is used to hold various MQ headers (RFH) present in the message.

See Also:
Constant Field Values
Constructor Detail

MQe

public MQe()
Constructs an MQe object.

Example:
 import com.ibm.mqe.MQe;
 
 MQe myMQeInstance = new com.ibm.mqe.MQe();
 
 
Method Detail

isCLDC

public static final boolean isCLDC()
Used to determine if JVM is CLDC compliant.

Returns:
true for a CLDC system, false otherwise

fileSeparator

public static final java.lang.String fileSeparator()
String to get file separator from System, rather than using File

Returns:
A file separator (\\, /, etc) for use on the current system

abbreviate

public static java.lang.String abbreviate(java.lang.String className,
                                          int index)
Resolves an abbreviated class name, or abbreviates a class name.

An abbreviated class name is of the form "n:" where n is an number representing an MQe class name.

For example, "6:" would resolve to "com.ibm.mqe.MQeTransporter".

For example, "com.ibm.mqe.MQeTransporter" would resolve to "6:".

Parameters:
className - A String containg the search name to be resolved into an abbreviated form, or to be un-resolved from an abbreviated for. Whether it is resolved to or from an abbreviated form is dictated by the value of the index parameter.
index - An integer indicating the action to perform.
<=0
turn the abbreviated name into a fully qualified class name.
>=1
turn the fully qualified class name into an abbreviated form if possible.
Returns:
A string that is either a fully qualified class name, or an abbreviated form, dependent on the action selected by the index parameter. Will equal the className passed as a parameter if no abbreviate or un-abbreviate action could be performed.
Example:
 // Find the abbreviation of the MQe transporter class
 String abbreviatedClassName = MQe.abbreviate("com.ibm.mqe.MQeTransporter", 1);
 
 // Will return the string value "6:"
 
 System.out.println("abbreviation of com.ibm.mqe.MQeTransporter is " + abbreviatedClassName);
 // Will print the string "abbreviation of com.ibm.mqe.MQeTransporter is 6:"
 
 // Convert the abbreviated form of the class name into the full name again.
 String originalClassName = MQe.abbreviate(abbreviatedClassName, 0);
 
 // Will return the string value "com.ibm.mqe.MQeTransporter"
 
 System.out.println("unabbreviation of " + abbreviatedClassName + " is " + originalClassName);
 // Will print the string "unabbreviation of 6: is com.ibm.mqe.MQeTransporter
 
 
 

alias

public static void alias(java.lang.String from,
                         java.lang.String to)
                  throws java.lang.Exception
To add or remove a class alias from a static table held within MQe.

An alias is a syntactic mapping from one string to another. Use this method to add a mapping to the table held within MQe, or remove a mapping which already exists.

This mechanism is sometimes used in MQe to map from an abstract name of a java class, to the fully specified class name.

Adding an alias which already exists in the alias table causes its' value to be replaced with the new one specified.

By default, some pre-defined aliases are provided. We recommend you do not remove these from the alias table, or over-write the values they map to.

The pre-defined aliases are :

  • "DefaultChannel" is an alias of the default channel class name.
  • "Network" is an alias of the class implementing the HTTP protocol over TCP/IP
  • "FastNetwork" is an alias of a class implementing an encoded form of TCP/IP traffic, aiming to reduce duplicate data sent over the connection.
  • "DefaultTransporter" is an alias of a class used to control the transportation of data over the channel.
  • "ChannelAttrRules" is an alias for the default channel attribute rule.
  • "MsgLog" is an alias for the default adapter which stores data to persistent store.
  • "QueueManager" is an alias for the queue manager class if it is going to be dynamically loaded.
  • "FileRegistry" is an alias for the class used to manage a non-private registry.
  • "PrivateRegistry" is an alias for the class used to manage a private registry.
  • "RegistryAdapter" is an alias for the class used by the registry in which configuration information is stored.

    Parameters:
    from - The name of the string which is to be mapped to another string, or removed from the MQe table of aliases. This can be thought of as the 'alias' of the string passed on the 'to' parameter. A null pointer exception will result if this value is null.
    to - The name to which the 'from' string will be mapped. If you specify null, then the 'from' string will be removed from the alias mapping table.
    Throws:
    java.lang.Exception - Doesn't throw anything
    Example:
     // Add an alias such that the text "mypackage.mysubpackage.MyClass" can be referred
     // to by the text string "MyClass"
     myMQe.alias("MyClass", "mypackage.mysubpackage.MyClass");
     
     //  Remove the alias
     myMQe.alias("MyClass", null);
     
     

  • asciiToByte

    public static byte[] asciiToByte(java.lang.String data)
    To convert an String containing Ascii invariant characters to a byte array, preserving only the low byte of each character.

    Parameters:
    data - A Unicode string, where each characgter in that string is an invariant Ascii character. The most significant 8 bits of the 16 bits of the character code is discarded during the conversion performed by this method.
    Returns:
    A byte array containing ascii data. null is returned if data is null.
    Example:
     byte data[] = MQe.asciiToByte("A piece of test data");
     
     

    byteToAscii

    public static java.lang.String byteToAscii(byte[] data)
    To convert a byte array to an Ascii string.

    Parameters:
    data - byte array which is to be converted to an Ascii string.
    Returns:
    String representation of the byte array passed. Each character represents 1 byte of the input array, and is formed using that byte as the least-significant byte in the 2-byte unicode character value. The most significant byte of each character is set to 0x00. null is returned if data is null.
    Example:
     byte[] myData = new byte[] { 64, 65, 66, 67, 68 };
     String results = MQe.byteToAscii(myData);
     
     

    byteToHex

    public static java.lang.String byteToHex(byte[] data)
    Converts a byte array to a String containing the character Hex representation of the data.

    Each byte value is converted into 2 characters, each in the range '0' to 'F'.

    Parameters:
    data - byte array to convert to character hex
    Returns:
    String
    Example:
     // Put our example data into a byte array.
     byte[] byteData = new byte[] { 8, 9, 10, 11, 12 };
     
     // Convert the 2nd and 3rd elements to hexadecimal string.
     String hexResults = MQe.byteToHex(byteData);
     
     // Returns the string "08090A0B0C"
     
     

    byteToHex

    public static java.lang.String byteToHex(byte[] data,
                                             int offset,
                                             int count)
    Converts selected elements of a byte array to a String containing the character Hex representation of the data.

    Each byte value is converted into 2 characters, each in the range '0' to 'F'.

    Parameters:
    data - byte array to convert to character hex
    offset - integer offset into data array
    count - integer byte count of array elements to convert
    Returns:
    String
    Example:
     // Put our example data into a byte array.
     byte[] byteData = new byte[] { 8, 9, 10, 11, 12 };
     
     // Convert the 2nd and 3rd elements to hexadecimal string.
     String hexResults = MQe.byteToHex(byteData, 1, 2);
     
     // Returns the string "090A"
     
     

    byteToInt

    public static int byteToInt(byte[] data,
                                int offset)
    Converts four selected consecutive elements of a byte array to a integer value.

    Parameters:
    data - byte array containing the four bytes to convert to an integer
    offset - integer offset into data array of the first of four bytes of data used in the conversion.
    Returns:
    int
    Example:
     byte[] myByteData = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     
     // Use the bytes containing 2,3,4 and 5 into an int
     int result = MQe.byteToInt(myByteData, 2);
     
     // result is now 33752069
     
     

    byteToLong

    public static long byteToLong(byte[] data,
                                  int offset)
    Converts eight selected consecutive elements of a byte array to a long value.

    Parameters:
    data - byte array containing the eight bytes to convert to a long
    offset - integer offset into data array of the first of eight bytes of data used in the conversion.
    Returns:
    long
    Example:
     byte[] myByteData = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     
     // Use the bytes containing 1,2,3,4,5,6,7,and 8 into a long
     long result = MQe.byteToLong(myByteData, 1);
     
     // result is now 72623859790382856
     
     

    byteToShort

    public static short byteToShort(byte[] data,
                                    int offset)
    Convert two selected consecutive elements of a byte array to a short integer value.

    Parameters:
    data - byte array containing the data to convert to a short
    offset - integer offset into data array of first of two bytes of data used in the conversion.
    Returns:
    short
    Example:
     byte[] myByteData = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
     
     // Use the bytes containing 1,2,3,4,5,6,7,and 8 into a long
     long result = MQe.byteToShort(myByteData, 1);
     
     // result is now 258
     
     

    byteToUnicode

    public static java.lang.String byteToUnicode(byte[] data)
    To convert an entire byte array to a Unicode string.

    Parameters:
    data - byte array containing the data to convert to a Unicode string. Each pair of bytes in the array are used to form a Unicode character. If there are an odd number of bytes in the array, the last byte is not used.
    Returns:
    A Unicode string. Will be null if data is null.
    Example:
     byte[] myByteData = new byte[] { 0, 65, 0, 66, 0, 67, 0, 68, 0 };
     
     String result = MQe.byteToUnicode(myByteData);
     
     // result is now "ABCD"
     
     

    getEventLogHandler

    public static MQeEventLogInterface getEventLogHandler()
    To get the MQe Event Log handler object which was previously set using the setEventLogHandler method.

    See Also:
    setEventLogHandler(com.ibm.mqe.MQeEventLogInterface)

    hexToAscii

    public static java.lang.String hexToAscii(java.lang.String data)
                                       throws java.lang.Exception
    Converts a character hex array to an ascii String.

    Parameters:
    data - hex character string to convert to ascii.
    Returns:
    A String. null will be returned if null was passed as a parameter.
    Throws:
    MQeException - Except_BadRequest - The input string has an odd number of characters.
    java.lang.Exception

    hexToByte

    public static byte[] hexToByte(java.lang.String data)
                            throws java.lang.Exception
    Converts a character hex array to bytes.

    Parameters:
    data - hex character string to convert
    Returns:
    byte[] null if null is supplied as input.
    Throws:
    MQeException - Except_Syntax
    java.lang.Exception

    intToByte

    public static byte[] intToByte(int data)
    Converts an integer value to 4 bytes of a byte array.

    Parameters:
    data - int value to a byte array
    Returns:
    byte[4]

    loadClass

    public static final java.lang.Class loadClass(java.lang.String className,
                                                  boolean resolve)
                                           throws java.lang.ClassNotFoundException
    Return an instance of class Class representing the named class.

    The className must be either a valid class on the classpath, or an alias for a valid class on the classpath.

    The loader set using the setLoader method will be used to load the class.

    Throws:
    java.lang.ClassNotFoundException
    See Also:
    setLoader(com.ibm.mqe.MQeLoader)

    loadObject

    public static final java.lang.Object loadObject(java.lang.String className)
                                             throws java.lang.Exception
    Load and return an instance of the named class.

    The className must be either a valid class on the classpath, or an alias for a valid class on the classpath.

    The class specified must be loadable, and must have a default (no argument) constructor.

    The loader set using the setLoader method will be used to instantiate the object from the class name.

    Throws:
    java.lang.ClassNotFoundException
    java.lang.Exception
    See Also:
    setLoader(com.ibm.mqe.MQeLoader)

    log

    public static void log(byte logType,
                           int logNumber,
                           java.lang.Object logData)
    Write to the registered event log handler.

    This method might be useful to an application developer to post entries to the MQe event log.

    There is some example code in the examples\eventlog directory.

    MQe trace entries may also be directed to the log by changing the modifier in the examples\trace\MQeTraceResource.java file.

    Parameters:
    logType - byte value of the type of log entry (e.g. MQe_Log_SUCCESS)
    logNumber - int log entry number
    logData - Object data associated with the log entry

    setEventLogHandler

    public static MQeEventLogInterface setEventLogHandler(MQeEventLogInterface logObj)
    Set MQe an Event Log handler object.

    Parameters:
    logObj - a Log object to receive Log requests
    Returns:
    MQeEventLogInterface the previous Event Log handler object
    See Also:
    getEventLogHandler()

    setLoader

    public static final MQeLoader setLoader(MQeLoader newLoader)
    Allows a solution to plug-in their own loader.

    All MQe dynamic loads are performed by the MQe.loadObject or MQe.loadClass methods. These methods in turn call a separate class and object loader.

    The MQe class initially starts with an instance of the com.ibm.mqe.MQeLoader class being used as the provider of dynamic loading capability.

    This method allows user code to change the way in which MQe and user classes are loaded, and objects instantiated from those classes.

    For example, if the solution wishes to load classes using a different mechanism to the default java class loader, the MQeLoader class could be subclassed, and methods over-ridden to achieve the desired effect.

    All calls to the loadObject and loadClass methods after this method has been used will invoke the loadObject and loadClass methods on the loader.

    Parameters:
    newLoader - The new loader to use when loading classes dynamically, and instantiating instances of those classes. Must be derived from the com.ibm.mqe.MQeLoader class. If set to null, it will NOT clear the loader currently being used, but will return a reference to the current loader.
    Returns:
    A reference to the loader being used prior to this call.

    sliceByteArray

    public static byte[] sliceByteArray(byte[] data,
                                        int offset,
                                        int length)
    Subset of a byte array.

    Parameters:
    data - byte array to be sliced
    offset - integer offset into data array
    Returns:
    byte[]

    type

    public java.lang.String type()
    Return the string name of the object.

    Used by subclasses to obtain a potentially shortened string which represents their class name

    Returns:
    String If an abbreviation exists as one of the pre-defined class abbreviations, then the string contains an abbreviated class name, otherwise the full class name (including package details) is returned.
    See Also:
    abbreviate(java.lang.String, int)

    unicodeToByte

    public static byte[] unicodeToByte(java.lang.String data)
    Converts an Unicode string to a byte array.

    Parameters:
    data - a String to be converted to a byte array
    Returns:
    a byte array, or null if data was null.

    uniqueValue

    public static long uniqueValue()
                            throws java.lang.Exception
    Generate a long value which is unique within the current JVM.

    Using this method, you can obtain values which will be unlikely to match any other values returned to any other callers of this method.

    Amongst other things, this is often used to allocate a unique value for a request-style messages, where replies to that message carry the same id.

    The field in which the value sits can be used to efficiently filter looking for that exact reply field. For example, this technique is often used when issuing administration messages to a queue manager.

    This method is thread-safe.

    Returns:
    a long, holding the unique value allocated to the caller.
    Throws:
    java.lang.InterruptedException
    java.lang.Exception
    Example:
     long value1 = MQe.uniqueValue();
     long value2 = MQe.uniqueValue();
     
     // value1 will not be equal to value2
     
     

    Websphere MQ Everyplace