net.sourceforge.saxadapter.examples.env
Class EnvironmentImpl

java.lang.Object
  |
  +--net.sourceforge.saxadapter.examples.env.EnvironmentImpl
All Implemented Interfaces:
Environment, java.io.Serializable

class EnvironmentImpl
extends java.lang.Object
implements Environment

This is a simple implementation of the Environment interface

Author:
Mark Priest
See Also:
Serialized Form

Fields inherited from interface net.sourceforge.saxadapter.examples.env.Environment
HOST_IP_PROP, HOST_NAME_PROP
 
Constructor Summary
(package private) EnvironmentImpl()
           
 
Method Summary
 java.lang.Boolean getBooleanProperty(java.lang.String argName)
          Returns the requested property as a Boolean.
 java.util.Date getDateProperty(java.lang.String argName)
          Returns the requested property as a Date.
 java.lang.Double getDoubleProperty(java.lang.String argName)
          Returns the requested property as a Double.
 java.lang.Float getFloatProperty(java.lang.String argName)
          Returns the requested property as a Float.
 java.lang.Integer getIntegerProperty(java.lang.String argName)
          Returns the requested property as an Integer.
 java.lang.Long getLongProperty(java.lang.String argName)
          Returns the requested property as a Long.
 java.lang.Object getObjectProperty(java.lang.String argName)
          Returns a named property as an java.lang.Object type regardless of the underlying type
 java.lang.String getStringProperty(java.lang.String argName)
          Returns a String property from the configuration file
static void main(java.lang.String[] args)
          This main method takes an argument for path of an XML file in the JVM classpath and prints out the tranformed properties
 void printProperties(java.io.OutputStream argOut)
          Prints all of the properties to the output stream.
(package private)  void setProperty(java.lang.String argName, java.lang.String argValue, java.lang.String argType)
          Set the property based on type
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentImpl

EnvironmentImpl()
Method Detail

getStringProperty

public java.lang.String getStringProperty(java.lang.String argName)
Returns a String property from the configuration file
Specified by:
getStringProperty in interface Environment
Parameters:
argName - name of the property
Returns:
java.lang.String

getObjectProperty

public java.lang.Object getObjectProperty(java.lang.String argName)
Returns a named property as an java.lang.Object type regardless of the underlying type
Specified by:
getObjectProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as an Object

getLongProperty

public java.lang.Long getLongProperty(java.lang.String argName)
Returns the requested property as a Long. Can throw ClassCastException if the data type is incorrect.
Specified by:
getLongProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Long

getIntegerProperty

public java.lang.Integer getIntegerProperty(java.lang.String argName)
Returns the requested property as an Integer. Can throw ClassCastException if the data type is incorrect.
Specified by:
getIntegerProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Integer

getFloatProperty

public java.lang.Float getFloatProperty(java.lang.String argName)
Returns the requested property as a Float. Can throw ClassCastException if the data type is incorrect.
Specified by:
getFloatProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Float

getDoubleProperty

public java.lang.Double getDoubleProperty(java.lang.String argName)
Returns the requested property as a Double. Can throw ClassCastException if the data type is incorrect.
Specified by:
getDoubleProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Double

getBooleanProperty

public java.lang.Boolean getBooleanProperty(java.lang.String argName)
Returns the requested property as a Boolean. Can throw ClassCastException if the data type is incorrect.
Specified by:
getBooleanProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Boolean

getDateProperty

public java.util.Date getDateProperty(java.lang.String argName)
Returns the requested property as a Date. Can throw ClassCastException if the data type is incorrect.
Specified by:
getDateProperty in interface Environment
Parameters:
argName - name of the property
Returns:
the property as a Date

printProperties

public void printProperties(java.io.OutputStream argOut)
Prints all of the properties to the output stream.
Specified by:
printProperties in interface Environment
Parameters:
argOut - the output stream on which to print properties

setProperty

void setProperty(java.lang.String argName,
                 java.lang.String argValue,
                 java.lang.String argType)
           throws java.lang.Exception
Set the property based on type
Parameters:
argName - the name of the property
argValue - the String representation of the value
argType - the Java type of the property
Throws:
java.lang.Exception -  

main

public static void main(java.lang.String[] args)
This main method takes an argument for path of an XML file in the JVM classpath and prints out the tranformed properties
Parameters:
args - the first and only argument is the path of an XML file within the JVM classpath following the DTD