Rice Pastry API

rice.environment.params.simple
Class SimpleParameters

java.lang.Object
  extended by rice.environment.params.simple.SimpleParameters
All Implemented Interfaces:
Parameters

public class SimpleParameters
extends java.lang.Object
implements Parameters

This class represents a generic Java process launching program which reads in preferences from a preferences file and then invokes another JVM using those prefs. If the launched JVM dies, this process can be configured to restart the JVM any number of times before giving up. This process can also be configured to launch the second JVM with a specified memory allocation, etc...

Author:
Alan Mislove

Nested Class Summary
protected  class SimpleParameters.MyProperties
           
 
Constructor Summary
SimpleParameters(java.lang.String[] orderedDefaults, java.lang.String mutableConfigFileName)
           
 
Method Summary
 void addChangeListener(ParameterChangeListener p)
           
 boolean contains(java.lang.String name)
           
 java.util.Enumeration enumerateDefaults()
           
 java.util.Enumeration enumerateNonDefaults()
           
 boolean getBoolean(java.lang.String name)
           
 double getDouble(java.lang.String name)
           
 float getFloat(java.lang.String name)
           
 java.net.InetAddress getInetAddress(java.lang.String name)
          String format is dnsname ex: "computer.school.edu"
 java.net.InetSocketAddress getInetSocketAddress(java.lang.String name)
          String format is name:port ex: "computer.school.edu:1984"
 java.net.InetSocketAddress[] getInetSocketAddressArray(java.lang.String name)
          String format is comma seperated.
 int getInt(java.lang.String name)
           
 long getLong(java.lang.String name)
           
protected  java.lang.String getProperty(java.lang.String name)
           
 java.lang.String getString(java.lang.String name)
           
 java.lang.String[] getStringArray(java.lang.String name)
           
protected  java.net.InetSocketAddress parseInetSocketAddress(java.lang.String name)
           
 void remove(java.lang.String name)
           
 void removeChangeListener(ParameterChangeListener p)
           
 void setBoolean(java.lang.String name, boolean value)
           
 void setDouble(java.lang.String name, double value)
           
 void setFloat(java.lang.String name, float value)
           
 void setInetAddress(java.lang.String name, java.net.InetAddress value)
           
 void setInetSocketAddress(java.lang.String name, java.net.InetSocketAddress value)
           
 void setInetSocketAddressArray(java.lang.String name, java.net.InetSocketAddress[] value)
           
 void setInt(java.lang.String name, int value)
           
 void setLong(java.lang.String name, long value)
           
protected  void setProperty(java.lang.String name, java.lang.String value)
          Note, this method does not implicitly call store()
 void setString(java.lang.String name, java.lang.String value)
           
 void setStringArray(java.lang.String name, java.lang.String[] value)
           
 void store()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleParameters

public SimpleParameters(java.lang.String[] orderedDefaults,
                        java.lang.String mutableConfigFileName)
Parameters:
orderedDefaults -
mutableConfigFileName - if this is null, no params are saved, if this file doesn't exist, you will get a warning printed to stdErr, then the file will be created if you ever store
Throws:
java.io.IOException
Method Detail

enumerateDefaults

public java.util.Enumeration enumerateDefaults()

enumerateNonDefaults

public java.util.Enumeration enumerateNonDefaults()

parseInetSocketAddress

protected java.net.InetSocketAddress parseInetSocketAddress(java.lang.String name)
                                                     throws java.net.UnknownHostException
Throws:
java.net.UnknownHostException

getProperty

protected java.lang.String getProperty(java.lang.String name)

setProperty

protected void setProperty(java.lang.String name,
                           java.lang.String value)
Note, this method does not implicitly call store()

Parameters:
name -
value -
See Also:
store()

remove

public void remove(java.lang.String name)
Specified by:
remove in interface Parameters

contains

public boolean contains(java.lang.String name)
Specified by:
contains in interface Parameters

getInt

public int getInt(java.lang.String name)
Specified by:
getInt in interface Parameters

getDouble

public double getDouble(java.lang.String name)
Specified by:
getDouble in interface Parameters

getFloat

public float getFloat(java.lang.String name)
Specified by:
getFloat in interface Parameters

getLong

public long getLong(java.lang.String name)
Specified by:
getLong in interface Parameters

getBoolean

public boolean getBoolean(java.lang.String name)
Specified by:
getBoolean in interface Parameters

getInetAddress

public java.net.InetAddress getInetAddress(java.lang.String name)
                                    throws java.net.UnknownHostException
Description copied from interface: Parameters
String format is dnsname ex: "computer.school.edu"

Specified by:
getInetAddress in interface Parameters
Returns:
Throws:
java.net.UnknownHostException

getInetSocketAddress

public java.net.InetSocketAddress getInetSocketAddress(java.lang.String name)
                                                throws java.net.UnknownHostException
Description copied from interface: Parameters
String format is name:port ex: "computer.school.edu:1984"

Specified by:
getInetSocketAddress in interface Parameters
Returns:
Throws:
java.net.UnknownHostException

getInetSocketAddressArray

public java.net.InetSocketAddress[] getInetSocketAddressArray(java.lang.String name)
                                                       throws java.net.UnknownHostException
Description copied from interface: Parameters
String format is comma seperated. ex: "computer.school.edu:1984,computer2.school.edu:1984,computer.school.edu:1985"

Specified by:
getInetSocketAddressArray in interface Parameters
Returns:
Throws:
java.net.UnknownHostException

getString

public java.lang.String getString(java.lang.String name)
Specified by:
getString in interface Parameters

getStringArray

public java.lang.String[] getStringArray(java.lang.String name)
Specified by:
getStringArray in interface Parameters

setInt

public void setInt(java.lang.String name,
                   int value)
Specified by:
setInt in interface Parameters

setDouble

public void setDouble(java.lang.String name,
                      double value)
Specified by:
setDouble in interface Parameters

setFloat

public void setFloat(java.lang.String name,
                     float value)
Specified by:
setFloat in interface Parameters

setLong

public void setLong(java.lang.String name,
                    long value)
Specified by:
setLong in interface Parameters

setBoolean

public void setBoolean(java.lang.String name,
                       boolean value)
Specified by:
setBoolean in interface Parameters

setInetAddress

public void setInetAddress(java.lang.String name,
                           java.net.InetAddress value)
Specified by:
setInetAddress in interface Parameters

setInetSocketAddress

public void setInetSocketAddress(java.lang.String name,
                                 java.net.InetSocketAddress value)
Specified by:
setInetSocketAddress in interface Parameters

setInetSocketAddressArray

public void setInetSocketAddressArray(java.lang.String name,
                                      java.net.InetSocketAddress[] value)
Specified by:
setInetSocketAddressArray in interface Parameters

setString

public void setString(java.lang.String name,
                      java.lang.String value)
Specified by:
setString in interface Parameters

setStringArray

public void setStringArray(java.lang.String name,
                           java.lang.String[] value)
Specified by:
setStringArray in interface Parameters

store

public void store()
           throws java.io.IOException
Specified by:
store in interface Parameters
Throws:
java.io.IOException

addChangeListener

public void addChangeListener(ParameterChangeListener p)
Specified by:
addChangeListener in interface Parameters

removeChangeListener

public void removeChangeListener(ParameterChangeListener p)
Specified by:
removeChangeListener in interface Parameters

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection