MQEnvironment



java.lang.Object
   |
   *- com.ibm.mq.MQEnvironment

public class MQEnvironment
extends Object
Note:
All the methods and attributes of this class apply to the WebSphere MQ classes for Java client connections, but only enableTracing, disableTracing, properties, and version_notice apply to bindings connections.

MQEnvironment contains static member variables that control the environment in which an MQQueueManager object (and its corresponding connection to WebSphere MQ) is constructed.

Values set in the MQEnvironment class take effect when the MQQueueManager constructor is called, so you should set the values in the MQEnvironment class before you construct an MQQueueManager instance.

Variables

Note:
Variables marked with * do not apply when connecting directly to WebSphere MQ in bindings mode.

CCSID*
public static int CCSID

The CCSID used by the client.

Changing this value affects the way that the queue manager you connect to translates information in the WebSphere MQ headers. All data in WebSphere MQ headers is drawn from the invariant part of the ASCII codeset, except for the data in the applicationIdData and the putApplicationName fields of the MQMessage class. (See MQMessage.)

If you avoid using characters from the variant part of the ASCII codeset for these two fields, you are then safe to change the CCSID from 819 to any other ASCII codeset.

If you change the client's CCSID to be the same as that of the queue manager to which you are connecting, you gain a performance benefit at the queue manager because it does not attempt to translate the message headers.

The default value is 819.

channel*
public static String channel

The name of the channel to connect to on the target queue manager. You must set this member variable, or the corresponding property, before constructing an MQQueueManager instance for use in client mode.

hostname*
public static String hostname

The TCP/IP hostname of the machine on which the WebSphere MQ server resides. If the hostname is not set, and no overriding properties are set, bindings mode is used to connect to the local queue manager.

password*
public static String password

Equivalent to the WebSphere MQ environment variable MQ_PASSWORD.

If a security exit is not defined for this client, the value of password is transmitted to the server and is available to the server security exit when it is invoked. The value may be used to verify the identity of the WebSphere MQ client.

The default value is "".

port*
public static int port

The port to connect to. This is the port on which the WebSphere MQ server is listening for incoming connection requests. The default value is 1414.

properties
public static java.util.Hashtable properties

A set of key/value pairs defining the WebSphere MQ environment.

This hash table allows you to set environment properties as key/value pairs rather than as individual variables.

The properties can also be passed as a hash table in a parameter on the MQQueueManager constructor. Properties passed on the constructor take precedence over values set with this properties variable, but they are otherwise interchangeable. The order of precedence of finding properties is:

  1. properties parameter on MQQueueManager constructor
  2. MQEnvironment.properties
  3. Other MQEnvironment variables
  4. Constant default values

The possible Key/value pairs are shown in the following table:

Key Value
MQC.CCSID_PROPERTY Integer (overrides MQEnvironment.CCSID)
MQC.CHANNEL_PROPERTY String (overrides MQEnvironment.channel)
MQC.CONNECT_OPTIONS_PROPERTY Integer, defaults to MQC.MQCNO_NONE
MQC.HOST_NAME_PROPERTY String (overrides MQEnvironment.hostname)
MQC.ORB_PROPERTY org.omg.CORBA.ORB (optional)
MQC.PASSWORD_PROPERTY String (overrides MQEnvironment.password)
MQC.PORT_PROPERTY Integer (overrides MQEnvironment.port)
MQC.RECEIVE_EXIT_PROPERTY MQReceiveExit (overrides MQEnvironment.receiveExit)
MQC.SECURITY_EXIT_PROPERTY MQSecurityExit (overrides MQEnvironment.securityExit)
MQC.SEND_EXIT_PROPERTY MQSendExit (overrides MQEnvironment.sendExit)
MQC.SSL_CERT_STORE_PROPERTY java.util.Collection, or java.security.cert.CertStore (overrides MQEnvironment.sslCertStores)
MQC.SSL_CIPHER_SUITE_PROPERTY String (overrides MQEnvironment.sslCipherSuite)
MQC.SSL_PEER_NAME_PROPERTY String (overrides MQEnvironment.sslPeerName)
MQC.SSL_SOCKET_FACTORY_PROPERTY javax.net.ssl.SSLSocketFactory (overrides MQEnvironment.sslSocketFactory)
MQC.TRANSPORT_PROPERTY MQC.TRANSPORT_MQSERIES_BINDINGS
or
MQC.TRANSPORT_MQSERIES_CLIENT
or
MQC.TRANSPORT_MQSERIES (the default,
which selects bindings or client, based on
the value of "hostname".)
MQC.USER_ID_PROPERTY String (overrides MQEnvironment.userID.)

receiveExit*
public static MQReceiveExit receiveExit

A receive exit allows you to examine, and possibly alter, data received from a queue manager. It is normally used in conjunction with a corresponding send exit at the queue manager.

To provide your own receive exit, define a class that implements the MQReceiveExit interface, and assign receiveExit to an instance of that class. Otherwise, you can leave receiveExit set to null, in which case no receive exit will be called.

See also MQReceiveExit.

securityExit*
public static MQSecurityExit securityExit

A security exit allows you to customize the security flows that occur when an attempt is made to connect to a queue manager.

To provide your own security exit, define a class that implements the MQSecurityExit interface, and assign securityExit to an instance of that class. Otherwise, you can leave securityExit set to null, in which case no security exit will be called.

See also MQSecurityExit.

sendExit*
public static MQSendExit sendExit

A send exit allows you to examine, and possibly alter, the data sent to a queue manager. It is normally used in conjunction with a corresponding receive exit at the queue manager.

To provide your own send exit, define a class that implements the MQSendExit interface, and assign sendExit to an instance of that class. Otherwise, you can leave sendExit set to null, in which case no send exit will be called.

See also MQSendExit.

sslCertStores*
public static java.util.Collection sslCertStores

A Collection of CertStore objects used for certificate revocation checking. Use of this variable requires a JVM at Java 2 v1.4 or later. If sslCipherSuite is set, this variable can be used to ensure that the queue manager's certificate has not become revoked. Each CertStore in the Collection represents an identical copy of the certificate revocation list (CRL). For more information on the behaviour of sslCertStores, refer to Using certificate revocation lists. If set to null (default), the certificate presented by the queue manager is not checked against any certificate revocation list. This variable is ignored if sslCipherSuite is null.

sslCipherSuite*
public static String sslCipherSuite

If set, SSL is enabled for the connection. The sslCipherSuite should be set to the CipherSuite name matching the CipherSpec set on the SVRCONN channel. If set to null (default), no SSL encryption is performed.

sslPeerName*
public static String sslPeerName

A distinguished name pattern. If sslCipherSuite is set, this variable can be used to ensure the correct queue manager is used. For a description of the format for this value, see Using the distinguished name of the queue manager. If set to null (default), no checking of the queue manager's DN is performed. This variable is ignored if sslCipherSuite is null.

sslSocketFactory*
public static javax.net.ssl.SSLSocketFactory sslSocketFactory

The factory to use when connecting with SSL encryption. If sslCipherSuite is set, this variable can be used to customize all aspects of the SSL connection. For more information on constructing and customizing SSLSocketFactory instances, refer to your JSSE provider; for information regarding the use of this variable, refer to Supplying a customized SSLSocketFactory. If set to null (default) and SSL encryption is requested, the default SSLSocketFactory is used. This variable is ignored if sslCipherSuite is null.

userID*
public static String userID

Equivalent to the WebSphere MQ environment variable MQ_USER_ID.

If a security exit is not defined for this client, the value of userID is transmitted to the server and will be available to the server security exit when it is invoked. The value may be used to verify the identity of the WebSphere MQ client.

The default value is "".

version_notice
public final static String version_notice

The current version of WebSphere MQ classes for Java.

Constructors

MQEnvironment
public MQEnvironment()

Methods

addConnectionPoolToken
public static void addConnectionPoolToken(MQPoolToken token)

Adds the supplied MQPoolToken to the set of tokens. A default ConnectionManager can use this as a hint; typically, it are enabled only while there is at least one token in the set.

Parameters:

token
The MQPoolToken to add to the set of tokens.

addConnectionPoolToken
public static MQPoolToken addConnectionPoolToken()

Constructs an MQPoolToken and adds it to the set of tokens. The MQPoolToken is returned to the application to be passed later into removeConnectionPoolToken().

disableTracing
public static void disableTracing()

Turns off the WebSphere MQ Client for Java trace facility.

enableTracing
public static void enableTracing(int level)

Turns on the WebSphere MQ Client for Java trace facility.

Parameters

level
The level of tracing required, from 1 to 5 (5 being the most detailed).

enableTracing
public static void enableTracing(int level,
                                  OutputStream stream)

Turns on the WebSphere MQ Client for Java trace facility.

Parameters:

level
The level of tracing required, from 1 to 5 (5 being the most detailed).

stream
The stream to which the trace is written.

getDefaultConnectionManager
public static javax.resource.spi.ConnectionManager 
                                 getDefaultConnectionManager()

Returns the default ConnectionManager. If the default ConnectionManager is actually an MQConnectionManager, returns null.

getVersionNotice()
public static final String getVersionNotice()

Returns the current version of the WebSphere MQ base Java.

removeConnectionPoolToken
public static void removeConnectionPoolToken(MQPoolToken token)

Removes the specified MQPoolToken from the set of tokens. If that MQPoolToken is not in the set, there is no action.

Parameters:

token
The MQPoolToken to remove from the set of tokens.

setDefaultConnectionManager
public static void setDefaultConnectionManager(
                                       MQConnectionManager cxManager)

Sets the supplied MQConnectionManager to be the default ConnectionManager. The default ConnectionManager is used when there is no ConnectionManager specified on the MQQueueManager constructor. This method also empties the set of MQPoolTokens.

Parameters:

cxManager
The MQConnectionManager to be the default ConnectionManager.

setDefaultConnectionManager
public static void setDefaultConnectionManager
                      (javax.resource.spi.ConnectionManager cxManager)

Sets the default ConnectionManager, and empties the set of MQPoolTokens. The default ConnectionManager is used when there is no ConnectionManager specified on the MQQueueManager constructor.

This method requires a JVM at Java 2 v1.3 or later, with JAAS 1.0 or later installed.

Parameters:

cxManager
The default ConnectionManager (which implements the javax.resource.spi.ConnectionManager interface).



© IBM Corporation 1997, 2002. All Rights Reserved