public final class Broker
extends java.lang.Object
implements com.softwareag.entirex.aci.BrokerImplFactory
getBrokerID()
);
Modifier and Type | Field and Description |
---|---|
static int |
ENCRYPTION_LEVEL_BROKER
Specifies that the message data for send and receive calls will be
encrypted.
|
static int |
ENCRYPTION_LEVEL_NONE
Specifies that the message data will not be encrypted.
|
static int |
ENCRYPTION_LEVEL_TARGET
Specifies that the message data for send and receive calls will be
encrypted.
|
Constructor and Description |
---|
Broker(java.lang.String brokerID,
java.lang.String userID)
Creates a Broker object for the specified Broker address and user ID.
|
Broker(java.lang.String brokerID,
java.lang.String userID,
int poolSize)
Creates a Broker object for the specified Broker address, user ID and
socket pool size.
|
Broker(java.lang.String brokerID,
java.lang.String userID,
java.lang.String token)
Creates a Broker object for the specified Broker address, user ID and
token.
|
Broker(java.lang.String brokerID1,
java.lang.String userID,
java.lang.String token,
int poolSize)
Creates a Broker object for the specified Broker address, user ID,
token and socket pool size.
|
Modifier and Type | Method and Description |
---|---|
void |
autoLogon(java.lang.String password)
Provides a password to this instance of the Broker object to be used in
subsequent calls.
|
void |
disconnect()
Disconnects this Broker instance from the EntireX Broker.
|
java.lang.String |
getApplicationName()
Gets the name of the application.
|
java.lang.String |
getBrokerID()
Returns the Broker ID which was specified in the constructor of this
class.
|
int |
getCompressionLevel()
Returns the compression level.
|
java.lang.String |
getConnInfo()
Returns connection information.
|
byte[] |
getIAFToken()
Get the IAF Security Token.
|
byte[] |
getSecurityToken()
Returns the current value of the security token.
|
static ThreadRunner |
getThreadRunner()
Gets the
ThreadRunner object. |
java.lang.String |
getToken()
Returns the token specified in the constructor of this class.
|
static int |
getTrace()
Returns the current trace level.
|
static int |
getTransportTimeout()
Gets the socket timeout value in seconds.
|
java.lang.String |
getUniqueID()
Returns a String object, which is unique for this instance of the Broker
object.
|
java.lang.String |
getUserID()
Returns the current value of the user ID.
|
static java.lang.String |
getVersion()
Returns version information of the EntireX Java ACI package.
|
boolean |
hasUserSecurity()
Check if a user security object is used
|
boolean |
isCommandLogging()
Gets the state of the command logging.
|
java.lang.String |
kernelversion()
Retrieves the version of the EntireX Broker.
|
void |
logoff()
Logs off the application from EntireX Broker.
|
void |
logon()
Logs the application on to EntireX Broker, either as client or server.
|
void |
logon(java.lang.String password)
Logs the application on to EntireX Broker with a password, either as
client or server.
|
void |
logon(java.lang.String password,
java.lang.String newpassword)
Logs the application on to EntireX Broker with a password and new password, either as client or server.
|
void |
reconnect(java.lang.String userID)
Reconnects this Broker object to the Broker address specified in the
constructor and set the user ID.
|
void |
reconnect(java.lang.String userID,
java.lang.String token)
Reconnects this Broker object to the Broker address specified in the
constructor and set user ID and token.
|
void |
setApplicationName(java.lang.String name)
Sets the name of the application.
|
void |
setCommandLogging(boolean value)
Switch command logging on and off.
|
void |
setCompressionLevel(int level)
Sets the compression level.
|
void |
setCompressionLevel(java.lang.String level)
Sets the compression level.
|
void |
setIAFToken(byte[] iafToken)
Sets the IAF Security Token.
|
void |
setSecurity(BrokerSecurity securityObject,
boolean doEncrypt)
Specifies a security object, enables BrokerSecurity and permits
encryption/decryption of message data.
|
void |
setSecurity(BrokerSecurity securityObject,
int encryptionLevel)
Specifies a security object, enables BrokerSecurity and permits
encryption/decryption of message data.
|
void |
setSecurity(BrokerSecurity securityObject,
int encryptionLevel,
boolean autoMode)
Specifies a security object, enables BrokerSecurity and permits
encryption/decryption of message data.
|
void |
setSecurityToken(byte[] s)
Sets the security token to the argument.
|
static void |
setThreadRunner(ThreadRunner t)
Sets the
ThreadRunner object, which wraps the method
to start a new thread. |
static void |
setTrace(int level)
Sets the trace level.
|
static void |
setTrace(int level,
java.io.PrintWriter pw)
Sets the trace level.
|
static void |
setTransportTimeout(int timeout)
Sets the socket timeout value in seconds.
|
java.lang.String |
toString()
Overrides the
toString() method of the class Object. |
void |
useEntireXSecurity()
Enables EntireX Security for this Broker instance.
|
void |
useEntireXSecurity(boolean autoMode)
Enables EntireX Security for this Broker instance.
|
void |
useEntireXSecurity(int encryptionLevel)
Enables EntireX Security for this Broker instance.
|
void |
useEntireXSecurity(int encryptionLevel,
boolean autoMode)
Enables EntireX Security for this Broker instance.
|
public static final int ENCRYPTION_LEVEL_NONE
public static final int ENCRYPTION_LEVEL_BROKER
public static final int ENCRYPTION_LEVEL_TARGET
public Broker(java.lang.String brokerID, java.lang.String userID)
brokerID
- The BrokerID, for a definition see getBrokerID()
userID
- Authentication for the Broker instance.java.lang.IllegalArgumentException
- if the broker ID or user ID is invalid.public Broker(java.lang.String brokerID, java.lang.String userID, int poolSize)
brokerID
- The BrokerID, for a definition see getBrokerID()
userID
- Authentication for the Broker instance.poolSize
- Maximum socket pool size, if 0 socket pooling is disabled.java.lang.IllegalArgumentException
- if the broker ID or user ID is invalid.public Broker(java.lang.String brokerID, java.lang.String userID, java.lang.String token)
brokerID
- The BrokerID, for a definition see getBrokerID()
userID
- Authentication for the Broker instance.token
- Token for the Broker instance. Mandatory when using units of
work.java.lang.IllegalArgumentException
- if the broker ID or user ID is invalid.getToken()
public Broker(java.lang.String brokerID1, java.lang.String userID, java.lang.String token, int poolSize)
brokerID1
- The BrokerID, for a definition see getBrokerID()
userID
- Authentication for the Broker instance.token
- Token for the Broker instance. Mandatory when using units of
work.poolSize
- Maximum socket pool size, if 0 socket pooling is disabled.java.lang.IllegalArgumentException
- if the broker ID or user ID is invalid.getToken()
public static java.lang.String getVersion()
public java.lang.String getConnInfo()
public java.lang.String getBrokerID()
For TCP/IP and SSL there are two parameters to control the socket
pooling. They are specified as part of the Broker ID.
The parameter poolsize specifies the maximum number of socket
connections which are kept in the socket pool. The default value for the
poolsize parameter is 32. Set the poolsize parameter to
0 to disable the socket pooling. The poolsize parameter can also be set in the Broker
constructor, see Broker(String,String,int)
or Broker(String,String,String,int)
.
Automatic closing of socket connections is controlled by the parameter
pooltimeout. If a socket connection has not been used for the
specified the number of seconds, it will be closed automatically.
The default for this parameter is 300 seconds.
The encryption level can be set within the Broker ID. Add the parameter encryptionlevel=<value> to the Broker ID. Allowed values are 0 (no encryption), 1 (encryption), or 2 (end-to-end encryption).
The compression level can be set within the Broker ID. Add the parameter compresslevel=<value> to the Broker ID. Allowed values are
public java.lang.String toString()
toString()
method of the class Object.toString
in class java.lang.Object
public java.lang.String getUserID()
public byte[] getSecurityToken()
null
after the call has been made.public void setSecurityToken(byte[] s)
null
before the call is done and the logoff() method
resets the security token after the call has been made.s
- new Security Token as byte array.public java.lang.String getToken()
public boolean hasUserSecurity()
public void setSecurity(BrokerSecurity securityObject, boolean doEncrypt)
securityObject
- object which implements the BrokerSecurity
interface.doEncrypt
- if true then message data will be
encrypted/decrypted.java.lang.IllegalStateException
- if security object is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
BrokerSecurity
,
useEntireXSecurity()
,
useEntireXSecurity(int)
public void setSecurity(BrokerSecurity securityObject, int encryptionLevel)
securityObject
- object which implements the BrokerSecurity
interface.encryptionLevel
- one of the values ENCRYPTION_LEVEL_NONE,
ENCRYPTION_LEVEL_BROKER, or ENCRYPTION_LEVEL_TARGET.java.lang.IllegalArgumentException
- if encryptionLevel is invalid.java.lang.IllegalStateException
- if security object is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
BrokerSecurity
,
useEntireXSecurity()
,
useEntireXSecurity(int)
,
ENCRYPTION_LEVEL_NONE
,
ENCRYPTION_LEVEL_BROKER
,
ENCRYPTION_LEVEL_TARGET
public void setSecurity(BrokerSecurity securityObject, int encryptionLevel, boolean autoMode)
securityObject
- object which implements the BrokerSecurity
interface.encryptionLevel
- one of the values ENCRYPTION_LEVEL_NONE,
ENCRYPTION_LEVEL_BROKER, or ENCRYPTION_LEVEL_TARGET.autoMode
- if true
, let the Broker object figure out
whether the Broker uses security. If the Broker uses security,
set the specified securityObject
.java.lang.IllegalArgumentException
- if encryptionLevel
is
invalid.java.lang.IllegalStateException
- if security object is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
BrokerSecurity
,
useEntireXSecurity()
,
useEntireXSecurity(int)
,
ENCRYPTION_LEVEL_NONE
,
ENCRYPTION_LEVEL_BROKER
,
ENCRYPTION_LEVEL_TARGET
public void useEntireXSecurity()
java.lang.IllegalStateException
- if EntireX Security is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
useEntireXSecurity(int)
public void useEntireXSecurity(int encryptionLevel)
encryptionLevel
- one of the values ENCRYPTION_LEVEL_NONE,
ENCRYPTION_LEVEL_BROKER, or ENCRYPTION_LEVEL_TARGET.java.lang.IllegalArgumentException
- if encryptionLevel is invalid.java.lang.IllegalStateException
- if EntireX Security is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
ENCRYPTION_LEVEL_NONE
,
ENCRYPTION_LEVEL_BROKER
,
ENCRYPTION_LEVEL_TARGET
public void useEntireXSecurity(boolean autoMode)
autoMode
- if true
, let the Broker object figure out
whether the Broker uses security. If the Broker uses security,
set the EntireXSecurity
object.java.lang.IllegalStateException
- if EntireX Security is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
public void useEntireXSecurity(int encryptionLevel, boolean autoMode)
encryptionLevel
- one of the values ENCRYPTION_LEVEL_NONE,
ENCRYPTION_LEVEL_BROKER, or ENCRYPTION_LEVEL_TARGET.autoMode
- if true
, let the Broker object figure out
whether the Broker uses security. If the Broker uses security,
set the EntireXSecurity
object.java.lang.IllegalArgumentException
- if encryptionLevel is invalid.java.lang.IllegalStateException
- if EntireX Security is already set.logon(java.lang.String)
,
autoLogon(java.lang.String)
,
ENCRYPTION_LEVEL_NONE
,
ENCRYPTION_LEVEL_BROKER
,
ENCRYPTION_LEVEL_TARGET
public java.lang.String kernelversion() throws BrokerException
BrokerException
- if the Broker call fails.public void logon() throws BrokerException
BrokerException
- if the Broker call fails.public void logon(java.lang.String password) throws BrokerException
logon()
method performs the
authentication process.password
- Password used for authentication together with the user ID.BrokerException
- if the Broker call fails.public void logon(java.lang.String password, java.lang.String newpassword) throws BrokerException
password
- Password used for authentication together with the user ID.newpassword
- The new password is transmitted to the Broker
security exit to allow a password change.BrokerException
- if the Broker call fails.public void autoLogon(java.lang.String password)
autoLogon
is used, no logon to the Broker will be done
and the password will be sent with every subsequent Broker call. If
logon
is used, a logon to the Broker will be done and the
password will be sent only with the logon call.
autoLogon
whenever there is a high
probability that a sequence of Broker calls is interrupted by a client
non-activity timeout. In the case of a client timeout the 0008 0146 or
0002 0134 is avoided when autoLogon has been called.password
- Password used for authentication together with the user
ID.public void logoff() throws BrokerException
BrokerException
- a Broker Exceptionpublic static void setTrace(int level)
level
- Trace level.setTrace(int, java.io.PrintWriter)
public static void setTrace(int level, java.io.PrintWriter pw)
level
- Trace level.pw
- instance of PrintWriter object which will receive the trace output.public static int getTrace()
public void reconnect(java.lang.String userID)
logon
afterwards.userID
- Authentication for the Broker instance.java.lang.IllegalArgumentException
- if the user ID is invalid.public void reconnect(java.lang.String userID, java.lang.String token)
logon
afterwards.userID
- Authentication for the Broker instance.token
- Token for the Broker instance.java.lang.IllegalArgumentException
- if the user ID is invalid.public void disconnect()
logoff
. If disconnect
is not
used, the network resources are freed if the Broker
object
is destroyed or the socket pooling frees the unused sockets.
public java.lang.String getUniqueID() throws java.lang.IllegalStateException
java.lang.IllegalStateException
- if uniqueID cannot be obtained.public int getCompressionLevel()
public void setCompressionLevel(int level)
level
- the compression level.public void setCompressionLevel(java.lang.String level)
java.util.zip.Deflater
.level
- the compression level.public static void setThreadRunner(ThreadRunner t)
ThreadRunner
object, which wraps the method
to start a new thread.t
- the ThreadRunner
object.public static ThreadRunner getThreadRunner()
ThreadRunner
object. The ThreadRunner
object wraps the start method of the thread. This is used in application
server to use the method of the application server to start a new thread.ThreadRunner
objectpublic static void setTransportTimeout(int timeout) throws BrokerException
entirex.timeout
may be used to configure
the timeout value.timeout
- the socket timeout value in seconds.BrokerException
- if the timeout value is negative.getTransportTimeout()
public static int getTransportTimeout() throws BrokerException
entirex.timeout
. The system property is read once. The
system property wins over use of setTransportTimeout
.BrokerException
- if the property entirex.timeout
is not a
number or negative.setTransportTimeout(int)
public java.lang.String getApplicationName()
public void setApplicationName(java.lang.String name)
name
- the name of the application.java.lang.IllegalArgumentException
- if the name is null or empty.public boolean isCommandLogging()
true
if command logging is on. false
otherwise.public void setCommandLogging(boolean value)
Broker
object.value
- true
to turn command logging on,
false
to turn it off.public byte[] getIAFToken()
public void setIAFToken(byte[] iafToken)
Broker.logon
call uses the IAF
token, not the user id / password if the token is not null
.iafToken
- the IAF Security Token or null
.