org.apache.camel.impl
Class JndiRegistry

java.lang.Object
  extended by org.apache.camel.impl.JndiRegistry
All Implemented Interfaces:
Registry

public class JndiRegistry
extends Object
implements Registry

A Registry implementation which looks up the objects in JNDI


Constructor Summary
JndiRegistry()
           
JndiRegistry(Context context)
           
 
Method Summary
 void bind(String name, Object object)
           
 void close()
           
protected  Context createContext()
           
<T> Set<T>
findByType(Class<T> type)
          Finds services in the registry by their type.
<T> Map<String,T>
findByTypeWithName(Class<T> type)
          Finds services in the registry by their type.
 Context getContext()
           
 Object lookup(String name)
          Looks up a service in the registry based purely on name, returning the service or null if it could not be found.
<T> T
lookup(String name, Class<T> type)
          Looks up a service in the registry, returning the service or null if it could not be found.
 Object lookupByName(String name)
          Looks up a service in the registry based purely on name, returning the service or null if it could not be found.
<T> T
lookupByNameAndType(String name, Class<T> type)
          Looks up a service in the registry, returning the service or null if it could not be found.
<T> Map<String,T>
lookupByType(Class<T> type)
          Looks up services in the registry by their type.
 void setContext(Context context)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JndiRegistry

public JndiRegistry()

JndiRegistry

public JndiRegistry(Context context)
Method Detail

lookupByNameAndType

public <T> T lookupByNameAndType(String name,
                                 Class<T> type)
Description copied from interface: Registry
Looks up a service in the registry, returning the service or null if it could not be found.

Specified by:
lookupByNameAndType in interface Registry
Parameters:
name - the name of the service
type - the type of the required service
Returns:
the service from the registry or null if it could not be found

lookupByName

public Object lookupByName(String name)
Description copied from interface: Registry
Looks up a service in the registry based purely on name, returning the service or null if it could not be found.

Specified by:
lookupByName in interface Registry
Parameters:
name - the name of the service
Returns:
the service from the registry or null if it could not be found

findByTypeWithName

public <T> Map<String,T> findByTypeWithName(Class<T> type)
Description copied from interface: Registry
Finds services in the registry by their type.

Specified by:
findByTypeWithName in interface Registry
Parameters:
type - the type of the registered services
Returns:
the types found, with their ids as the key. Returns an empty Map if none found.

findByType

public <T> Set<T> findByType(Class<T> type)
Description copied from interface: Registry
Finds services in the registry by their type.

Specified by:
findByType in interface Registry
Parameters:
type - the type of the registered services
Returns:
the types found. Returns an empty Set if none found.

lookup

public Object lookup(String name)
Description copied from interface: Registry
Looks up a service in the registry based purely on name, returning the service or null if it could not be found.

Specified by:
lookup in interface Registry
Parameters:
name - the name of the service
Returns:
the service from the registry or null if it could not be found

lookup

public <T> T lookup(String name,
                    Class<T> type)
Description copied from interface: Registry
Looks up a service in the registry, returning the service or null if it could not be found. cha

Specified by:
lookup in interface Registry
Parameters:
name - the name of the service
type - the type of the required service
Returns:
the service from the registry or null if it could not be found

lookupByType

public <T> Map<String,T> lookupByType(Class<T> type)
Description copied from interface: Registry
Looks up services in the registry by their type.

Note: Not all registry implementations support this feature, such as the JndiRegistry.

Specified by:
lookupByType in interface Registry
Parameters:
type - the type of the registered services
Returns:
the types found, with their id as the key. Returns an empty Map if none found.

bind

public void bind(String name,
                 Object object)

close

public void close()
           throws NamingException
Throws:
NamingException

getContext

public Context getContext()
                   throws NamingException
Throws:
NamingException

setContext

public void setContext(Context context)

createContext

protected Context createContext()
                         throws NamingException
Throws:
NamingException


Apache Camel