Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java?rev=356734&r1=356733&r2=356734&view=diff ============================================================================== --- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java (original) +++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java Tue Dec 13 21:14:36 2005 @@ -1,160 +1,160 @@ -/* - * Copyright 2004-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shale.tiger.managed.rules; - -import org.apache.commons.digester.Digester; -import org.apache.commons.digester.RuleSetBase; -import org.apache.shale.tiger.config.FacesConfigConfig; - -/** - * <p>Digester <code>RuleSet</code> for parsing managed bean declarations - * from a JavaServer Faces configuration file.</p> - * - * <p><strong>ASSERTION</strong> - The <code>Digester</code> stack is - * preinitialized with an instance of [EMAIL PROTECTED] FacesConfigConfig} prior - * to parsing being initiated.</p> - */ -public class ManagedBeansRuleSet extends RuleSetBase { - - /** Creates a new instance of ManagedBeansRuleSet */ - public ManagedBeansRuleSet() { - } - - - /** - * <p>Add the required <code>Rule</code> instances to parse - * managed bean declaration metadata.</p> - * - * @param digester Digester instance to which rules should be added - */ - public void addRuleInstances(Digester digester) { - - digester.addRule - ("faces-config/managed-bean", - new ManagedBeanRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-bean-name", - "setName", 0); - digester.addCallMethod - ("faces-config/managed-bean/managed-bean-class", - "setType", 0); - digester.addCallMethod - ("faces-config/managed-bean/managed-bean-scope", - "setScope", 0); - - digester.addRule - ("faces-config/managed-bean/managed-property", - new ManagedPropertyRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/property-name", - "setName", 0); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/property-class", - "setType", 0); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/value", - "setValue", 0); - digester.addRule - ("faces-config/managed-bean/managed-property/null-value", - new NullValueRule()); - - digester.addRule - ("faces-config/managed-bean/list-entries", - new ListEntriesRule()); - digester.addCallMethod - ("faces-config/managed-bean/list-entries/value-class", - "setValueType", 0); - digester.addRule - ("faces-config/managed-bean/list-entries/null-value", - new ListEntryRule()); - digester.addRule - ("faces-config/managed-bean/list-entries/null-value", - new NullValueRule()); - digester.addRule - ("faces-config/managed-bean/list-entries/value", - new ListEntryRule()); - digester.addCallMethod - ("faces-config/managed-bean/list-entries/value", - "setValue", 0); - - digester.addRule - ("faces-config/managed-bean/managed-property/list-entries", - new ListEntriesRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/list-entries/value-class", - "setValueType", 0); - digester.addRule - ("faces-config/managed-bean/managed-property/list-entries/null-value", - new ListEntryRule()); - digester.addRule - ("faces-config/managed-bean/managed-property/list-entries/null-value", - new NullValueRule()); - digester.addRule - ("faces-config/managed-bean/managed-property/list-entries/value", - new ListEntryRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/list-entries/value", - "setValue", 0); - - digester.addRule - ("faces-config/managed-bean/map-entries", - new MapEntriesRule()); - digester.addCallMethod - ("faces-config/managed-bean/map-entries/key-class", - "setKeyType", 0); - digester.addCallMethod - ("faces-config/managed-bean/map-entries/value-class", - "setValueType", 0); - digester.addRule - ("faces-config/managed-bean/map-entries/map-entry", - new MapEntryRule()); - digester.addCallMethod - ("faces-config/managed-bean/map-entries/map-entry/key", - "setKey", 0); - digester.addRule - ("faces-config/managed-bean/map-entries/map-entry/null-value", - new NullValueRule()); - digester.addCallMethod - ("faces-config/managed-bean/map-entries/map-entry/value", - "setValue", 0); - - digester.addRule - ("faces-config/managed-bean/managed-property/map-entries", - new MapEntriesRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/map-entries/key-class", - "setKeyType", 0); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/map-entries/value-class", - "setValueType", 0); - digester.addRule - ("faces-config/managed-bean/managed-property/map-entries/map-entry", - new MapEntryRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/map-entries/map-entry/key", - "setKey", 0); - digester.addRule - ("faces-config/managed-bean/managed-property/map-entries/map-entry/null-value", - new NullValueRule()); - digester.addCallMethod - ("faces-config/managed-bean/managed-property/map-entries/map-entry/value", - "setValue", 0); - - } - - -} +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shale.tiger.managed.rules; + +import org.apache.commons.digester.Digester; +import org.apache.commons.digester.RuleSetBase; +import org.apache.shale.tiger.config.FacesConfigConfig; + +/** + * <p>Digester <code>RuleSet</code> for parsing managed bean declarations + * from a JavaServer Faces configuration file.</p> + * + * <p><strong>ASSERTION</strong> - The <code>Digester</code> stack is + * preinitialized with an instance of [EMAIL PROTECTED] FacesConfigConfig} prior + * to parsing being initiated.</p> + */ +public class ManagedBeansRuleSet extends RuleSetBase { + + /** Creates a new instance of ManagedBeansRuleSet */ + public ManagedBeansRuleSet() { + } + + + /** + * <p>Add the required <code>Rule</code> instances to parse + * managed bean declaration metadata.</p> + * + * @param digester Digester instance to which rules should be added + */ + public void addRuleInstances(Digester digester) { + + digester.addRule + ("faces-config/managed-bean", + new ManagedBeanRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-bean-name", + "setName", 0); + digester.addCallMethod + ("faces-config/managed-bean/managed-bean-class", + "setType", 0); + digester.addCallMethod + ("faces-config/managed-bean/managed-bean-scope", + "setScope", 0); + + digester.addRule + ("faces-config/managed-bean/managed-property", + new ManagedPropertyRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/property-name", + "setName", 0); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/property-class", + "setType", 0); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/value", + "setValue", 0); + digester.addRule + ("faces-config/managed-bean/managed-property/null-value", + new NullValueRule()); + + digester.addRule + ("faces-config/managed-bean/list-entries", + new ListEntriesRule()); + digester.addCallMethod + ("faces-config/managed-bean/list-entries/value-class", + "setValueType", 0); + digester.addRule + ("faces-config/managed-bean/list-entries/null-value", + new ListEntryRule()); + digester.addRule + ("faces-config/managed-bean/list-entries/null-value", + new NullValueRule()); + digester.addRule + ("faces-config/managed-bean/list-entries/value", + new ListEntryRule()); + digester.addCallMethod + ("faces-config/managed-bean/list-entries/value", + "setValue", 0); + + digester.addRule + ("faces-config/managed-bean/managed-property/list-entries", + new ListEntriesRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/list-entries/value-class", + "setValueType", 0); + digester.addRule + ("faces-config/managed-bean/managed-property/list-entries/null-value", + new ListEntryRule()); + digester.addRule + ("faces-config/managed-bean/managed-property/list-entries/null-value", + new NullValueRule()); + digester.addRule + ("faces-config/managed-bean/managed-property/list-entries/value", + new ListEntryRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/list-entries/value", + "setValue", 0); + + digester.addRule + ("faces-config/managed-bean/map-entries", + new MapEntriesRule()); + digester.addCallMethod + ("faces-config/managed-bean/map-entries/key-class", + "setKeyType", 0); + digester.addCallMethod + ("faces-config/managed-bean/map-entries/value-class", + "setValueType", 0); + digester.addRule + ("faces-config/managed-bean/map-entries/map-entry", + new MapEntryRule()); + digester.addCallMethod + ("faces-config/managed-bean/map-entries/map-entry/key", + "setKey", 0); + digester.addRule + ("faces-config/managed-bean/map-entries/map-entry/null-value", + new NullValueRule()); + digester.addCallMethod + ("faces-config/managed-bean/map-entries/map-entry/value", + "setValue", 0); + + digester.addRule + ("faces-config/managed-bean/managed-property/map-entries", + new MapEntriesRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/map-entries/key-class", + "setKeyType", 0); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/map-entries/value-class", + "setValueType", 0); + digester.addRule + ("faces-config/managed-bean/managed-property/map-entries/map-entry", + new MapEntryRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/map-entries/map-entry/key", + "setKey", 0); + digester.addRule + ("faces-config/managed-bean/managed-property/map-entries/map-entry/null-value", + new NullValueRule()); + digester.addCallMethod + ("faces-config/managed-bean/managed-property/map-entries/map-entry/value", + "setValue", 0); + + } + + +}
Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedBeansRuleSet.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java?rev=356734&r1=356733&r2=356734&view=diff ============================================================================== --- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java (original) +++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java Tue Dec 13 21:14:36 2005 @@ -1,129 +1,129 @@ -/* - * Copyright 2004-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shale.tiger.managed.rules; - -import org.apache.commons.digester.Rule; -import org.apache.shale.tiger.managed.config.ManagedBeanConfig; -import org.apache.shale.tiger.managed.config.ManagedPropertyConfig; -import org.xml.sax.Attributes; - -/** - * <p>Digester rule for processing a <code><managed-property></code> - * element.</p> - */ -public class ManagedPropertyRule extends Rule { - - /** Creates a new instance of ManagedPropertyRule */ - public ManagedPropertyRule() { - } - - /** <p>Fully qualified class name of our configuration element bean.</p> */ - private static final String CLASS_NAME = - "org.apache.shale.tiger.managed.config.ManagedPropertyConfig"; - - /** - * <p>Create a new [EMAIL PROTECTED] ManagedPropertyConfig} and push it on to the - * Digester stack.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * @param attributes Attribute list of the matching element - * - * @exception Exception if a parsing error occurs - */ - public void begin(String namespace, String name, - Attributes attributes) throws Exception { - - Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); - digester.push(clazz.newInstance()); - - } - - - /** - * <p>No body processing for this element.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @throws Exception if a parsing error occurs - */ - public void body(String namespace, String name) throws Exception { - } - - - /** - * <p>Pop the [EMAIL PROTECTED] ManagedPropertyConfig} instance from the stack, - * and either add it or merge it with parent information.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @exception IllegalStateException if the popped object is not - * of the correct type - */ - public void end(String namespace, String name) throws Exception { - - ManagedPropertyConfig config = (ManagedPropertyConfig) digester.pop(); - ManagedBeanConfig parent = (ManagedBeanConfig) digester.peek(); - ManagedPropertyConfig previous = parent.getProperty(config.getName()); - if (previous == null) { - parent.addProperty(config); - } else { - merge(config, previous); - } - - } - - - /** - * <p>Merge properties from <code>config</code> into - * <code>previous</code>.</p> - * - * @param config Newly constructed bean - * @param previous Previous bean to merge into - */ - static void merge(ManagedPropertyConfig config, ManagedPropertyConfig previous) { - - if (config.getType() != null) { - previous.setType(config.getType()); - } - if (config.getValue() != null) { - previous.setValue(config.getValue()); - } - if (config.isNullValue()) { - previous.setNullValue(true); - } - if (config.getListEntries() != null) { - if (previous.getListEntries() != null) { - ListEntriesRule.merge(config.getListEntries(), previous.getListEntries()); - } else { - previous.setListEntries(config.getListEntries()); - } - } - if (config.getMapEntries() != null) { - if (previous.getMapEntries() != null) { - MapEntriesRule.merge(config.getMapEntries(), previous.getMapEntries()); - } else { - previous.setMapEntries(config.getMapEntries()); - } - } - - } - - -} +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shale.tiger.managed.rules; + +import org.apache.commons.digester.Rule; +import org.apache.shale.tiger.managed.config.ManagedBeanConfig; +import org.apache.shale.tiger.managed.config.ManagedPropertyConfig; +import org.xml.sax.Attributes; + +/** + * <p>Digester rule for processing a <code><managed-property></code> + * element.</p> + */ +public class ManagedPropertyRule extends Rule { + + /** Creates a new instance of ManagedPropertyRule */ + public ManagedPropertyRule() { + } + + /** <p>Fully qualified class name of our configuration element bean.</p> */ + private static final String CLASS_NAME = + "org.apache.shale.tiger.managed.config.ManagedPropertyConfig"; + + /** + * <p>Create a new [EMAIL PROTECTED] ManagedPropertyConfig} and push it on to the + * Digester stack.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * @param attributes Attribute list of the matching element + * + * @exception Exception if a parsing error occurs + */ + public void begin(String namespace, String name, + Attributes attributes) throws Exception { + + Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); + digester.push(clazz.newInstance()); + + } + + + /** + * <p>No body processing for this element.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @throws Exception if a parsing error occurs + */ + public void body(String namespace, String name) throws Exception { + } + + + /** + * <p>Pop the [EMAIL PROTECTED] ManagedPropertyConfig} instance from the stack, + * and either add it or merge it with parent information.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @exception IllegalStateException if the popped object is not + * of the correct type + */ + public void end(String namespace, String name) throws Exception { + + ManagedPropertyConfig config = (ManagedPropertyConfig) digester.pop(); + ManagedBeanConfig parent = (ManagedBeanConfig) digester.peek(); + ManagedPropertyConfig previous = parent.getProperty(config.getName()); + if (previous == null) { + parent.addProperty(config); + } else { + merge(config, previous); + } + + } + + + /** + * <p>Merge properties from <code>config</code> into + * <code>previous</code>.</p> + * + * @param config Newly constructed bean + * @param previous Previous bean to merge into + */ + static void merge(ManagedPropertyConfig config, ManagedPropertyConfig previous) { + + if (config.getType() != null) { + previous.setType(config.getType()); + } + if (config.getValue() != null) { + previous.setValue(config.getValue()); + } + if (config.isNullValue()) { + previous.setNullValue(true); + } + if (config.getListEntries() != null) { + if (previous.getListEntries() != null) { + ListEntriesRule.merge(config.getListEntries(), previous.getListEntries()); + } else { + previous.setListEntries(config.getListEntries()); + } + } + if (config.getMapEntries() != null) { + if (previous.getMapEntries() != null) { + MapEntriesRule.merge(config.getMapEntries(), previous.getMapEntries()); + } else { + previous.setMapEntries(config.getMapEntries()); + } + } + + } + + +} Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/ManagedPropertyRule.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java?rev=356734&r1=356733&r2=356734&view=diff ============================================================================== --- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java (original) +++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java Tue Dec 13 21:14:36 2005 @@ -1,113 +1,113 @@ -/* - * Copyright 2004-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shale.tiger.managed.rules; - -import org.apache.commons.digester.Rule; -import org.apache.shale.tiger.managed.config.MapEntriesConfig; -import org.apache.shale.tiger.managed.config.MapEntriesHolder; -import org.xml.sax.Attributes; - -/** - * <p>Digester rule for processing a <code><map-entries></code> - * element.</p> - */ -public class MapEntriesRule extends Rule { - - /** Creates a new instance of MapEntriesRule */ - public MapEntriesRule() { - } - - /** <p>Fully qualified class name of our configuration element bean.</p> */ - private static final String CLASS_NAME = - "org.apache.shale.tiger.managed.config.MapEntriesConfig"; - - /** - * <p>Create a new [EMAIL PROTECTED] MapEntriesConfig} and push it on to the - * Digester stack.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * @param attributes Attribute list of the matching element - * - * @exception Exception if a parsing error occurs - */ - public void begin(String namespace, String name, - Attributes attributes) throws Exception { - - Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); - digester.push(clazz.newInstance()); - - } - - - /** - * <p>No body processing for this element.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @throws Exception if a parsing error occurs - */ - public void body(String namespace, String name) throws Exception { - } - - - /** - * <p>Pop the [EMAIL PROTECTED] MapEntriesConfig} instance from the stack, - * and either add it or merge it with parent information.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @exception IllegalStateException if the popped object is not - * of the correct type - */ - public void end(String namespace, String name) throws Exception { - - MapEntriesConfig config = (MapEntriesConfig) digester.pop(); - MapEntriesHolder parent = (MapEntriesHolder) digester.peek(); - MapEntriesConfig previous = (MapEntriesConfig) parent.getMapEntries(); - if (previous == null) { - parent.setMapEntries(config); - } else { - merge(config, previous); - } - - } - - - /** - * <p>Merge properties from <code>config</code> into - * <code>previous</code>.</p> - * - * @param config Newly constructed bean - * @param previous Previous bean to merge into - */ - static void merge(MapEntriesConfig config, MapEntriesConfig previous) { - - if (config.getKeyType() != null) { - previous.setKeyType(config.getKeyType()); - } - if (config.getValueType() != null) { - previous.setValueType(config.getValueType()); - } - previous.getEntries().addAll(config.getEntries()); - - } - - -} +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shale.tiger.managed.rules; + +import org.apache.commons.digester.Rule; +import org.apache.shale.tiger.managed.config.MapEntriesConfig; +import org.apache.shale.tiger.managed.config.MapEntriesHolder; +import org.xml.sax.Attributes; + +/** + * <p>Digester rule for processing a <code><map-entries></code> + * element.</p> + */ +public class MapEntriesRule extends Rule { + + /** Creates a new instance of MapEntriesRule */ + public MapEntriesRule() { + } + + /** <p>Fully qualified class name of our configuration element bean.</p> */ + private static final String CLASS_NAME = + "org.apache.shale.tiger.managed.config.MapEntriesConfig"; + + /** + * <p>Create a new [EMAIL PROTECTED] MapEntriesConfig} and push it on to the + * Digester stack.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * @param attributes Attribute list of the matching element + * + * @exception Exception if a parsing error occurs + */ + public void begin(String namespace, String name, + Attributes attributes) throws Exception { + + Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); + digester.push(clazz.newInstance()); + + } + + + /** + * <p>No body processing for this element.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @throws Exception if a parsing error occurs + */ + public void body(String namespace, String name) throws Exception { + } + + + /** + * <p>Pop the [EMAIL PROTECTED] MapEntriesConfig} instance from the stack, + * and either add it or merge it with parent information.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @exception IllegalStateException if the popped object is not + * of the correct type + */ + public void end(String namespace, String name) throws Exception { + + MapEntriesConfig config = (MapEntriesConfig) digester.pop(); + MapEntriesHolder parent = (MapEntriesHolder) digester.peek(); + MapEntriesConfig previous = (MapEntriesConfig) parent.getMapEntries(); + if (previous == null) { + parent.setMapEntries(config); + } else { + merge(config, previous); + } + + } + + + /** + * <p>Merge properties from <code>config</code> into + * <code>previous</code>.</p> + * + * @param config Newly constructed bean + * @param previous Previous bean to merge into + */ + static void merge(MapEntriesConfig config, MapEntriesConfig previous) { + + if (config.getKeyType() != null) { + previous.setKeyType(config.getKeyType()); + } + if (config.getValueType() != null) { + previous.setValueType(config.getValueType()); + } + previous.getEntries().addAll(config.getEntries()); + + } + + +} Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntriesRule.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java?rev=356734&r1=356733&r2=356734&view=diff ============================================================================== --- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java (original) +++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java Tue Dec 13 21:14:36 2005 @@ -1,107 +1,107 @@ -/* - * Copyright 2004-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shale.tiger.managed.rules; - -import org.apache.commons.digester.Rule; -import org.apache.shale.tiger.managed.config.MapEntriesConfig; -import org.apache.shale.tiger.managed.config.MapEntryConfig; -import org.xml.sax.Attributes; - -/** - * <p>Digester rule for processing a <code><map-entry></code> - * element.</p> - */ -public class MapEntryRule extends Rule { - - /** Creates a new instance of MapEntryRule */ - public MapEntryRule() { - } - - /** <p>Fully qualified class name of our configuration element bean.</p> */ - private static final String CLASS_NAME = - "org.apache.shale.tiger.managed.config.MapEntryConfig"; - - /** - * <p>Create a new [EMAIL PROTECTED] MapEntryConfig} and push it on to the - * Digester stack.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * @param attributes Attribute list of the matching element - * - * @exception Exception if a parsing error occurs - */ - public void begin(String namespace, String name, - Attributes attributes) throws Exception { - - Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); - digester.push(clazz.newInstance()); - - } - - - /** - * <p>No body processing for this element.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @throws Exception if a parsing error occurs - */ - public void body(String namespace, String name) throws Exception { - } - - - /** - * <p>Pop the [EMAIL PROTECTED] MapEntriesConfig} instance from the stack, - * and either add it or merge it with parent information.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @exception IllegalStateException if the popped object is not - * of the correct type - */ - public void end(String namespace, String name) throws Exception { - - MapEntryConfig config = (MapEntryConfig) digester.pop(); - MapEntriesConfig parent = (MapEntriesConfig) digester.peek(); - MapEntryConfig previous = parent.getEntry(config.getKey()); - if (previous == null) { - parent.addEntry(config); - } else { - merge(config, previous); - } - - } - - - /** - * <p>Merge properties from <code>config</code> into - * <code>previous</code>.</p> - * - * @param config Newly constructed bean - * @param previous Previous bean to merge into - */ - static void merge(MapEntryConfig config, MapEntryConfig previous) { - - previous.setValue(config.getValue()); - - } - - -} +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shale.tiger.managed.rules; + +import org.apache.commons.digester.Rule; +import org.apache.shale.tiger.managed.config.MapEntriesConfig; +import org.apache.shale.tiger.managed.config.MapEntryConfig; +import org.xml.sax.Attributes; + +/** + * <p>Digester rule for processing a <code><map-entry></code> + * element.</p> + */ +public class MapEntryRule extends Rule { + + /** Creates a new instance of MapEntryRule */ + public MapEntryRule() { + } + + /** <p>Fully qualified class name of our configuration element bean.</p> */ + private static final String CLASS_NAME = + "org.apache.shale.tiger.managed.config.MapEntryConfig"; + + /** + * <p>Create a new [EMAIL PROTECTED] MapEntryConfig} and push it on to the + * Digester stack.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * @param attributes Attribute list of the matching element + * + * @exception Exception if a parsing error occurs + */ + public void begin(String namespace, String name, + Attributes attributes) throws Exception { + + Class clazz = digester.getClassLoader().loadClass(CLASS_NAME); + digester.push(clazz.newInstance()); + + } + + + /** + * <p>No body processing for this element.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @throws Exception if a parsing error occurs + */ + public void body(String namespace, String name) throws Exception { + } + + + /** + * <p>Pop the [EMAIL PROTECTED] MapEntriesConfig} instance from the stack, + * and either add it or merge it with parent information.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @exception IllegalStateException if the popped object is not + * of the correct type + */ + public void end(String namespace, String name) throws Exception { + + MapEntryConfig config = (MapEntryConfig) digester.pop(); + MapEntriesConfig parent = (MapEntriesConfig) digester.peek(); + MapEntryConfig previous = parent.getEntry(config.getKey()); + if (previous == null) { + parent.addEntry(config); + } else { + merge(config, previous); + } + + } + + + /** + * <p>Merge properties from <code>config</code> into + * <code>previous</code>.</p> + * + * @param config Newly constructed bean + * @param previous Previous bean to merge into + */ + static void merge(MapEntryConfig config, MapEntryConfig previous) { + + previous.setValue(config.getValue()); + + } + + +} Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/MapEntryRule.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Modified: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java URL: http://svn.apache.org/viewcvs/struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java?rev=356734&r1=356733&r2=356734&view=diff ============================================================================== --- struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java (original) +++ struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java Tue Dec 13 21:14:36 2005 @@ -1,77 +1,77 @@ -/* - * Copyright 2004-2005 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.shale.tiger.managed.rules; - -import org.apache.commons.digester.Rule; -import org.apache.shale.tiger.managed.config.NullValueHolder; -import org.xml.sax.Attributes; - -/** - * <p>Digester rule for processing a <code><null-value></code> - * element.</p> - */ -public class NullValueRule extends Rule { - - /** Creates a new instance of NullValueRule */ - public NullValueRule() { - } - - /** - * <p>Set the <code>nullValue</code> property on the containing - * <code>NullValueHolder</code>.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * @param attributes Attribute list of the matching element - * - * @exception Exception if a parsing error occurs - */ - public void begin(String namespace, String name, - Attributes attributes) throws Exception { - - NullValueHolder config = (NullValueHolder) digester.peek(); - config.setNullValue(true); - - } - - - /** - * <p>No body processing for this element.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @throws Exception if a parsing error occurs - */ - public void body(String namespace, String name) throws Exception { - } - - - /** - * <p>No end processing for this element.</p> - * - * @param namespace Namespace URI of the matching element - * @param name Local name of the matching element - * - * @exception IllegalStateException if the popped object is not - * of the correct type - */ - public void end(String namespace, String name) throws Exception { - } - - -} +/* + * Copyright 2004-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.shale.tiger.managed.rules; + +import org.apache.commons.digester.Rule; +import org.apache.shale.tiger.managed.config.NullValueHolder; +import org.xml.sax.Attributes; + +/** + * <p>Digester rule for processing a <code><null-value></code> + * element.</p> + */ +public class NullValueRule extends Rule { + + /** Creates a new instance of NullValueRule */ + public NullValueRule() { + } + + /** + * <p>Set the <code>nullValue</code> property on the containing + * <code>NullValueHolder</code>.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * @param attributes Attribute list of the matching element + * + * @exception Exception if a parsing error occurs + */ + public void begin(String namespace, String name, + Attributes attributes) throws Exception { + + NullValueHolder config = (NullValueHolder) digester.peek(); + config.setNullValue(true); + + } + + + /** + * <p>No body processing for this element.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @throws Exception if a parsing error occurs + */ + public void body(String namespace, String name) throws Exception { + } + + + /** + * <p>No end processing for this element.</p> + * + * @param namespace Namespace URI of the matching element + * @param name Local name of the matching element + * + * @exception IllegalStateException if the popped object is not + * of the correct type + */ + public void end(String namespace, String name) throws Exception { + } + + +} Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/NullValueRule.java ------------------------------------------------------------------------------ svn:keywords = Date Author Id Revision HeadURL Propchange: struts/shale/trunk/tiger/src/java/org/apache/shale/tiger/managed/rules/package.html ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]