You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/02/11 15:19:33 UTC
svn commit: r1069805 [2/2] - in /commons/sandbox/digester3/trunk/src:
main/java/org/apache/commons/digester3/
main/java/org/apache/commons/digester3/internal/rulesbinder/
main/java/org/apache/commons/digester3/rule/
main/java/org/apache/commons/digeste...
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java Fri Feb 11 14:19:30 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.rule;
+
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * Rule implementation that creates a new object and pushes it
+ * onto the object stack. When the element is complete, the
+ * object will be popped
+ */
+public class ObjectCreateRule extends Rule {
+
+ /**
+ * The Java class name of the object to be created.
+ */
+ private final Class<?> type;
+
+ /**
+ * The attribute containing an override class name if it is present.
+ */
+ private final String attributeName; // @Nullable
+
+ /**
+ *
+ *
+ * @param className The Java class name of the object to be created
+ * @param attributeName The attribute containing an override class name if it is present
+ */
+ public ObjectCreateRule(Class<?> type, String attributeName) {
+ this.type = type;
+ this.attributeName = attributeName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ // Identify the name of the class to instantiate
+ Class<?> clazz = this.type;
+ if (this.attributeName != null) {
+ String value = attributes.getValue(this.attributeName);
+ if (value != null) {
+ clazz = this.getDigester().getClassLoader().loadClass(value);
+ }
+ }
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug(String.format("[ObjectCreateRule]{%s} New %s",
+ this.getDigester().getMatch(),
+ clazz.getName()));
+ }
+
+ if (clazz == null) {
+ throw this.getDigester().createSAXException(String.format("[ObjectCreateRule]{%s} No type defined",
+ this.getDigester().getMatch()));
+ }
+
+ // Instantiate the new object and push it on the context stack
+ Object instance = clazz.newInstance();
+ this.getDigester().push(instance);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ Object top = this.getDigester().pop();
+
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug(String.format("[ObjectCreateRule]{%s} Pop %s",
+ this.getDigester().getMatch(),
+ top.getClass().getName()));
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return String.format("ObjectCreateRule[type=%s, attributeName=%s]", this.type.getName(), this.attributeName);
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectCreateRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,100 @@
+/* $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.rule;
+
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * <p>Rule implementation that saves a parameter for use by a surrounding
+ * <code>CallMethodRule<code>.</p>
+ *
+ * <p>This parameter may be:
+ * <ul>
+ * <li>an arbitrary Object defined programatically, assigned when the element
+ * pattern associated with the Rule is matched. See
+ * {@link #ObjectParamRule(int paramIndex, Object param)}.
+ * <li>an arbitrary Object defined programatically, assigned if the element
+ * pattern AND specified attribute name are matched. See
+ * {@link #ObjectParamRule(int paramIndex, String attributeName, Object param)}.
+ * </ul>
+ * </p>
+ */
+public class ObjectParamRule extends Rule {
+
+ /**
+ * The attribute which we are attempting to match
+ */
+ private final String attributeName;
+
+ /**
+ * The zero-relative index of the parameter we are saving.
+ */
+ private final int paramIndex;
+
+ /**
+ * The parameter we wish to pass to the method call
+ */
+ private final Object param;
+
+ /**
+ * Construct a "call parameter" rule that will save the given Object as
+ * the parameter value, provided that the specified attribute exists.
+ *
+ * @param paramIndex The zero-relative parameter number
+ * @param attributeName The name of the attribute to match
+ * @param param the parameter to pass along
+ */
+ public ObjectParamRule(int paramIndex, String attributeName, Object param) {
+ this.paramIndex = paramIndex;
+ this.attributeName = attributeName;
+ this.param = param;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ Object anAttribute = null;
+ Object parameters[] = (Object[]) this.getDigester().peekParams();
+
+ if (this.attributeName != null) {
+ anAttribute = attributes.getValue(attributeName);
+ if (anAttribute != null) {
+ parameters[paramIndex] = param;
+ }
+ // note -- if attributeName != null and anAttribute == null, this rule
+ // will pass null as its parameter!
+ } else{
+ parameters[paramIndex] = param;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return String.format("ObjectParamRule[paramIndex=%s, attributeName=%s, param=%s]",
+ this.paramIndex,
+ this.attributeName,
+ this.param);
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/ObjectParamRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,74 @@
+/* $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.rule;
+
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * <p>Rule implementation that saves a parameter containing the
+ * <code>Digester</code> matching path for use by a surrounding
+ * <code>CallMethodRule</code>. This Rule is most useful when making
+ * extensive use of wildcards in rule patterns.</p>
+ */
+public class PathCallParamRule extends Rule {
+
+ /**
+ * The zero-relative index of the parameter we are saving.
+ */
+ private final int paramIndex;
+
+ /**
+ * Construct a "call parameter" rule that will save the body text of this
+ * element as the parameter value.
+ *
+ * @param paramIndex The zero-relative parameter number
+ */
+ public PathCallParamRule(int paramIndex) {
+ this.paramIndex = paramIndex;
+ }
+
+ /**
+ * Process the start of this element.
+ *
+ * @param namespace the namespace URI of the matching element, or an
+ * empty string if the parser is not namespace aware or the element has
+ * no namespace
+ * @param name the local name if the parser is namespace aware, or just
+ * the element name otherwise
+ * @param attributes The attribute list for this element
+ */
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ String param = getDigester().getMatch();
+
+ if (param != null) {
+ Object parameters[] = (Object[]) this.getDigester().peekParams();
+ parameters[this.paramIndex] = param;
+ }
+ }
+
+ /**
+ * Render a printable version of this Rule.
+ */
+ @Override
+ public String toString() {
+ return String.format("PathCallParamRule[paramIndex=%s]", this.paramIndex);
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/PathCallParamRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,74 @@
+/* $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.rule;
+
+import org.apache.commons.digester3.rulesbinder.ConverterBuilder;
+import org.apache.commons.digester3.rulesbinder.LinkedRuleBuilder;
+
+/**
+ * The Digester EDSL.
+ */
+public interface RulesBinder {
+
+ /**
+ * Records an error message which will be presented to the user at a later
+ * time. Unlike throwing an exception, this enable us to continue
+ * configuring the Digester and discover more errors. Uses {@link
+ * String#format(String, Object[])} to insert the arguments into the
+ * message.
+ *
+ * @param messagePattern The message string pattern
+ * @param arguments Arguments referenced by the format specifiers in the format string
+ */
+ void addError(String messagePattern, Object... arguments);
+
+ /**
+ * Records an exception, the full details of which will be logged, and the
+ * message of which will be presented to the user at a later
+ * time. If your Module calls something that you worry may fail, you should
+ * catch the exception and pass it into this.
+ *
+ * @param t The exception has to be recorded.
+ */
+ void addError(Throwable t);
+
+ /**
+ * Allows sub-modules inclusion while binding rules.
+ *
+ * @param rulesModule the sub-module has to be included.
+ */
+ void install(RulesModule rulesModule);
+
+ /**
+ * Allows to associate the given pattern to one or more Digester rules.
+ *
+ * @param pattern The pattern that this rule should match
+ * @return The Digester rules builder
+ */
+ LinkedRuleBuilder forPattern(String pattern);
+
+ /**
+ * Allows to associate the given type to one {@link org.apache.commons.digester3.spi.TypeConverter}.
+ *
+ * @param <T>
+ * @param type
+ * @return
+ */
+ <T> ConverterBuilder<T> convert(Class<T> type);
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesBinder.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,32 @@
+/* $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.rule;
+
+/**
+ * A module is the Digester rule bindings provider.
+ */
+public interface RulesModule {
+
+ /**
+ * Configure the Digester rules binding via the given rules binder.
+ *
+ * @param rulesBinder The binder instance used to configure rules bindings.
+ */
+ void configure(RulesBinder rulesBinder);
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/RulesModule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,329 @@
+/* $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.rule;
+
+import java.beans.PropertyDescriptor;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.DynaBean;
+import org.apache.commons.beanutils.DynaProperty;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.digester3.Digester;
+import org.apache.commons.digester3.Rule;
+import org.apache.commons.digester3.spi.Rules;
+import org.xml.sax.Attributes;
+
+/**
+ * <p>Rule implementation that sets properties on the object at the top of the
+ * stack, based on child elements with names matching properties on that
+ * object.</p>
+ *
+ * <p>Example input that can be processed by this rule:</p>
+ * <pre>
+ * [widget]
+ * [height]7[/height]
+ * [width]8[/width]
+ * [label]Hello, world[/label]
+ * [/widget]
+ * </pre>
+ *
+ * <p>For each child element of [widget], a corresponding setter method is
+ * located on the object on the top of the digester stack, the body text of
+ * the child element is converted to the type specified for the (sole)
+ * parameter to the setter method, then the setter method is invoked.</p>
+ *
+ * <p>This rule supports custom mapping of xml element names to property names.
+ * The default mapping for particular elements can be overridden by using
+ * {@link #SetNestedPropertiesRule(String[] elementNames,
+ * String[] propertyNames)}.
+ * This allows child elements to be mapped to properties with different names.
+ * Certain elements can also be marked to be ignored.</p>
+ *
+ * <p>A very similar effect can be achieved using a combination of the
+ * <code>BeanPropertySetterRule</code> and the <code>ExtendedBaseRules</code>
+ * rules manager; this <code>Rule</code>, however, works fine with the default
+ * <code>RulesBase</code> rules manager.</p>
+ *
+ * <p>Note that this rule is designed to be used to set only "primitive"
+ * bean properties, eg String, int, boolean. If some of the child xml elements
+ * match ObjectCreateRule rules (ie cause objects to be created) then you must
+ * use one of the more complex constructors to this rule to explicitly skip
+ * processing of that xml element, and define a SetNextRule (or equivalent) to
+ * handle assigning the child object to the appropriate property instead.</p>
+ *
+ * <p><b>Implementation Notes</b></p>
+ *
+ * <p>This class works by creating its own simple Rules implementation. When
+ * begin is invoked on this rule, the digester's current rules object is
+ * replaced by a custom one. When end is invoked for this rule, the original
+ * rules object is restored. The digester rules objects therefore behave in
+ * a stack-like manner.</p>
+ *
+ * <p>For each child element encountered, the custom Rules implementation
+ * ensures that a special AnyChildRule instance is included in the matches
+ * returned to the digester, and it is this rule instance that is responsible
+ * for setting the appropriate property on the target object (if such a property
+ * exists). The effect is therefore like a "trailing wildcard pattern". The
+ * custom Rules implementation also returns the matches provided by the
+ * underlying Rules implementation for the same pattern, so other rules
+ * are not "disabled" during processing of a SetNestedPropertiesRule.</p>
+ *
+ * <p>TODO: Optimize this class. Currently, each time begin is called,
+ * new AnyChildRules and AnyChildRule objects are created. It should be
+ * possible to cache these in normal use (though watch out for when a rule
+ * instance is invoked re-entrantly!).</p>
+ */
+public class SetNestedPropertiesRule extends Rule {
+
+ private final Map<String, String> elementNames;
+
+ private final boolean trimData;
+
+ private final boolean allowUnknownChildElements;
+
+ /**
+ * Constructor which allows element->property mapping to be overridden.
+ *
+ * @param elementNames
+ * @param trimData
+ * @param allowUnknownChildElements
+ */
+ public SetNestedPropertiesRule(Map<String, String> elementNames, boolean trimData, boolean allowUnknownChildElements) {
+ this.elementNames = elementNames;
+ this.trimData = trimData;
+ this.allowUnknownChildElements = allowUnknownChildElements;
+ }
+
+ /**
+ * Process the beginning of this element.
+ *
+ * @param namespace is the namespace this attribute is in, or null
+ * @param name is the name of the current xml element
+ * @param attributes is the attribute list of this element
+ */
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ Rules oldRules = this.getDigester().getRules();
+ AnyChildRule anyChildRule = new AnyChildRule();
+ anyChildRule.setDigester(this.getDigester());
+ AnyChildRules newRules = new AnyChildRules(anyChildRule);
+ newRules.init(this.getDigester().getMatch() + "/", oldRules);
+ this.getDigester().setRules(newRules);
+ }
+
+ /**
+ * This is only invoked after all child elements have been processed,
+ * so we can remove the custom Rules object that does the
+ * child-element-matching.
+ */
+ @Override
+ public void body(String namespace, String name, String text) throws Exception {
+ AnyChildRules newRules = (AnyChildRules) this.getDigester().getRules();
+ this.getDigester().setRules(newRules.getOldRules());
+ }
+
+ /**
+ * Render a printable version of this Rule.
+ */
+ @Override
+ public String toString() {
+ return String.format("SetNestedPropertiesRule[allowUnknownChildElements=%s, trimData=%s, elementNames=%s]",
+ this.allowUnknownChildElements,
+ this.trimData,
+ this.elementNames);
+ }
+
+ //----------------------------------------- local classes
+
+ /** Private Rules implementation */
+ private class AnyChildRules implements Rules {
+
+ private String matchPrefix = null;
+
+ private Rules decoratedRules = null;
+
+ private List<Rule> rules = new ArrayList<Rule>(1);
+
+ private AnyChildRule rule;
+
+ public AnyChildRules(AnyChildRule rule) {
+ this.rule = rule;
+ rules.add(rule);
+ }
+
+ public Digester getDigester() { return null; }
+
+ public void setDigester(Digester digester) {}
+
+ public String getNamespaceURI() { return null; }
+
+ public void setNamespaceURI(String namespaceURI) {}
+
+ public void add(String pattern, Rule rule) {}
+
+ public void clear() {}
+
+ public List<Rule> match(String namespaceURI, String matchPath) {
+ List<Rule> match = decoratedRules.match(namespaceURI, matchPath);
+
+ if ((matchPath.startsWith(matchPrefix))
+ && (matchPath.indexOf('/', matchPrefix.length()) == -1)) {
+
+ // The current element is a direct child of the element
+ // specified in the init method, so we want to ensure that
+ // the rule passed to this object's constructor is included
+ // in the returned list of matching rules.
+ if ((match == null || match.size()==0)) {
+ // The "real" rules class doesn't have any matches for
+ // the specified path, so we return a list containing
+ // just one rule: the one passed to this object's
+ // constructor.
+ return rules;
+ } else {
+ // The "real" rules class has rules that match the current
+ // node, so we return this list *plus* the rule passed to
+ // this object's constructor.
+ //
+ // It might not be safe to modify the returned list,
+ // so clone it first.
+ LinkedList<Rule> newMatch = new LinkedList<Rule>(match);
+ newMatch.addLast(rule);
+ return newMatch;
+ }
+ } else {
+ return match;
+ }
+ }
+
+ public List<Rule> rules() {
+ // This is not actually expected to be called during normal
+ // processing.
+ //
+ // There is only one known case where this is called; when a rule
+ // returned from AnyChildRules.getMatch() is invoked and throws a
+ // SAXException then method Digester.endDocument will be called
+ // without having "uninstalled" the AnyChildRules ionstance. That
+ // method attempts to invoke the "finish" method for every Rule
+ // instance - and thus needs to call rules() on its Rules object,
+ // which is this one. Actually, java 1.5 and 1.6beta2 have a
+ // bug in their xml implementation such that endDocument is not
+ // called after a SAXException, but other parsers (eg Aelfred)
+ // do call endDocument. Here, we therefore need to return the
+ // rules registered with the underlying Rules object.
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug("AnyChildRules.rules invoked.");
+ }
+ return decoratedRules.rules();
+ }
+
+ public void init(String prefix, Rules rules) {
+ matchPrefix = prefix;
+ decoratedRules = rules;
+ }
+
+ public Rules getOldRules() {
+ return decoratedRules;
+ }
+ }
+
+ private class AnyChildRule extends Rule {
+
+ private String currChildNamespaceURI = null;
+
+ private String currChildElementName = null;
+
+ @Override
+ public void begin(String namespaceURI, String name, Attributes attributes) throws Exception {
+ currChildNamespaceURI = namespaceURI;
+ currChildElementName = name;
+ }
+
+ @Override
+ public void body(String namespace, String name, String text) throws Exception {
+ String propName = currChildElementName;
+ if (elementNames.containsKey(currChildElementName)) {
+ // overide propName
+ propName = elementNames.get(currChildElementName);
+ if (propName == null) {
+ // user wants us to ignore this element
+ return;
+ }
+ }
+
+ boolean debug = this.getDigester().getLog().isDebugEnabled();
+
+ if (debug) {
+ this.getDigester().getLog().debug(
+ String.format("[SetNestedPropertiesRule]{%s} Setting property '%s' to '%s'",
+ this.getDigester().getMatch(),
+ propName,
+ text));
+ }
+
+ // Populate the corresponding properties of the top object
+ Object top = this.getDigester().peek();
+ if (debug) {
+ this.getDigester().getLog().debug(String.format("[SetNestedPropertiesRule]{%s} Set %s properties",
+ this.getDigester().getMatch(),
+ (top != null ? top.getClass().getName() : "NULL")));
+ }
+
+ if (trimData) {
+ text = text.trim();
+ }
+
+ if (!allowUnknownChildElements) {
+ // Force an exception if the property does not exist
+ // (BeanUtils.setProperty() silently returns in this case)
+ if (top instanceof DynaBean) {
+ DynaProperty desc =
+ ((DynaBean) top).getDynaClass().getDynaProperty(propName);
+ if (desc == null) {
+ throw new NoSuchMethodException("Bean has no property named " + propName);
+ }
+ } else /* this is a standard JavaBean */ {
+ PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor(top, propName);
+ if (desc == null) {
+ throw new NoSuchMethodException("Bean has no property named " + propName);
+ }
+ }
+ }
+
+ try {
+ BeanUtils.setProperty(top, propName, text);
+ } catch(NullPointerException e) {
+ this.getDigester().getLog().error(String.format("NullPointerException: top=%s, propName=%s, value=%s!",
+ top,
+ propName,
+ text));
+ throw e;
+ }
+ }
+
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ this.currChildElementName = null;
+ }
+
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNestedPropertiesRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,61 @@
+/* $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.rule;
+
+/**
+ * <p>Rule implementation that calls a method on the (top-1) (parent)
+ * object, passing the top object (child) as an argument. It is
+ * commonly used to establish parent-child relationships.</p>
+ *
+ * <p>This rule now supports more flexible method matching by default.
+ * It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier.
+ * See {@link #isExactMatch()} for more details.</p>
+ *
+ * <p>Note that while CallMethodRule uses commons-beanutils' data-conversion
+ * functionality (ConvertUtils class) to convert parameter values into
+ * the appropriate type for the parameter to the called method, this
+ * rule does not. Needing to use ConvertUtils functionality when building
+ * parent-child relationships is expected to be very rare; however if you
+ * do need this then instead of using this rule, create a CallMethodRule
+ * specifying targetOffset of 1 in the constructor.</p>
+ */
+public class SetNextRule extends AbstractMethodRule {
+
+ /**
+ * Construct a "set next" rule with the specified method name.
+ *
+ * @param methodName Method name of the parent method to call
+ * @param paramType Java class of the parent method's argument
+ * (if you wish to use a primitive type, specify the corresonding
+ * Java wrapper class instead, such as <code>java.lang.Boolean</code>
+ * for a <code>boolean</code> parameter)
+ */
+ public SetNextRule(String methodName, String paramType, boolean useExactMatch) {
+ super(methodName, paramType, useExactMatch);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ this.invoke(this.getDigester().peek(1), this.getDigester().peek(0), "PARENT");
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetNextRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,136 @@
+/* $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.rule;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * <p>Rule implementation that sets properties on the object at the top of the
+ * stack, based on attributes with corresponding names.</p>
+ *
+ * <p>This rule supports custom mapping of attribute names to property names.
+ * The default mapping for particular attributes can be overridden by using
+ * {@link #SetPropertiesRule(String[] attributeNames, String[] propertyNames)}.
+ * This allows attributes to be mapped to properties with different names.
+ * Certain attributes can also be marked to be ignored.</p>
+ */
+public class SetPropertiesRule extends Rule {
+
+ private final Map<String, String> aliases;
+
+ /**
+ * Used to determine whether the parsing should fail if an property specified
+ * in the XML is missing from the bean. Default is true for backward compatibility.
+ */
+ private boolean ignoreMissingProperty;
+
+ /**
+ *
+ *
+ * @param aliases
+ * @param ignoreMissingProperty
+ */
+ public SetPropertiesRule(Map<String, String> aliases, boolean ignoreMissingProperty) {
+ this.aliases = aliases;
+ this.ignoreMissingProperty = ignoreMissingProperty;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public void begin(String namespace, String elementName, Attributes attributes) throws Exception {
+ // Build a set of attribute names and corresponding values
+ Map<String, String> values = new HashMap<String, String>();
+
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String name = attributes.getLocalName(i);
+ if ("".equals(name)) {
+ name = attributes.getQName(i);
+ }
+ String value = attributes.getValue(i);
+
+ if (this.aliases.containsKey(name)) {
+ name = this.aliases.get(name);
+ }
+
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug(String.format("[SetPropertiesRule]{%s} Setting property '%s' to '%s'",
+ this.getDigester().getMatch(),
+ name,
+ value));
+ }
+
+ if ((!ignoreMissingProperty) && (name != null)) {
+ // The BeanUtils.populate method silently ignores items in
+ // the map (ie xml entities) which have no corresponding
+ // setter method, so here we check whether each xml attribute
+ // does have a corresponding property before calling the
+ // BeanUtils.populate method.
+ //
+ // Yes having the test and set as separate steps is ugly and
+ // inefficient. But BeanUtils.populate doesn't provide the
+ // functionality we need here, and changing the algorithm which
+ // determines the appropriate setter method to invoke is
+ // considered too risky.
+ //
+ // Using two different classes (PropertyUtils vs BeanUtils) to
+ // do the test and the set is also ugly; the codepaths
+ // are different which could potentially lead to trouble.
+ // However the BeanUtils/ProperyUtils code has been carefully
+ // compared and the PropertyUtils functionality does appear
+ // compatible so we'll accept the risk here.
+
+ Object top = this.getDigester().peek();
+ boolean test = PropertyUtils.isWriteable(top, name);
+ if (!test) {
+ throw new NoSuchMethodException("Property " + name + " can't be set");
+ }
+ }
+
+ if (name != null) {
+ values.put(name, value);
+ }
+ }
+
+ // Populate the corresponding properties of the top object
+ Object top = this.getDigester().peek();
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug(String.format("[SetPropertiesRule]{%s} Set %s properties",
+ this.getDigester().getMatch(),
+ (top != null ? top.getClass().getName() : "NULL")));
+ }
+ BeanUtils.populate(top, values);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return String.format("SetPropertiesRule[aliases=%s, ignoreMissingProperty=%s]",
+ this.aliases,
+ this.ignoreMissingProperty);
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertiesRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,130 @@
+/* $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.rule;
+
+import java.beans.PropertyDescriptor;
+
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.DynaBean;
+import org.apache.commons.beanutils.DynaProperty;
+import org.apache.commons.beanutils.PropertyUtils;
+import org.apache.commons.digester3.Rule;
+import org.xml.sax.Attributes;
+
+/**
+ * Rule implementation that sets an individual property on the object at the
+ * top of the stack, based on attributes with specified names.
+ */
+public class SetPropertyRule extends Rule {
+
+ /**
+ * The attribute that will contain the property name.
+ */
+ private final String name;
+
+ /**
+ * The attribute that will contain the property value.
+ */
+ private final String value;
+
+ /**
+ * Construct a "set property" rule with the specified name and value
+ * attributes.
+ *
+ * @param name Name of the attribute that will contain the name of the
+ * property to be set
+ * @param value Name of the attribute that will contain the value to which
+ * the property should be set
+ */
+ public SetPropertyRule(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void begin(String namespace, String name, Attributes attributes) throws Exception {
+ if (attributes.getLength() == 0) {
+ return;
+ }
+
+ // Identify the actual property name and value to be used
+ String actualName = null;
+ String actualValue = null;
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String localName = attributes.getLocalName(i);
+ if ("".equals(localName)) {
+ localName = attributes.getQName(i);
+ }
+ String value = attributes.getValue(i);
+ if (localName.equals(this.name)) {
+ actualName = value;
+ } else if (localName.equals(this.value)) {
+ actualValue = value;
+ }
+ }
+
+ // Get a reference to the top object
+ Object top = this.getDigester().peek();
+
+ // Log some debugging information
+ if (this.getDigester().getLog().isDebugEnabled()) {
+ this.getDigester().getLog().debug(String.format("[SetPropertyRule]{%s} Set %s property %s to %s",
+ this.getDigester().getMatch(),
+ top.getClass().getName(),
+ actualName,
+ actualValue));
+ }
+
+ // Force an exception if the property does not exist
+ // (BeanUtils.setProperty() silently returns in this case)
+ //
+ // This code should probably use PropertyUtils.isWriteable(),
+ // like SetPropertiesRule does.
+ if (top instanceof DynaBean) {
+ DynaProperty desc =
+ ((DynaBean) top).getDynaClass().getDynaProperty(actualName);
+ if (desc == null) {
+ throw new NoSuchMethodException("Bean has no property named "
+ + actualName);
+ }
+ } else /* this is a standard JavaBean */ {
+ PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor(top, actualName);
+ if (desc == null) {
+ throw new NoSuchMethodException("Bean has no property named "
+ + actualName);
+ }
+ }
+
+ // Set the property (with conversion as necessary)
+ BeanUtils.setProperty(top, actualName, actualValue);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public final String toString() {
+ return String.format("SetPropertyRule[name=%s, value=%s]",
+ this.name,
+ this.value);
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetPropertyRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,53 @@
+/* $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.rule;
+
+/**
+ * <p>Rule implementation that calls a method on the root object on the stack,
+ * passing the top object (child) as an argument.
+ * It is important to remember that this rule acts on <code>end</code>.</p>
+ *
+ * <p>This rule now supports more flexible method matching by default.
+ * It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier.
+ * See {@link #isExactMatch()} for more details.</p>
+ */
+public class SetRootRule extends AbstractMethodRule {
+
+ /**
+ * Construct a "set root" rule with the specified method name.
+ *
+ * @param methodName Method name of the parent method to call
+ * @param paramType Java class of the parent method's argument
+ * (if you wish to use a primitive type, specify the corresonding
+ * Java wrapper class instead, such as <code>java.lang.Boolean</code>
+ * for a <code>boolean</code> parameter)
+ */
+ public SetRootRule(String methodName, String paramType, boolean useExactMatch) {
+ super(methodName, paramType, useExactMatch);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ this.invoke(this.getDigester().getRoot(), this.getDigester().peek(0), "ROOT");
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetRootRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java?rev=1069805&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java Fri Feb 11 14:19:30 2011
@@ -0,0 +1,49 @@
+/* $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.rule;
+
+/**
+ * <p>Rule implementation that calls a "set parent" method on the top (child)
+ * object, passing the (top-1) (parent) object as an argument.</p>
+ *
+ * <p>This rule now supports more flexible method matching by default.
+ * It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier.
+ * See {@link #isExactMatch()} for more details.</p>
+ */
+public class SetTopRule extends AbstractMethodRule {
+
+ /**
+ * Construct a "set parent" rule with the specified method name.
+ *
+ * @param methodName Method name of the "set parent" method to call
+ * @param paramType Java class of the "set parent" method's argument
+ */
+ public SetTopRule(String methodName, String paramType, boolean useExactMatch) {
+ super(methodName, paramType, useExactMatch);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void end(String namespace, String name) throws Exception {
+ this.invoke(this.getDigester().peek(0), this.getDigester().peek(1), "CHILD");
+ }
+
+}
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rule/SetTopRule.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/BeanPropertySetterBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/BeanPropertySetterBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/BeanPropertySetterBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/BeanPropertySetterBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.BeanPropertySetterRule;
+import org.apache.commons.digester3.rule.BeanPropertySetterRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setBeanProperty()}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallMethodBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallMethodBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallMethodBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallMethodBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.CallMethodRule;
+import org.apache.commons.digester3.rule.CallMethodRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#callMethod(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallParamBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallParamBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallParamBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/CallParamBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.CallParamRule;
+import org.apache.commons.digester3.rule.CallParamRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#callParam(int)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/FactoryCreateBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/FactoryCreateBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/FactoryCreateBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/FactoryCreateBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.FactoryCreateRule;
+import org.apache.commons.digester3.rule.FactoryCreateRule;
import org.apache.commons.digester3.spi.ObjectCreationFactory;
/**
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/LinkedRuleBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/LinkedRuleBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/LinkedRuleBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/LinkedRuleBuilder.java Fri Feb 11 14:19:30 2011
@@ -18,9 +18,9 @@
package org.apache.commons.digester3.rulesbinder;
import org.apache.commons.digester3.Rule;
-import org.apache.commons.digester3.SetNextRule;
-import org.apache.commons.digester3.SetRootRule;
-import org.apache.commons.digester3.SetTopRule;
+import org.apache.commons.digester3.rule.SetNextRule;
+import org.apache.commons.digester3.rule.SetRootRule;
+import org.apache.commons.digester3.rule.SetTopRule;
import org.apache.commons.digester3.spi.ObjectCreationFactory;
import org.apache.commons.digester3.spi.RuleProvider;
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetNestedPropertiesRule;
+import org.apache.commons.digester3.rule.SetNestedPropertiesRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setNestedProperties()}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectCreateBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectCreateBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectCreateBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectCreateBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.ObjectCreateRule;
+import org.apache.commons.digester3.rule.ObjectCreateRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#objectCreate(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectParamBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectParamBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectParamBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/ObjectParamBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.ObjectParamRule;
+import org.apache.commons.digester3.rule.ObjectParamRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#objectCreate(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/PathCallParamBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/PathCallParamBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/PathCallParamBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/PathCallParamBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.PathCallParamRule;
+import org.apache.commons.digester3.rule.PathCallParamRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#callParam(int)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetNextBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetNextBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetNextBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetNextBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetNextRule;
+import org.apache.commons.digester3.rule.SetNextRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setNext(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertiesBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertiesBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertiesBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertiesBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetPropertiesRule;
+import org.apache.commons.digester3.rule.SetPropertiesRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setNestedProperties()}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertyBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertyBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertyBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetPropertyBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetPropertyRule;
+import org.apache.commons.digester3.rule.SetPropertyRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setProperty(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetRootBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetRootBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetRootBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetRootBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetRootRule;
+import org.apache.commons.digester3.rule.SetRootRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setRoot(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetTopBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetTopBuilder.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetTopBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/SetTopBuilder.java Fri Feb 11 14:19:30 2011
@@ -17,7 +17,7 @@
*/
package org.apache.commons.digester3.rulesbinder;
-import org.apache.commons.digester3.SetTopRule;
+import org.apache.commons.digester3.rule.SetTopRule;
/**
* Builder chained when invoking {@link LinkedRuleBuilder#setTop(String)}.
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/spi/ObjectCreationFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/spi/ObjectCreationFactory.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/spi/ObjectCreationFactory.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/spi/ObjectCreationFactory.java Fri Feb 11 14:19:30 2011
@@ -18,12 +18,12 @@
package org.apache.commons.digester3.spi;
import org.apache.commons.digester3.Digester;
-import org.apache.commons.digester3.FactoryCreateRule;
+import org.apache.commons.digester3.rule.FactoryCreateRule;
import org.xml.sax.Attributes;
/**
* Interface for use with {@link FactoryCreateRule}.
- * The rule calls {@link org.apache.commons.digester3.RulesBinder#createObject} to create an object
+ * The rule calls {@link org.apache.commons.digester3.rule.RulesBinder#createObject} to create an object
* to be pushed onto the {@code Digester} stack whenever it is matched.
*/
public interface ObjectCreationFactory<T> {
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/AbstractTestCase.java Fri Feb 11 14:19:30 2011
@@ -22,6 +22,8 @@ import static org.apache.commons.digeste
import java.io.IOException;
import java.io.InputStream;
+import org.apache.commons.digester3.rule.RulesModule;
+
/**
* Define some common utility methods shared between Digester tests.
*/
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/BeanPropertySetterRuleTestCase.java Fri Feb 11 14:19:30 2011
@@ -30,6 +30,7 @@ import java.lang.reflect.InvocationTarge
import java.util.ArrayList;
import java.util.List;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.apache.commons.digester3.rules.ExtendedBaseRules;
import org.junit.Test;
import org.xml.sax.SAXException;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/DigesterTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/DigesterTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/DigesterTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/DigesterTestCase.java Fri Feb 11 14:19:30 2011
@@ -34,6 +34,7 @@ import java.net.URL;
import java.util.EmptyStackException;
import java.util.Map;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.apache.commons.digester3.spi.Substitutor;
import org.junit.Test;
import org.xml.sax.Attributes;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/EmployeeModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/EmployeeModule.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/EmployeeModule.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/EmployeeModule.java Fri Feb 11 14:19:30 2011
@@ -17,6 +17,8 @@
*/
package org.apache.commons.digester3;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
+
/**
* Shared module that contains rules for parsing Employee/Address entities.
*/
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/NamespaceSnapshotTestCase.java Fri Feb 11 14:19:30 2011
@@ -24,6 +24,7 @@ import static org.junit.Assert.assertNot
import java.util.List;
import java.util.Map;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.junit.Test;
import org.xml.sax.Attributes;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectCreationFactoryTestImpl.java Fri Feb 11 14:19:30 2011
@@ -17,6 +17,7 @@
*/
package org.apache.commons.digester3;
+import org.apache.commons.digester3.rule.AbstractObjectCreationFactory;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/ObjectParamRuleTestCase.java Fri Feb 11 14:19:30 2011
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.junit.Test;
import org.xml.sax.SAXException;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetNestedPropertiesRuleTestCase.java Fri Feb 11 14:19:30 2011
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.Reader;
import java.io.StringReader;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.apache.commons.digester3.rules.BaseRules;
import org.junit.Test;
import org.xml.sax.SAXException;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertiesRuleTestCase.java Fri Feb 11 14:19:30 2011
@@ -25,6 +25,7 @@ import static org.junit.Assert.fail;
import java.io.Reader;
import java.io.StringReader;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.junit.Test;
import org.xml.sax.SAXException;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/SetPropertyRuleTestCase.java Fri Feb 11 14:19:30 2011
@@ -26,6 +26,7 @@ import java.io.Reader;
import java.io.StringReader;
import java.lang.reflect.InvocationTargetException;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/TestFactoryCreate.java Fri Feb 11 14:19:30 2011
@@ -26,6 +26,8 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.List;
+import org.apache.commons.digester3.rule.AbstractObjectCreationFactory;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/URLTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/URLTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/URLTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/URLTestCase.java Fri Feb 11 14:19:30 2011
@@ -21,6 +21,8 @@ import static org.junit.Assert.assertNot
import java.net.URL;
+import org.apache.commons.digester3.rule.RulesBinder;
+import org.apache.commons.digester3.rule.RulesModule;
import org.junit.Test;
/**
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/rules/BaseRulesTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/rules/BaseRulesTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/rules/BaseRulesTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/rules/BaseRulesTestCase.java Fri Feb 11 14:19:30 2011
@@ -25,7 +25,7 @@ import java.util.List;
import org.apache.commons.digester3.OrderRule;
import org.apache.commons.digester3.Rule;
-import org.apache.commons.digester3.SetPropertiesRule;
+import org.apache.commons.digester3.rule.SetPropertiesRule;
import org.apache.commons.digester3.spi.Rules;
import org.junit.Test;
Modified: commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java?rev=1069805&r1=1069804&r2=1069805&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java (original)
+++ commons/sandbox/digester3/trunk/src/test/java/org/apache/commons/digester3/substitution/VariableExpansionTestCase.java Fri Feb 11 14:19:30 2011
@@ -27,11 +27,11 @@ import java.io.StringReader;
import java.util.HashMap;
import java.util.LinkedList;
-import org.apache.commons.digester3.AbstractRulesModule;
import org.apache.commons.digester3.Digester;
-import org.apache.commons.digester3.RulesBinder;
-import org.apache.commons.digester3.RulesModule;
import org.apache.commons.digester3.SimpleTestBean;
+import org.apache.commons.digester3.rule.AbstractRulesModule;
+import org.apache.commons.digester3.rule.RulesBinder;
+import org.apache.commons.digester3.rule.RulesModule;
import org.junit.Test;
import org.xml.sax.SAXException;