Class BaseJndiImplementation
- java.lang.Object
-
- com.adaptris.core.jms.VendorImplementationImp
-
- com.adaptris.core.jms.jndi.BaseJndiImplementation
-
- All Implemented Interfaces:
ComponentLifecycleExtension
,ConnectionComparator<VendorImplementationBase>
,VendorImplementation
,VendorImplementationBase
- Direct Known Subclasses:
StandardJndiImplementation
public abstract class BaseJndiImplementation extends VendorImplementationImp
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.naming.Context
context
protected @NotBlank java.lang.String
jndiName
-
Fields inherited from class com.adaptris.core.jms.VendorImplementationImp
log
-
-
Constructor Summary
Constructors Constructor Description BaseJndiImplementation()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.util.List<java.lang.String>
asList(java.lang.String commaSepList, java.lang.String delim)
boolean
connectionEquals(VendorImplementationBase vendorImp)
javax.jms.Queue
createQueue(java.lang.String name, JmsActorConfig c)
Create or otherwise obtain aQueue
.javax.jms.Topic
createTopic(java.lang.String name, JmsActorConfig c)
Create or otherwise obtain aTopic
.boolean
enableEncodedPasswords()
java.lang.Boolean
getEnableEncodedPasswords()
Whether or not encoded passwords are enabled.java.lang.String
getEncodedPasswordKeys()
ExtraFactoryConfiguration
getExtraFactoryConfiguration()
java.lang.String
getJndiName()
Returns the name to look up in the JNDI store.KeyValuePairSet
getJndiParams()
Returns aKeyValuePairSet
of the parameters requires to connect to the JNDI store.java.lang.Boolean
getNewContextOnException()
java.lang.Boolean
getUseJndiForQueues()
java.lang.Boolean
getUseJndiForTopics()
protected java.lang.Object
lookup(java.lang.String name)
boolean
newContextOnException()
java.lang.String
retrieveBrokerDetailsForLogging()
Returns the broker details used to create the underlyingConnectionFactory
.void
setEnableEncodedPasswords(java.lang.Boolean b)
Specify whether or not to enable encoded passwords.void
setEncodedPasswordKeys(java.lang.String encodedPasswordKey)
A comma separated list of keys that will be decoded.void
setExtraFactoryConfiguration(ExtraFactoryConfiguration efc)
Configure any additional settings that need to be applied to theConnectionFactory
after it has been read from the JNDI store.void
setJndiName(java.lang.String s)
Sets the name to look up in the JNDI store.void
setJndiParams(KeyValuePairSet k)
Sets aKeyValuePairSet
of the parameters requires to connect to the JNDI store.void
setNewContextOnException(java.lang.Boolean b)
Whether or not to create a new JNDI context on exception.void
setUseJndiForQueues(java.lang.Boolean b)
Specify whether to use JNDI when attempting to create a Queue.void
setUseJndiForTopics(java.lang.Boolean b)
Specify whether to use JNDI when attempting to create a Topic.boolean
useJndiForQueues()
boolean
useJndiForTopics()
-
Methods inherited from class com.adaptris.core.jms.VendorImplementationImp
applyVendorSessionProperties, createConsumer, createDestination, createQueueReceiver, createSession, createTopicSubscriber, prepare
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.jms.VendorImplementation
createConnection, createConnectionFactory
-
-
-
-
Method Detail
-
lookup
protected java.lang.Object lookup(java.lang.String name) throws javax.jms.JMSException
- Throws:
javax.jms.JMSException
-
asList
protected static java.util.List<java.lang.String> asList(java.lang.String commaSepList, java.lang.String delim)
-
createQueue
public javax.jms.Queue createQueue(java.lang.String name, JmsActorConfig c) throws javax.jms.JMSException
Description copied from interface:VendorImplementationBase
Create or otherwise obtain a
Queue
.- Specified by:
createQueue
in interfaceVendorImplementationBase
- Overrides:
createQueue
in classVendorImplementationImp
- Parameters:
name
- the name of the queuec
- the Configuration- Returns:
- a
Queue
object - Throws:
javax.jms.JMSException
- if any occur- See Also:
VendorImplementationBase.createQueue(java.lang.String, JmsActorConfig)
-
createTopic
public javax.jms.Topic createTopic(java.lang.String name, JmsActorConfig c) throws javax.jms.JMSException
Description copied from interface:VendorImplementationBase
Create or otherwise obtain a
Topic
.- Specified by:
createTopic
in interfaceVendorImplementationBase
- Overrides:
createTopic
in classVendorImplementationImp
- Parameters:
name
- the name of the topicc
- the Configuration- Returns:
- a
Topic
object - Throws:
javax.jms.JMSException
- if any occur- See Also:
VendorImplementationBase.createTopic(java.lang.String, JmsActorConfig)
-
retrieveBrokerDetailsForLogging
public java.lang.String retrieveBrokerDetailsForLogging()
Description copied from interface:VendorImplementationBase
Returns the broker details used to create the underlying
ConnectionFactory
. This is delegated to theVendorImplementation
because it may over-ride the broker details configured inJmsConnection
.- Specified by:
retrieveBrokerDetailsForLogging
in interfaceVendorImplementationBase
- Overrides:
retrieveBrokerDetailsForLogging
in classVendorImplementationImp
- Returns:
- the broker details used to create the underlying
ConnectionFactory
- See Also:
#retrieveBrokerDetailsForLogging()
-
connectionEquals
public boolean connectionEquals(VendorImplementationBase vendorImp)
-
getJndiName
public java.lang.String getJndiName()
Returns the name to look up in the JNDI store.
- Returns:
- the name to look up in the JNDI store
-
setJndiName
public void setJndiName(java.lang.String s)
Sets the name to look up in the JNDI store. May not be null or empty.
- Parameters:
s
- the name to look up in the JNDI store that corresponds to a ConnectionFactory of the correct type.
-
getJndiParams
public KeyValuePairSet getJndiParams()
Returns a
KeyValuePairSet
of the parameters requires to connect to the JNDI store. Keys are commonly represented in Java by constants. It is the value of these constants not the constants themselves which should be configured in theKeyValuePairSet
.- Returns:
- a
KeyValuePairSet
of the parameters requires to connect to the JNDI store
-
setJndiParams
public void setJndiParams(KeyValuePairSet k)
Sets a
KeyValuePairSet
of the parameters requires to connect to the JNDI store. Keys are commonly represented in Java by constants. It is the value of these constants not the constants themselves which should be configured in theKeyValuePairSet
. May not be null.- Parameters:
k
- aKeyValuePairSet
of the parameters requires to connect to the JNDI store
-
getUseJndiForQueues
public java.lang.Boolean getUseJndiForQueues()
- Returns:
- the useJndiForQueues
- See Also:
setUseJndiForQueues(Boolean)
-
setUseJndiForQueues
public void setUseJndiForQueues(java.lang.Boolean b)
Specify whether to use JNDI when attempting to create a Queue.This specifies whether to use
Context.lookup(String)
to find any specified queues, if the named object is not present within JNDI, then an Exception will be thrown- Parameters:
b
- true to use JNDI to create a Queue, false to use standard JMS methods, default false.
-
useJndiForQueues
public boolean useJndiForQueues()
-
getUseJndiForTopics
public java.lang.Boolean getUseJndiForTopics()
- Returns:
- the useJndiForTopics
- See Also:
setUseJndiForTopics(Boolean)
-
setUseJndiForTopics
public void setUseJndiForTopics(java.lang.Boolean b)
Specify whether to use JNDI when attempting to create a Topic.This specifies whether to use
Context.lookup(String)
to find any specified topics, if the named object is not present within JNDI, then an Exception will be thrown- Parameters:
b
- true to use JNDI to create a Topic, false to use standard JMS methods, default false.
-
useJndiForTopics
public boolean useJndiForTopics()
-
getEnableEncodedPasswords
public java.lang.Boolean getEnableEncodedPasswords()
Whether or not encoded passwords are enabled.- Returns:
- true if encoded passwords are to be supported.
-
setEnableEncodedPasswords
public void setEnableEncodedPasswords(java.lang.Boolean b)
Specify whether or not to enable encoded passwords.When enabled, the entry matching
Context.SECURITY_CREDENTIALS
will be parsed and decoding attempted using the appropriatePassword
- Parameters:
b
- true to enable, false otherwise (default false)
-
enableEncodedPasswords
public boolean enableEncodedPasswords()
-
getEncodedPasswordKeys
public java.lang.String getEncodedPasswordKeys()
-
setEncodedPasswordKeys
public void setEncodedPasswordKeys(java.lang.String encodedPasswordKey)
A comma separated list of keys that will be decoded.- Parameters:
encodedPasswordKey
- the keys to decode.- See Also:
setEnableEncodedPasswords(Boolean)
-
getExtraFactoryConfiguration
public ExtraFactoryConfiguration getExtraFactoryConfiguration()
-
setExtraFactoryConfiguration
public void setExtraFactoryConfiguration(ExtraFactoryConfiguration efc)
Configure any additional settings that need to be applied to theConnectionFactory
after it has been read from the JNDI store.Generally speaking, this is not encouraged, as you are now keeping configuration in 2 separate locations (both JNDI and adapter config). The ConnectionFactory should ideally be configured in JNDI with all the settings that are required for each connection.
- Parameters:
efc
- any extra configuration, default isNoOpFactoryConfiguration
- See Also:
NoOpFactoryConfiguration
,SimpleFactoryConfiguration
-
newContextOnException
public boolean newContextOnException()
-
getNewContextOnException
public java.lang.Boolean getNewContextOnException()
-
setNewContextOnException
public void setNewContextOnException(java.lang.Boolean b)
Whether or not to create a new JNDI context on exception.In some instances, the
InitialContextFactory
implementation may be badly behaved, and not re-initialise nicely when error situations occur. By setting this to true, we create a newInitialContext
when any exception is encountered. This will of course have a performance hit if you are constantly resetting the connection for things like a missing JNDI entry; but might help with rare events like recovery after a network outage.- Parameters:
b
- true or false, default false.
-
-