|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.monica.javacom.util.MJCInputStreamConfiguration
This class implements the MJConfiguration interface to provide customization possibility
for MJC classes. This class reads customization information from a file called MJC.conf,
which has to be located in the current directory.
The configuration file can have the following stucure:
keyword=valueValues can be Strings, ints, and booleans. Booleans are represented with the strings "true" and "false". These values can be referenced int he get methods of the MJCConfiguration with the id matching the keyword.
Field Summary | |
protected java.io.InputStream |
iS
The InputStream from which the configuration settings will be read. |
Constructor Summary | |
MJCInputStreamConfiguration()
|
Method Summary | |
boolean |
getBoolean(java.lang.String id)
Returns a boolean configuraton value for the specified configuration id. |
boolean |
getBoolean(java.lang.String id,
boolean def)
Returns a boolean configuraton value for the specified configuration id. |
java.lang.String |
getConfigurationName()
Sets the MJCConfiguration for this object. |
java.lang.String |
getConfigurationVersion()
Returns the MJCConfiguration with which this object is customized. |
int |
getInt(java.lang.String id)
Retuns an int configuration value for the specified configuration id. |
int |
getInt(java.lang.String id,
int def)
Returns an int configuraton value for the specified configuration id. |
int |
getIntFromStrings(java.lang.String id,
java.lang.String[] possibilities,
int[] values,
int def)
Useable if String possible values in the configuration source should be mapped into ints as configuration values. |
java.io.InputStream |
getStream(java.lang.String ID)
Returns the InputStream identified with the specified ID. |
java.lang.String |
getString(java.lang.String id)
Returns a String configuraton value for the specified configuration id. |
java.lang.String |
getString(java.lang.String id,
java.lang.String def)
Returns a String configuraton value for the specified configuration id. |
protected void |
post_init()
Method that has to be called last in the constructors of all subclasses. |
protected void |
pre_init()
Method that has to be called first in the constructors of all subclasses. |
void |
setStream(java.lang.String ID,
java.io.InputStream stream)
Defines for the given ID an InputStream stream, whose contents can be retrieved unlimited times from clients of this class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.io.InputStream iS
Constructor Detail |
public MJCInputStreamConfiguration()
Method Detail |
protected void pre_init()
protected void post_init()
public java.lang.String getConfigurationName()
getConfigurationName
in interface MJCConfiguration
MJCConfiguration
- configuration: the MJCConfiguration
object for the customizationpublic java.lang.String getConfigurationVersion()
getConfigurationVersion
in interface MJCConfiguration
public int getInt(java.lang.String id) throws java.lang.Exception
getInt
in interface MJCConfiguration
String
- id: the required configuration idException:
- if the id is invalid or the id doesn't represent an
int valuepublic boolean getBoolean(java.lang.String id) throws java.lang.Exception
getBoolean
in interface MJCConfiguration
String
- id: the required configuration id
` @return boolean: the configuration boolean matching the configuration idException:
- if the id is invalid or the id doesn't represent a
boolean valuepublic java.lang.String getString(java.lang.String id) throws java.lang.Exception
getString
in interface MJCConfiguration
String
- id: the required configuration idException:
- if the id is invalid or the id doesn't represent a
String valuepublic int getInt(java.lang.String id, int def)
getInt
in interface MJCConfiguration
String
- id: the required configuration idint
- def: the specified default valuepublic boolean getBoolean(java.lang.String id, boolean def)
getBoolean
in interface MJCConfiguration
String
- id: the required configuration idboolean
- def: the specified default valuepublic java.lang.String getString(java.lang.String id, java.lang.String def)
getString
in interface MJCConfiguration
String
- id: the required configuration idboolean
- String: the specified default valuepublic int getIntFromStrings(java.lang.String id, java.lang.String[] possibilities, int[] values, int def)
getIntFromStrings
in interface MJCConfiguration
String
- id: the required configuration idString[]
- possibilities: possible Strings acceptable in the
configuration sourceint[]
- values: int values matching the possible Stringsint
- def: the dafault int that should be returned in case of
errorspublic void setStream(java.lang.String ID, java.io.InputStream stream)
setStream
in interface MJCConfiguration
String
- ID: the ID of the InputStreamInputStream
- stream: the stream whose contents can be retrievedpublic java.io.InputStream getStream(java.lang.String ID)
getStream
in interface MJCConfiguration
String
- ID: the ID of the returned stream
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |