|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.shiro.jndi.JndiLocator
public class JndiLocator
Convenient superclass for JNDI accessors, providing "jndiTemplate" and "jndiEnvironment" bean properties.
Note that this implementation is an almost exact combined copy of the Spring Framework's 'JndiAccessor' and 'JndiLocatorSupport' classes from their 2.5.4 distribution - we didn't want to re-invent the wheel, but not require a full dependency on the Spring framework, nor does Spring make available only its JNDI classes in a small jar, or we would have used that. Since Shiro is also Apache 2.0 licensed, all regular licenses and conditions and authors have remained in tact.
setJndiTemplate(org.apache.shiro.jndi.JndiTemplate)
,
setJndiEnvironment(java.util.Properties)
,
setResourceRef(boolean)
Field Summary | |
---|---|
static String |
CONTAINER_PREFIX
JNDI prefix used in a J2EE container |
Constructor Summary | |
---|---|
JndiLocator()
|
Method Summary | |
---|---|
protected String |
convertJndiName(String jndiName)
Convert the given JNDI name into the actual JNDI name to use. |
Properties |
getJndiEnvironment()
Return the JNDI environment to use for JNDI lookups. |
JndiTemplate |
getJndiTemplate()
Return the JNDI template to use for JNDI lookups. |
boolean |
isResourceRef()
Return whether the lookup occurs in a J2EE container. |
protected Object |
lookup(String jndiName)
Perform an actual JNDI lookup for the given name via the JndiTemplate. |
protected Object |
lookup(String jndiName,
Class requiredType)
Perform an actual JNDI lookup for the given name via the JndiTemplate. |
void |
setJndiEnvironment(Properties jndiEnvironment)
Set the JNDI environment to use for JNDI lookups. |
void |
setJndiTemplate(JndiTemplate jndiTemplate)
Set the JNDI template to use for JNDI lookups. |
void |
setResourceRef(boolean resourceRef)
Set whether the lookup occurs in a J2EE container, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONTAINER_PREFIX
Constructor Detail |
---|
public JndiLocator()
Method Detail |
---|
public void setJndiTemplate(JndiTemplate jndiTemplate)
You can also specify JNDI environment settings via "jndiEnvironment".
setJndiEnvironment(java.util.Properties)
public JndiTemplate getJndiTemplate()
public void setJndiEnvironment(Properties jndiEnvironment)
Creates a JndiTemplate with the given environment settings.
setJndiTemplate(org.apache.shiro.jndi.JndiTemplate)
public Properties getJndiEnvironment()
public void setResourceRef(boolean resourceRef)
Note: Will only get applied if no other scheme (e.g. "java:") is given.
public boolean isResourceRef()
protected Object lookup(String jndiName) throws NamingException
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
jndiName
- the JNDI name to look up
NamingException
- if the JNDI lookup failedsetResourceRef(boolean)
protected Object lookup(String jndiName, Class requiredType) throws NamingException
If the name doesn't begin with "java:comp/env/", this prefix is added if "resourceRef" is set to "true".
jndiName
- the JNDI name to look uprequiredType
- the required type of the object
NamingException
- if the JNDI lookup failedsetResourceRef(boolean)
protected String convertJndiName(String jndiName)
The default implementation applies the "java:comp/env/" prefix if "resourceRef" is "true" and no other scheme (e.g. "java:") is given.
jndiName
- the original JNDI name
CONTAINER_PREFIX
,
setResourceRef(boolean)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |