Package org.zkoss.zkplus.jndi
Class JndiVariableResolver
- java.lang.Object
-
- org.zkoss.zkplus.jndi.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
-
-
-
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
- java:comp/env
- java:comp
- java:
- The variable will be look up as a sessionBean with prepend.
- 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 namemapping
- 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 interfaceVariableResolver
- Parameters:
var
- JNDI binding name- Returns:
- bean of context
- Throws:
XelException
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-