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 Details

    • jndiName

      @NotBlank protected @NotBlank String jndiName
    • context

      protected transient volatile Context context
  • Constructor Details

    • BaseJndiImplementation

      public BaseJndiImplementation()
  • Method Details

    • lookup

      protected Object lookup(String name) throws javax.jms.JMSException
      Throws:
      javax.jms.JMSException
    • asList

      protected static List<String> asList(String commaSepList, String delim)
    • createQueue

      public javax.jms.Queue createQueue(String name, JmsActorConfig c) throws javax.jms.JMSException
      Description copied from interface: VendorImplementationBase

      Create or otherwise obtain a Queue.

      Specified by:
      createQueue in interface VendorImplementationBase
      Overrides:
      createQueue in class VendorImplementationImp
      Parameters:
      name - the name of the queue
      c - the Configuration
      Returns:
      a Queue object
      Throws:
      javax.jms.JMSException - if any occur
      See Also:
    • createTopic

      public javax.jms.Topic createTopic(String name, JmsActorConfig c) throws javax.jms.JMSException
      Description copied from interface: VendorImplementationBase

      Create or otherwise obtain a Topic.

      Specified by:
      createTopic in interface VendorImplementationBase
      Overrides:
      createTopic in class VendorImplementationImp
      Parameters:
      name - the name of the topic
      c - the Configuration
      Returns:
      a Topic object
      Throws:
      javax.jms.JMSException - if any occur
      See Also:
    • retrieveBrokerDetailsForLogging

      public String retrieveBrokerDetailsForLogging()
      Description copied from interface: VendorImplementationBase

      Returns the broker details used to create the underlying ConnectionFactory. This is delegated to the VendorImplementation because it may over-ride the broker details configured in JmsConnection.

      Specified by:
      retrieveBrokerDetailsForLogging in interface VendorImplementationBase
      Overrides:
      retrieveBrokerDetailsForLogging in class VendorImplementationImp
      Returns:
      the broker details used to create the underlying ConnectionFactory
      See Also:
    • connectionEquals

      public boolean connectionEquals(VendorImplementationBase vendorImp)
    • getJndiName

      public 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(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 the KeyValuePairSet.

      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 the KeyValuePairSet. May not be null.

      Parameters:
      k - a KeyValuePairSet of the parameters requires to connect to the JNDI store
    • getUseJndiForQueues

      public Boolean getUseJndiForQueues()
      Returns:
      the useJndiForQueues
      See Also:
    • setUseJndiForQueues

      public void setUseJndiForQueues(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 Boolean getUseJndiForTopics()
      Returns:
      the useJndiForTopics
      See Also:
    • setUseJndiForTopics

      public void setUseJndiForTopics(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 Boolean getEnableEncodedPasswords()
      Whether or not encoded passwords are enabled.
      Returns:
      true if encoded passwords are to be supported.
    • setEnableEncodedPasswords

      public void setEnableEncodedPasswords(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 appropriate Password

      Parameters:
      b - true to enable, false otherwise (default false)
    • enableEncodedPasswords

      public boolean enableEncodedPasswords()
    • getEncodedPasswordKeys

      public String getEncodedPasswordKeys()
    • setEncodedPasswordKeys

      public void setEncodedPasswordKeys(String encodedPasswordKey)
      A comma separated list of keys that will be decoded.
      Parameters:
      encodedPasswordKey - the keys to decode.
      See Also:
    • getExtraFactoryConfiguration

      public ExtraFactoryConfiguration getExtraFactoryConfiguration()
    • setExtraFactoryConfiguration

      public void setExtraFactoryConfiguration(ExtraFactoryConfiguration efc)
      Configure any additional settings that need to be applied to the ConnectionFactory 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 is NoOpFactoryConfiguration
      See Also:
    • newContextOnException

      public boolean newContextOnException()
    • getNewContextOnException

      public Boolean getNewContextOnException()
    • setNewContextOnException

      public void setNewContextOnException(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 new InitialContext 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.