commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1070823 - in /commons/sandbox/digester3/trunk/src/main: java/org/apache/commons/digester3/xmlrules/ java/org/apache/commons/digester3/xmlrules/metaparser/ resources/org/apache/commons/digester3/xmlrules/
Date Tue, 15 Feb 2011 09:42:49 GMT
Author: simonetripodi
Date: Tue Feb 15 09:42:48 2011
New Revision: 1070823

URL: http://svn.apache.org/viewvc?rev=1070823&view=rev
Log:
started importing the 'xmlruleset' package, ad adapted verison of the proper one on /trunk, using the RulesModule and no more dedicated Loader, using the on on root

Added:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java   (with props)
Modified:
    commons/sandbox/digester3/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,97 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules;
+
+import static org.apache.commons.digester3.DigesterLoader.newLoader;
+
+import java.net.URL;
+
+import org.apache.commons.digester3.DigesterLoadingException;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.xmlrules.metaparser.XmlRulesModule;
+
+/**
+ * 
+ */
+public final class FromXmlRulesModule implements RulesModule {
+
+    private static final String DIGESTER_PUBLIC_ID = "-//Apache Commons //DTD digester-rules XML V2.0//EN";
+
+    private  static final String DIGESTER_DTD_PATH = "digester-rules.dtd";
+
+    private final URL xmlRules;
+
+    private URL xmlRulesDtdUrl = this.getClass().getResource(DIGESTER_DTD_PATH);
+
+    public FromXmlRulesModule(String path) {
+        this(path, Thread.currentThread().getContextClassLoader());
+    }
+
+    public FromXmlRulesModule(String path, ClassLoader classLoader) {
+        if (path == null) {
+            throw new DigesterLoadingException("Parameter 'path' must not be null");
+        }
+        if (classLoader == null) {
+            classLoader = this.getClass().getClassLoader();
+        }
+        URL xmlRules = classLoader.getResource(path);
+        if (xmlRules == null) {
+            throw new DigesterLoadingException(String.format("XML Rules '%s' not found on ", path));
+        }
+        this.xmlRules = xmlRules;
+    }
+
+    public FromXmlRulesModule(URL xmlRules) {
+        if (xmlRules == null) {
+            throw new DigesterLoadingException("Parameter 'xmlRules' must not be null");
+        }
+        this.xmlRules = xmlRules;
+    }
+
+    public void setXmlRulesDtdUrl(URL xmlRulesDtdUrl) {
+        if (xmlRulesDtdUrl == null) {
+            throw new IllegalArgumentException("Parameter 'xmlRulesDtdUrl' must be not null");
+        }
+        this.xmlRulesDtdUrl = xmlRulesDtdUrl;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void configure(RulesBinder rulesBinder) {
+        try {
+            newLoader(new XmlRulesModule(rulesBinder))
+                .register(DIGESTER_PUBLIC_ID, this.xmlRulesDtdUrl.toString())
+                .setXIncludeAware(true)
+                .newDigester()
+                .parse(this.xmlRules);
+        } catch (Exception e) {
+            rulesBinder.addError("Impossible to load XML defined in the URL '%s': %s", this.xmlRules, e.getMessage());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return String.format("FromXmlRulesModule[%s]", this.xmlRules);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/FromXmlRulesModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,56 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+abstract class AbstractXmlMethodRule extends AbstractXmlRule {
+
+    public AbstractXmlMethodRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected final void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        String methodName = attributes.getValue("methodname");
+        String paramType = attributes.getValue("paramtype");
+
+        ParamTypeBuilder<? extends Rule> builder = this.createBuilder(linkedRuleBuilder, methodName);
+        if (paramType != null && paramType.length() > 0) {
+            builder.withParameterType(paramType);
+        }
+    }
+
+    /**
+     * 
+     * @param methodName
+     * @return
+     */
+    protected abstract ParamTypeBuilder<? extends Rule> createBuilder(LinkedRuleBuilder linkedRuleBuilder, String methodName);
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlMethodRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,52 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+abstract class AbstractXmlRule extends PatternRule {
+
+    private final RulesBinder targetRulesBinder;
+
+    public AbstractXmlRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super("pattern", patternStack);
+        this.targetRulesBinder = targetRulesBinder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void begin(String namespace, String name, Attributes attributes) throws Exception {
+        super.begin(namespace, name, attributes);
+        this.targetRulesBinder.forPattern(this.getMatchingPattern());
+    }
+
+    /**
+     * 
+     * @param linkedRuleBuilder
+     * @param attributes
+     */
+    protected abstract void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception;
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/AbstractXmlRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,41 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class BeanPropertySetterRule extends AbstractXmlRule {
+
+    public BeanPropertySetterRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        linkedRuleBuilder.setBeanProperty().withName(attributes.getValue("propertyname"));
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/BeanPropertySetterRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,73 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import java.util.StringTokenizer;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.CallMethodBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class CallMethodRule extends AbstractXmlRule {
+
+    public CallMethodRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        CallMethodBuilder builder = linkedRuleBuilder.callMethod(attributes.getValue("methodname"));
+
+        // Select which element is to be the target. Default to zero,
+        // ie the top object on the stack.
+        int targetOffset = 0;
+        String targetOffsetStr = attributes.getValue("targetoffset");
+        if (targetOffsetStr != null) {
+            targetOffset = Integer.parseInt(targetOffsetStr);
+            builder.withTargetOffset(targetOffset);
+        }
+
+        String paramCountStr = attributes.getValue("paramcount");
+        if (paramCountStr != null) {
+            int paramCount = Integer.parseInt(attributes.getValue("paramcount"));
+
+            builder.withParamCount(paramCount);
+
+            String paramTypesStr = attributes.getValue("paramtypes");
+            if (paramTypesStr != null && paramTypesStr.length() > 0) {
+                StringTokenizer tokens = new StringTokenizer(paramTypesStr, " \t\n\r,");
+                String[] paramTypeNames = new String[tokens.countTokens()];
+                int counter = 0;
+                while (tokens.hasMoreTokens()) {
+                    paramTypeNames[counter++] = tokens.nextToken();
+                }
+                builder.withParamTypes(paramTypeNames);
+            }
+        } else {
+            builder.usingElementBodyAsArgument();
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallMethodRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,62 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.CallParamBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class CallParamRule extends AbstractXmlRule {
+
+    public CallParamRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        int paramIndex = Integer.parseInt(attributes.getValue("paramnumber"));
+        CallParamBuilder builder = linkedRuleBuilder.callParam().ofIndex(paramIndex);
+
+        String attributeName = attributes.getValue("attrname");
+        String fromStack = attributes.getValue("from-stack");
+        String stackIndex = attributes.getValue("stack-index");
+
+        if (attributeName == null) {
+            if (stackIndex != null) {
+                builder.withStackIndex(Integer.parseInt(stackIndex));
+            } else if (fromStack != null) {
+                builder.fromStack(Boolean.valueOf(fromStack).booleanValue());
+            }
+        } else {
+            if (fromStack == null) {
+                builder.fromAttribute(attributeName);
+            } else {
+                // specifying both from-stack and attribute name is not allowed
+                throw new RuntimeException("Attributes from-stack and attrname cannot both be present.");
+            }
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/CallParamRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class FactoryCreateRule extends AbstractXmlRule {
+
+    public FactoryCreateRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        linkedRuleBuilder.factoryCreate()
+            .ofType(attributes.getValue("classname"))
+            .overriddenByAttribute(attributes.getValue("attrname"))
+            .ignoreCreateExceptions("true".equalsIgnoreCase(attributes.getValue("ignore-exceptions")));
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/FactoryCreateRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,85 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.DigesterLoadingException;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.xmlrules.FromXmlRulesModule;
+import org.xml.sax.Attributes;
+
+/**
+ * A rule for including one rules XML file within another. Included files
+ * behave as if they are 'macro-expanded' within the includer. This means
+ * that the values of the pattern stack are prefixed to every pattern
+ * in the included rules. <p>This rule will detect 'circular' includes,
+ * which would result in infinite recursion. It throws a
+ * CircularIncludeException when a cycle is detected, which will terminate
+ * the parse.
+ */
+final class IncludeRule extends Rule {
+
+    private final WithMemoryRulesBinder memoryRulesBinder;
+
+    private final RulesBinder targetRulesBinder;
+
+    public IncludeRule(final WithMemoryRulesBinder memoryRulesBinder, final RulesBinder targetRulesBinder) {
+        this.memoryRulesBinder = memoryRulesBinder;
+        this.targetRulesBinder = targetRulesBinder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void begin(String namespace, String name, Attributes attributes) throws Exception {
+        // The path attribute gives the URI to another digester rules xml file
+        String fileName = attributes.getValue("path");
+        if (fileName != null && fileName.length() > 0) {
+            if (!this.memoryRulesBinder.getIncludedFiles().add(fileName)) {
+                throw new DigesterLoadingException("Circular file inclusion detected for file: " + fileName);
+            }
+            this.memoryRulesBinder.install(new FromXmlRulesModule(fileName));
+        }
+
+        // The class attribute gives the name of a class that implements
+        // the DigesterRulesSource interface
+        String className = attributes.getValue("class");
+        if (className != null && className.length() > 0) {
+            try {
+                Class<?> cls = Class.forName(className);
+                if (!RulesModule.class.isAssignableFrom(cls)) {
+                    this.targetRulesBinder.addError("Class '%s' if not a '%s' implementation",
+                            className,
+                            RulesModule.class.getName());
+                    return;
+                }
+
+                RulesModule rulesSource = (RulesModule) cls.newInstance();
+
+                this.targetRulesBinder.install(rulesSource);
+            } catch (Exception e) {
+                this.targetRulesBinder.addError("Impossible to include programmatic rules from class '%s': %s",
+                        className,
+                        e.getMessage());
+            }
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/IncludeRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,43 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class ObjectCreateRule extends AbstractXmlRule {
+
+    public ObjectCreateRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        linkedRuleBuilder.createObject()
+            .ofType(attributes.getValue("classname"))
+            .ofTypeSpecifiedByAttribute(attributes.getValue("attrname"));
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectCreateRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,67 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ObjectParamBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class ObjectParamRule extends AbstractXmlRule {
+
+    public ObjectParamRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        // create callparamrule
+        int paramIndex = Integer.parseInt(attributes.getValue("paramnumber"));
+
+        String attributeName = attributes.getValue("attrname");
+        String type = attributes.getValue("type");
+        String value = attributes.getValue("value");
+
+        // type name is requried
+        if (type == null) {
+            throw new RuntimeException("Attribute 'type' is required.");
+        }
+
+        // create object instance
+        Object param = null;
+        Class<?> clazz = Class.forName(type);
+        if (value == null) {
+            param = clazz.newInstance();
+        } else {
+            param = ConvertUtils.convert(value, clazz);
+        }
+
+        ObjectParamBuilder<?> builder = linkedRuleBuilder.objectParam(param).ofIndex(paramIndex);
+        if (attributeName != null) {
+            builder.matchingAttribute(attributeName);
+        }
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/ObjectParamRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,72 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+class PatternRule extends Rule {
+
+    private final String attributeName;
+
+    private final PatternStack patternStack;
+
+    private String pattern;
+
+    public PatternRule(PatternStack patternStack) {
+        this("value", patternStack);
+    }
+
+    public PatternRule(String attributeName, PatternStack patternStack) {
+        this.attributeName = attributeName;
+        this.patternStack = patternStack;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void begin(String namespace, String name, Attributes attributes) throws Exception {
+        this.pattern = attributes.getValue(this.attributeName);
+        if (this.pattern != null) {
+            this.patternStack.push(pattern);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void end(String namespace, String name) throws Exception {
+        if (this.pattern != null) {
+            this.patternStack.pop();
+        }
+    }
+
+    /**
+     * 
+     * @return
+     */
+    protected String getMatchingPattern() {
+        return this.patternStack.toString();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,46 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import java.util.Stack;
+
+/**
+ * 
+ *
+ * @param <E>
+ */
+final class PatternStack extends Stack<String> {
+
+    private static final long serialVersionUID = 1L;
+
+    @Override
+    public String toString() {
+        StringBuilder str = new StringBuilder();
+        for (int i = 0; i < size(); i++) {
+            String elem = get(i);
+            if (elem.length() > 0) {
+                if (str.length() > 0) {
+                    str.append('/');
+                }
+                str.append(elem);
+            }
+        }
+        return str.toString();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/PatternStack.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class SetNestedPropertiesAliasRule extends AbstractXmlRule {
+
+    public SetNestedPropertiesAliasRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        String elementName = attributes.getValue("attr-name");
+        String propertyName = attributes.getValue("prop-name");
+
+        linkedRuleBuilder.setNestedProperties().addAlias(elementName, propertyName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,42 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class SetNestedPropertiesRule extends AbstractXmlRule {
+
+    public SetNestedPropertiesRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        boolean allowUnknownChildElements = "true".equalsIgnoreCase(attributes.getValue("allow-unknown-child-elements"));
+        linkedRuleBuilder.setNestedProperties().allowUnknownChildElements(allowUnknownChildElements);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,47 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder;
+
+/**
+ * 
+ */
+final class SetNextRule extends AbstractXmlMethodRule {
+
+    /**
+     * 
+     * @param targetRulesBinder
+     * @param patternStack
+     */
+    public SetNextRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ParamTypeBuilder<? extends Rule> createBuilder(LinkedRuleBuilder linkedRuleBuilder, String methodName) {
+        return linkedRuleBuilder.setNext(methodName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetNextRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,44 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class SetPropertiesAliasRule extends AbstractXmlRule {
+
+    public SetPropertiesAliasRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        String attributeName = attributes.getValue("attr-name");
+        String propertyName = attributes.getValue("prop-name");
+
+        linkedRuleBuilder.setProperties().addAlias(attributeName, propertyName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesAliasRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,42 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class SetPropertiesRule extends AbstractXmlRule {
+
+    public SetPropertiesRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        boolean ignoreMissingProperty = "true".equalsIgnoreCase(attributes.getValue("ignore-missing-property"));
+        linkedRuleBuilder.setProperties().ignoreMissingProperty(ignoreMissingProperty);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertiesRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,43 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.xml.sax.Attributes;
+
+/**
+ * 
+ */
+final class SetPropertyRule extends AbstractXmlRule {
+
+    public SetPropertyRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void bindRule(LinkedRuleBuilder linkedRuleBuilder, Attributes attributes) throws Exception {
+        String name = attributes.getValue("name");
+        String value = attributes.getValue("value");
+        linkedRuleBuilder.setProperty(name).extractingValueFromAttribute(value);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetPropertyRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,47 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder;
+
+/**
+ * 
+ */
+final class SetRootRule extends AbstractXmlMethodRule {
+
+    /**
+     * 
+     * @param targetRulesBinder
+     * @param patternStack
+     */
+    public SetRootRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ParamTypeBuilder<? extends Rule> createBuilder(LinkedRuleBuilder linkedRuleBuilder, String methodName) {
+        return linkedRuleBuilder.setRoot(methodName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetRootRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,47 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder;
+
+/**
+ * 
+ */
+final class SetTopRule extends AbstractXmlMethodRule {
+
+    /**
+     * 
+     * @param targetRulesBinder
+     * @param patternStack
+     */
+    public SetTopRule(RulesBinder targetRulesBinder, PatternStack patternStack) {
+        super(targetRulesBinder, patternStack);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ParamTypeBuilder<? extends Rule> createBuilder(LinkedRuleBuilder linkedRuleBuilder, String methodName) {
+        return linkedRuleBuilder.setTop(methodName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/SetTopRule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,105 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.rulesbinder.ConverterBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+
+/**
+ * 
+ */
+class WithMemoryRulesBinder implements RulesBinder {
+
+    /**
+     * A stack used to maintain the current pattern. The Rules XML document
+     * type allows nesting of patterns. If an element defines a matching
+     * pattern, the resulting pattern is a concatenation of that pattern with
+     * all the ancestor elements' patterns. Hence the need for a stack.
+     */
+    private final PatternStack patternStack = new PatternStack();
+
+    /**
+     * Used to detect circular includes
+     */
+    private final Set<String> includedFiles = new HashSet<String>();
+
+    private final RulesBinder wrappedRulesBinder;
+
+    public WithMemoryRulesBinder(RulesBinder wrappedRulesBinder) {
+        this.wrappedRulesBinder = wrappedRulesBinder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addError(String messagePattern, Object... arguments) {
+        this.wrappedRulesBinder.addError(messagePattern, arguments);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addError(Throwable t) {
+        this.wrappedRulesBinder.addError(t);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void install(RulesModule rulesModule) {
+        this.wrappedRulesBinder.install(rulesModule);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LinkedRuleBuilder forPattern(String pattern) {
+        return this.wrappedRulesBinder.forPattern(pattern);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> ConverterBuilder<T> convert(Class<T> type) {
+        return this.wrappedRulesBinder.convert(type);
+    }
+
+    /**
+     * 
+     *
+     * @return
+     */
+    public PatternStack getPatternStack() {
+        return this.patternStack;
+    }
+
+    /**
+     * 
+     *
+     * @return
+     */
+    public Set<String> getIncludedFiles() {
+        return this.includedFiles;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/WithMemoryRulesBinder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java?rev=1070823&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java Tue Feb 15 09:42:48 2011
@@ -0,0 +1,103 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.commons.digester3.xmlrules.metaparser;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.RulesModule;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+
+/**
+ * 
+ */
+public final class XmlRulesModule implements RulesModule {
+
+    private final RulesBinder targetRulesBinder;
+
+    private WithMemoryRulesBinder memoryRulesBinder;
+
+    public XmlRulesModule(final RulesBinder targetRulesBinder) {
+        this.targetRulesBinder = targetRulesBinder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void configure(RulesBinder rulesBinder) {
+        if (rulesBinder instanceof WithMemoryRulesBinder) {
+            this.memoryRulesBinder = (WithMemoryRulesBinder) rulesBinder;
+        } else {
+            this.memoryRulesBinder = new WithMemoryRulesBinder(rulesBinder);
+        }
+
+        PatternStack patternStack = this.memoryRulesBinder.getPatternStack();
+
+        try {
+            forPattern("*/pattern")
+                .addRule(new PatternRule(patternStack));
+            forPattern("*/include")
+                .addRule(new IncludeRule(this.memoryRulesBinder, this.targetRulesBinder));
+
+            forPattern("*/bean-property-setter-rule")
+                .addRule(new BeanPropertySetterRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/call-method-rule")
+                .addRule(new CallMethodRule(this.targetRulesBinder, patternStack));
+            forPattern("*/call-param-rule")
+                .addRule(new CallParamRule(this.targetRulesBinder, patternStack));
+            forPattern("*/object-param-rule")
+                .addRule(new ObjectParamRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/factory-create-rule")
+                .addRule(new FactoryCreateRule(this.targetRulesBinder, patternStack));
+            forPattern("*/object-create-rule")
+                .addRule(new ObjectCreateRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/set-properties-rule")
+                .addRule(new SetPropertiesRule(this.targetRulesBinder, patternStack));
+            forPattern("*/set-properties-rule/alias")
+                .addRule(new SetPropertiesAliasRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/set-property-rule")
+                .addRule(new SetPropertyRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/set-nested-properties-rule")
+                .addRule(new SetNestedPropertiesRule(this.targetRulesBinder, patternStack));
+            forPattern("*/set-nested-properties-rule/alias")
+                .addRule(new SetNestedPropertiesAliasRule(this.targetRulesBinder, patternStack));
+
+            forPattern("*/set-top-rule")
+                .addRule(new SetTopRule(this.targetRulesBinder, patternStack));
+            forPattern("*/set-next-rule")
+                .addRule(new SetNextRule(this.targetRulesBinder, patternStack));
+            forPattern("*/set-root-rule")
+                .addRule(new SetRootRule(this.targetRulesBinder, patternStack));
+        } finally {
+            this.memoryRulesBinder = null;
+        }
+    }
+
+    /**
+     * 
+     * @param pattern
+     * @return
+     */
+    protected LinkedRuleBuilder forPattern(String pattern) {
+        return this.memoryRulesBinder.forPattern(pattern);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/xmlrules/metaparser/XmlRulesModule.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/digester3/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd?rev=1070823&r1=1070822&r2=1070823&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd (original)
+++ commons/sandbox/digester3/trunk/src/main/resources/org/apache/commons/digester3/xmlrules/digester-rules.dtd Tue Feb 15 09:42:48 2011
@@ -78,7 +78,6 @@
     path  CDATA #IMPLIED
     class CDATA #IMPLIED>
 
-
 <!-- Each 'rule' element below corresponds to a concrete subclass
      of org.apache.framework.digester.Rule.
      Each 'rule' element has an optional 'pattern' attribute, which
@@ -176,7 +175,8 @@
 <!-- SetPropertiesRule -->
 <!ELEMENT set-properties-rule (alias)*>
 <!ATTLIST set-properties-rule
-    pattern   CDATA #IMPLIED>
+    pattern                 CDATA #IMPLIED
+    ignore-missing-property CDATA #IMPLIED>
 
 <!-- SetNestedPropertiesRule -->
 <!ELEMENT set-nested-properties-rule (alias)*>



Mime
View raw message