| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shale.clay.config.beans.ComponentConfigBean
public class ComponentConfigBean
This class is kind of the metadata object pool for configuration data
  loaded from XML files on startup in the ClayConfigureListener
  by the ClayXmlParser.  An instance of this
  class will be registered with the ConfigBeanFactory.
  
| Nested Class Summary | |
|---|---|
| protected  class | ComponentConfigBean.WatchDogThis inner class watches for changes in a array of ConfigBean.ConfigDefinition's. | 
| protected  class | ComponentConfigBean.XmlConfigDefThis class defines a single configration file that is watched for changes. | 
| Nested classes/interfaces inherited from interface org.apache.shale.clay.config.beans.ConfigBean | 
|---|
| ConfigBean.ConfigDefinition | 
| Field Summary | |
|---|---|
| protected  ServletContext | contextReference to the ServletContext. | 
| protected  Map | displayElementsCollection holding all the top-level components defined in the XML config files. | 
| protected  boolean | isWatchDogOnThis parameter is initialized from the initmethod from theorg.apache.shale.clay.AUTO_RELOAD_CONFIG_FILESinit
 parameter in the web.xml. | 
| protected static org.apache.shale.util.Messages | messagesMessage resources for this class. | 
| protected static String[] | NAMING_CONTAINER_TYPESA static string array of faces component types that are naming containers. | 
| protected  ClayConfigParser | parserUses the digester to load the configuration files into a object graph cached in displayElements. | 
| protected  String[] | suffixesThe suffixes used to identify that a jsfid is a template style of composition. | 
| protected  Map | watchDogsMap of ComponentConfigBean.WatchDogthat watches the configuration files looking for changes. | 
| Constructor Summary | |
|---|---|
| ComponentConfigBean()Constructor initializes the displayElementscollection. | |
| Method Summary | |
|---|---|
|  void | addChild(ComponentBean obj)Adds a {link ComponentBean} to the displayElementmap collection using
 thejsfidas the key. | 
|  void | assignParent(ComponentBean b)Called to assign the IsA parent to the ComponentBeanusing theextendsattribute. | 
| protected  void | checkCircularInheritance(ComponentBean b)Passed a ComponentBean, the method looks for several
 types of circular inheritances. | 
|  void | checkTree(ComponentBean b)Recursively walks the tree of component metadata verifying there is not a duplicate component id within a naming container. | 
| protected  void | checkTree(List componentIds,
          ComponentBean b)Verifies there is not a duplicate component id within a naming container. | 
| protected  void | clear(String watchDogName)Cleans up before a group of files are reloaded. | 
|  int | compareTo(Object config)Implementation of the Comparable interface. | 
| protected  StringBuffer | describeRelationships(Stack heritage)Returns a StringBuffer with an xpath like expression of jsfidthat describes the Stack ofComponentBean. | 
|  void | destroy()The destroy method is invoked to clean up resources. | 
| protected  Stack | getAssociations(ComponentBean b)Walks up the hasA parent chain looking for circular relationships. | 
| protected  ConfigBean.ConfigDefinition[] | getConfigDefinitions(String configFiles)Passed a comma delimited list of configuration files, this method returns an array of ConfigBean.ConfigDefinitiondefining the files. | 
|  ComponentBean | getElement(String jsfid)Factory method that returns a top-level {link ComponentBean} with a matching jsfidornullif not found. | 
| protected  Stack | getGeneralizations(ComponentBean b)Walks up the isA parent chain looking for circular relationships. | 
|  ServletContext | getServletContext()Returns the web container ServletContext. | 
| protected  ComponentBean | getTopLevelElement(String jsfid)Returns the root metadata component that is used to add to the component tree. | 
|  int | getWeight()The weight is an attempt to make a plug-able system for registering ConfigBeanobjects with theConfigBeanFactory. | 
|  void | init(ServletContext context)Initialization method that is passed the ServletContextas a parameter. | 
|  boolean | isDesigntime()Returns trueif the current mode
 is design time. | 
| protected  boolean | isNamingContainer(String componentType)Checks the componentTypeagainst theNAMING_CONTAINER_TYPESlist to determine if it is a naming container. | 
| protected  void | loadConfigFiles()Loads the Clayconfigration files
 into thedisplayElementsMap. | 
| protected  void | realizingInheritance(AttributeBean a)This overload handles fixing up AttributeBeaninheritance. | 
|  void | realizingInheritance(ComponentBean b)This method is passed a ComponentBeanand is
 recursively called for each contained component. | 
|  boolean | refresh(boolean forceReload)This method should be called from key points in the application to invoke automatic reloading of the configuration files if they have been modified since last reloaded. | 
|  void | resolveInheritance()This method is called on startup to resolve the meta inheritance relationships for each top-level components in the displayElementscollection. | 
|  void | setDesigntime(boolean isDesigntime)Sets the design time to somthing other than the default falsevalue. | 
| protected  void | unassignParent(ComponentBean b)Recursively called to unassign isA and hasA parent relationships. | 
|  boolean | validMoniker(String id)Called by the ConfigBeanFactoryto determine if this
 instance ofConfigBeancan handle finding theConfigBeanfrom thejsfid. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
protected ClayConfigParser parser
Uses the digester to load the configuration files
 into a object graph cached in displayElements.
 
protected boolean isWatchDogOn
This parameter is initialized from the init
 method from the org.apache.shale.clay.AUTO_RELOAD_CONFIG_FILES init
 parameter in the web.xml.  The default value is true
 which will trigger reloading the files when a change has occurred.
 
protected Map watchDogs
Map of ComponentConfigBean.WatchDog that watches the configuration files looking for changes.
 The configuration files are defined by the ConfigBean.ConfigDefinition top level
 interface.
protected static org.apache.shale.util.Messages messages
Message resources for this class.
protected String[] suffixes
The suffixes used to identify that a jsfid is a template style of
  composition.  If it has a matching suffix, it will be handled
  by the TemplateConfigBean or TemplateComponentConfigBean;
  Otherwise, it's handled by ComponentConfigBean.
protected transient ServletContext context
Reference to the ServletContext.
protected Map displayElements
Collection holding all the top-level components defined in the XML config files.
protected static final String[] NAMING_CONTAINER_TYPES
A static string array of faces component types that are naming containers.
| Constructor Detail | 
|---|
public ComponentConfigBean()
Constructor initializes the displayElements
 collection.
| Method Detail | 
|---|
public boolean isDesigntime()
Returns true if the current mode
 is design time.
true if design timepublic void setDesigntime(boolean isDesigntime)
Sets the design time to somthing other than
 the default false value.
isDesigntime - load config descriptionspublic void init(ServletContext context)
Initialization method that is passed the ServletContext
 as a parameter.  Loads the sufixes for the ServletContext
 initialization parameter.
 
init in interface ConfigBeancontext - servlet contextprotected void loadConfigFiles()
Loads the Clay configration files
 into the displayElements Map.  The files are defined by the
 clay-template-suffix initialization parameter in the web deployment
 descriptor.  The default configuration file "META-INF/view-config.xml" is always
 loaded from the shale-clay java archive.
protected ConfigBean.ConfigDefinition[] getConfigDefinitions(String configFiles)
Passed a comma delimited list of configuration files, this method returns
 an array of ConfigBean.ConfigDefinition defining the files.
configFiles - comma seperated list of config files
public ServletContext getServletContext()
Returns the web container ServletContext.
getServletContext in interface ConfigBeanpublic ComponentBean getElement(String jsfid)
Factory method that returns a top-level {link ComponentBean} with a
  matching jsfid or null if not found.
 
getElement in interface ConfigBeanjsfid - id of component definition
public void addChild(ComponentBean obj)
Adds a {link ComponentBean} to the displayElement map collection using
 the jsfid as the key.
obj - component bean added to the map of elementspublic void resolveInheritance()
This method is called on startup to resolve the meta inheritance relationships for
 each top-level components in the displayElements collection.  There are
 three steps, find parents, check for circular relationships, and realize the relationships.
 
protected ComponentBean getTopLevelElement(String jsfid)
Returns the root metadata component that is used to add to the component
 tree.  This method might be overridden to broaden the scope to search for
 components outside of the displayElement cache.
jsfid - id of a component bean
public void assignParent(ComponentBean b)
Called to assign the IsA parent to the ComponentBean
 using the extends attribute.
 
assignParent in interface ConfigBeanb - component bean needing isa parent assignedprotected void realizingInheritance(AttributeBean a)
This overload handles fixing up AttributeBean
 inheritance.
a - attribute needing inheritance resolvedpublic void realizingInheritance(ComponentBean b)
This method is passed a ComponentBean and is
 recursively called for each contained component.  It fixes up
 the meta inheritance relationships.
 
realizingInheritance in interface ConfigBeanb - component bean needing inheritance realizedprotected Stack getGeneralizations(ComponentBean b)
Walks up the isA parent chain looking for circular
 relationships.  It returns a Stack of ComponentBean
 documenting the heritage.  A runtime exception is thrown if
 a circular relationship is found.
 
b - component bean having inheritance checked
protected Stack getAssociations(ComponentBean b)
Walks up the hasA parent chain looking for circular
 relationships.  It returns a Stack of ComponentBean
 documenting the composition.  A runtime exception is thrown if
 a circular relationship is found.
 
b - component bean having composition checked
protected StringBuffer describeRelationships(Stack heritage)
Returns a StringBuffer with an xpath like expression of
 jsfid that describes the Stack of ComponentBean.
 
heritage - stack of relationships to report on
protected void checkCircularInheritance(ComponentBean b)
Passed a ComponentBean, the method looks for several
 types of circular inheritances.  It's recursively called for all
 contained components, children, validators, actionListeners,
 valueChangeListeners and Converter. A runtime exception is
 thrown if a invalid relationship is found.
 
b - component bean to checkprotected void unassignParent(ComponentBean b)
Recursively called to unassign isA and hasA parent relationships.
b - component beanprotected void clear(String watchDogName)
Cleans up before a group of files are reloaded.
watchDogName - group name for a group of config files or templatespublic void destroy()
The destroy method is invoked to clean up resources. By dereferencing the complex graph of display elements
destroy in interface ConfigBeanpublic boolean validMoniker(String id)
Called by the ConfigBeanFactory to determine if this
 instance of ConfigBean can handle finding the ConfigBean
 from the jsfid.
validMoniker in interface ConfigBeanid - jsfid
true if the jsfid can be handledpublic int compareTo(Object config)
Implementation of the Comparable interface. The weight
 is used to determine the ordering of the registered ConfigBean
 objects within the ConfigBeanFactory.
 
compareTo in interface Comparableconfig - object to compare to
public int getWeight()
The weight is an attempt to make a plug-able system for
 registering ConfigBean objects with the ConfigBeanFactory.
 A custom implementation could be registered for a different composition
 technique adding or overriding an existing implementation.
 
getWeight in interface ConfigBean0public boolean refresh(boolean forceReload)
This method should be called from key points in the application to invoke
 automatic reloading of the configuration files if they have been modified since
 last reloaded.  If the forceReload flag is true the files are
 reloaded.  A true return value indicates the config files
 were reloaded.
refresh in interface ConfigBeanforceReload - reload the files
protected boolean isNamingContainer(String componentType)
Checks the componentType against the NAMING_CONTAINER_TYPES
 list to determine if it is a naming container. Component id's must be unique within a
 naming container.  Returns a true value if the componentType
 is a naming container; otherwise, returns false.
componentType - type of the component
true if the component type is a naming comtainerpublic void checkTree(ComponentBean b)
Recursively walks the tree of component metadata verifying
 there is not a duplicate component id within a naming container.
 A root ComponentBean is passed as a single parameter.
 The overloaded checkTree(List, ComponentBean) is
 invoked to process components under a naming container.
checkTree in interface ConfigBeanb - root of the component tree
protected void checkTree(List componentIds,
                         ComponentBean b)
Verifies there is not a duplicate component id within a naming container.
 A list of accumulating componentIds and a
 root ComponentBean is passed as parameters.  A runtime
 exception is thrown if a duplicate id is encountered.
componentIds - list of component id's in the naming containerb - parent component bean| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||