org.mortbay.jetty.plus.naming
Class NamingEntry

java.lang.Object
  extended by org.mortbay.jetty.plus.naming.NamingEntry
Direct Known Subclasses:
EnvEntry, Resource, Transaction

public abstract class NamingEntry
extends Object

NamingEntry Base class for all jndi related entities. Instances of subclasses of this class are declared in jetty.xml or in a webapp's WEB-INF/jetty-env.xml file. NOTE: that all NamingEntries will be bound in a single namespace. The "global" level is just in the top level context. The "local" level is a context specific to a webapp.


Field Summary
protected  String absoluteObjectNameString
           
protected  Context context
           
protected  boolean isGlobal
           
protected  String jndiName
           
protected  String namingEntryNameString
           
protected  String objectNameString
           
protected  Object objectToBind
           
protected static ThreadLocal scope
           
static int SCOPE_GLOBAL
           
static int SCOPE_LOCAL
           
 
Constructor Summary
NamingEntry(String jndiName, Object object)
          Constructor
 
Method Summary
 void bindToEnv()
          Add a java:comp/env binding for the object represented by this NamingEntry
 String getJndiName()
          Get the unique name of the object
 Object getObjectToBind()
          Get the object that is to be bound
static int getScope()
           
 boolean isGlobal()
          Check if this naming entry was global or locally scoped to a webapp
static List lookupNamingEntries(int scopeType, Class clazz)
          Get all NameEntries of a certain type in a context.
static NamingEntry lookupNamingEntry(int scopeType, Class clazz, String jndiName)
           
static void setScope(int scopeType)
           
 void unbind()
          Unbind this NamingEntry entirely
 void unbindEnv()
          Unbind this NamingEntry from a java:comp/env
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCOPE_GLOBAL

public static final int SCOPE_GLOBAL
See Also:
Constant Field Values

SCOPE_LOCAL

public static final int SCOPE_LOCAL
See Also:
Constant Field Values

jndiName

protected String jndiName

objectToBind

protected Object objectToBind

absoluteObjectNameString

protected String absoluteObjectNameString

namingEntryNameString

protected String namingEntryNameString

objectNameString

protected String objectNameString

context

protected Context context

isGlobal

protected boolean isGlobal

scope

protected static ThreadLocal scope
Constructor Detail

NamingEntry

public NamingEntry(String jndiName,
                   Object object)
            throws NamingException
Constructor

Parameters:
jndiName - the name of the object which will eventually be in java:comp/env
object - the object to be bound
Throws:
NamingException
Method Detail

setScope

public static void setScope(int scopeType)

getScope

public static int getScope()

lookupNamingEntry

public static NamingEntry lookupNamingEntry(int scopeType,
                                            Class clazz,
                                            String jndiName)
                                     throws NamingException
Throws:
NamingException

lookupNamingEntries

public static List lookupNamingEntries(int scopeType,
                                       Class clazz)
                                throws NamingException
Get all NameEntries of a certain type in a context.

Parameters:
scopeType - local or global
clazz - the type of the entry
Returns:
Throws:
NamingException

bindToEnv

public void bindToEnv()
               throws NamingException
Add a java:comp/env binding for the object represented by this NamingEntry

Throws:
NamingException

unbindEnv

public void unbindEnv()
Unbind this NamingEntry from a java:comp/env


unbind

public void unbind()
Unbind this NamingEntry entirely


getJndiName

public String getJndiName()
Get the unique name of the object

Returns:

getObjectToBind

public Object getObjectToBind()
                       throws NamingException
Get the object that is to be bound

Returns:
Throws:
NamingException

isGlobal

public boolean isGlobal()
Check if this naming entry was global or locally scoped to a webapp

Returns:
true if naming entry was bound at global scope, false otherwise


Copyright © 2007 Mort Bay Consulting. All Rights Reserved.