org.objectweb.jonas.common
Class JProp

java.lang.Object
  |
  +--org.objectweb.jonas.common.JProp

public class JProp
extends java.lang.Object

This class manages reading of the properties used by EJB Server. This class adopts the singleton design-pattern. No need to instanciate it, this is done by the private constructor called in the static reference. This class provides as well a public constructor, to read other properties files.


Field Summary
static java.lang.String JONASPREFIX
           
 
Method Summary
 void env2Ctx(javax.naming.Context ctx)
          Bind all the properties found in file properties in a naming context the naming context must be allocated by the caller
 java.util.Properties getEnv()
          Returns JOnAS environment as configured with files properties and system properties.
 java.util.Properties getFilesEnv()
          Returns JOnAS environment as configured with files properties only.
static java.lang.String getInstallRoot()
          Static method which return the JOnAS install root value.
static JProp getInstance()
          Get the unique instance.
static JProp getInstance(java.lang.String fileName)
          Get one of the multiple instances.
 java.lang.String[] getPropFiles()
          Returns properties files names
 java.lang.String getValue(java.lang.String key)
          Returns the value of the related property.
 java.lang.String getValue(java.lang.String key, java.lang.String defaultVal)
          Returns the value of the related property.
 java.lang.String[] getValueAsArray(java.lang.String key)
          Returns the value of the related property as String [].
 boolean getValueAsBoolean(java.lang.String key, boolean def)
          Returns the value of the related property as boolean.
static void main(java.lang.String[] args)
          Displays the JOnAS properties values, as they are set by the different property files.
 java.lang.String toString()
          String representation of the object for trace purpose
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JONASPREFIX

public static final java.lang.String JONASPREFIX
Method Detail

getInstance

public static JProp getInstance()
                         throws java.lang.Exception
Get the unique instance. Create it at first call.

getInstance

public static JProp getInstance(java.lang.String fileName)
                         throws java.lang.Exception
Get one of the multiple instances. Create it at first call with a given configuration file name
Parameters:
fileName - the name of the configuration file

getInstallRoot

public static java.lang.String getInstallRoot()
Static method which return the JOnAS install root value.

getPropFiles

public java.lang.String[] getPropFiles()
Returns properties files names
Returns:
JOnAS properties files names

getEnv

public java.util.Properties getEnv()
Returns JOnAS environment as configured with files properties and system properties.
Returns:
JOnAS properties

getFilesEnv

public java.util.Properties getFilesEnv()
Returns JOnAS environment as configured with files properties only.
Returns:
JOnAS properties

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.lang.String defaultVal)
Returns the value of the related property. With default values.
Returns:
property value

getValue

public java.lang.String getValue(java.lang.String key)
Returns the value of the related property. The method returns null if the property is not found.
Returns:
property value, null if not exist

getValueAsBoolean

public boolean getValueAsBoolean(java.lang.String key,
                                 boolean def)
Returns the value of the related property as boolean.
Returns:
property value, true or false.

getValueAsArray

public java.lang.String[] getValueAsArray(java.lang.String key)
Returns the value of the related property as String []. The method returns null if the property is not found.
Returns:
property value, null if not exist

toString

public java.lang.String toString()
String representation of the object for trace purpose
Overrides:
toString in class java.lang.Object
Returns:
String representation of this object

env2Ctx

public void env2Ctx(javax.naming.Context ctx)
             throws java.lang.Exception
Bind all the properties found in file properties in a naming context the naming context must be allocated by the caller

main

public static void main(java.lang.String[] args)
Displays the JOnAS properties values, as they are set by the different property files.