db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r1470235 [2/7] - in /db/torque/torque4/trunk: torque-generator/ torque-generator/src/main/java/org/apache/torque/generator/configuration/ torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/ torque-generator/src/...
Date Sat, 20 Apr 2013 21:23:42 GMT
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java Sat Apr 20 21:23:39 2013
@@ -32,7 +32,7 @@ import org.apache.torque.generator.confi
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.control.action.MergepointAction;
 import org.apache.torque.generator.qname.QualifiedName;
-import org.apache.torque.generator.source.SourcePath;
+import org.apache.torque.generator.source.SourceElement;
 import org.apache.torque.generator.variable.Variable;
 import org.apache.torque.generator.variable.VariableStore;
 
@@ -60,11 +60,18 @@ public abstract class OutletImpl impleme
 
     /**
      * The name of the input elements to process. If null, the input
-     * elements are not checked.
+     * elements are not checked. If not null, the input element must be
+     * a SourceElement.
      */
     private String inputElementName;
 
     /**
+     * The class  of the input models to process. If null, the class of the
+     * input objects are not checked, except if inputElementName is not null.
+     */
+    private String inputClass;
+
+    /**
      * Constructs a OutletImpl with the given name.
      *
      * @param name the name of this outlet, not null.
@@ -95,6 +102,16 @@ public abstract class OutletImpl impleme
         this.inputElementName = inputElementName;
     }
 
+    public String getInputClass()
+    {
+        return inputClass;
+    }
+
+    public void setInputClass(String inputClass)
+    {
+        this.inputClass = inputClass;
+    }
+
     /**
      * Adds an mergepoint mapping to the outlet. No mergepoint
      * mappings must exist with the given name.
@@ -156,8 +173,46 @@ public abstract class OutletImpl impleme
     }
 
     public void beforeExecute(ControllerState controllerState)
-        throws GeneratorException
+            throws GeneratorException
     {
+        if (inputElementName != null || inputClass != null)
+        {
+            Object model = controllerState.getModel();
+            if (inputClass != null
+                    && !inputClass.equals(model.getClass().getName()))
+            {
+                throw new GeneratorException("The input model of outlet "
+                        + getName()
+                        + " must be of class " + inputClass
+                        + " (because of the value of the attribute inputClass"
+                        + " on the outlet in the generator config) "
+                        + "but is of class " + model.getClass().getName());
+            }
+            if (inputElementName != null
+                    && !SourceElement.class.isAssignableFrom(model.getClass()))
+            {
+                throw new GeneratorException("The input model of outlet "
+                        + getName()
+                        + " must be "
+                        + SourceElement.class.getName()
+                        + " or a subclass thereof "
+                        + "(because the attribute elementName is set "
+                        + "on the outlet in the generator config) "
+                        + " but is of class "
+                        + model.getClass().getName());
+            }
+            if (inputElementName != null
+                && !inputElementName.equals(((SourceElement) model).getName()))
+            {
+                throw new GeneratorException("Input element name, "
+                        + ((SourceElement) model).getName()
+                        + ", is not the expected name, "
+                        + getInputElementName()
+                        + ", for outlet "
+                        + getName());
+            }
+        }
+
         controllerState.pushOutlet(this);
         controllerState.getVariableStore().startOutlet();
         if (log.isDebugEnabled())
@@ -165,8 +220,7 @@ public abstract class OutletImpl impleme
             log.debug("Executing outlet "
                     + getName()
                     + " on element "
-                    + SourcePath.getPathAsString(
-                            controllerState.getSourceElement()));
+                    + controllerState.getModel());
         }
     }
 

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/OutletUtils.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/OutletUtils.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/OutletUtils.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/OutletUtils.java Sat Apr 20 21:23:39 2013
@@ -70,7 +70,7 @@ public final class OutletUtils
         throws GeneratorException
     {
         SourceElement sourceElement = SourcePath.getElement(
-                controllerState.getSourceElement(),
+                (SourceElement) controllerState.getModel(),
                 elementName,
                 false);
         Object attribute

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java Sat Apr 20 21:23:39 2013
@@ -23,6 +23,7 @@ import org.apache.torque.generator.Gener
 import org.apache.torque.generator.control.ControllerState;
 import org.apache.torque.generator.outlet.OutletResult;
 import org.apache.torque.generator.qname.QualifiedName;
+import org.apache.torque.generator.source.SourceElement;
 import org.apache.torque.generator.source.stream.SourceToXml;
 
 /**
@@ -50,7 +51,7 @@ public class XmlOutlet extends OutletWit
             throws GeneratorException
     {
         String result = sourceToXml.toXml(
-                controllerState.getRootElement(),
+                (SourceElement) controllerState.getModelRoot(),
                 createIdAttributes);
 
         return new OutletResult(result.toString());

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodeFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodeFactory.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodeFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodeFactory.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,73 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import java.util.Locale;
+
+import org.apache.commons.jxpath.JXPathBeanInfo;
+import org.apache.commons.jxpath.JXPathIntrospector;
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.apache.commons.jxpath.ri.model.NodePointerFactory;
+import org.apache.commons.jxpath.ri.model.beans.NullPointer;
+
+/**
+ * Implements NodePointerFactory for JavaBeans.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ * @version $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
+ */
+public class ModelNodeFactory implements NodePointerFactory
+{
+
+    /** factory order constant */
+    public static final int MODEL_NODE_FACTORY_ORDER = 2;
+
+    public int getOrder()
+    {
+        return MODEL_NODE_FACTORY_ORDER;
+    }
+
+    public NodePointer createNodePointer(
+            final QName name,
+            final Object bean,
+            final Locale locale)
+    {
+        final JXPathBeanInfo bi
+                = JXPathIntrospector.getBeanInfo(bean.getClass());
+        return new ModelNodePointer(name, bean, bi, bean.getClass(), locale);
+    }
+
+    public NodePointer createNodePointer(
+            final NodePointer parent,
+            final QName name,
+            final Object bean)
+    {
+        if (bean == null)
+        {
+            return new NullPointer(parent, name);
+        }
+
+        final JXPathBeanInfo bi
+                = JXPathIntrospector.getBeanInfo(bean.getClass());
+        return new ModelNodePointer(parent, name, bean, bi, bean.getClass());
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodePointer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodePointer.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodePointer.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodePointer.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,117 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import java.util.Locale;
+
+import org.apache.commons.jxpath.JXPathBeanInfo;
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.apache.commons.jxpath.ri.model.beans.BeanPointer;
+import org.apache.commons.jxpath.ri.model.beans.PropertyPointer;
+
+/**
+ * A Pointer that points to a Java Object or a collection. It is either
+ * the first element of a path or a pointer for a property value.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ *
+ * @version $Id: $
+ */
+public class ModelNodePointer extends BeanPointer
+{
+    /** SerialVersionUID. */
+    private static final long serialVersionUID = 1L;
+
+    /** The JavaBean properties of the object pointed to. */
+    private final JXPathBeanInfo beanInfo;
+
+    /** The class of the object pointed to. */
+    private final Class<?> beanClass;
+
+    /**
+     * Create a new BeanPointer.
+     * @param name is the name given to the first node
+     * @param bean pointed
+     * @param beanInfo JXPathBeanInfo
+     * @param beanClass the class of the bean
+     * @param locale Locale
+     */
+    public ModelNodePointer(
+            final QName name,
+            final Object bean,
+            final JXPathBeanInfo beanInfo,
+            final Class<?> beanClass,
+            final Locale locale)
+    {
+        super(name, bean, beanInfo, locale);
+        this.beanInfo = beanInfo;
+        this.beanClass = beanClass;
+    }
+
+    /**
+     * Create a new BeanPointer.
+     * @param parent pointer
+     * @param name is the name given to the first node
+     * @param bean pointed
+     * @param beanInfo JXPathBeanInfo
+     * @param beanClass the class of the bean
+     */
+    public ModelNodePointer(
+            final NodePointer parent,
+            final QName name,
+            final Object bean,
+            final JXPathBeanInfo beanInfo,
+            final Class<?> beanClass)
+    {
+        super(parent, name, bean, beanInfo);
+        this.beanInfo = beanInfo;
+        this.beanClass = beanClass;
+    }
+
+    @Override
+    public PropertyPointer getPropertyPointer()
+    {
+        return new ModelPropertyPointer(this, beanInfo, beanClass);
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return getName() == null ? 0 : getName().hashCode();
+    }
+
+    @Override
+    public boolean equals(final Object object)
+    {
+        if (object == this)
+        {
+            return true;
+        }
+
+        if (!(object instanceof ModelNodePointer))
+        {
+            return false;
+        }
+
+        return super.equals(object);
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,586 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import java.beans.IndexedPropertyDescriptor;
+import java.beans.PropertyDescriptor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.commons.jxpath.JXPathBeanInfo;
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.JXPathException;
+import org.apache.commons.jxpath.JXPathInvalidAccessException;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.apache.commons.jxpath.ri.model.beans.PropertyPointer;
+import org.apache.commons.jxpath.util.ValueUtils;
+
+/**
+ * Pointer pointing to a property or field of a JavaBean.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ * @version $Id: $
+ */
+public class ModelPropertyPointer extends PropertyPointer
+{
+    /** Serial Verion UID. */
+    private static final long serialVersionUID = 1L;
+
+    /** The object which signifies that a field is not initialized. */
+    private static final Object UNINITIALIZED = new Object();
+
+    /** The name of the property or field pointed to. */
+    private String name;
+
+    /** The JavaBean properties of the base object. */
+    private final JXPathBeanInfo beanInfo;
+
+    /** The class of the base object. */
+    private final Class<?> valueClass;
+
+    /** The base value of the object (which properties should be accessed). */
+    private Object baseValue = UNINITIALIZED;
+
+    /** The current value pointed to. */
+    private Object value = UNINITIALIZED;
+
+    /** The names of all JavaBean properties and fields of the base object. */
+    private transient String[] propertyNames;
+
+    /** The descriptors of all JavaBean properties of the base object. */
+    private transient PropertyDescriptor[] propertyDescriptors;
+
+    /** The descriptor of the current property pointed to. */
+    private transient PropertyDescriptor propertyDescriptor;
+
+    /** The descriptor of the current field pointed to. */
+    private transient Field field;
+
+    /**
+     * Create a new BeanPropertyPointer.
+     * @param parent parent pointer
+     * @param beanInfo describes the target property/ies.
+     */
+    public ModelPropertyPointer(
+            final NodePointer parent,
+            final JXPathBeanInfo beanInfo,
+            final Class<?> valueClass)
+    {
+        super(parent);
+        this.beanInfo = beanInfo;
+        this.valueClass = valueClass;
+    }
+
+    /**
+     * This type of node is auxiliary.
+     * @return true
+     */
+    @Override
+    public boolean isContainer()
+    {
+        return true;
+    }
+
+    @Override
+    public int getPropertyCount()
+    {
+        if (beanInfo.isAtomic())
+        {
+            return 0;
+        }
+        return getPropertyDescriptors().length;
+    }
+
+    /**
+     * Get the names of all properties, sorted alphabetically
+     * @return String[]
+     */
+    @Override
+    public String[] getPropertyNames()
+    {
+        if (propertyNames == null)
+        {
+            final Set<String> names = new TreeSet<String>();
+            for (final PropertyDescriptor pd : beanInfo.getPropertyDescriptors())
+            {
+                names.add(pd.getName());
+            }
+            for (final Field f : valueClass.getFields())
+            {
+                if (Modifier.isPublic(f.getModifiers()))
+                {
+                    names.add(f.getName());
+                }
+            }
+            propertyNames = names.toArray(new String[] {});
+        }
+        return propertyNames;
+    }
+
+    /**
+     * Select a property by name.
+     * @param name String name
+     */
+    @Override
+    public void setPropertyName(final String name)
+    {
+        setPropertyIndex(UNSPECIFIED_PROPERTY);
+        this.name = name;
+    }
+
+    /**
+     * Selects a property by its offset in the alphabetically sorted list.
+     * @param index property index
+     */
+    @Override
+    public void setPropertyIndex(final int index)
+    {
+        if (this.propertyIndex != index)
+        {
+            super.setPropertyIndex(index);
+            name = null;
+            propertyDescriptor = null;
+            field = null;
+            baseValue = UNINITIALIZED;
+            value = UNINITIALIZED;
+        }
+    }
+
+    /**
+     * Get the value of the currently selected property.
+     * @return Object value
+     */
+    @Override
+    public Object getBaseValue()
+    {
+        if (baseValue == UNINITIALIZED)
+        {
+            final PropertyDescriptor pd = getPropertyDescriptor();
+            if (pd == null)
+            {
+                final Field f = getField();
+                if (f == null)
+                {
+                    return null;
+                }
+                baseValue = getFieldValue(f);
+            }
+            else
+            {
+                baseValue = ValueUtils.getValue(getBean(), pd);
+            }
+        }
+        return baseValue;
+    }
+
+    @Override
+    public void setIndex(final int index)
+    {
+        if (this.index == index)
+        {
+            return;
+        }
+        // When dealing with a scalar, index == 0 is equivalent to
+        // WHOLE_COLLECTION, so do not change it.
+        if (this.index != WHOLE_COLLECTION
+                || index != 0
+                || isCollection())
+        {
+            super.setIndex(index);
+            value = UNINITIALIZED;
+        }
+    }
+
+    /**
+     * If index == WHOLE_COLLECTION, the value of the property, otherwise
+     * the value of the index'th element of the collection represented by the
+     * property. If the property is not a collection, index should be zero
+     * and the value will be the property itself.
+     * @return Object
+     */
+    @Override
+    public Object getImmediateNode()
+    {
+        if (value == UNINITIALIZED)
+        {
+            if (index == WHOLE_COLLECTION)
+            {
+                value = ValueUtils.getValue(getBaseValue());
+            }
+            else
+            {
+                final PropertyDescriptor pd = getPropertyDescriptor();
+                if (pd == null)
+                {
+                    final Field f = getField();
+                    if (f == null)
+                    {
+                        value = null;
+                    }
+                    else
+                    {
+                        value = ValueUtils.getValue(getFieldValue(f), index);
+                    }
+                }
+                else
+                {
+                    value = ValueUtils.getValue(getBean(), pd, index);
+                }
+            }
+        }
+        return value;
+    }
+
+    @Override
+    protected boolean isActualProperty()
+    {
+        return getPropertyDescriptor() != null;
+    }
+
+    @Override
+    public boolean isCollection()
+    {
+        final PropertyDescriptor pd = getPropertyDescriptor();
+        final int hint;
+        if (pd == null)
+        {
+            final Field f = getField();
+            if (f == null)
+            {
+                return false;
+            }
+            hint = ValueUtils.getCollectionHint(field.getType());
+        }
+        else
+        {
+            if (pd instanceof IndexedPropertyDescriptor)
+            {
+                return true;
+            }
+            hint = ValueUtils.getCollectionHint(pd.getPropertyType());
+        }
+        if (hint == -1)
+        {
+            return false;
+        }
+        if (hint == 1)
+        {
+            return true;
+        }
+
+        final Object v = getBaseValue();
+        return v != null && ValueUtils.isCollection(v);
+    }
+
+    /**
+     * If the property contains a collection, then the length of that
+     * collection, otherwise - 1.
+     * @return int length
+     */
+    @Override
+    public int getLength()
+    {
+        final PropertyDescriptor pd = getPropertyDescriptor();
+        final int hint;
+        if (pd == null)
+        {
+            final Field f = getField();
+            if (f == null)
+            {
+                return 1;
+            }
+            hint = ValueUtils.getCollectionHint(f.getType());
+        }
+        else
+        {
+            if (pd instanceof IndexedPropertyDescriptor)
+            {
+                return ValueUtils.getIndexedPropertyLength(
+                    getBean(),
+                    (IndexedPropertyDescriptor) pd);
+            }
+            hint = ValueUtils.getCollectionHint(pd.getPropertyType());
+        }
+
+        if (hint == -1)
+        {
+            return 1;
+        }
+        return ValueUtils.getLength(getBaseValue());
+    }
+
+    /**
+     * If index == WHOLE_COLLECTION, change the value of the property, otherwise
+     * change the value of the index'th element of the collection
+     * represented by the property.
+     * @param value value to set
+     */
+    @Override
+    public void setValue(final Object value)
+    {
+        final PropertyDescriptor pd = getPropertyDescriptor();
+        Field f;
+        if (pd == null)
+        {
+            f = getField();
+            if (f == null)
+            {
+                throw new JXPathInvalidAccessException(
+                    "Cannot set property: " + asPath() + " - no such property");
+            }
+            setFieldValue(f, value);
+        }
+        else
+        {
+            if (index == WHOLE_COLLECTION)
+            {
+                ValueUtils.setValue(getBean(), pd, value);
+            }
+            else
+            {
+                ValueUtils.setValue(getBean(), pd, index, value);
+            }
+        }
+        this.value = value;
+    }
+
+    @Override
+    public NodePointer createPath(final JXPathContext context)
+    {
+        if (getImmediateNode() == null)
+        {
+            super.createPath(context);
+            baseValue = UNINITIALIZED;
+            value = UNINITIALIZED;
+        }
+        return this;
+    }
+
+    @Override
+    public void remove()
+    {
+        if (index == WHOLE_COLLECTION)
+        {
+            setValue(null);
+        }
+        else if (isCollection())
+        {
+            final Object o = getBaseValue();
+            final Object collection = ValueUtils.remove(getBaseValue(), index);
+            if (collection != o)
+            {
+                final PropertyDescriptor pd = getPropertyDescriptor();
+                if (pd == null)
+                {
+                    final Field f = getField();
+                    setFieldValue(f, collection);
+                }
+                else
+                {
+                    ValueUtils.setValue(
+                            getBean(),
+                            getPropertyDescriptor(),
+                            collection);
+                }
+            }
+        }
+        else if (index == 0)
+        {
+            index = WHOLE_COLLECTION;
+            setValue(null);
+        }
+    }
+
+    /**
+     * Get the name of the currently selected property.
+     * @return String property name
+     */
+    @Override
+    public String getPropertyName()
+    {
+        if (name == null)
+        {
+            final PropertyDescriptor pd = getPropertyDescriptor();
+            if (pd != null)
+            {
+                name = pd.getName();
+            }
+            else
+            {
+                final Field f = getField();
+                if (f != null)
+                {
+                    name = f.getName();
+                }
+            }
+        }
+        return name != null ? name : "*";
+    }
+
+    /**
+     * Finds the property descriptor corresponding to the current property
+     * index.
+     * @return PropertyDescriptor
+     */
+    private PropertyDescriptor getPropertyDescriptor()
+    {
+        if (propertyDescriptor == null)
+        {
+            final int inx = getPropertyIndex();
+            if (inx == UNSPECIFIED_PROPERTY)
+            {
+                propertyDescriptor =
+                    beanInfo.getPropertyDescriptor(name);
+            }
+            else
+            {
+                final String[] names = getPropertyNames();
+                if (inx >= 0 && inx < names.length)
+                {
+                    propertyDescriptor
+                            = beanInfo.getPropertyDescriptor(names[inx]);
+                }
+                else
+                {
+                    propertyDescriptor = null;
+                }
+            }
+        }
+        return propertyDescriptor;
+    }
+
+    /**
+     * Finds the property descriptor corresponding to the current property
+     * index.
+     * @return PropertyDescriptor
+     */
+    private Field getField()
+    {
+        if (field == null)
+        {
+            final int inx = getPropertyIndex();
+            if (inx == UNSPECIFIED_PROPERTY)
+            {
+                field = getField(name);
+            }
+            else
+            {
+                final String[] names = getPropertyNames();
+                if (inx >= 0 && inx < names.length)
+                {
+                    field = getField(names[inx]);
+                }
+                else
+                {
+                    field = null;
+                }
+            }
+        }
+        return field;
+    }
+
+    private Field getField(final String name)
+    {
+        try
+        {
+            return valueClass.getField(name);
+        }
+        catch (final SecurityException e)
+        {
+            throw new JXPathException(
+                    "Cannot access property: "
+                        + valueClass.getName()
+                        + "."
+                        + name,
+                    e);
+       }
+        catch (final NoSuchFieldException e)
+        {
+            throw new JXPathException(
+                    "Cannot access property: "
+                        + valueClass.getName()
+                        + "."
+                        + name,
+                    e);
+        }
+    }
+
+    private Object getFieldValue(final Field field)
+    {
+        try
+        {
+            return field.get(getBean());
+        }
+        catch (final IllegalArgumentException e)
+        {
+            throw new JXPathException(
+                    "Cannot access property: "
+                        + (bean == null ? "null" : bean.getClass().getName())
+                        + "."
+                        + name,
+                    e);
+        }
+        catch (final IllegalAccessException e)
+        {
+            throw new JXPathException(
+                    "Cannot access property: "
+                        + (bean == null ? "null" : bean.getClass().getName())
+                        + "."
+                        + name,
+                    e);
+
+        }
+    }
+
+    private void setFieldValue(final Field field, final Object value)
+    {
+        try
+        {
+            field.set(getBean(), value);
+        }
+        catch (final IllegalArgumentException e)
+        {
+            throw new JXPathInvalidAccessException(
+                    "Cannot set property: " + asPath(), e);
+        }
+        catch (final IllegalAccessException e)
+        {
+            throw new JXPathInvalidAccessException(
+                    "Cannot set property: " + asPath(), e);
+        }
+    }
+
+    /**
+     * Get all PropertyDescriptors.
+     * @return PropertyDescriptor[]
+     */
+    protected synchronized PropertyDescriptor[] getPropertyDescriptors()
+    {
+        if (propertyDescriptors == null)
+        {
+            propertyDescriptors = beanInfo.getPropertyDescriptors();
+        }
+        return propertyDescriptors;
+    }
+
+}

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java Sat Apr 20 21:23:39 2013
@@ -24,7 +24,9 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
 import java.util.Set;
 
@@ -51,7 +53,8 @@ public class SourceElement
     /**
      * the source element's attributes.
      */
-    private final Map<String, Object> attributes = new HashMap<String, Object>();
+    private final Map<String, Object> attributes
+            = new LinkedHashMap<String, Object>();
 
     /**
      * Constructor.
@@ -231,6 +234,33 @@ public class SourceElement
         return SourcePath.hasChild(this, name);
     }
 
+    /**
+     * Returns the first child of this source element.
+     *
+     * @return the first child, or null if this source element has no children.
+     */
+    public SourceElement getFirstChild()
+    {
+        if (children.isEmpty())
+        {
+            return null;
+        }
+        return children.get(0);
+    }
+
+    /**
+     * Returns the last child of this source element.
+     *
+     * @return the last child, or null if this source element has no children.
+     */
+    public SourceElement getLastChild()
+    {
+        if (children.isEmpty())
+        {
+            return null;
+        }
+        return children.get(children.size() - 1);
+    }
 
     /**
      * Returns all the following elements after this element
@@ -251,6 +281,35 @@ public class SourceElement
     }
 
     /**
+     * Returns the following element after this element
+     * If this element has no parent, null is returned.
+     *
+     * @param parent the parent of this source Element in which child
+     *        list the following element should be looked for.
+     *
+     * @return the following source element,
+     *         or null if no following source element exists.
+     *
+     * @throws IllegalArgumentException if parent is not a parent
+     *         of this SourceElement.
+     */
+    public SourceElement getFollowingSourceElement(SourceElement parent)
+    {
+        if (!parents.contains(parent))
+        {
+            throw new IllegalArgumentException(
+                    "parent is not a parent of this SourceElement");
+        }
+        ListIterator<SourceElement> sameLevelIt
+            = SourcePath.getSiblingIteratorPositionedOnSelf(this, parent);
+        if (!sameLevelIt.hasNext())
+        {
+            return null;
+        }
+        return sameLevelIt.next();
+    }
+
+    /**
      * Returns whether a following element exists as a child of the parent of
      * this element.
      *
@@ -313,6 +372,36 @@ public class SourceElement
     }
 
     /**
+     * Returns the preceding element after this element.
+     * If this element has no parent, null is returned.
+     *
+     * @param parent the parent of this source Element in which child
+     *        list the following element should be looked for.
+     *
+     * @return the preceding source element,
+     *         or null if no preceding source element exists.
+     *
+     * @throws IllegalArgumentException if parent is not a parent
+     *         of this SourceElement.
+     */
+    public SourceElement getPrecedingSourceElement(SourceElement parent)
+    {
+        if (!parents.contains(parent))
+        {
+            throw new IllegalArgumentException(
+                    "parent is not a parent of this SourceElement");
+        }
+        ListIterator<SourceElement> sameLevelIt
+            = SourcePath.getSiblingIteratorPositionedOnSelf(this, parent);
+        sameLevelIt.previous();
+        if (!sameLevelIt.hasPrevious())
+        {
+            return null;
+        }
+        return sameLevelIt.previous();
+    }
+
+    /**
      * Returns the object stored in the attribute with key null.
      *
      * @return the stored object, or null if no object is stored

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,135 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.model.NodeIterator;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+
+/**
+ * A node iterator iterating over attributes of a SourceElement.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ *
+ * @version $Id: $
+ */
+public class SourceElementAttributeIterator implements NodeIterator
+{
+    /** The parent pointer. */
+    private final NodePointer parent;
+
+    /** The source element over which attributes is iterated. */
+    private final SourceElement sourceElement;
+
+    /** The name of the selected attribute. */
+    private final String name;
+
+    /** All matching names. */
+    private final List<String> names;
+
+    /** The position of the iterator. */
+    private int position = 0;
+
+    /**
+     * Create a new SourceElementAttributeIterator.
+     *
+     * @param parent the parent pointer
+     * @param qName the name to test
+     */
+    public SourceElementAttributeIterator(final NodePointer parent, final QName qName)
+    {
+        this.parent = parent;
+        this.name = qName.getName();
+        names = new ArrayList<String>();
+        sourceElement = (SourceElement) parent.getNode();
+        if (!name.equals("*"))
+        {
+            final Object attr = sourceElement.getAttribute(name);
+            if (attr != null)
+            {
+                names.add(name);
+            }
+        }
+        else
+        {
+            final Set<String> attributeNames = sourceElement.getAttributeNames();
+            for (final String attributeName : attributeNames)
+            {
+                final Object value = sourceElement.getAttribute(attributeName);
+                if (testAttr(attributeName, value))
+                {
+                    names.add(name);
+                }
+            }
+        }
+    }
+
+    /**
+     * Test an attribute.
+     * @param attr to test
+     * @return whether test succeeded
+     */
+    private boolean testAttr(final String attributeName, final Object value)
+    {
+        if (name.equals("*") || name.equals(attributeName))
+        {
+            return true;
+        }
+        return false;
+    }
+
+    public NodePointer getNodePointer()
+    {
+        if (position == 0)
+        {
+            if (!setPosition(1))
+            {
+                return null;
+            }
+            position = 0;
+        }
+        int index = position - 1;
+        if (index < 0)
+        {
+            index = 0;
+        }
+        return new SourceElementAttributePointer(
+                parent,
+                sourceElement,
+                names.get(index));
+    }
+
+    public int getPosition()
+    {
+        return position;
+    }
+
+    public boolean setPosition(final int position)
+    {
+        this.position = position;
+        return position >= 1 && position <= names.size();
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,204 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import org.apache.commons.jxpath.ri.Compiler;
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.compiler.NodeTest;
+import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.apache.commons.lang.ObjectUtils;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+/**
+ * A node pointer pointing to an attribute of a SourceElement.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ *
+ * @version $Id: $
+ */
+public class SourceElementAttributePointer extends NodePointer
+{
+    /** SerialVersionUID. */
+    private static final long serialVersionUID = 1115085175427555951L;
+
+    /** The source element to which the attribute belongs. */
+    private final SourceElement sourceElement;
+
+    /** The name of the attribute. */
+    private final String name;
+
+    /**
+     * Constructor.
+     *
+     * @param parent the parent pointer.
+     * @param sourceElement the SourceElement to which attribute is pointed.
+     * @param name the name of the attribute pointed to.
+     */
+    public SourceElementAttributePointer(
+            final NodePointer parent,
+            final SourceElement sourceElement,
+            final String name)
+    {
+        super(parent);
+        this.sourceElement = sourceElement;
+        this.name = name;
+    }
+
+    @Override
+    public QName getName()
+    {
+        return new QName(null, name);
+    }
+
+    @Override
+    public String getNamespaceURI()
+    {
+        return null;
+    }
+
+    @Override
+    public Object getValue()
+    {
+        return sourceElement.getAttribute(name);
+    }
+
+    @Override
+    public Object getBaseValue()
+    {
+        return sourceElement.getAttribute(name);
+    }
+
+    @Override
+    public boolean isCollection()
+    {
+        return false;
+    }
+
+    @Override
+    public int getLength()
+    {
+        return 1;
+    }
+
+    @Override
+    public Object getImmediateNode()
+    {
+        return sourceElement.getAttribute(name);
+    }
+
+    @Override
+    public boolean isActual()
+    {
+        return true;
+    }
+
+    @Override
+    public boolean isLeaf()
+    {
+        return true;
+    }
+
+    @Override
+    public boolean testNode(final NodeTest nodeTest)
+    {
+        return nodeTest == null
+            || ((nodeTest instanceof NodeTypeTest)
+                && ((NodeTypeTest) nodeTest).getNodeType() == Compiler.NODE_TYPE_NODE);
+    }
+
+    /**
+     * Sets the value of this attribute.
+     *
+     * @param value to set
+     */
+    @Override
+    public void setValue(final Object value)
+    {
+        sourceElement.setAttribute(name, value);
+    }
+
+    /**
+     * Removes the attribute pointed to.
+     */
+    @Override
+    public void remove()
+    {
+        sourceElement.setAttribute(name, null);
+    }
+
+    @Override
+    public String asPath()
+    {
+        final StringBuffer buffer = new StringBuffer();
+        if (parent != null)
+        {
+            buffer.append(parent.asPath());
+            if (buffer.length() == 0
+                || buffer.charAt(buffer.length() - 1) != '/')
+            {
+                buffer.append('/');
+            }
+        }
+        buffer.append('@');
+        buffer.append(getName());
+        return buffer.toString();
+    }
+
+    @Override
+    public int hashCode()
+    {
+        return new HashCodeBuilder()
+            .append(sourceElement)
+            .append(name)
+            .toHashCode();
+    }
+
+    @Override
+    public boolean equals(final Object object)
+    {
+        if (object == this)
+        {
+            return true;
+        }
+        if (!(object instanceof SourceElementAttributePointer))
+        {
+            return false;
+        }
+        final SourceElementAttributePointer other
+                = (SourceElementAttributePointer) object;
+        if (sourceElement != other.sourceElement)
+        {
+            return false;
+        }
+        return ObjectUtils.equals(name, other.name);
+    }
+
+    @Override
+    public int compareChildNodePointers(
+            final NodePointer pointer1,
+            final NodePointer pointer2)
+    {
+        // Won't happen - attributes don't have children
+        return 0;
+    }
+
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodeIterator.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodeIterator.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodeIterator.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodeIterator.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,210 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+
+import org.apache.commons.jxpath.ri.compiler.NodeTest;
+import org.apache.commons.jxpath.ri.model.NodeIterator;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+
+/**
+ * A node iterator iterating over children of a SourceElement.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ *
+ * @version $Id: $
+ */
+public class SourceElementNodeIterator implements NodeIterator
+{
+    /** The parent pointer. */
+    private final NodePointer parent;
+
+    /** The node test which the selected children must match. */
+    private final NodeTest nodeTest;
+
+    /** The source element which is the parent of the nodes iterated over. */
+    private final SourceElement sourceElement;
+
+    /** The current matching child in the iteration. */
+    private SourceElement child = null;
+
+    /** Whether order is reverse. */
+    private final boolean reverse;
+
+    /** The current iterator position. */
+    private int position = 0;
+
+    /**
+     * Create a new DOMNodeIterator.
+     * @param parent parent pointer
+     * @param nodeTest test
+     * @param reverse whether to iterate in reverse
+     * @param startWith starting pointer
+     */
+    public SourceElementNodeIterator(
+        final NodePointer parent,
+        final NodeTest nodeTest,
+        final boolean reverse,
+        final NodePointer startWith)
+    {
+        this.parent = parent;
+        this.sourceElement = (SourceElement) parent.getNode();
+        if (startWith != null)
+        {
+            this.child = (SourceElement) startWith.getNode();
+        }
+        this.nodeTest = nodeTest;
+        this.reverse = reverse;
+    }
+
+    public NodePointer getNodePointer()
+    {
+        if (position == 0)
+        {
+            setPosition(1);
+        }
+        return child == null ? null : new SourceElementNodePointer(parent, child);
+    }
+
+    public int getPosition()
+    {
+        return position;
+    }
+
+    public boolean setPosition(final int position)
+    {
+        while (this.position < position)
+        {
+            if (!next())
+            {
+                return false;
+            }
+        }
+        while (this.position > position)
+        {
+            if (!previous())
+            {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Set the previous position.
+     * @return whether valid
+     */
+    private boolean previous()
+    {
+        position--;
+        if (!reverse)
+        {
+            if (position == 0)
+            {
+                child = null;
+            }
+            else if (child == null)
+            {
+                child = sourceElement.getLastChild();
+            }
+            else
+            {
+                child = child.getPrecedingSourceElement(sourceElement);
+            }
+            while (child != null && !testChild())
+            {
+                child = child.getPrecedingSourceElement(sourceElement);
+            }
+        }
+        else
+        {
+            child = child.getFollowingSourceElement(sourceElement);
+            while (child != null && !testChild())
+            {
+                child = child.getFollowingSourceElement(sourceElement);
+            }
+        }
+        return child != null;
+    }
+
+    /**
+     * Set the next position.
+     * @return whether valid
+     */
+    private boolean next()
+    {
+        position++;
+        if (!reverse)
+        {
+            if (position == 1)
+            {
+                if (child == null)
+                {
+                    child = sourceElement.getFirstChild();
+                }
+                else
+                {
+                    child = child.getFollowingSourceElement(sourceElement);
+                }
+            }
+            else
+            {
+                child = child.getFollowingSourceElement(sourceElement);
+            }
+            while (child != null && !testChild())
+            {
+                child = child.getFollowingSourceElement(sourceElement);
+            }
+        }
+        else
+        {
+            if (position == 1)
+            {
+                if (child == null)
+                {
+                    child = sourceElement.getLastChild();
+                }
+                else
+                {
+                    child = sourceElement.getPrecedingSourceElement(sourceElement);
+                }
+            }
+            else
+            {
+                child = sourceElement.getPrecedingSourceElement(sourceElement);
+            }
+            while (child != null && !testChild())
+            {
+                child = child.getPrecedingSourceElement(sourceElement);
+            }
+        }
+        return child != null;
+    }
+
+    /**
+     * Test child.
+     * @return result of the test
+     */
+    private boolean testChild()
+    {
+        return SourceElementNodePointer.testSourceElement(child, nodeTest);
+    }
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,194 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import java.util.Locale;
+
+import org.apache.commons.jxpath.ri.Compiler;
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
+import org.apache.commons.jxpath.ri.compiler.NodeTest;
+import org.apache.commons.jxpath.ri.compiler.NodeTypeTest;
+import org.apache.commons.jxpath.ri.model.NodeIterator;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+
+/**
+ * A node pointer pointing to a SourceElement.
+ *
+ * @author Dmitri Plotnikov
+ * @author Thomas Fox
+ *
+ * @version $Id: $
+ */
+public class SourceElementNodePointer extends NodePointer
+{
+    /** SerialVersionUID. */
+    private static final long serialVersionUID = 1L;
+
+    /** The SourceElement pointed to. */
+    private final SourceElement sourceElement;
+
+    protected SourceElementNodePointer(
+            final SourceElement sourceElement,
+            final Locale locale)
+    {
+        super(null, locale);
+        this.sourceElement = sourceElement;
+    }
+
+    protected SourceElementNodePointer(
+            final NodePointer parent,
+            final SourceElement sourceElement)
+    {
+        super(parent);
+        this.sourceElement = sourceElement;
+    }
+
+    @Override
+    public boolean isLeaf()
+    {
+        return sourceElement.getChildren().isEmpty();
+    }
+
+    @Override
+    public boolean isCollection()
+    {
+        return false;
+    }
+
+    @Override
+    public int getLength()
+    {
+        return 1;
+    }
+
+    @Override
+    public QName getName()
+    {
+        return new QName(null, sourceElement.getName());
+    }
+
+    @Override
+    public Object getBaseValue()
+    {
+        return sourceElement;
+    }
+
+    @Override
+    public Object getImmediateNode()
+    {
+        return sourceElement;
+    }
+
+    @Override
+    public void setValue(final Object value)
+    {
+        // do nothing
+    }
+
+    @Override
+    public int compareChildNodePointers(final NodePointer pointer1,
+            final NodePointer pointer2)
+    {
+        final SourceElement sourceElement1
+                = (SourceElement) pointer1.getBaseValue();
+        final SourceElement sourceElement2
+                = (SourceElement) pointer2.getBaseValue();
+        if (sourceElement1 == sourceElement2)
+        {
+            return 0;
+        }
+        for (final SourceElement child : sourceElement.getChildren())
+        {
+            if (child == sourceElement1)
+            {
+                return -1;
+            }
+            if (child == sourceElement2)
+            {
+                return 1;
+            }
+        }
+        return 0;
+    }
+
+    @Override
+    public NodeIterator childIterator(
+            final NodeTest test,
+            final boolean reverse,
+            final NodePointer startWith)
+    {
+        return new SourceElementNodeIterator(this, test, reverse, startWith);
+    }
+
+    @Override
+    public NodeIterator attributeIterator(final QName qname)
+    {
+        return new SourceElementAttributeIterator(this, qname);
+    }
+
+    public boolean testSourceElement(final NodeTest test)
+    {
+        return testSourceElement(sourceElement, test);
+    }
+
+    /**
+     * Test a Node.
+     * @param node to test
+     * @param test to execute
+     * @return true if node passes test
+     */
+    public static boolean testSourceElement(
+            final SourceElement sourceElement,
+            final NodeTest test)
+    {
+        if (test == null)
+        {
+            return true;
+        }
+        if (test instanceof NodeNameTest)
+        {
+
+            final NodeNameTest nodeNameTest = (NodeNameTest) test;
+            final QName testName = nodeNameTest.getNodeName();
+            final boolean wildcard = nodeNameTest.isWildcard();
+            final String testPrefix = testName.getPrefix();
+            if (wildcard && testPrefix == null)
+            {
+                return true;
+            }
+            if (wildcard || testName.getName().equals(sourceElement.getName()))
+            {
+               return true;
+            }
+            return false;
+        }
+        if (test instanceof NodeTypeTest)
+        {
+            if (((NodeTypeTest) test).getNodeType() == Compiler.NODE_TYPE_NODE)
+            {
+                    return true;
+            }
+            return false;
+        }
+        return false;
+    }
+
+}

Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointerFactory.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointerFactory.java?rev=1470235&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointerFactory.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointerFactory.java Sat Apr 20 21:23:39 2013
@@ -0,0 +1,60 @@
+package org.apache.torque.generator.source;
+
+/*
+ * 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.
+ */
+
+import java.util.Locale;
+
+import org.apache.commons.jxpath.ri.QName;
+import org.apache.commons.jxpath.ri.model.NodePointer;
+import org.apache.commons.jxpath.ri.model.NodePointerFactory;
+
+/**
+ * A node pointer factory for SourceElements.
+ *
+ * @version $Id: $
+ */
+public class SourceElementNodePointerFactory implements NodePointerFactory
+{
+    public int getOrder()
+    {
+        return 1;
+    }
+
+    public NodePointer createNodePointer(
+            final QName name,
+            final Object object,
+            final Locale locale)
+    {
+        return object instanceof SourceElement
+                ? new SourceElementNodePointer((SourceElement) object, locale)
+                : null;
+    }
+
+    public NodePointer createNodePointer(
+            final NodePointer parent,
+            final QName name,
+            final Object object)
+    {
+        return object instanceof SourceElement
+                ? new SourceElementNodePointer(parent, (SourceElement) object)
+                : null;
+    }
+
+}

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java Sat Apr 20 21:23:39 2013
@@ -20,12 +20,16 @@ package org.apache.torque.generator.sour
  */
 
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
 import java.util.Set;
 import java.util.StringTokenizer;
 
+import org.apache.commons.jxpath.JXPathContext;
+import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
 import org.apache.torque.generator.GeneratorException;
 
 /**
@@ -53,6 +57,14 @@ public final class SourcePath
      */
     private static final String ANY_ELEMENT_TOKEN = "*";
 
+    static
+    {
+        JXPathContextReferenceImpl.addNodePointerFactory(
+                new SourceElementNodePointerFactory());
+        JXPathContextReferenceImpl.addNodePointerFactory(
+                new ModelNodeFactory());
+    }
+
     /**
      * Private constructor for utility class.
      */
@@ -70,7 +82,7 @@ public final class SourcePath
      *
      * @throws NullPointerException if name is null.
      */
-    public static boolean hasChild(SourceElement sourceElement, String name)
+    public static boolean hasChild(final SourceElement sourceElement, final String name)
     {
         if (name == null)
         {
@@ -80,7 +92,7 @@ public final class SourcePath
         {
             throw new NullPointerException("sourceElement must not be null");
         }
-        for (SourceElement child : sourceElement.getChildren())
+        for (final SourceElement child : sourceElement.getChildren())
         {
             if (name.equals(child.getName()))
             {
@@ -98,7 +110,7 @@ public final class SourcePath
      *
      * @return true if a following element exists, false if not.
      */
-    public static boolean hasFollowing(SourceElement sourceElement)
+    public static boolean hasFollowing(final SourceElement sourceElement)
     {
         return !getFollowing(sourceElement, null).isEmpty();
     }
@@ -111,7 +123,7 @@ public final class SourcePath
      *
      * @return true if a preceding element exists, false if not.
      */
-    public static boolean hasPreceding(SourceElement sourceElement)
+    public static boolean hasPreceding(final SourceElement sourceElement)
     {
         return !getPreceding(sourceElement, sourceElement.getName()).isEmpty();
     }
@@ -124,7 +136,7 @@ public final class SourcePath
      *
      * @return true if a following sibling exists, false if not.
      */
-    public static boolean hasFollowingSibling(SourceElement sourceElement)
+    public static boolean hasFollowingSibling(final SourceElement sourceElement)
     {
         return !getFollowing(sourceElement, sourceElement.getName()).isEmpty();
     }
@@ -137,13 +149,14 @@ public final class SourcePath
      *
      * @return true if a preceding sibling exists, false if not.
      */
-    public static boolean hasPrecedingSibling(SourceElement sourceElement)
+    public static boolean hasPrecedingSibling(final SourceElement sourceElement)
     {
         return !getPreceding(sourceElement, sourceElement.getName()).isEmpty();
     }
 
     /**
-     * Returns all the preceding elements before this element
+     * Returns all the preceding elements in the child list
+     * of the default parent which appear before this element
      * with the given name.
      * If name is null, all preceding elements are returned.
      * If this element has no parent, an empty list is returned.
@@ -158,17 +171,19 @@ public final class SourcePath
      * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
      */
     public static List<SourceElement> getPreceding(
-            SourceElement sourceElement,
-            String name)
+            final SourceElement sourceElement,
+            final String name)
     {
         if (sourceElement == null)
         {
             throw new NullPointerException("sourceElement must not be null");
         }
 
-        List<SourceElement> result = new ArrayList<SourceElement>();
-        ListIterator<SourceElement> sameLevelIt
-                = getSiblingIteratorPositionedOnSelf(sourceElement);
+        final List<SourceElement> result = new ArrayList<SourceElement>();
+        final ListIterator<SourceElement> sameLevelIt
+                = getSiblingIteratorPositionedOnSelf(
+                        sourceElement,
+                        sourceElement.getParent());
         if (sameLevelIt == null)
         {
             return result;
@@ -176,7 +191,7 @@ public final class SourcePath
         boolean first = true;
         while (sameLevelIt.hasPrevious())
         {
-            SourceElement sameLevelElement = sameLevelIt.previous();
+            final SourceElement sameLevelElement = sameLevelIt.previous();
             // skip first iterated element because it is input element,
             // but we want to begin before the input element.
             if (first)
@@ -194,7 +209,8 @@ public final class SourcePath
     }
 
     /**
-     * Returns all the following elements after this element
+     * Returns all the following elements in the child list
+     * of the default parent which appear after this element
      * with the given name.
      * If name is null, all following elements are returned.
      * If this element has no parent, an empty list is returned.
@@ -209,24 +225,26 @@ public final class SourcePath
      * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
      */
     public static List<SourceElement> getFollowing(
-            SourceElement sourceElement,
-            String name)
+            final SourceElement sourceElement,
+            final String name)
     {
         if (sourceElement == null)
         {
             throw new NullPointerException("sourceElement must not be null");
         }
-        List<SourceElement> result = new ArrayList<SourceElement>();
+        final List<SourceElement> result = new ArrayList<SourceElement>();
 
-        ListIterator<SourceElement> sameLevelIt
-                = getSiblingIteratorPositionedOnSelf(sourceElement);
+        final ListIterator<SourceElement> sameLevelIt
+                = getSiblingIteratorPositionedOnSelf(
+                        sourceElement,
+                        sourceElement.getParent());
         if (sameLevelIt == null)
         {
             return result;
         }
         while (sameLevelIt.hasNext())
         {
-            SourceElement sameLevelElement = sameLevelIt.next();
+            final SourceElement sameLevelElement = sameLevelIt.next();
             if (name == null || name.equals(sameLevelElement.getName()))
             {
                 result.add(sameLevelElement);
@@ -243,6 +261,7 @@ public final class SourcePath
      *
      * @param sourceElement the source element for which the sibling iterator
      *        should be created, not null.
+     * @param parent the parent for the source element.
      *
      * @return the sibling iterator, or null if the input source element has
      *         no parent.
@@ -250,21 +269,21 @@ public final class SourcePath
      * @throws IllegalArgumentException if the element cannot be found in the
      *         list of children of its parent.
      */
-    private static ListIterator<SourceElement> getSiblingIteratorPositionedOnSelf(
-            SourceElement sourceElement)
+    protected static ListIterator<SourceElement> getSiblingIteratorPositionedOnSelf(
+            final SourceElement sourceElement,
+            final SourceElement parent)
     {
-        SourceElement parent = sourceElement.getParent();
         if (parent == null)
         {
             return null;
         }
-        ListIterator<SourceElement> sameLevelIt
+        final ListIterator<SourceElement> sameLevelIt
                 = parent.getChildren().listIterator();
 
         boolean found = false;
         while (sameLevelIt.hasNext())
         {
-            SourceElement sameLevelElement = sameLevelIt.next();
+            final SourceElement sameLevelElement = sameLevelIt.next();
             if (sameLevelElement == sourceElement)
             {
                 found = true;
@@ -284,6 +303,35 @@ public final class SourcePath
      * Gets the elements which can be reached from the start element by a given
      * path.
      *
+     * @param base the base object, not null.
+     * @param path the path to use, or null (which refers base).
+     *
+     * @return the list of matching source elements, not null, may be empty.
+     *
+     * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
+     */
+    public static Iterator<?> iterate(final Object base, final String path)
+    {
+        if (base == null)
+        {
+            throw new NullPointerException("base must not be null");
+        }
+        if (path == null)
+        {
+            return Arrays.asList(new Object[] {base}).iterator();
+        }
+
+        final JXPathContext context = JXPathContext.newContext(base);
+        context.setLenient(true);
+
+        final Iterator<?> iterator = context.iterate(path);
+        return iterator;
+    }
+
+    /**
+     * Gets the elements which can be reached from the start element by a given
+     * path.
+     *
      * @param sourceElement the start element, not null.
      * @param path the path to use, not null.
      *
@@ -292,8 +340,8 @@ public final class SourcePath
      * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
      */
     public static List<SourceElement> getElements(
-            SourceElement sourceElement,
-            String path)
+            final SourceElement sourceElement,
+            final String path)
     {
         if (sourceElement == null)
         {
@@ -302,23 +350,23 @@ public final class SourcePath
 
         if (path.equals(THIS_TOKEN))
         {
-            List<SourceElement> result = new ArrayList<SourceElement>(1);
+            final List<SourceElement> result = new ArrayList<SourceElement>(1);
             result.add(sourceElement);
             return result;
         }
-        StringTokenizer selectionPathTokenizer
+        final StringTokenizer selectionPathTokenizer
             = new StringTokenizer(path, PATH_LEVEL_SEPARATOR);
         List<SourceElement> currentSelection = new ArrayList<SourceElement>();
         currentSelection.add(sourceElement);
         while (selectionPathTokenizer.hasMoreTokens())
         {
-            String childName = selectionPathTokenizer.nextToken();
-            List<SourceElement> nextSelection = new ArrayList<SourceElement>();
-            for (SourceElement currentElement : currentSelection)
+            final String childName = selectionPathTokenizer.nextToken();
+            final List<SourceElement> nextSelection = new ArrayList<SourceElement>();
+            for (final SourceElement currentElement : currentSelection)
             {
                 if (childName.equals(PARENT_TOKEN))
                 {
-                    SourceElement parent = currentElement.getParent();
+                    final SourceElement parent = currentElement.getParent();
                     if (parent != null && !nextSelection.contains(parent))
                     {
                         nextSelection.add(parent);
@@ -326,14 +374,14 @@ public final class SourcePath
                 }
                 else if (ANY_ELEMENT_TOKEN.equals(childName))
                 {
-                    for (SourceElement child
+                    for (final SourceElement child
                             : currentElement.getChildren())
                     {
                         nextSelection.add(child);
                     }
                 }
                 {
-                    for (SourceElement child
+                    for (final SourceElement child
                             : currentElement.getChildren(childName))
                     {
                         nextSelection.add(child);
@@ -358,7 +406,7 @@ public final class SourcePath
      * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
      */
     public static List<SourceElement> getElementsFromRoot(
-            SourceElement rootElement,
+            final SourceElement rootElement,
             String path)
     {
         if (rootElement == null)
@@ -371,7 +419,7 @@ public final class SourcePath
                 || PATH_LEVEL_SEPARATOR.equals(path.trim()))
         {
             // use root element
-            List<SourceElement> result = new ArrayList<SourceElement>(1);
+            final List<SourceElement> result = new ArrayList<SourceElement>(1);
             result.add(rootElement);
             return result;
         }
@@ -382,7 +430,7 @@ public final class SourcePath
         {
             path = path.substring(1);
         }
-        int firstSeparatorPos = path.indexOf(PATH_LEVEL_SEPARATOR);
+        final int firstSeparatorPos = path.indexOf(PATH_LEVEL_SEPARATOR);
         String firstElementName;
         if (firstSeparatorPos == -1)
         {
@@ -402,6 +450,55 @@ public final class SourcePath
         return SourcePath.getElements(rootElement, path);
     }
 
+    /**
+     * Gets a single source element which can be reached from the start element
+     * by a given path.
+     *
+     * @param sourceElement the start element, not null.
+     * @param path the path to use, not null.
+     * @param acceptEmpty whether no match is an error(acceptEmpty=false)
+     *        or not (acceptEmpty=true)
+     *
+     * @return the single matching source elements, may be null only if
+     *         acceptEmpty=true.
+     *
+     * @throws GeneratorException if more than one source element matches,
+     *       or if no source element matches and acceptEmpty=false
+     * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
+     */
+    public static Object getObject(
+            final SourceElement sourceElement,
+            final String path,
+            final boolean acceptEmpty)
+        throws GeneratorException
+    {
+        final Iterator<?> sourceElementIt = iterate(sourceElement, path);
+        if (!sourceElementIt.hasNext())
+        {
+            if (acceptEmpty)
+            {
+                return null;
+            }
+            else
+            {
+                throw new GeneratorException(
+                        "Source element path "
+                        + path
+                        + " selects no element on source element "
+                        + sourceElement.getName());
+            }
+        }
+        final Object result = sourceElementIt.next();
+        if (sourceElementIt.hasNext())
+        {
+            throw new GeneratorException(
+                    "Source element path "
+                    + path
+                    + " selects more than a single element on source element "
+                    + sourceElement.getName());
+        }
+        return result;
+    }
 
     /**
      * Gets a single source element which can be reached from the start element
@@ -420,12 +517,12 @@ public final class SourcePath
      * @see <a href="http://www.w3.org/TR/xpath#axes">xpath axes</a>
      */
     public static SourceElement getElement(
-            SourceElement sourceElement,
-            String path,
-            boolean acceptEmpty)
+            final SourceElement sourceElement,
+            final String path,
+            final boolean acceptEmpty)
         throws GeneratorException
     {
-        List<SourceElement> sourceElements
+        final List<SourceElement> sourceElements
                 = SourcePath.getElements(sourceElement, path);
         if (sourceElements.isEmpty())
         {
@@ -464,10 +561,10 @@ public final class SourcePath
      *
      * @throws GeneratorException if the parent chain contains a closed loop.
      */
-    public static String getPathAsString(SourceElement sourceElement)
+    public static String getPathAsString(final SourceElement sourceElement)
         throws GeneratorException
     {
-        StringBuilder result = new StringBuilder();
+        final StringBuilder result = new StringBuilder();
         getParentPath(sourceElement, new HashSet<SourceElement>(), result);
         result.append(sourceElement.getName());
         return result.toString();
@@ -486,12 +583,12 @@ public final class SourcePath
      *         or if the parent chain contains a closed loop.
      */
     private static void getParentPath(
-            SourceElement toProcess,
-            Set<SourceElement> alreadyProcessed,
-            StringBuilder result)
+            final SourceElement toProcess,
+            final Set<SourceElement> alreadyProcessed,
+            final StringBuilder result)
         throws GeneratorException
     {
-        SourceElement parent = toProcess.getParent();
+        final SourceElement parent = toProcess.getParent();
         if (alreadyProcessed.contains(parent))
         {
             throw new GeneratorException(

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java Sat Apr 20 21:23:39 2013
@@ -49,12 +49,6 @@ public class SourceProcessConfiguration
     private SkipDecider skipDecider;
 
     /**
-     * The model class instance attached to the root of the source,
-     * or null if none exists.
-     */
-    private Object modelRoot;
-
-    /**
      * Sets the start element path.
      *
      * @param startElementsPath the path to the elements which are used
@@ -97,33 +91,6 @@ public class SourceProcessConfiguration
     }
 
     /**
-     * Sets and instantiates the model root class instance.
-     *
-     * @param modelRootClass the fully qualified name of a class
-     *        which contains the root class of the source model.
-     * @param unitDescriptor The description of the generation unit, not null.
-     *
-     * @throws SourceException if the class cannot be instantiated.
-     */
-    public void setModelRootClass(
-                String modelRootClass,
-                UnitDescriptor unitDescriptor)
-            throws ConfigurationException
-    {
-        if (modelRootClass != null)
-        {
-            this.modelRoot = ClassHelper.getInstance(
-                    modelRootClass,
-                    null,
-                    unitDescriptor);
-        }
-        else
-        {
-            this.modelRoot = null;
-        }
-    }
-
-    /**
      * Sets the transformer definitions.
      *
      * @param transformerDefinitions the transformer definitions, or null
@@ -177,17 +144,4 @@ public class SourceProcessConfiguration
     {
         return skipDecider;
     }
-
-    /**
-     * Returns the model root instance.
-     * This is the instance of the class equivalent to the root node of
-     * the source graph. The instance is not yet filled.
-     *
-     * @return the model root instance, or null if no model root class is
-     *         defined.
-     */
-    public Object getModelRoot()
-    {
-       return modelRoot;
-    }
 }

Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java Sat Apr 20 21:23:39 2013
@@ -37,20 +37,12 @@ public final class SourceTransformerDefi
     private final SourceTransformer sourceTransformer;
 
     /**
-     * The path to the source elements on which the transformer is applied.
-     */
-    private final String elements;
-
-    /**
      * Constructor.
      *
      * @param sourceTransformer the transformer instance, not null.
-     * @param elements the elements to which the transformer is applied,
-     *        may be null.
      */
     public SourceTransformerDefinition(
-            SourceTransformer sourceTransformer,
-            String elements)
+            SourceTransformer sourceTransformer)
     {
         if (sourceTransformer == null)
         {
@@ -58,7 +50,6 @@ public final class SourceTransformerDefi
                     "sourceTransformer must not be null");
         }
         this.sourceTransformer = sourceTransformer;
-        this.elements = elements;
     }
 
     /**
@@ -71,29 +62,17 @@ public final class SourceTransformerDefi
         return sourceTransformer;
     }
 
-    /**
-     * Returns the path to the source elements to which the transformer is
-     * applied.
-     *
-     * @return The path to the transformed source elements, or null.
-     */
-    public String getElements()
-    {
-        return elements;
-    }
-
     @Override
     public String toString()
     {
-        return "SourceTransformerDefinition [elements=" + elements
-                + ", sourceTransformer=" + sourceTransformer + "]";
+        return "SourceTransformerDefinition [sourceTransformer="
+                + sourceTransformer + "]";
     }
 
     @Override
     public int hashCode()
     {
         HashCodeBuilder hashCodeBuilder = new HashCodeBuilder()
-            .append(elements)
             .append(sourceTransformer);
         return hashCodeBuilder.toHashCode();
     }
@@ -115,7 +94,6 @@ public final class SourceTransformerDefi
         }
         SourceTransformerDefinition other = (SourceTransformerDefinition) obj;
         EqualsBuilder equalsBuilder = new EqualsBuilder()
-            .append(elements, other.elements)
             .append(sourceTransformer, other.sourceTransformer);
         return equalsBuilder.isEquals();
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message