org.ow2.carol.cmi.config
Class JNDIConfig

java.lang.Object
  extended by org.ow2.carol.cmi.config.JNDIConfig

@ThreadSafe
public final class JNDIConfig
extends java.lang.Object

Utility to configure JNDI when CMI is used in standalone. The methods getCMIEnv(), getCMIEnv(URL) and getCMIEnv(Properties) allows to get a proper environment before creating a new InitialContext. When Carol is preferred this class must not be used.


Field Summary
static java.lang.String INITIAL_PROVIDER_URLS
          Property name for defining the initial provider URLs.
static java.lang.String SERVER_MODE
          Property name for specifying if we are in server mode.
static java.lang.String WRAPPED_INITIAL_CONTEXT_FACTORY
          Property name for defining the wrapped InitialContextFactory.
static java.lang.String WRAPPED_PROTOCOL
          Property name for defining the protocol.
 
Method Summary
static java.util.Hashtable<java.lang.String,?> getCMIEnv()
          Returns the JNDI environment to use CMI in standalone.
static java.util.Hashtable<java.lang.String,?> getCMIEnv(java.util.Properties properties)
          Returns the JNDI environment to use CMI in standalone.
static java.util.Hashtable<java.lang.String,?> getCMIEnv(java.net.URL url)
          Returns the JNDI environment to use CMI in standalone.
static java.lang.String getProtocol()
           
static void setProtocol(java.lang.String protocol)
          Sets the protocol used with CMI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRAPPED_PROTOCOL

public static final java.lang.String WRAPPED_PROTOCOL
Property name for defining the protocol.

See Also:
Constant Field Values

INITIAL_PROVIDER_URLS

public static final java.lang.String INITIAL_PROVIDER_URLS
Property name for defining the initial provider URLs.

See Also:
Constant Field Values

WRAPPED_INITIAL_CONTEXT_FACTORY

public static final java.lang.String WRAPPED_INITIAL_CONTEXT_FACTORY
Property name for defining the wrapped InitialContextFactory.

See Also:
Constant Field Values

SERVER_MODE

public static final java.lang.String SERVER_MODE
Property name for specifying if we are in server mode.

See Also:
Constant Field Values
Method Detail

getCMIEnv

public static java.util.Hashtable<java.lang.String,?> getCMIEnv()
                                                         throws CMIConfigException
Returns the JNDI environment to use CMI in standalone. It will be extracted from the default configuration file: 'cmi.properties'.

Returns:
the JNDI environment to use CMI in standalone
Throws:
CMIConfigException - if the provided configuration file is not valid

getCMIEnv

public static java.util.Hashtable<java.lang.String,?> getCMIEnv(java.net.URL url)
                                                         throws CMIConfigException
Returns the JNDI environment to use CMI in standalone. It will be extracted from the given url.

Parameters:
url - an URL to find the configuration file
Returns:
the JNDI environment to use CMI in standalone
Throws:
CMIConfigException - if the provided configuration file is not valid

getCMIEnv

public static java.util.Hashtable<java.lang.String,?> getCMIEnv(java.util.Properties properties)
                                                         throws CMIConfigException
Returns the JNDI environment to use CMI in standalone. It will be extracted from the given set of properties.

Parameters:
properties - a set of properties
Returns:
the JNDI environment to use CMI in standalone
Throws:
CMIConfigException - if the provided configuration file is not valid

getProtocol

public static java.lang.String getProtocol()
Returns:
the protocol used with CMI

setProtocol

public static void setProtocol(java.lang.String protocol)
Sets the protocol used with CMI.

Parameters:
protocol - a name of protocol


Copyright © 2008 OW2 Consortium. All Rights Reserved.