org.objectledge.naming
Class ContextFactory

java.lang.Object
  extended by org.objectledge.naming.ContextFactory

public class ContextFactory
extends Object

Naming context factory component.

Version:
$Id: ContextFactory.java,v 1.6 2004/12/23 07:16:43 rafal Exp $
Author:
Rafal Krzewski, Pawel Potempski

Field Summary
private  Map alias
          Context aliases.
private  Map context
          Cached contexts.
private  Map initial
          Initial environments.
private  org.jcontainer.dna.Logger logger
          the logger
 
Constructor Summary
ContextFactory(org.picocontainer.PicoContainer container, org.jcontainer.dna.Configuration config, org.jcontainer.dna.Logger logger)
          Component constructor.
 
Method Summary
 Context getContext(String name)
          Returns the specified naming context.
 DirContext getDirContext(String name)
          Returns the specified directory context.
 void reconnect(String name)
          Requests that the cached context object be discarded and created anew.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.jcontainer.dna.Logger logger
the logger


initial

private Map initial
Initial environments.


alias

private Map alias
Context aliases.


context

private Map context
Cached contexts.

Constructor Detail

ContextFactory

public ContextFactory(org.picocontainer.PicoContainer container,
                      org.jcontainer.dna.Configuration config,
                      org.jcontainer.dna.Logger logger)
               throws org.jcontainer.dna.ConfigurationException
Component constructor.

Parameters:
container - the container to resolve component properties from.
config - the configuration.
logger - the logger.
Throws:
org.jcontainer.dna.ConfigurationException - if the component's configuration is invalid.
Method Detail

getContext

public Context getContext(String name)
                   throws NamingException
Returns the specified naming context.

Parameters:
name - the context identifier used in the configuration file.
Returns:
thread-safe view of the context.
Throws:
NamingException - if identifier cannot be resolved.

getDirContext

public DirContext getDirContext(String name)
                         throws NamingException
Returns the specified directory context.

Parameters:
name - the directory context identifier used in the configuration file
Returns:
thread-safe view of the context. * @throws NamingException if identifier cannot be resolved.
Throws:
NamingException

reconnect

public void reconnect(String name)
Requests that the cached context object be discarded and created anew.

This method is helpful for recovering from teporary failures of external naming/directory services.

Parameters:
name - the name of the context.


Copyright © 2003-2006 objectledge.org. All Rights Reserved.