Package org.objectweb.joram.mom.dest.jms
Class JMSModule
- java.lang.Object
-
- org.objectweb.joram.mom.dest.jms.JMSModule
-
- All Implemented Interfaces:
jakarta.jms.ExceptionListener,Serializable,JMSModuleMBean
public class JMSModule extends Object implements jakarta.jms.ExceptionListener, Serializable, JMSModuleMBean
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classJMSModule.ReconnectionDaemonTheReconnectionDaemonthread is responsible for reconnecting the bridge module with the foreign JMS server in case of disconnection.protected classJMSModule.StartupDaemonTheStartupDaemonthread is responsible for retrieving the needed JMS administered objects from the JNDI server.
-
Field Summary
Fields Modifier and Type Field Description protected StringclientIDJMS clientID field.protected jakarta.jms.ConnectioncnxConnection to the foreign JMS server.protected jakarta.jms.ConnectionFactorycnxFactConnection factory object for connecting to the foreign JMS server.protected StringcnxFactNameConnectionFactory JNDI name.private Cryptocryptoprivate static StringCRYPTO_ALGOprivate static StringCRYPTO_ALGO_PROPERTYprivate static StringCRYPTO_DFLT_ALGOprivate static intCRYPTO_DFLT_ITERATION_COUNTprivate static intCRYPTO_DFLT_KEY_LENGTHprivate static StringCRYPTO_DFLT_NONCEprivate static StringCRYPTO_DFLT_PASSWORDprivate static StringCRYPTO_DFLT_SALTprivate static intCRYPTO_ITERATION_COUNTprivate static StringCRYPTO_ITERATION_COUNT_PROPERTYprivate static intCRYPTO_KEY_LENGTHprivate static StringCRYPTO_KEY_LENGTH_PROPERTYprivate static StringCRYPTO_NONCEprivate static StringCRYPTO_NONCE_PROPERTYprivate static StringCRYPTO_PASSWORDprivate static intCRYPTO_PASSWORD_MIN_LENGTHprivate static StringCRYPTO_PASSWORD_PROPERTYprivate static StringCRYPTO_SALTprivate static intCRYPTO_SALT_MIN_LENGTHprivate static StringCRYPTO_SALT_PROPERTYprivate static booleanDEBUGprivate static booleanENCRYPT_CONFIGURATIONprivate static StringENCRYPT_CONFIGURATION_PROPERTYstatic intFAILINGprotected StringjndiFactoryName of the JNDI factory class to use.protected StringjndiUrlJNDI URL.private List<JMSAcquisition.JmsListener>listenersprivate static Loggerloggerprivate Stringnamethe name identifying the remote JMS providerprotected booleannotUsabletrueif the module is fully usable.protected StringnotUsableMessageMessage explaining why the module is not usable.static intOKprotected StringpasswordUser password for connecting to the foreign JMS server.private Stringpassword2Contains decrypted value of password field, this field is lazily initialized.protected JMSModule.ReconnectionDaemonreconnectionDaemonDaemon used for the reconnection process.private static longserialVersionUIDdefine serialVersionUID for interoperability, fix with 5.15.0 value.static intSTARTINGprivate intstatusstatic intUNKNOWNprotected StringuserNameUser identification for connecting to the foreign JMS server.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidaddExceptionListener(JMSAcquisition.JmsListener listener)private Stringdecrypt(String cypherText, String nonce)protected voiddoConnect()Opens a connection with the foreign JMS server and creates the JMS resources for interacting with the foreign JMS destination.private Stringencrypt(String clearText, String nonce)StringgetClientID()JMS clientID field.jakarta.jms.ConnectiongetCnx()StringgetCnxFactName()ConnectionFactory JNDI name.private CryptogetCrypto()protected ContextgetInitialContext()private StringgetMBeanName()StringgetName()StringgetNamingFactory()Name of the JNDI factory class to use.StringgetNamingURL()JNDI URL.StringgetState()intgetStatus()StringgetUserName()booleanisConnectionOpen()voidonException(jakarta.jms.JMSException exc)Implements thejavax.jms.ExceptionListenerinterface for catching the failures of the connection to the remote JMS server.(package private) voidremoveExceptionListener(JMSAcquisition.JmsListener listener)protected ObjectretrieveJndiObject(String jndiName)Retrieves ConnectionFactory and Destination objects from JNDI.voidstartLiveConnection()Launches the connection process to the foreign JMS server.voidstopLiveConnection()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability, fix with 5.15.0 value. This value is identical in 5.15.0, 5.16.0, 5.16.3, 5.17 and next. It is different in 5.16.1 and 5.16.2 (and 5.17.0RC).- See Also:
- Constant Field Values
-
logger
private static final Logger logger
-
DEBUG
private static final boolean DEBUG
-
ENCRYPT_CONFIGURATION_PROPERTY
private static final String ENCRYPT_CONFIGURATION_PROPERTY
- See Also:
- Constant Field Values
-
ENCRYPT_CONFIGURATION
private static final boolean ENCRYPT_CONFIGURATION
-
CRYPTO_ALGO_PROPERTY
private static final String CRYPTO_ALGO_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_ALGO
private static final String CRYPTO_DFLT_ALGO
- See Also:
- Constant Field Values
-
CRYPTO_ALGO
private static final String CRYPTO_ALGO
-
CRYPTO_PASSWORD_PROPERTY
private static final String CRYPTO_PASSWORD_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_PASSWORD
private static final String CRYPTO_DFLT_PASSWORD
- See Also:
- Constant Field Values
-
CRYPTO_PASSWORD
private static final String CRYPTO_PASSWORD
-
CRYPTO_PASSWORD_MIN_LENGTH
private static final int CRYPTO_PASSWORD_MIN_LENGTH
- See Also:
- Constant Field Values
-
CRYPTO_SALT_PROPERTY
private static final String CRYPTO_SALT_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_SALT
private static final String CRYPTO_DFLT_SALT
- See Also:
- Constant Field Values
-
CRYPTO_SALT
private static final String CRYPTO_SALT
-
CRYPTO_SALT_MIN_LENGTH
private static final int CRYPTO_SALT_MIN_LENGTH
- See Also:
- Constant Field Values
-
CRYPTO_NONCE_PROPERTY
private static final String CRYPTO_NONCE_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_NONCE
private static final String CRYPTO_DFLT_NONCE
- See Also:
- Constant Field Values
-
CRYPTO_NONCE
private static final String CRYPTO_NONCE
-
CRYPTO_ITERATION_COUNT_PROPERTY
private static final String CRYPTO_ITERATION_COUNT_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_ITERATION_COUNT
private static final int CRYPTO_DFLT_ITERATION_COUNT
- See Also:
- Constant Field Values
-
CRYPTO_ITERATION_COUNT
private static final int CRYPTO_ITERATION_COUNT
-
CRYPTO_KEY_LENGTH_PROPERTY
private static final String CRYPTO_KEY_LENGTH_PROPERTY
- See Also:
- Constant Field Values
-
CRYPTO_DFLT_KEY_LENGTH
private static final int CRYPTO_DFLT_KEY_LENGTH
- See Also:
- Constant Field Values
-
CRYPTO_KEY_LENGTH
private static final int CRYPTO_KEY_LENGTH
-
notUsable
protected transient boolean notUsable
trueif the module is fully usable.
-
notUsableMessage
protected transient String notUsableMessage
Message explaining why the module is not usable.
-
reconnectionDaemon
protected transient JMSModule.ReconnectionDaemon reconnectionDaemon
Daemon used for the reconnection process.
-
cnx
protected transient volatile jakarta.jms.Connection cnx
Connection to the foreign JMS server.
-
name
private String name
the name identifying the remote JMS provider
-
userName
protected String userName
User identification for connecting to the foreign JMS server.
-
password
protected String password
User password for connecting to the foreign JMS server. This field may be encrypted if JMSConnections.ENCRYPT_CONFIGURATION_PROPERTY is defined to true.
-
password2
private transient String password2
Contains decrypted value of password field, this field is lazily initialized. Note (AF): Only used if ENCRYPT_CONFIGURATION is true.
-
crypto
private transient Crypto crypto
-
jndiFactory
protected String jndiFactory
Name of the JNDI factory class to use.
-
jndiUrl
protected String jndiUrl
JNDI URL.
-
cnxFactName
protected String cnxFactName
ConnectionFactory JNDI name.
-
clientID
protected String clientID
JMS clientID field.
-
cnxFact
protected transient jakarta.jms.ConnectionFactory cnxFact
Connection factory object for connecting to the foreign JMS server.
-
status
private int status
-
UNKNOWN
public static final int UNKNOWN
- See Also:
- Constant Field Values
-
STARTING
public static final int STARTING
- See Also:
- Constant Field Values
-
OK
public static final int OK
- See Also:
- Constant Field Values
-
FAILING
public static final int FAILING
- See Also:
- Constant Field Values
-
listeners
private transient List<JMSAcquisition.JmsListener> listeners
-
-
Method Detail
-
getCnx
public jakarta.jms.Connection getCnx()
- Returns:
- the cnx
-
getName
public String getName()
-
getUserName
public String getUserName()
- Specified by:
getUserNamein interfaceJMSModuleMBean- Returns:
- the user name
-
getCrypto
private Crypto getCrypto()
-
encrypt
private String encrypt(String clearText, String nonce) throws UnsupportedEncodingException, GeneralSecurityException
-
decrypt
private String decrypt(String cypherText, String nonce) throws UnsupportedEncodingException, GeneralSecurityException
-
getNamingFactory
public String getNamingFactory()
Description copied from interface:JMSModuleMBeanName of the JNDI factory class to use.- Specified by:
getNamingFactoryin interfaceJMSModuleMBean
-
getNamingURL
public String getNamingURL()
Description copied from interface:JMSModuleMBeanJNDI URL.- Specified by:
getNamingURLin interfaceJMSModuleMBean
-
getCnxFactName
public String getCnxFactName()
Description copied from interface:JMSModuleMBeanConnectionFactory JNDI name.- Specified by:
getCnxFactNamein interfaceJMSModuleMBean- Returns:
- the cnxFactName
-
getClientID
public String getClientID()
Description copied from interface:JMSModuleMBeanJMS clientID field.- Specified by:
getClientIDin interfaceJMSModuleMBean
-
stopLiveConnection
public void stopLiveConnection()
-
startLiveConnection
public void startLiveConnection()
Launches the connection process to the foreign JMS server.- Throws:
IllegalStateException- If the module can't access the foreign JMS server.JMSException- If the needed JMS resources can't be created.
-
retrieveJndiObject
protected Object retrieveJndiObject(String jndiName) throws Exception
Retrieves ConnectionFactory and Destination objects from JNDI. This method converts 'old' javax.jms references to the new Jakarta JMS API. TODO (AF): We should replace this code by a call to Helper.retrieveJakartaJMSObjectFromJNDI method (org.ow2.joram.jndi package).- Parameters:
jndiName-- Returns:
- Throws:
Exception
-
getInitialContext
protected Context getInitialContext() throws IOException, NamingException
- Throws:
IOExceptionNamingException
-
doConnect
protected void doConnect() throws jakarta.jms.JMSExceptionOpens a connection with the foreign JMS server and creates the JMS resources for interacting with the foreign JMS destination.- Throws:
jakarta.jms.JMSException- If the needed JMS resources could not be created.
-
onException
public void onException(jakarta.jms.JMSException exc)
Implements thejavax.jms.ExceptionListenerinterface for catching the failures of the connection to the remote JMS server.Reacts by launching a reconnection process.
- Specified by:
onExceptionin interfacejakarta.jms.ExceptionListener
-
isConnectionOpen
public boolean isConnectionOpen()
-
getStatus
public int getStatus()
-
getState
public String getState()
- Specified by:
getStatein interfaceJMSModuleMBean
-
getMBeanName
private String getMBeanName()
-
removeExceptionListener
void removeExceptionListener(JMSAcquisition.JmsListener listener)
-
addExceptionListener
void addExceptionListener(JMSAcquisition.JmsListener listener)
-
-