org.activemath.abstractcontent
Class SubconfImpl.UnionSubconfiguration

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

public static class SubconfImpl.UnionSubconfiguration
extends SubconfImpl.AbstractSubconfiguration

A subcoonfiguration merging two subconfigurations. Note that the Union operation is not commutative and the given subconfigurations are actually given as one primary and and one secondary.

TODO: this class has some similarity to SubconfImpl.ChildSubconfiguration and a common subset should be performed.


Constructor Summary
SubconfImpl.UnionSubconfiguration(Subconfiguration primary, Subconfiguration secondary)
           
 
Method Summary
 Collection getChildrenNames(String prefix)
          Returns the next step completion given the named prefix.
 URL getPath(String key)
          Returns the primary or secondary result of Subconfiguration.getPath(java.lang.String) if available, otherwise builds a file with the indicated value and makes a URL out of it.
 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 serviceName)
          This is the way to provide named services to users of the subconfiguation.
 URL pathFromString(String pathString)
          Just call sthe primary's Subconfiguration.pathFromString(java.lang.String).
 void refreshServices()
          Commodity method to request the configurator to re-read the services from whichever source it was given.
 void setDefaultProperties(Map defaultProps)
          Sets the default properties for this component.
 
Methods inherited from class org.activemath.abstractcontent.SubconfImpl.AbstractSubconfiguration
getBoolean, getInt, getSubconfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubconfImpl.UnionSubconfiguration

public SubconfImpl.UnionSubconfiguration(Subconfiguration primary,
                                         Subconfiguration secondary)
Method Detail

getProperty

public String getProperty(String name)
Description copied from interface: Subconfiguration
Returns the values for the given name or null if there's none.

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

setDefaultProperties

public void setDefaultProperties(Map defaultProps)
Description copied from interface: Subconfiguration
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.

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

getPath

public URL getPath(String key)
Returns the primary or secondary result of Subconfiguration.getPath(java.lang.String) if available, otherwise builds a file with the indicated value and makes a URL out of it.

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)
Just call sthe primary's Subconfiguration.pathFromString(java.lang.String).


getService

public Object getService(String serviceName)
Description copied from interface: Subconfiguration
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 Subconfiguration.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.

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.


getChildrenNames

public Collection getChildrenNames(String prefix)
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:
prefix - the prefix string, without the trailing "." or null if the root property names is wished.

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