Author: gvanmatre
Date: Thu Nov 9 14:26:21 2006
New Revision: 473102
URL: http://svn.apache.org/viewvc?view=rev&rev=473102
Log:
Added an extra hook in the Clay commons chains flow that builds the sub
component tree. You an now register handlers in the "clayCustomization"
catalog to address specialized components.
For example, if you had a component that required a unique method binding you
could register a commons chain handler to address the need (SHALE-326).
An example chains config snippet:
<catalog name="clayCustomization">
<!-- custom method binding attriubte handler -->
<chain name="attributeChangeListener">
<command
className="org.apache.shale.clay.component.chain.trinidad.AttributeChangeListenerCommand"/>
</chain>
<!-- custom html namespaces-->
<chain name="http://myfaces.apache.org/trinidad">
<command
className="org.apache.shale.clay.parser.builder.chain.JsfDefaultBuilderRule"
prefix="tr" />
</chain>
<chain name="http://myfaces.apache.org/trinidad/html">
<command
className="org.apache.shale.clay.parser.builder.chain.JsfDefaultBuilderRule"
prefix="trh" />
</chain>
</catalog>
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AbstractCommand.java
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AbstractCommand.java
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AbstractCommand.java?view=diff&rev=473102&r1=473101&r2=473102
==============================================================================
---
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AbstractCommand.java
(original)
+++
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AbstractCommand.java
Thu Nov 9 14:26:21 2006
@@ -111,6 +111,24 @@
/**
* <p>
+ * Returns the [EMAIL PROTECTED] Catalog} from the
+ * <code>Globals.CLAY_CUSTOMIZATION_CATALOG_NAME</code> in the
+ * <code>Globals.CLAY_RESOURCE_NAME</code> configuration file.
+ * </p>
+ *
+ * @return commons chains customizations catalog
+ * @exception Exception finding customizations catalog
+ */
+ protected Catalog getCustomizationCatalog() throws Exception {
+
+ Catalog catalog = CatalogFactory.getInstance().getCatalog(
+ Globals.CLAY_CUSTOMIZATION_CATALOG_NAME);
+
+ return catalog;
+ }
+
+ /**
+ * <p>
* This call is used to substitue an attribute binding expression
containing
* the <code>symbols</code> with the target property value in the [EMAIL
PROTECTED] ClayContext}.
* The current attribute within the context is assumed.
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java?view=diff&rev=473102&r1=473101&r2=473102
==============================================================================
---
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
(original)
+++
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/component/chain/AssignPropertiesCommand.java
Thu Nov 9 14:26:21 2006
@@ -84,15 +84,26 @@
}
Iterator ai = displayElement.getAttributeIterator();
- Catalog catalog = getCatalog();
- Command defaultCommand =
catalog.getCommand(Globals.SET_ATTRIBUTE_COMMAND_NAME);
+ Catalog defaultCatalog = getCatalog();
+ Catalog customizationCatalog = getCustomizationCatalog();
+
+ Command defaultCommand =
defaultCatalog.getCommand(Globals.SET_ATTRIBUTE_COMMAND_NAME);
next: while (ai.hasNext()) {
AttributeBean a = (AttributeBean) ai.next();
if (a.getValue() == null) {
continue next;
}
- Command command = catalog.getCommand(a.getName());
+ Command command = null;
+ //look for a command override in the customization catalog first
+ if (customizationCatalog != null) {
+ command = customizationCatalog.getCommand(a.getName());
+ }
+ //look for a command override in the defaut catalog
+ if (command == null) {
+ command = defaultCatalog.getCommand(a.getName());
+ }
+ //use the default command
if (command == null) {
command = defaultCommand;
}
Modified:
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
URL:
http://svn.apache.org/viewvc/shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java?view=diff&rev=473102&r1=473101&r2=473102
==============================================================================
---
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
(original)
+++
shale/framework/trunk/shale-clay/src/main/java/org/apache/shale/clay/config/Globals.java
Thu Nov 9 14:26:21 2006
@@ -151,6 +151,14 @@
public static final String CLAY_CATALOG_NAME = "clay";
/**
+ * <p>The customization catalog name used to configure the chain
+ * workflow for building the clay subtree from a object
+ * graph of metadata.
+ *</p>
+ */
+ public static final String CLAY_CUSTOMIZATION_CATALOG_NAME =
"clayCustomization";
+
+ /**
* <p>Chain subchain command invoked by the [EMAIL PROTECTED]
org.apache.shale.clay.component.chain.AssignPropertiesCommand}
* to assign the attributes to the components. There are five subcommands
* under this chain that handle the associated attributes.