commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1069734 [1/2] - in /commons/sandbox/digester3/trunk: ./ src/main/java/org/apache/commons/digester3/ src/main/java/org/apache/commons/digester3/internal/ src/main/java/org/apache/commons/digester3/internal/rulesbinder/ src/main/java/org/apa...
Date Fri, 11 Feb 2011 10:21:48 GMT
Author: simonetripodi
Date: Fri Feb 11 10:21:47 2011
New Revision: 1069734

URL: http://svn.apache.org/viewvc?rev=1069734&view=rev
Log:
RulesBinder implementation moved to a proper package, maintainance quickly became hard

Added:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RulesBinderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/SetNextBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/SetPropertiesBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/SetPropertyBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/SetRootBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/SetTopBuilderImpl.java   (with props)
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/package-info.java   (with props)
Removed:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ErrorMessage.java
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Modified:
    commons/sandbox/digester3/trunk/   (props changed)
    commons/sandbox/digester3/trunk/pom.xml
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoader.java
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoadingException.java
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectParamBuilder.java

Propchange: commons/sandbox/digester3/trunk/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 11 10:21:47 2011
@@ -0,0 +1 @@
+target

Modified: commons/sandbox/digester3/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/pom.xml?rev=1069734&r1=1069733&r2=1069734&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/pom.xml (original)
+++ commons/sandbox/digester3/trunk/pom.xml Fri Feb 11 10:21:47 2011
@@ -92,6 +92,39 @@
             <version>4.8.1</version>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>log4j</groupId>
+            <artifactId>log4j</artifactId>
+            <version>1.2.15</version>
+            <scope>runtime</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.sun.jdmk</groupId>
+                    <artifactId>jmxtools</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.sun.jmx</groupId>
+                    <artifactId>jmxri</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.jms</groupId>
+                    <artifactId>jms</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>javax.mail</groupId>
+                    <artifactId>mail</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>oro</groupId>
+                    <artifactId>oro</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
     </dependencies>
 
     <build>

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoader.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoader.java?rev=1069734&r1=1069733&r2=1069734&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoader.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoader.java Fri Feb 11 10:21:47 2011
@@ -30,6 +30,7 @@ import javax.xml.parsers.SAXParser;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.validation.Schema;
 
+import org.apache.commons.digester3.internal.rulesbinder.RulesBinderImpl;
 import org.apache.commons.digester3.rules.BaseRules;
 import org.apache.commons.digester3.spi.Rules;
 import org.apache.commons.digester3.spi.Substitutor;
@@ -359,11 +360,6 @@ public final class DigesterLoader {
             }
         }
 
-        // check if there were errors while binding rules
-        if (this.rulesBinder.containsErrors()) {
-            throw new DigesterLoadingException(this.rulesBinder.getErrors());
-        }
-
         this.rulesBinder.populateRules(rules);
 
         return new DigesterImpl(reader, rules, classLoader, this.substitutor, this.entityValidator);

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoadingException.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoadingException.java?rev=1069734&r1=1069733&r2=1069734&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoadingException.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/DigesterLoadingException.java Fri Feb 11 10:21:47 2011
@@ -17,11 +17,6 @@
  */
 package org.apache.commons.digester3;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Formatter;
-import java.util.List;
 
 /**
  * Thrown when errors occur while creating a {@link Digester}. Includes a list of encountered
@@ -30,85 +25,20 @@ import java.util.List;
 public final class DigesterLoadingException extends RuntimeException {
 
     /**
-     * The default head when reporting an errors list.
-     */
-    private static final String HEADING = "Digester creation errors:%n%n";
-
-    /**
      * The typical serial version UID.
      */
     private static final long serialVersionUID = 1L;
 
-    /**
-     * The errors list encountered while creating a new {@code Digester} instance.
-     */
-    private final List<ErrorMessage> errors;
-
-    /**
-     * Create a new {@link DigesterLoadingException} with the given specified message.
-     *
-     * @param messagePattern The message string pattern
-     * @param arguments Arguments referenced by the format specifiers in the format string
-     */
-    protected DigesterLoadingException(String messagePattern, Object... arguments) {
-        this(new ErrorMessage(String.format(messagePattern, arguments)));
+    public DigesterLoadingException(String message, Throwable cause) {
+        super(message, cause);
     }
 
-    /**
-     * Create a new {@link DigesterLoadingException} with the given cause.
-     *
-     * @param cause The throwable that caused this message
-     */
-    protected DigesterLoadingException(Throwable cause) {
-        this(new ErrorMessage("An exception was caught and reported. Message: " + cause.getMessage(), cause));
+    public DigesterLoadingException(String message) {
+        super(message);
     }
 
-    /**
-     * Create a new {@link DigesterLoadingException} with the given errors.
-     *
-     * @param errors the errors occurred while creating a new {@code Digester} instance
-     */
-    protected DigesterLoadingException(ErrorMessage...errors) {
-        this(Arrays.asList(errors));
-    }
-
-    /**
-     * Create a new {@link DigesterLoadingException} with the given errors.
-     *
-     * @param errors the errors occurred while creating a new {@code Digester} instance
-     */
-    protected DigesterLoadingException(List<ErrorMessage> errors) {
-        this.errors = errors;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String getMessage() {
-        Formatter fmt = new Formatter().format(HEADING);
-        int index = 1;
-
-        for (ErrorMessage errorMessage : this.errors) {
-            fmt.format("%s) %s%n", index++, errorMessage.getMessage());
-
-            Throwable cause = errorMessage.getCause();
-            if (cause != null) {
-                StringWriter writer = new StringWriter();
-                cause.printStackTrace(new PrintWriter(writer));
-                fmt.format("Caused by: %s", writer.getBuffer());
-            }
-
-            fmt.format("%n");
-        }
-
-        if (this.errors.size() == 1) {
-            fmt.format("1 error");
-        } else {
-            fmt.format("%s errors", this.errors.size());
-        }
-
-        return fmt.toString();
+    public DigesterLoadingException(Throwable cause) {
+        super(cause);
     }
 
 }

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,80 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.BackToLinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+
+/**
+ * Abstract {@link BackToLinkedRuleBuilder} implementation.
+ *
+ * @param <R>
+ */
+abstract class AbstractBackToLinkedRuleBuilder<R extends Rule> implements BackToLinkedRuleBuilder<R> {
+
+    private final String keyPattern;
+
+    private final String namespaceURI;
+
+    private final RulesBinder mainBinder;
+
+    private final LinkedRuleBuilderImpl mainBuilder;
+
+    public AbstractBackToLinkedRuleBuilder(final String keyPattern,
+            final String namespaceURI,
+            final RulesBinder mainBinder,
+            final LinkedRuleBuilderImpl mainBuilder) {
+        this.keyPattern = keyPattern;
+        this.namespaceURI = namespaceURI;
+        this.mainBinder = mainBinder;
+        this.mainBuilder = mainBuilder;
+    }
+
+    /**
+     * Come back to the main {@link LinkedRuleBuilderImpl}.
+     *
+     * @return the main {@link LinkedRuleBuilderImpl}
+     */
+    public final LinkedRuleBuilder then() {
+        return this.mainBuilder;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final R get() {
+        R rule = this.createRule();
+        if (rule != null && this.namespaceURI != null) {
+            rule.setNamespaceURI(this.namespaceURI);
+        }
+        return rule;
+    }
+
+    protected final void reportError(String methodChain, String message) {
+        this.mainBinder.addError("{forPattern(\"%s\").%s} %s", this.keyPattern, methodChain, message);
+    }
+
+    /**
+     * @see #get()
+     * @return
+     */
+    protected abstract R createRule();
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractBackToLinkedRuleBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,87 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.ParamTypeBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#setNext(String)},
+ * {@link LinkedRuleBuilderImpl#setRoot(String)} or {@link LinkedRuleBuilderImpl#setTop(String)}.
+ */
+abstract class AbstractParamTypeBuilder<R extends Rule>
+        extends AbstractBackToLinkedRuleBuilder<R>
+        implements ParamTypeBuilder<R> {
+
+    private final String methodName;
+
+    private boolean useExactMatch = false;
+
+    private String paramType;
+
+    public AbstractParamTypeBuilder(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            String methodName) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.methodName = methodName;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final ParamTypeBuilder<R> withParameterType(Class<?> paramType) {
+        if (paramType == null) {
+            this.reportError(String.format(".%s.withParameterType(Class<?>)", this.methodName),
+                    "NULL Java type not allowed");
+            return this;
+        }
+        return this.withParameterType(paramType.getName());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final ParamTypeBuilder<R> withParameterType(String paramType) {
+        this.paramType = paramType;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public final ParamTypeBuilder<R> useExactMatch(boolean useExactMatch) {
+        this.useExactMatch = useExactMatch;
+        return this;
+    }
+
+    protected final String getMethodName() {
+        return this.methodName;
+    }
+
+    protected final String getParamType() {
+        return this.paramType;
+    }
+
+    protected final boolean isUseExactMatch() {
+        return this.useExactMatch;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/AbstractParamTypeBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,59 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.BeanPropertySetterRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.BeanPropertySetterBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#setBeanProperty()}.
+ */
+final class BeanPropertySetterBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<BeanPropertySetterRule>
+        implements BeanPropertySetterBuilder {
+
+    private String propertyName;
+
+    protected BeanPropertySetterBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+    }
+
+    /**
+     * Sets the name of property to set.
+     *
+     * @param propertyName The name of property to set
+     * @return this builder instance
+     */
+    public BeanPropertySetterBuilderImpl withName(/* @Nullable */String propertyName) {
+        this.propertyName = propertyName;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected BeanPropertySetterRule createRule() {
+        return new BeanPropertySetterRule(this.propertyName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/BeanPropertySetterBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,45 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.ByRuleBuilder;
+
+final class ByRuleBuilderImpl<R extends Rule> extends AbstractBackToLinkedRuleBuilder<R> implements ByRuleBuilder<R> {
+
+    private final R rule;
+
+    public ByRuleBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            R rule) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.rule = rule;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected R createRule() {
+        return this.rule;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,48 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.ByRuleProviderBuilder;
+import org.apache.commons.digester3.spi.RuleProvider;
+
+final class ByRuleProviderBuilderImpl<R extends Rule>
+        extends AbstractBackToLinkedRuleBuilder<R>
+        implements ByRuleProviderBuilder<R> {
+
+    private final RuleProvider<R> provider;
+
+    public ByRuleProviderBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            RuleProvider<R> provider) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.provider = provider;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected R createRule() {
+        return this.provider.get();
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ByRuleProviderBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,170 @@
+/* $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.internal.rulesbinder;
+
+import java.util.Arrays;
+
+import org.apache.commons.digester3.CallMethodRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.CallMethodBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#callMethod(String)}.
+ */
+final class CallMethodBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<CallMethodRule>
+        implements CallMethodBuilder {
+
+    private final String methodName;
+
+    private final ClassLoader classLoader;
+
+    private int targetOffset;
+
+    private int paramCount = 0;
+
+    private Class<?>[] paramTypes;
+
+    private boolean useExactMatch = false;
+
+    public CallMethodBuilderImpl(String keyPattern,
+            String namespaceURI,
+            final RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            String methodName,
+            ClassLoader classLoader) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.methodName = methodName;
+        this.classLoader = classLoader;
+    }
+
+    /**
+     * Sets the location of the target object.
+     *
+     * Positive numbers are relative to the top of the digester object stack.
+     * Negative numbers are relative to the bottom of the stack. Zero implies the top object on the stack.
+     *
+     * @param targetOffset location of the target object.
+     * @return this builder instance
+     */
+    public CallMethodBuilderImpl withTargetOffset(int targetOffset) {
+        this.targetOffset = targetOffset;
+        return this;
+    }
+
+    /**
+     * Sets the Java classe names that represent the parameter types of the method arguments.
+     *
+     * If you wish to use a primitive type, specify the corresonding Java wrapper class instead,
+     * such as {@code java.lang.Boolean.TYPE} for a {@code boolean} parameter.
+     *
+     * @param The Java classe names that represent the parameter types of the method arguments
+     * @return this builder instance
+     */
+    public CallMethodBuilderImpl withParamTypes(String...paramTypeNames) {
+        if (paramTypeNames != null) {
+            this.paramTypes = new Class[paramTypeNames.length];
+            for (int i = 0; i < paramTypeNames.length; i++) {
+                try {
+                    this.paramTypes[i] = classLoader.loadClass(paramTypeNames[i]);
+                } catch (ClassNotFoundException e) {
+                    this.reportError(
+                            String.format("callMethod(\"%s\").withParamTypes(%s)", this.methodName, Arrays.toString(paramTypeNames)),
+                            String.format("class '%s' cannot be load", paramTypeNames[i]));
+                }
+            }
+        }
+
+        return this;
+    }
+
+    /**
+     * Sets the Java classes that represent the parameter types of the method arguments.
+     *
+     * If you wish to use a primitive type, specify the corresonding Java wrapper class instead,
+     * such as {@code java.lang.Boolean.TYPE} for a {@code boolean} parameter.
+     *
+     * @param paramTypes The Java classes that represent the parameter types of the method arguments
+     * @return this builder instance
+     */
+    public CallMethodBuilderImpl withParamTypes(Class<?>...paramTypes) {
+        this.paramTypes = paramTypes;
+
+        if (paramTypes != null) {
+            this.paramCount = paramTypes.length;
+        }
+
+        return this;
+    }
+
+    /**
+     * Should <code>MethodUtils.invokeExactMethod</code> be used for the reflection.
+     *
+     * @param useExactMatch Flag to mark exact matching or not
+     * @return this builder instance
+     */
+    public CallMethodBuilderImpl useExactMatch(boolean useExactMatch) {
+        this.useExactMatch = useExactMatch;
+        return this;
+    }
+
+    /**
+     * The number of parameters to collect, or zero for a single argument from the body of this element.
+     *
+     * @param paramCount The number of parameters to collect, or zero for a single argument
+     *        from the body of this element.
+     * @return this builder instance
+     */
+    public CallMethodBuilderImpl withParamCount(int paramCount) {
+        if (paramCount < 0) {
+            this.reportError(String.format("callMethod(\"%s\").withParamCount(int)", this.methodName),
+                    "negative parameters counter not allowed");
+        }
+
+        this.paramCount = paramCount;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected CallMethodRule createRule() {
+        Class<?>[] paramTypes = null;
+
+        if (this.paramTypes == null) {
+            if (this.paramCount == 0) {
+                paramTypes = new Class<?>[] { String.class };
+            } else {
+                paramTypes = new Class<?>[this.paramCount];
+                for (int i = 0; i < paramTypes.length; i++) {
+                    paramTypes[i] = String.class;
+                }
+            }
+        } else {
+            paramTypes = this.paramTypes;
+        }
+
+        return new CallMethodRule(this.targetOffset,
+                this.methodName,
+                this.paramCount,
+                paramTypes,
+                this.useExactMatch);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallMethodBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,102 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.CallParamRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.CallParamBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#callParam(int)}.
+ */
+final class CallParamBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<CallParamRule>
+        implements CallParamBuilder {
+
+    private int paramIndex = 0;
+
+    private int stackIndex = 0;
+
+    private boolean fromStack = false;
+
+    private String attributeName;
+
+    public CallParamBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+    }
+
+    /**
+     * Sets the zero-relative parameter number.
+     *
+     * @param paramIndex The zero-relative parameter number
+     * @return this builder instance
+     */
+    public CallParamBuilderImpl ofIndex(int paramIndex) {
+        if (paramIndex < 0) {
+            this.reportError("callParam().ofIndex(int)", "negative index argument not allowed");
+        }
+
+        this.paramIndex = paramIndex;
+        return this;
+    }
+
+    /**
+     * Sets the attribute from which to save the parameter value.
+     *
+     * @param attributeName The attribute from which to save the parameter value
+     * @return this builder instance
+     */
+    public CallParamBuilderImpl fromAttribute(/* @Nullable */String attributeName) {
+        this.attributeName = attributeName;
+        return this;
+    }
+
+    /**
+     * Flags the parameter to be set from the stack.
+     *
+     * @param fromStack the parameter flag to be set from the stack
+     * @return this builder instance
+     */
+    public CallParamBuilderImpl fromStack(boolean fromStack) {
+        this.fromStack = fromStack;
+        return this;
+    }
+
+    /**
+     * Sets the position of the object from the top of the stack.
+     *
+     * @param stackIndex The position of the object from the top of the stack
+     * @return this builder instance
+     */
+    public CallParamBuilderImpl withStackIndex(int stackIndex) {
+        this.stackIndex = stackIndex;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected CallParamRule createRule() {
+        return new CallParamRule(this.paramIndex, this.fromStack, this.stackIndex, this.attributeName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/CallParamBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,92 @@
+/* $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.internal.rulesbinder;
+
+/**
+ * An error message and the context in which it occurred. Messages are usually created internally by
+ * {@code Digester} and its extensions. Messages can be created explicitly in a module using
+ * {@link org.apache.commons.digester3.RulesBinder#addError(Throwable) addError()} statement:
+ * <pre>try {
+ *   bindRulesFromFile();
+ * } catch (IOException e) {
+ *   addError(e);
+ * }</pre>
+ */
+final class ErrorMessage {
+
+    /**
+     * The error message text.
+     */
+    private final String message;
+
+    /**
+     * The throwable that caused this message.
+     */
+    /* @Nullable */ private final Throwable cause;
+
+    /**
+     * Create a new {@link ErrorMessage} instance from the error message text.
+     *
+     * @param messagePattern The error message text pattern
+     * @param arguments  Arguments referenced by the format specifiers in the format string
+     */
+    public ErrorMessage(String messagePattern, Object... arguments) {
+        this(String.format(messagePattern, arguments), (Throwable) null);
+    }
+
+    /**
+     * Create a new {@link ErrorMessage} instance from the error message text
+     * and the related cause.
+     *
+     * @param message The error message text
+     * @param cause The throwable that caused this message
+     */
+    public ErrorMessage(String message, Throwable cause) {
+        this.message = message;
+        this.cause = cause;
+    }
+
+    /**
+     * Gets the error message text.
+     *
+     * @return The error message text
+     */
+    public String getMessage() {
+        return this.message;
+    }
+
+    /**
+     * Returns the throwable that caused this message, or {@code null} if this
+     * message was not caused by a throwable.
+     *
+     * @return The throwable that caused this message, or {@code null} if this
+     *         message was not caused by a throwable
+     */
+    public Throwable getCause() {
+        return this.cause;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        return this.message;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ErrorMessage.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,104 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.FactoryCreateRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.FactoryCreateBuilder;
+import org.apache.commons.digester3.spi.ObjectCreationFactory;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#factoryCreate(String)}.
+ */
+final class FactoryCreateBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<FactoryCreateRule>
+        implements FactoryCreateBuilder {
+
+    private String className;
+
+    private String attributeName;
+
+    private boolean ignoreCreateExceptions;
+
+    private ObjectCreationFactory<?> creationFactory;
+
+    public FactoryCreateBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FactoryCreateBuilderImpl ofType(/* @Nullable */String className) {
+        this.className = className;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FactoryCreateBuilderImpl ofType(Class<?> type) {
+        if (type == null) {
+            this.reportError("factoryCreate().ofType(Class<?>)", "NULL Java type not allowed");
+            return this;
+        }
+
+        return this.ofType(type.getName());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> FactoryCreateBuilderImpl usingFactory(/* @Nullable */ObjectCreationFactory<T> creationFactory) {
+        this.creationFactory = creationFactory;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FactoryCreateBuilderImpl overriddenByAttribute(/* @Nullable */String attributeName) {
+        this.attributeName = attributeName;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FactoryCreateBuilderImpl ignoreCreateExceptions(boolean ignoreCreateExceptions) {
+        this.ignoreCreateExceptions = ignoreCreateExceptions;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected FactoryCreateRule createRule() {
+        if (className == null && attributeName == null && creationFactory == null) {
+            this.reportError("factoryCreate()",
+                    "at least one between 'className' ar 'attributeName' or 'creationFactory' has to be specified");
+        }
+
+        return new FactoryCreateRule(this.className, this.attributeName, this.creationFactory, this.ignoreCreateExceptions);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/FactoryCreateBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,241 @@
+/* $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.internal.rulesbinder;
+
+import java.util.Collection;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.BeanPropertySetterBuilder;
+import org.apache.commons.digester3.rulesbinder.ByRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.ByRuleProviderBuilder;
+import org.apache.commons.digester3.rulesbinder.CallMethodBuilder;
+import org.apache.commons.digester3.rulesbinder.CallParamBuilder;
+import org.apache.commons.digester3.rulesbinder.FactoryCreateBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+import org.apache.commons.digester3.rulesbinder.NestedPropertiesBuilder;
+import org.apache.commons.digester3.rulesbinder.ObjectCreateBuilder;
+import org.apache.commons.digester3.rulesbinder.ObjectParamBuilder;
+import org.apache.commons.digester3.rulesbinder.PathCallParamBuilder;
+import org.apache.commons.digester3.rulesbinder.SetNextBuilder;
+import org.apache.commons.digester3.rulesbinder.SetPropertiesBuilder;
+import org.apache.commons.digester3.rulesbinder.SetPropertyBuilder;
+import org.apache.commons.digester3.rulesbinder.SetRootBuilder;
+import org.apache.commons.digester3.rulesbinder.SetTopBuilder;
+import org.apache.commons.digester3.spi.RuleProvider;
+
+/**
+ * Builder invoked to bind one or more rules to a pattern.
+ */
+final class LinkedRuleBuilderImpl implements LinkedRuleBuilder {
+
+    private final RulesBinder mainBinder;
+
+    /**
+     * The data structure where storing the providers binding.
+     */
+    private final Collection<RegisteredProvider> providers;
+
+    private final ClassLoader classLoader;
+
+    private final String keyPattern;
+
+    private String namespaceURI;
+
+    public LinkedRuleBuilderImpl(final RulesBinder mainBinder,
+            final Collection<RegisteredProvider> providers,
+            final ClassLoader classLoader,
+            final String keyPattern) {
+        this.mainBinder = mainBinder;
+        this.providers = providers;
+        this.classLoader = classLoader;
+        this.keyPattern = keyPattern;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public LinkedRuleBuilder withNamespaceURI(/* @Nullable */String namespaceURI) {
+        this.namespaceURI = namespaceURI;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public BeanPropertySetterBuilder setBeanProperty() {
+        return this.addProvider(
+                new BeanPropertySetterBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CallMethodBuilder callMethod(String methodName) {
+        if (methodName == null || methodName.length() == 0) {
+            this.mainBinder.addError("{forPattern(\"%s\").callMethod(String)} empty 'methodName' not allowed", keyPattern);
+        }
+
+        return this.addProvider(
+                new CallMethodBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, methodName, this.classLoader));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public CallParamBuilder callParam() {
+        return this.addProvider(new CallParamBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PathCallParamBuilder callParamPath() {
+        return this.addProvider(new PathCallParamBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public FactoryCreateBuilder factoryCreate() {
+        return this.addProvider(new FactoryCreateBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public ObjectCreateBuilder createObject() {
+        return this.addProvider(
+                new ObjectCreateBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, this.classLoader));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <T> ObjectParamBuilder<T> objectParam(/* @Nullable */T paramObj) {
+        return this.addProvider(
+                new ObjectParamBuilderImpl<T>(this.keyPattern, this.namespaceURI, this.mainBinder, this, paramObj));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public NestedPropertiesBuilder setNestedProperties() {
+        return this.addProvider(new NestedPropertiesBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public SetNextBuilder setNext(String methodName) {
+        if (methodName == null || methodName.length() == 0) {
+            this.mainBinder.addError("{forPattern(\"%s\").setNext(String)} empty 'methodName' not allowed",
+                    this.keyPattern);
+        }
+        return this.addProvider(
+                new SetNextBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, methodName));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public SetPropertiesBuilder setProperties() {
+        return this.addProvider(new SetPropertiesBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public SetPropertyBuilder setProperty(String attributePropertyName) {
+        if (attributePropertyName == null || attributePropertyName.length() == 0) {
+            this.mainBinder.addError("{forPattern(\"%s\").setProperty(String)} empty 'attributePropertyName' not allowed",
+                    this.keyPattern);
+        }
+
+        return this.addProvider(
+                new SetPropertyBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, attributePropertyName));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public SetRootBuilder setRoot(String methodName) {
+        if (methodName == null || methodName.length() == 0) {
+            this.mainBinder.addError("{forPattern(\"%s\").setRoot(String)} empty 'methodName' not allowed",
+                    this.keyPattern);
+        }
+
+        return this.addProvider(
+                new SetRootBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, methodName));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public SetTopBuilder setTop(String methodName) {
+        if (methodName == null || methodName.length() == 0) {
+            this.mainBinder.addError("{forPattern(\"%s\").setTop(String)} empty 'methodName' not allowed",
+                    this.keyPattern);
+        }
+
+        return this.addProvider(
+                new SetTopBuilderImpl(this.keyPattern, this.namespaceURI, this.mainBinder, this, methodName));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <R extends Rule> ByRuleBuilder<R> addRule(R rule) {
+        if (rule == null) {
+            this.mainBinder.addError("{forPattern(\"%s\").addRule(R)} NULL rule not valid", this.keyPattern);
+        }
+
+        return this.addProvider(
+                new ByRuleBuilderImpl<R>(this.keyPattern, this.namespaceURI, this.mainBinder, this, rule));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public <R extends Rule> ByRuleProviderBuilder<R> addRuleCreatedBy(RuleProvider<R> provider) {
+        if (provider == null) {
+            this.mainBinder.addError("{forPattern(\"%s\").addRuleCreatedBy()} null rule not valid", this.keyPattern);
+        }
+
+        return this.addProvider(
+                new ByRuleProviderBuilderImpl<R>(this.keyPattern, this.namespaceURI, this.mainBinder, this, provider));
+    }
+
+    /**
+     * Add a provider in the data structure where storing the providers binding.
+     *
+     * @param <R> The rule will be created by the given provider
+     * @param provider The provider has to be stored in the data structure
+     * @return The provider itself has to be stored in the data structure
+     */
+    private <R extends Rule, RP extends RuleProvider<R>> RP addProvider(RP provider) {
+        if (this.keyPattern == null) {
+            return provider;
+        }
+
+        this.providers.add(new RegisteredProvider(this.keyPattern, provider));
+
+        return provider;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/LinkedRuleBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,114 @@
+/* $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.internal.rulesbinder;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.SetNestedPropertiesRule;
+import org.apache.commons.digester3.rulesbinder.NestedPropertiesBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#setNestedProperties()}.
+ */
+final class NestedPropertiesBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<SetNestedPropertiesRule>
+        implements NestedPropertiesBuilder {
+
+    private final Map<String, String> elementNames = new HashMap<String, String>();
+
+    private boolean trimData = true;
+
+    private boolean allowUnknownChildElements = false;
+
+    public NestedPropertiesBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+    }
+
+    /**
+     * Allows ignore a matching element.
+     *
+     * @param elementName The child xml element to be ignored
+     * @return this builder instance
+     */
+    public NestedPropertiesBuilderImpl ignoreElement(String elementName) {
+        if (elementName == null) {
+            this.reportError("setNestedProperties().ignoreElement(String)", "empty 'elementName' not allowed");
+        } else {
+            this.elementNames.put(elementName, null);
+        }
+        return this;
+    }
+
+    /**
+     * Allows element2property mapping to be overridden.
+     *
+     * @param elementName The child xml element to match
+     * @param propertyName The java bean property to be assigned the value
+     * @return this builder instance
+     */
+    public NestedPropertiesBuilderImpl addAlias(String elementName, String propertyName) {
+        if (elementName == null) {
+            this.reportError("setNestedProperties().addAlias(String,String)", "empty 'elementName' not allowed");
+        } else {
+            if (propertyName == null) {
+                this.reportError("setNestedProperties().addAlias(String,String)", "empty 'propertyName' not allowed");
+            } else {
+                this.elementNames.put(elementName, propertyName);
+            }
+        }
+        return this;
+    }
+
+    /**
+     * When set to true, any text within child elements will have leading
+     * and trailing whitespace removed before assignment to the target
+     * object.
+     *
+     * @param trimData
+     * @return this builder instance
+     */
+    public NestedPropertiesBuilderImpl trimData(boolean trimData) {
+        this.trimData = trimData;
+        return this;
+    }
+
+    /**
+     * 
+     *
+     * @param allowUnknownChildElements
+     * @return
+     */
+    public NestedPropertiesBuilderImpl allowUnknownChildElements(boolean allowUnknownChildElements) {
+        this.allowUnknownChildElements = allowUnknownChildElements;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected SetNestedPropertiesRule createRule() {
+        return new SetNestedPropertiesRule(this.elementNames, this.trimData, this.allowUnknownChildElements);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/NestedPropertiesBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,102 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.ObjectCreateRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.ObjectCreateBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#objectCreate(String)}.
+ */
+final class ObjectCreateBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<ObjectCreateRule>
+        implements ObjectCreateBuilder {
+
+    private final ClassLoader classLoader;
+
+    private Class<?> type;
+
+    private String attributeName;
+
+    public ObjectCreateBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            ClassLoader classLoader) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.classLoader = classLoader;
+    }
+
+    /**
+     * Construct an object with the specified class name.
+     *
+     * @param className Java class name of the object to be created
+     * @return this builder instance
+     */
+    public ObjectCreateBuilderImpl ofType(String className) {
+        if (className == null) {
+            this.reportError("createObject().ofType(String)", "NULL Java type not allowed");
+            return this;
+        }
+
+        try {
+            return this.ofType(this.classLoader.loadClass(className));
+        } catch (ClassNotFoundException e) {
+            this.reportError("createObject().ofType(String)", String.format("class '%s' cannot be load", className));
+            return this;
+        }
+    }
+
+    /**
+     * Construct an object with the specified class.
+     *
+     * @param type Java class of the object to be created
+     * @return this builder instance
+     */
+    public <T> ObjectCreateBuilderImpl ofType(Class<T> type) {
+        if (type == null) {
+            this.reportError("createObject().ofType(Class<?>)", "NULL Java type not allowed");
+            return this;
+        }
+
+        this.type = type;
+
+        return this;
+    }
+
+    /**
+     * Allows specify the attribute containing an override class name if it is present.
+     *
+     * @param attributeName The attribute containing an override class name if it is present
+     * @return this builder instance
+     */
+    public ObjectCreateBuilderImpl ofTypeSpecifiedByAttribute(/* @Nullable */String attributeName) {
+        this.attributeName = attributeName;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ObjectCreateRule createRule() {
+        return new ObjectCreateRule(this.type, this.attributeName);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectCreateBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,80 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.ObjectParamRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.ObjectParamBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#objectCreate(String)}.
+ */
+final class ObjectParamBuilderImpl<T>
+        extends AbstractBackToLinkedRuleBuilder<ObjectParamRule>
+        implements ObjectParamBuilder<T> {
+
+    private final T paramObj;
+
+    private int paramIndex = 0;
+
+    private String attributeName;
+
+    public ObjectParamBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder,
+            /* @Nullable */T paramObj) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+        this.paramObj = paramObj;
+    }
+
+    /**
+     * The zero-relative index of the parameter we are saving.
+     *
+     * @param paramIndex The zero-relative index of the parameter we are saving
+     * @return this builder instance
+     */
+    public ObjectParamBuilderImpl<T> ofIndex(int paramIndex) {
+        if (paramIndex < 0) {
+            this.reportError("objectParam(%s).ofIndex(int)", "negative index argument not allowed");
+        }
+
+        this.paramIndex = paramIndex;
+        return this;
+    }
+
+    /**
+     * The attribute which we are attempting to match.
+     *
+     * @param attributeName The attribute which we are attempting to match
+     * @return this builder instance
+     */
+    public ObjectParamBuilderImpl<T> matchingAttribute(/* @Nullable */String attributeName) {
+        this.attributeName = attributeName;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected ObjectParamRule createRule() {
+        return new ObjectParamRule(this.paramIndex, this.attributeName, this.paramObj);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/ObjectParamBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,60 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.PathCallParamRule;
+import org.apache.commons.digester3.RulesBinder;
+import org.apache.commons.digester3.rulesbinder.PathCallParamBuilder;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilderImpl#callParam(int)}.
+ */
+final class PathCallParamBuilderImpl
+        extends AbstractBackToLinkedRuleBuilder<PathCallParamRule>
+        implements PathCallParamBuilder {
+
+    private int paramIndex = 0;
+
+    public PathCallParamBuilderImpl(String keyPattern,
+            String namespaceURI,
+            RulesBinder mainBinder,
+            LinkedRuleBuilderImpl mainBuilder) {
+        super(keyPattern, namespaceURI, mainBinder, mainBuilder);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public PathCallParamBuilderImpl ofIndex(int paramIndex) {
+        if (paramIndex < 0) {
+            this.reportError("callParamPath().ofIndex(int)", "negative index argument not allowed");
+        }
+
+        this.paramIndex = paramIndex;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected PathCallParamRule createRule() {
+        return new PathCallParamRule(this.paramIndex);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/PathCallParamBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java?rev=1069734&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java Fri Feb 11 10:21:47 2011
@@ -0,0 +1,45 @@
+/* $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.internal.rulesbinder;
+
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.spi.RuleProvider;
+
+/**
+ * Used to associate rule providers with paths in the rules binder.
+ */
+class RegisteredProvider {
+
+    private final String pattern;
+
+    private final RuleProvider<? extends Rule> provider;
+
+    public <R extends Rule> RegisteredProvider(String pattern, RuleProvider<R> provider) {
+        this.pattern = pattern;
+        this.provider = provider;
+    }
+
+    public String getPattern() {
+        return pattern;
+    }
+
+    public RuleProvider<? extends Rule> getProvider() {
+        return provider;
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/internal/rulesbinder/RegisteredProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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



Mime
View raw message