org.activemath.abstractcontent
Interface Subconfiguration

All Known Implementing Classes:
ManagerSubconfiguration, SubconfImpl.AbstractSubconfiguration, SubconfImpl.ChildSubconfiguration, SubconfImpl.PropertiesConfig, SubconfImpl.UnionSubconfiguration

public interface Subconfiguration

An interface to be passed to components for them to be configured.

Making this an interface allows thirdParty developers to be able to compile their sources while only using the ActiveMath interfaces (the abstractcontent package) and not reference directly the implementation Manager class.

Version:

Method Summary
 boolean getBoolean(String name)
          Tries to compute the boolean value of the value of the given property.
 Collection getChildrenNames(String prefix)
          Returns the next step completion given the named prefix.
 int getInt(String name)
          Tries to compute the integer value of the value of the given property.
 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 values for the given name or null if there's none.
 Iterator getPropertyNames()
          Returns an enumeration of all the property names.
 Object getService(String serviceInterfaceClassName)
          This is the way to provide named services to users of the subconfiguation.
 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 props)
          Sets the default properties for this component.
 

Method Detail

setDefaultProperties

void setDefaultProperties(Map props)
Sets the default properties for this component. This allows a configured object to set its default values which are used by the configuration implementation. The keys and values of the map passed as argument are supposed to be String.

Throws:
IllegalStateException - when this method is called more than once

getProperty

String getProperty(String name)
Returns the values for the given name or null if there's none.


getPath

URL getPath(String name)
Computes the path of the given properties according to ActiveMath's mechanism (using a possible extra <name>.refType property.

See Also:
Manager.getPath(java.lang.String)

pathFromString

URL pathFromString(String pathString)
Computes the path for the obtained property value.


getBoolean

boolean getBoolean(String name)
Tries to compute the boolean value of the value of the given property.

Throws:
IllegalArgumentException - if the property does not exist or if the value cannot be cast to a boolean

getInt

int getInt(String name)
Tries to compute the integer value of the value of the given property.

Throws:
IllegalArgumentException - if the property does not exist or if the value cannot be cast to an int

getService

Object getService(String serviceInterfaceClassName)
This is the way to provide named services to users of the subconfiguation. Implementations using the Subconfiguraiton interface should document the class-name of the interfaces expected to be called using this method thereby documenting the necessary services.

Note that implementations of the Subconfiguration interface should only accept, as argument of this method, the class of a java-interface.

The service returned is not supposed to be twiddled or adjusted by the user of this service as such a service will presumably be shared by several users in a normal deployment.

Examples of such services could be an implementation of the JAXP's TransformerFactory interface, or an implementation of the MBaseRef interface.

Child-subconfigurations obtained through getSubconfiguration(java.lang.String) should, so as to enforce the inversion-of-control pattern, restrict the amount of services provided to the strict needed parts.

Returns:
an object of a class implementing the service-interface-class.
Throws:
IllegalArgumentException - if the service indicated does not exist

refreshServices

void refreshServices()
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.


getPropertyNames

Iterator getPropertyNames()
Returns an enumeration of all the property names.


getChildrenNames

Collection getChildrenNames(String prefix)
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".

Parameters:
prefix - the prefix string, without the trailing "." or null if the root property names is wished.

getSubconfiguration

Subconfiguration getSubconfiguration(String prefix)
Creates a sub-configuration object with the properties with given prefix.

Parameters:
prefix - the prefix string, without the trailing "."