de.smartics.properties.api.core.app
Class JndiContext

Package class diagram package JndiContext
java.lang.Object
  extended by de.smartics.properties.api.core.app.JndiContext

public final class JndiContext
     
     
extends Object

Defines constants for this library.


Field Summary
static String JNDI_CONTEXT_PATH_BOOT
          The path within the JNDI context to access boot configuration properties.
 
Method Summary
static JndiContext boot(Context context)
          Provides access to the boot properties within a JNDI context.
static JndiContext config(Context context, String configKey)
          Provides access to the custom properties within a JNDI context.
 String getSourceId()
          Returns the name of the JNDI namespace.
 NamingEnumeration<NameClassPair> list()
          Returns the list of stored values in the context.
 String lookup(String key)
          Runs a lookup for the value with the given key in the JNDI context and returns the value as a String.
 Boolean lookupBoolean(String key)
          Runs a lookup for the value with the given key in the JNDI context.
 Object lookupObject(String key)
          Runs a lookup for the value with the given key in the JNDI context.
 void set(String key, Object value)
          Sets the value for the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JNDI_CONTEXT_PATH_BOOT

public static final String JNDI_CONTEXT_PATH_BOOT
The path within the JNDI context to access boot configuration properties.

Constant Field Value:
"/smartics-properties/boot"
Method Detail

boot

public static JndiContext boot(Context context)
                        throws IllegalArgumentException
Provides access to the boot properties within a JNDI context.

Parameters:
context - the root context.
Returns:
the JNDI context for boot properties.
Throws:
IllegalArgumentException - if the JNDI context cannot be initialized.

config

public static JndiContext config(Context context,
                                 String configKey)
                          throws IllegalArgumentException
Provides access to the custom properties within a JNDI context.

Parameters:
context - the custom context.
configKey - the key to the configuration. Will be used as a path within the context to set the root of the configuration.
Returns:
the JNDI context for custom properties.
Throws:
IllegalArgumentException - if the JNDI context cannot be initialized.

lookupObject

public Object lookupObject(String key)
                    throws NamingException
Runs a lookup for the value with the given key in the JNDI context.

Parameters:
key - the key to the value.
Returns:
the value to the key in the context.
Throws:
NamingException - on any problem accessing the value.

lookup

public String lookup(String key)
              throws NamingException
Runs a lookup for the value with the given key in the JNDI context and returns the value as a String.

Parameters:
key - the key to the value.
Returns:
the value to the key in the context.
Throws:
NamingException - on any problem accessing the value.

lookupBoolean

public Boolean lookupBoolean(String key)
                      throws NamingException
Runs a lookup for the value with the given key in the JNDI context.

Parameters:
key - the key to the value.
Returns:
the value to the key in the context.
Throws:
NamingException - on any problem accessing the value.

set

public void set(String key,
                Object value)
         throws NamingException
Sets the value for the given key.

Parameters:
key - the key to the value.
value - the value to the key in the context.
Throws:
NamingException - on any problem accessing the value.

list

public NamingEnumeration<NameClassPair> list()
                                      throws NamingException
Returns the list of stored values in the context.

Returns:
the list of stored values in the context.
Throws:
NamingException - on any problem accessing the naming context.

getSourceId

public String getSourceId()
Returns the name of the JNDI namespace.

Returns:
the name of the JNDI namespace.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.