Expresso 5-5-0

com.jcorporate.expresso.kernel.digester
Class ComponentConfig

java.lang.Object
  extended bycom.jcorporate.expresso.kernel.digester.ComponentConfig
All Implemented Interfaces:
Serializable

public class ComponentConfig
extends Object
implements Serializable

This class represents the configuration of a component as parsed from the xxpresso-services.xml file. It is set by the Digester that fills it.

This is different from the ConfigurationBean used in the kernel package in that all data is string based. It is up to the system factory to convert the string data to the appropriate data type as specified by the component's metadata

Version:
$Revision: 1.10 $ on $Date: 2003/10/01 01:18:35 $
Author:
Michael Rimov
See Also:
Serialized Form

Constructor Summary
ComponentConfig()
          Default initialization system.
 
Method Summary
 void addChildComponent(ComponentConfig newComponent)
          Adds a nested ComponentConfig bean to represent nested components.
 void addIndexedProperty(String name, int index, String value)
          Add an indexed property (often seen in the javabean world as arrays)
 void addMappedProperty(String name, String key, String value)
          Add a mapped property.
 void addProperty(String name, String value)
          Add a property for the component
 boolean equals(Object parm1)
          Determine if two component configuration beans are equal by checking all fields and all child component's configurations.
 Map getAllIndexedProperties()
          Retrieve a map of all indexed properties.
 Map getAllMappedProperties()
          Retrieve a map of all mapped properties.
 ComponentConfig getChildComponent(String componentName)
          Search for a child component by the given component name
 List getChildComponents()
          Retrieves a list of child component configurations.
 String getClassName()
          Retrieve the classname for this component.
 Map getIndexedProperties(String name)
          Retrieve a map of index properties.
 String getIndexedProperty(String key, int index)
          Retrieve a particular indexed property.
 Map getMappedProperties(String name)
          Retrieve all mapped property key/value pairs for a given property name
 String getMappedProperty(String name, String key)
          Retrieve the value of a mapped property
 String getName()
          Retrieve the name of the component
 Map getProperties()
          Retrieve a read-only map of all 'normal' properties keyed by the property name.
 String getProperty(String name)
          Retrieve the value of a property
 int hashCode()
          Custom hashcode... name and classname basically make a unique component config.
 void setClassName(String className)
          Sets the classname for this component
 void setIndexedProperty(String key, int index, String value)
          Sets an indexed property value.
 void setMappedProperty(String key, String name, String value)
          Sets an mapped property value.
 void setName(String name)
          Sets the name of the component
 void setProperty(String name, String value)
          Sets the value of a particular property
 void updateConfig(ComponentConfig newConfiguration)
          A semi-copy constructor that allows you to update the configuration for this component only, not it's children.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentConfig

public ComponentConfig()
Default initialization system.

Method Detail

getName

public String getName()
Retrieve the name of the component

Returns:
java.lang.String

setName

public void setName(String name)
Sets the name of the component

Parameters:
name - java.lang.String

setClassName

public void setClassName(String className)
Sets the classname for this component

Parameters:
className - java.lang.String (Should be a valid class)

getClassName

public String getClassName()
Retrieve the classname for this component.

Returns:
java.lang.String

addProperty

public void addProperty(String name,
                        String value)
Add a property for the component

Parameters:
name - the name of the property
value - the value of the named property.

addMappedProperty

public void addMappedProperty(String name,
                              String key,
                              String value)
Add a mapped property.

Parameters:
name - the name of the mapped property
key - the property key
value - the value of the key

addIndexedProperty

public void addIndexedProperty(String name,
                               int index,
                               String value)
Add an indexed property (often seen in the javabean world as arrays)

Parameters:
name - the name of the property
index - the index of the property
value - the value of the property at the given index.

getProperty

public String getProperty(String name)
Retrieve the value of a property

Parameters:
name - the name of the property
Returns:
java.lang.String

setProperty

public void setProperty(String name,
                        String value)
Sets the value of a particular property

Parameters:
name - the name of the property
value - the value of the property.

getMappedProperty

public String getMappedProperty(String name,
                                String key)
Retrieve the value of a mapped property

Parameters:
name - the property name
key - the key in the mapped property
Returns:
java.lang.String the actual property value

setMappedProperty

public void setMappedProperty(String key,
                              String name,
                              String value)
Sets an mapped property value.

Parameters:
key - The property name
name - the name of the property
value - the value for the property.

getMappedProperties

public Map getMappedProperties(String name)
Retrieve all mapped property key/value pairs for a given property name

Parameters:
name - the name of the property
Returns:
String:String Map that corresponds to all mapped values for this given property

getAllMappedProperties

public Map getAllMappedProperties()

Retrieve a map of all mapped properties. All objects in the map are Strings and are the format:

Map keyed by property names

  Map for each property name keyed by 'key'

    The actual property values

Returns:
java.util.Map

getIndexedProperties

public Map getIndexedProperties(String name)
Retrieve a map of index properties. The keys in the map correspond to the indexes in a typical array as they are used in a javabean.

Parameters:
name - the name of the property to retrieve
Returns:
java.util.Map keyed by java.lang.Integer

getAllIndexedProperties

public Map getAllIndexedProperties()
Retrieve a map of all indexed properties. The map is keyed by strings which in turn point to maps that are keyed by Integers representing the array indexes for each property name.

Returns:
java.util.Map

getIndexedProperty

public String getIndexedProperty(String key,
                                 int index)
Retrieve a particular indexed property.

Parameters:
key - the property name
index - the index of the property who's value we wish to retrieve
Returns:
java.lang.String

setIndexedProperty

public void setIndexedProperty(String key,
                               int index,
                               String value)
Sets an indexed property value.

Parameters:
key - The property name
index - the index of the property
value - the value for the property.

addChildComponent

public void addChildComponent(ComponentConfig newComponent)
Adds a nested ComponentConfig bean to represent nested components.

Parameters:
newComponent - the new ComponentConfig bean

getChildComponents

public List getChildComponents()
Retrieves a list of child component configurations.

Returns:
an unmodifiable list of child components.

getChildComponent

public ComponentConfig getChildComponent(String componentName)
Search for a child component by the given component name

Parameters:
componentName - the name of the component to retrieve
Returns:
ComponentConfig if one is found or null if it couldn't be found
Throws:
IllegalArgumentException - if componentName is null or zero length

getProperties

public Map getProperties()
Retrieve a read-only map of all 'normal' properties keyed by the property name.

Returns:
java.util.Map

equals

public boolean equals(Object parm1)
Determine if two component configuration beans are equal by checking all fields and all child component's configurations.

Parameters:
parm1 - the other object to check against
Returns:
true if this function determines that the two beans are equal.

updateConfig

public void updateConfig(ComponentConfig newConfiguration)
A semi-copy constructor that allows you to update the configuration for this component only, not it's children. Overrites the current properties, etc for everything except childComponents

Parameters:
newConfiguration - the new configuration to update

hashCode

public int hashCode()
Custom hashcode... name and classname basically make a unique component config.

Returns:
integer

Expresso 5-5-0

Please see www.jcorporate.com for information about new Expresso releases.