org.lsst.ccs.config
Class SubsystemDescription

java.lang.Object
  extended by org.lsst.ccs.config.SubsystemDescription
All Implemented Interfaces:
Serializable

@MappedSuperclass
public abstract class SubsystemDescription
extends Object
implements Serializable

Description for a subsystem as saved in database. The "subsystemName" and "tags" are keys (there is only one active subsystem with that name and tag, others are in historical data).

See Also:
Serialized Form

Field Summary
protected  Serializable configurationData
          Big object! see DescriptionType enum ...
protected  DataFlavour dataFlavour
          

TODO: only object_tree in future releases (other formats can be provided to constructors)

static ParameterFilter DEFAULT_TREE_PARAMETER_FILTER
          Default filter for parameters: gets rid of all parameters that are references to other components and considers that a parameter with name "name" is out.
 
Constructor Summary
protected SubsystemDescription(String subsystemName, String tag, String user, String version, Serializable configurationData, DataFlavour dataFlavour)
          used by subclasses
protected SubsystemDescription(SubsystemDescription other)
          creates a copy of the SubsystemDescription that is not (yet) registered to the database.
 
Method Summary
 void addDeploymentDescriptors(DeploymentDescriptor... descriptors)
          adds a list of Deployment Descriptors
abstract  void addParameterDescriptions(Collection<ParameterDescription> descriptions)
           
abstract  void addParameterDescriptions(ParameterDescription... descriptions)
          adds a list of parameter descriptions
 org.lsst.gruth.jutils.ComponentNode check()
          checks if a real subsystem can be built from the configurationData: all objects in the component node are built but the subsystem at the top is not started.
 boolean equals(Object o)
          compares only the name and tag of subsystems not their content!
 ParameterDescription fetch(PathObject path)
          Any ParameterDescription can be queried using any other PathObject
 void generateConfigProperties(PrintWriter writer, int levelMax)
          writes to a property file properties that can be edited to generate a ConfigProfile
 Map<String,ParameterDescription> generateDescriptionMap()
          returns a Map that contains all ParameterDescription both by their pathName and their simpleName
 Collection<ParameterBase> getBaseParameters()
          get the base parameters using the default filter.
 Collection<ParameterBase> getBaseParameters(ParameterFilter filter)
          gets the base parameters from a description
 Serializable getConfigurationData()
           
 DataFlavour getDataFlavour()
           
 List<DeploymentDescriptor> getDeployDescriptors()
          The list of deployment descriptors is modifiable only for objects not yet registered in database.
 long getEndTimestamp()
           
abstract  long getId()
          the technical id: zero if the object is not yet registered in database
 org.lsst.gruth.jutils.ComponentNode getModifiedConfigurationData(Properties configProps)
          to be used to create startup data object from a non-registered Configuration data (in a properties file).
abstract  Set<? extends ParameterDescription> getParamDescriptionSet()
          Detailed description of parameters that can be changed
 Collection<ParameterDescription> getPossibleDescriptions(int maxLevel)
           
 Collection<ParameterDescription> getPossibleDescriptions(int maxLevel, ParameterFilter filter)
          Loks like the getBaseParameters but builds a collection of ParameterDescription.
 long getPreviousDescriptionID()
          get the id of the previous subsystemDescription with same Name and tag.
 long getStartTimestamp()
           
 String getSubsystemName()
           
 String getTag()
           
 org.lsst.gruth.jutils.ComponentNode getTopComponentNode()
          returns the base object structure that describes the subsystem description (as loaded from a text file).
 String getUser()
           
 String getVersion()
           
 int hashCode()
           
 boolean isReadOnly()
          tells if the modifying methods can be invoked on a newly created objects.
static Collection<ParameterDescription> parameterDescriptionsFromNode(org.lsst.gruth.jutils.ComponentNode node, ParameterFilter filter, int maxLevel)
           
static Collection<ParameterBase> parametersFromNode(org.lsst.gruth.jutils.ComponentNode node, ParameterFilter filter)
          gets the ParameterBase objects that describes arguments passed to the constructor linked to a node of the configuration tree.
static void populateParameterBasesFromTop(Collection<ParameterBase> list, org.lsst.gruth.jutils.ComponentNode topNode, ParameterFilter filter)
          "tree-walker" to populate ParameterBase collection
static void populateParameterDescriptionsFromTop(Collection<ParameterDescription> list, org.lsst.gruth.jutils.ComponentNode topNode, ParameterFilter filter, int maxLevel)
           
 void removeDeploymentDescriptors(DeploymentDescriptor... descriptors)
          removes a list of Deployment Descriptors
abstract  void removeParameterDescriptions(ParameterDescription... descriptions)
          removes a list of parameter descriptions
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

configurationData

protected Serializable configurationData
Big object! see DescriptionType enum ... but not necessarily that big (so simply serializable Basic could be ok)


dataFlavour

protected DataFlavour dataFlavour

TODO: only object_tree in future releases (other formats can be provided to constructors)


DEFAULT_TREE_PARAMETER_FILTER

public static final ParameterFilter DEFAULT_TREE_PARAMETER_FILTER
Default filter for parameters: gets rid of all parameters that are references to other components and considers that a parameter with name "name" is out.

Constructor Detail

SubsystemDescription

protected SubsystemDescription(String subsystemName,
                               String tag,
                               String user,
                               String version,
                               Serializable configurationData,
                               DataFlavour dataFlavour)
used by subclasses

Parameters:
subsystemName - should not be null or empty
tag - may be null or empty
user - user that "owns" the description
version - the version
configurationData - see DataFlavour documentation
dataFlavour - which type of Configuration data

SubsystemDescription

protected SubsystemDescription(SubsystemDescription other)
creates a copy of the SubsystemDescription that is not (yet) registered to the database. Subclasses must fill the corresponding paramDescriptions set.

Parameters:
other -
Method Detail

getId

public abstract long getId()
the technical id: zero if the object is not yet registered in database

Returns:

getParamDescriptionSet

public abstract Set<? extends ParameterDescription> getParamDescriptionSet()
Detailed description of parameters that can be changed

Returns:

isReadOnly

public boolean isReadOnly()
tells if the modifying methods can be invoked on a newly created objects.

Returns:
false if the object has been already registered in the database

getSubsystemName

public String getSubsystemName()

getTag

public String getTag()

getStartTimestamp

public long getStartTimestamp()

getEndTimestamp

public long getEndTimestamp()

getUser

public String getUser()

getVersion

public String getVersion()

getConfigurationData

public Serializable getConfigurationData()

getDataFlavour

public DataFlavour getDataFlavour()

getPreviousDescriptionID

public long getPreviousDescriptionID()
get the id of the previous subsystemDescription with same Name and tag. This data is modified by the configuration facade (when replacing a subsystemDescription)

Returns:
0L if there is none

getDeployDescriptors

public List<DeploymentDescriptor> getDeployDescriptors()
The list of deployment descriptors is modifiable only for objects not yet registered in database. use addDeploymentDescriptor and removeDeploymentDescriptors to modify the list whil the object is not registered.

Returns:
an unmmodifiable view of the Deployment Descriptor list

addDeploymentDescriptors

public void addDeploymentDescriptors(DeploymentDescriptor... descriptors)
adds a list of Deployment Descriptors

Parameters:
descriptors -
Throws:
ImmutableStateException - if called on an object registered on the database

removeDeploymentDescriptors

public void removeDeploymentDescriptors(DeploymentDescriptor... descriptors)
removes a list of Deployment Descriptors

Parameters:
descriptors -
Throws:
ImmutableStateException - if called on an object registered on the database

equals

public boolean equals(Object o)
compares only the name and tag of subsystems not their content!

Overrides:
equals in class Object
Parameters:
-
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

fetch

public ParameterDescription fetch(PathObject path)
Any ParameterDescription can be queried using any other PathObject

Parameters:
path -
Returns:

addParameterDescriptions

public abstract void addParameterDescriptions(ParameterDescription... descriptions)
adds a list of parameter descriptions

Parameters:
descriptions -
Throws:
ImmutableStateException - if called on an immutable object

addParameterDescriptions

public abstract void addParameterDescriptions(Collection<ParameterDescription> descriptions)

removeParameterDescriptions

public abstract void removeParameterDescriptions(ParameterDescription... descriptions)
removes a list of parameter descriptions

Parameters:
descriptions -
Throws:
ImmutableStateException - if called on an immutable object

getTopComponentNode

public org.lsst.gruth.jutils.ComponentNode getTopComponentNode()
returns the base object structure that describes the subsystem description (as loaded from a text file). BEWARE: this data does not describe precisely ParameterDescriptions that may have been edited between creation and this request.

Returns:

check

public org.lsst.gruth.jutils.ComponentNode check()
                                          throws Exception
checks if a real subsystem can be built from the configurationData: all objects in the component node are built but the subsystem at the top is not started.

Returns:
a built subsystem
Throws:
Exception - if anything goes wrong (classes not found, improper build, etc.)

generateConfigProperties

public void generateConfigProperties(PrintWriter writer,
                                     int levelMax)
writes to a property file properties that can be edited to generate a ConfigProfile

Parameters:
writer -
levelMax -

getModifiedConfigurationData

public org.lsst.gruth.jutils.ComponentNode getModifiedConfigurationData(Properties configProps)
                                                                 throws RuntimeException
to be used to create startup data object from a non-registered Configuration data (in a properties file). use at your own risk!

Parameters:
configProps -
Returns:
Throws:
IllegalStateException - if the set of ParameterDescription is not populated Runtime Exception if illegal modification try (type or immutable object)
RuntimeException

generateDescriptionMap

public Map<String,ParameterDescription> generateDescriptionMap()
returns a Map that contains all ParameterDescription both by their pathName and their simpleName

Returns:

getBaseParameters

public Collection<ParameterBase> getBaseParameters(ParameterFilter filter)
gets the base parameters from a description

Parameters:
filter - drops unwanted parameter bases
Returns:

getBaseParameters

public Collection<ParameterBase> getBaseParameters()
get the base parameters using the default filter.

Returns:

parametersFromNode

public static Collection<ParameterBase> parametersFromNode(org.lsst.gruth.jutils.ComponentNode node,
                                                           ParameterFilter filter)
gets the ParameterBase objects that describes arguments passed to the constructor linked to a node of the configuration tree.

this code should be changed to describe also methods' parameters.

Parameters:
node -
filter -
Returns:

populateParameterBasesFromTop

public static void populateParameterBasesFromTop(Collection<ParameterBase> list,
                                                 org.lsst.gruth.jutils.ComponentNode topNode,
                                                 ParameterFilter filter)
"tree-walker" to populate ParameterBase collection

Parameters:
list -
topNode -
filter -

getPossibleDescriptions

public Collection<ParameterDescription> getPossibleDescriptions(int maxLevel,
                                                                ParameterFilter filter)
Loks like the getBaseParameters but builds a collection of ParameterDescription. The additional data may be empty if no additional data has been specified in the original text file/

Parameters:
maxLevel -
filter -
Returns:

getPossibleDescriptions

public Collection<ParameterDescription> getPossibleDescriptions(int maxLevel)

populateParameterDescriptionsFromTop

public static void populateParameterDescriptionsFromTop(Collection<ParameterDescription> list,
                                                        org.lsst.gruth.jutils.ComponentNode topNode,
                                                        ParameterFilter filter,
                                                        int maxLevel)

parameterDescriptionsFromNode

public static Collection<ParameterDescription> parameterDescriptionsFromNode(org.lsst.gruth.jutils.ComponentNode node,
                                                                             ParameterFilter filter,
                                                                             int maxLevel)


Copyright © 2013 LSST. All Rights Reserved.