jpos.util
Class DefaultProperties

java.lang.Object
  |
  +--jpos.util.DefaultProperties
All Implemented Interfaces:
JposProperties, JposPropertiesConst

public class DefaultProperties
extends java.lang.Object
implements JposProperties

Default implementation of the JposProperties interface Loads/looks for the Jpos properties from the System properties and from the jpos/res/jpos.properties files NOTE: changed so that the properties are no longer loaded via the ResourceBundle class but instead though the System class

Since:
1.2 (NY 2K 99 meeting)
Author:
E. Michael Maximilien (maxim@us.ibm.com)

Inner Class Summary
(package private)  class DefaultProperties.MultiProp
          Default implementation of the jpos.util.JposProperties interface Speficies an interface used for returning multi properties.
static class DefaultProperties.Prop
          Simple wrapper class for a property pair
 
Inner classes inherited from class jpos.util.JposProperties
JposProperties.MultiProperty, JposProperties.Prop
 
Fields inherited from interface jpos.util.JposPropertiesConst
DEFAULT_ENTRIES_SER_FILE_NAME, JPOS_CONFIG_POPULATOR_CLASS_MULTIPROP_NAME, JPOS_CONFIG_POPULATOR_FILE_MULTIPROP_NAME, JPOS_POPULATOR_FILE_PROP_NAME, JPOS_POPULATOR_FILE_URL_PROP_NAME, JPOS_PROPERTIES_FILENAME, JPOS_REG_POPULATOR_CLASS_PROP_NAME, JPOS_SERVICE_MANAGER_CLASS_PROP_NAME, JPOS_SERVICE_MANAGER_CLASS_PROP_NAME2, JPOS_TRACING_ON_PROP_VALUE, JPOS_TRACING_PROP_NAME, JPOS_TRACING_TRUE_PROP_VALUE, PROP_NAME_ARRAY
 
Constructor Summary
DefaultProperties()
           
 
Method Summary
protected  void createMultiProperties()
          Creates the set of MultiProperty from the loaded properties
(package private)  java.util.Properties findProperties(java.lang.String propFileName)
           
static java.util.Iterator getDefinedPropertyNames()
           
(package private)  java.util.Properties getJposProperties()
           
 java.lang.Exception getLastException()
           
(package private)  java.lang.String getLoadedPropFileName()
           
protected  java.lang.String getMultiPropBaseName(java.lang.String propName)
           
 JposProperties.MultiProperty getMultiProperty(java.lang.String multiPropName)
           
 java.util.Enumeration getPropertyNames()
           
 java.lang.String getPropertyString(java.lang.String propName)
           
 java.util.Iterator getProps()
           
 boolean hasMultiProperty(java.lang.String multiPropName)
           
 boolean isLoaded()
           
protected  boolean isMultiProp(java.lang.String propName)
           
 boolean isPropertyDefined(java.lang.String propName)
           
 void loadJposProperties()
          Loads the jpos.properties file from the "./jpos/res" directory
(package private)  void loadJposPropertiesByName(java.lang.String propFileName)
          Loads the JposProperties from the fileName specified
static java.util.Comparator propComparator()
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultProperties

public DefaultProperties()
Method Detail

loadJposProperties

public void loadJposProperties()
Loads the jpos.properties file from the "./jpos/res" directory
Specified by:
loadJposProperties in interface JposProperties
Since:
1.2 (NY 2K meeting)

isLoaded

public boolean isLoaded()
Specified by:
isLoaded in interface JposProperties
Returns:
true if the properties are loaded
Since:
1.3 (Washington DC 2001 meeting)

getLastException

public java.lang.Exception getLastException()
Returns:
the last Exception wile loading if any otherwise null
Since:
1.3 (Washington DC 2001 meeting)

getPropertyString

public java.lang.String getPropertyString(java.lang.String propName)
Specified by:
getPropertyString in interface JposProperties
Parameters:
propName - the property name to search for
Returns:
the String property by name specified looking in System then the "jpos.properties" resource bundle
Since:
1.2 (NY 2K meeting)

isPropertyDefined

public boolean isPropertyDefined(java.lang.String propName)
Specified by:
isPropertyDefined in interface JposProperties
Parameters:
propName - the property name to look for
Returns:
true if this property is defined in the Java System properties or in the jpos.properties resource file
Since:
1.2 (NY 2K meeting)

getPropertyNames

public java.util.Enumeration getPropertyNames()
Specified by:
getPropertyNames in interface JposProperties
Returns:
an enumeration of properties names defined
Since:
1.2 (NY 2K meeting)

getMultiProperty

public JposProperties.MultiProperty getMultiProperty(java.lang.String multiPropName)
Specified by:
getMultiProperty in interface JposProperties
Parameters:
multiPropName - the multi-property name
Returns:
the MultiProperty by the name passed. MultiProperty are properties named like . where n = 0, 1, ... If the multi-property does not exist then null is returned
Since:
1.3 (Wahington DC 2001 meeting)

hasMultiProperty

public boolean hasMultiProperty(java.lang.String multiPropName)
Specified by:
hasMultiProperty in interface JposProperties
Parameters:
multiPropName - the multi-property name
Returns:
true if the MultiProperty by the name passed exist otherwise false
Since:
1.3 (Wahington DC 2001 meeting)

size

public int size()
Specified by:
size in interface JposProperties
Returns:
the number of properties in this JposProperties
Since:
1.3 (Washington DC 2001 meeting)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a formated String representation list all properties with names
Since:
1.3 (Washington DC 2001 meeting)

propComparator

public static java.util.Comparator propComparator()
Returns:
a Comparator object to compare 2 JposProperties.Prop objects
Since:
1.3 (Washington DC 2001 meeting)

getDefinedPropertyNames

public static java.util.Iterator getDefinedPropertyNames()
Returns:
an Iterator of valid property names
Since:
1.3 (Washington DC 2001)

createMultiProperties

protected void createMultiProperties()
Creates the set of MultiProperty from the loaded properties
Since:
1.3 (Washington DC 2001 meeting)

isMultiProp

protected boolean isMultiProp(java.lang.String propName)
Parameters:
propName - the property name
Returns:
true if the propName passed is a multi-property
Since:
1.3 (Washington DC 2001 meeting)

getMultiPropBaseName

protected java.lang.String getMultiPropBaseName(java.lang.String propName)
                                         throws java.lang.IllegalArgumentException
Parameters:
propName - the multi-property name
Returns:
the base name of the multi-property that the propName belongs to
Throws:
java.lang.IllegalArgumentException - if the argument is not a multi-property
Since:
1.3 (Washington DC 2001 meeting)

getProps

public java.util.Iterator getProps()
Specified by:
getProps in interface JposProperties
Returns:
an iterator of JposProperties.Prop for all the properties in this JposProperties. Changes to these properties do not affect the JposProperties properties
Since:
1.3 (Washington DC 2001)
See Also:
JposProperties.Prop

loadJposPropertiesByName

void loadJposPropertiesByName(java.lang.String propFileName)
Loads the JposProperties from the fileName specified
Since:
1.3 (Washington DC 2001 meeting)

getLoadedPropFileName

java.lang.String getLoadedPropFileName()
Returns:
the properties file name that was loaded or "" if none was loaded
Since:
1.3 (Washington DC 20001 meeting)

getJposProperties

java.util.Properties getJposProperties()
Returns:
the jposProerties loading it if necessary
Since:
1.3 (SF-2K meeting)

findProperties

java.util.Properties findProperties(java.lang.String propFileName)
Parameters:
propFileName - the properties file name
Returns:
a Properties object loaded with the properties file passed Looks for the properties file in the current set JAR or Zip files
Since:
1.3 (SF-2K meeting)


This API and code belongs to the JavaPOS committee please see LISCENCE file for details