org.activemath.abstractcontent
Class SubconfImpl.ChildSubconfiguration

java.lang.Object
  extended by org.activemath.abstractcontent.SubconfImpl.AbstractSubconfiguration
      extended by org.activemath.abstractcontent.SubconfImpl.ChildSubconfiguration
All Implemented Interfaces:
Subconfiguration
Enclosing class:
SubconfImpl

public static class SubconfImpl.ChildSubconfiguration
extends SubconfImpl.AbstractSubconfiguration

A class to provide property-subtree-based configuration defined by a prefix and a parent subconfiguration.


Constructor Summary
SubconfImpl.ChildSubconfiguration(Subconfiguration parent, String prefix)
           
 
Method Summary
 boolean getBoolean(String name)
          Uses the SubconfImpl.AbstractSubconfiguration.getBoolean(java.lang.String) to convert the value of getProperty(java.lang.String) into an boolean.
 Collection getChildrenNames(String prefix2)
          Returns the next step completion given the named prefix.
 int getInt(String name)
          Uses the SubconfImpl.AbstractSubconfiguration.getInt(java.lang.String) to convert the value of getProperty(java.lang.String) into an integer.
 URL getPath(String name)
          Computes the path of the given properties according to ActiveMath's mechanism (using a possible extra <name>.refType property.
 String getProperty(String name)
          Returns the value in the parent subconfiguration if available, or the value in default-properties (as set by setDefaultProperties(java.util.Map)).
 Iterator getPropertyNames()
          Returns an enumeration of all the property names.
 Object getService(String serviceInterfaceName)
          Does nothing but relaying the request to the parent.
 Subconfiguration getSubconfiguration(String prefix)
          Creates a sub-configuration object with the properties with given prefix.
 URL pathFromString(String pathString)
          Computes the path for the obtained property value.
 void refreshServices()
          Commodity method to request the configurator to re-read the services from whichever source it was given.
 void setDefaultProperties(Map defaultsProps)
          Set the default properties which allow a client to this class to set default-values that will be returned if the parent's property does not exist.
 String toString()
           
 String wrapPropName(String name)
          Returns prefix + "." + name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SubconfImpl.ChildSubconfiguration

public SubconfImpl.ChildSubconfiguration(Subconfiguration parent,
                                         String prefix)
Method Detail

toString

public String toString()
Overrides:
toString in class Object

setDefaultProperties

public void setDefaultProperties(Map defaultsProps)
Set the default properties which allow a client to this class to set default-values that will be returned if the parent's property does not exist.

Specified by:
setDefaultProperties in interface Subconfiguration
Specified by:
setDefaultProperties in class SubconfImpl.AbstractSubconfiguration

wrapPropName

public String wrapPropName(String name)
Returns prefix + "." + name. This method is called just about everywhere in this class when a property name has to be looked up in the parent subconfiguration.


getProperty

public String getProperty(String name)
Returns the value in the parent subconfiguration if available, or the value in default-properties (as set by setDefaultProperties(java.util.Map)).

Specified by:
getProperty in interface Subconfiguration
Specified by:
getProperty in class SubconfImpl.AbstractSubconfiguration

getInt

public int getInt(String name)
Uses the SubconfImpl.AbstractSubconfiguration.getInt(java.lang.String) to convert the value of getProperty(java.lang.String) into an integer.

Specified by:
getInt in interface Subconfiguration
Overrides:
getInt in class SubconfImpl.AbstractSubconfiguration

getBoolean

public boolean getBoolean(String name)
Uses the SubconfImpl.AbstractSubconfiguration.getBoolean(java.lang.String) to convert the value of getProperty(java.lang.String) into an boolean.

Specified by:
getBoolean in interface Subconfiguration
Overrides:
getBoolean in class SubconfImpl.AbstractSubconfiguration

getPath

public URL getPath(String name)
Description copied from interface: Subconfiguration
Computes the path of the given properties according to ActiveMath's mechanism (using a possible extra <name>.refType property.

Specified by:
getPath in interface Subconfiguration
Specified by:
getPath in class SubconfImpl.AbstractSubconfiguration
See Also:
Manager.getPath(java.lang.String)

pathFromString

public URL pathFromString(String pathString)
Description copied from interface: Subconfiguration
Computes the path for the obtained property value.


getPropertyNames

public Iterator getPropertyNames()
Description copied from interface: Subconfiguration
Returns an enumeration of all the property names.

Specified by:
getPropertyNames in interface Subconfiguration
Specified by:
getPropertyNames in class SubconfImpl.AbstractSubconfiguration

getChildrenNames

public Collection getChildrenNames(String prefix2)
Description copied from interface: Subconfiguration
Returns the next step completion given the named prefix.

As an example, given

    i.a.blop.c = val1
i.b.blip = val2

This method, called with "i", would return the enumeration made of the string "a" and the string "b".

Specified by:
getChildrenNames in interface Subconfiguration
Specified by:
getChildrenNames in class SubconfImpl.AbstractSubconfiguration
Parameters:
prefix2 - the prefix string, without the trailing "." or null if the root property names is wished.

getSubconfiguration

public Subconfiguration getSubconfiguration(String prefix)
Description copied from interface: Subconfiguration
Creates a sub-configuration object with the properties with given prefix.

Specified by:
getSubconfiguration in interface Subconfiguration
Overrides:
getSubconfiguration in class SubconfImpl.AbstractSubconfiguration
Parameters:
prefix - the prefix string, without the trailing "."
Returns:
a SubconfImpl.ChildSubconfiguration that is backed by the current subconfiguration.

getService

public Object getService(String serviceInterfaceName)
Does nothing but relaying the request to the parent.

Returns:
an object of a class implementing the service-interface-class.

refreshServices

public void refreshServices()
Description copied from interface: Subconfiguration
Commodity method to request the configurator to re-read the services from whichever source it was given. Useful for services created, e.g., from system-properties after a preference update. Implementations are not required to provide this service but should not fail if they don't.