Class JndiVariableResolver

  • All Implemented Interfaces:
    VariableResolver

    public class JndiVariableResolver
    extends java.lang.Object
    implements VariableResolver
    JndiVariableResolver, a jndi variableResolver
    Author:
    Jeff
    • Constructor Summary

      Constructors 
      Constructor Description
      JndiVariableResolver()  
      JndiVariableResolver​(java.lang.String prepend, java.lang.String mapping)
      This constructor take arguments to initialize JNDI names.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      int hashCode()  
      java.lang.Object resolveVariable​(java.lang.String var)
      Get object from JNDI binding
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • JndiVariableResolver

        public JndiVariableResolver​(java.lang.String prepend,
                                    java.lang.String mapping)
        This constructor take arguments to initialize JNDI names.
        • prepend - The prepended part of JNDI name
        • mapping - The key-value pairs for JNDI name and its corresponding variable name
        The variable will be resolved in following priority
        1. java:comp/env
        2. java:comp
        3. java:
        4. The variable will be look up as a sessionBean with prepend.
        5. The key-value pairs which is defined by mapping

        For example:

        By default, session beans will bind to JNDI in the form ejbName/remote for remote interfaces and ejbName/local in the case of local interfaces. When the EJBs are deployed in an .ear file, the default jndi binding will be prepended by the name of the .ear file. As a result, if the ear file name is foo.ear, prepend is: foo


        If you define your own jndi binding, the string should be in key-value pairs format as
        "a=custom/MySession,b=custom/MySession2,emf=java:/EntityManagerFactory"

        Parameters:
        prepend - prepended part of JNDI name
        mapping - key-value pairs for JNDI name and its corresponding variable name
      • JndiVariableResolver

        public JndiVariableResolver()
    • Method Detail

      • resolveVariable

        public java.lang.Object resolveVariable​(java.lang.String var)
                                         throws XelException
        Get object from JNDI binding
        Specified by:
        resolveVariable in interface VariableResolver
        Parameters:
        var - JNDI binding name
        Returns:
        bean of context
        Throws:
        XelException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object