You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-dev@db.apache.org by tf...@apache.org on 2013/04/20 23:23:42 UTC
svn commit: r1470235 [1/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/...
Author: tfischer
Date: Sat Apr 20 21:23:39 2013
New Revision: 1470235
URL: http://svn.apache.org/r1470235
Log:
TORQUE-272 Support groovy templates out of the box
TORQUE-273 Support typed models in the generator
Added:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodeFactory.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelNodePointer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/ModelPropertyPointer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributeIterator.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementAttributePointer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodeIterator.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElementNodePointerFactory.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceElementToModelTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/
- copied from r1462477, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/NoSuchPropertyException.java
- copied, changed from r1465295, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/NoSuchPropertyException.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyAccess.java
- copied, changed from r1465295, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyAccess.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyNotReadableException.java
- copied, changed from r1464334, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyNotReadableException.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/PropertyNotWriteableException.java
- copied, changed from r1464334, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/PropertyNotWriteableException.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/StringToBooleanConverter.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/TypeConverter.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/model/package.html
- copied unchanged from r1464457, db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/package.html
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyScriptOutlet.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyTemplateOutlet.java
db/torque/torque4/trunk/torque-generator/src/test/groovyTemplates/src/main/torque-gen/templates/template.groovy
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/
- copied from r1462477, db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/model/
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/transform/model/PropertyAccessTest.java
- copied, changed from r1465295, db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/model/PropertyAccessTest.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTest.java
- copied, changed from r1460227, db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTemplateTest.java
db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/temp
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Column.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Database.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Domain.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/ExternalSchema.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/ForeignKey.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/IdMethodParameter.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/IncludeSchema.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Index.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/IndexColumn.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Inheritance.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Option.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Reference.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Table.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/Unique.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/UniqueColumn.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/View.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/model/ViewColumn.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLModelTransformer.java
Removed:
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/model/
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/model/
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/template/groovy/GroovyTemplateTest.java
Modified:
db/torque/torque4/trunk/torque-generator/pom.xml
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTags.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandler.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/ApplyAction.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/SourceElementAttributeAction.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/TraverseAllAction.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Outlet.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/OutletImpl.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/OutletUtils.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/java/XmlOutlet.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceElement.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourcePath.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceProcessConfiguration.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/SourceTransformerDefinition.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/AttributeTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/BeanPropertyMethodNameTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/CopyAttributeTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/GetterSetterNameTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAdditionalSourceTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/LoadAllSourceFilesTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceTargetAttributeTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/source/transform/SourceTransformer.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/GroovyOutlet.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/groovy/TorqueGenGroovy.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/TorqueGenVelocity.java
db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/template/velocity/VelocityOutlet.java
db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/configuration.xsd
db/torque/torque4/trunk/torque-generator/src/main/resources/org/apache/torque/generator/configuration/outlet.xsd
db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen-parent/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/configuration/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/deeplyNestedMergepoints/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/appendStrategy/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/initial/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/mergeStrategy/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/replaceStrategy/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/existingTargetStrategy/skipStrategy/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/groovyTemplates/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/groovyTemplates/src/main/torque-gen/outlets/outlets.xml
db/torque/torque4/trunk/torque-generator/src/test/groovyTemplates/src/main/torque-gen/templates/template.gtl
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ConfigurationTestTransformer.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/OtherConfigurationTestTransformer.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/configuration/ReadConfigurationTest.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/java/JavaOutlet.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/outlet/java/XmlOutletTest.java
db/torque/torque4/trunk/torque-generator/src/test/java/org/apache/torque/generator/source/SourcePathTest.java
db/torque/torque4/trunk/torque-generator/src/test/loadAdditionalSourceTransformer/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/expectedPropertiesDebugOutput.properties
db/torque/torque4/trunk/torque-generator/src/test/propertyToJava/src/main/torque-gen/conf/control.xml
db/torque/torque4/trunk/torque-templates/pom.xml
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/InterfaceSkipDecider.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/skipdecider/ManagerSkipDecider.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/IncludeSchemaTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/LoadExternalSchemaTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/SchemaTypeHelper.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/jdbc2schema/Jdbc2SchemaTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTableAndViewTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/OMTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTableTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/om/mapInit/DatabaseMapInitTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/java/org/apache/torque/templates/transformer/sql/SQLTransformer.java
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/doc/html/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/doc/xdoc/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/idtable/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/om/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/main/resources/org/apache/torque/templates/sql/createdb/conf/control.xml
db/torque/torque4/trunk/torque-templates/src/test/java/org/apache/torque/templates/TestProcessing.java
db/torque/torque4/trunk/torque-templates/src/test/schema/schema.xml
Modified: db/torque/torque4/trunk/torque-generator/pom.xml
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/pom.xml?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/pom.xml (original)
+++ db/torque/torque4/trunk/torque-generator/pom.xml Sat Apr 20 21:23:39 2013
@@ -62,7 +62,7 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.5</version>
+ <version>2.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
@@ -80,6 +80,11 @@
<version>1.4</version>
</dependency>
<dependency>
+ <groupId>commons-jxpath</groupId>
+ <artifactId>commons-jxpath</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/OutletTypes.java Sat Apr 20 21:23:39 2013
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.torque.generator.configuration.outlet.GroovyOutletSaxHandlerFactory;
import org.apache.torque.generator.configuration.outlet.JavaOutletSaxHandlerFactory;
import org.apache.torque.generator.configuration.outlet.ReflectionOutletSaxHandlerFactory;
import org.apache.torque.generator.configuration.outlet.TypedOutletSaxHandlerFactory;
@@ -41,14 +42,14 @@ public class OutletTypes
* A map containing all typed OutletSaxHandlerFactories,
* keyed by the type of the outlet.
*/
- private Map<String, TypedOutletSaxHandlerFactory>
+ private final Map<String, TypedOutletSaxHandlerFactory>
typedOutletHandlerFactories
= new HashMap<String, TypedOutletSaxHandlerFactory>();
/**
* A List containing all untyped OutletSaxHandlerFactories.
*/
- private List<UntypedOutletSaxHandlerFactory>
+ private final List<UntypedOutletSaxHandlerFactory>
untypedOutletHandlerFactories
= new ArrayList<UntypedOutletSaxHandlerFactory>();
@@ -64,11 +65,13 @@ public class OutletTypes
registerTypedOutletHandlerFactory(
new VelocityOutletSaxHandlerFactory());
registerTypedOutletHandlerFactory(
+ new GroovyOutletSaxHandlerFactory());
+ registerTypedOutletHandlerFactory(
new JavaOutletSaxHandlerFactory());
registerUntypedOutletHandlerFactory(
new ReflectionOutletSaxHandlerFactory());
}
- catch (ConfigurationException e)
+ catch (final ConfigurationException e)
{
// should not happen
throw new RuntimeException(e);
@@ -86,15 +89,15 @@ public class OutletTypes
* for the type of the outlet.
*/
public void registerTypedOutletHandlerFactory(
- TypedOutletSaxHandlerFactory factory)
+ final TypedOutletSaxHandlerFactory factory)
throws ConfigurationException
{
if (factory == null)
{
throw new NullPointerException("factory must not be null");
}
- String type = factory.getType();
- TypedOutletSaxHandlerFactory oldFactory
+ final String type = factory.getType();
+ final TypedOutletSaxHandlerFactory oldFactory
= typedOutletHandlerFactories.get(type);
if (oldFactory != null)
{
@@ -121,7 +124,7 @@ public class OutletTypes
* for the type of the outlet.
*/
public void registerUntypedOutletHandlerFactory(
- UntypedOutletSaxHandlerFactory factory)
+ final UntypedOutletSaxHandlerFactory factory)
throws ConfigurationException
{
if (factory == null)
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/GroovyOutletSaxHandler.java Sat Apr 20 21:23:39 2013
@@ -24,6 +24,7 @@ import static org.apache.torque.generato
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_OPTIONS_IN_BINDING_ATTRIBUTE;
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_PATH_ATTRIBUTE;
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_SOURCE_ATTRIBUTES_IN_BINDING_ATTRIBUTE;
+import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_TEMPLATE_ATTRIBUTE;
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.OUTLET_VARIABLES_IN_BINDING_ATTRIBUTE;
import org.apache.torque.generator.configuration.ConfigurationException;
@@ -33,6 +34,8 @@ import org.apache.torque.generator.confi
import org.apache.torque.generator.configuration.UnitDescriptor;
import org.apache.torque.generator.qname.QualifiedName;
import org.apache.torque.generator.template.groovy.GroovyOutlet;
+import org.apache.torque.generator.template.groovy.GroovyScriptOutlet;
+import org.apache.torque.generator.template.groovy.GroovyTemplateOutlet;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
@@ -43,6 +46,12 @@ import org.xml.sax.SAXException;
class GroovyOutletSaxHandler extends OutletSaxHandler
{
/**
+ * The file suffix for groovy Scripts.
+ * All other endings are interpreted as groovy templates.
+ */
+ public static final String GROOVY_SCRIPT_FILE_SUFFIX = ".groovy";
+
+ /**
* Constructor.
*
* @param outletName the name for the outlet which configuration
@@ -58,10 +67,10 @@ class GroovyOutletSaxHandler extends Out
* @throws SAXException if an error occurs during creation of the outlet.
*/
public GroovyOutletSaxHandler(
- QualifiedName outletName,
- ConfigurationProvider configurationProvider,
- UnitDescriptor unitDescriptor,
- ConfigurationHandlers configurationHandlers)
+ final QualifiedName outletName,
+ final ConfigurationProvider configurationProvider,
+ final UnitDescriptor unitDescriptor,
+ final ConfigurationHandlers configurationHandlers)
throws SAXException
{
super(outletName,
@@ -92,17 +101,18 @@ class GroovyOutletSaxHandler extends Out
*
* @throws SAXException if an error occurs during creation.
*/
+ @Override
protected GroovyOutlet createOutlet(
QualifiedName outletName,
- String uri,
- String localName,
- String rawName,
- Attributes attributes)
+ final String uri,
+ final String localName,
+ final String rawName,
+ final Attributes attributes)
throws SAXException
{
if (outletName == null)
{
- String nameAttribute
+ final String nameAttribute
= attributes.getValue(OUTLET_NAME_ATTRIBUTE);
if (nameAttribute == null)
{
@@ -115,18 +125,44 @@ class GroovyOutletSaxHandler extends Out
outletName = new QualifiedName(nameAttribute);
}
- String encoding = attributes.getValue(OUTLET_ENCODING_ATTRIBUTE);
- String path = attributes.getValue(OUTLET_PATH_ATTRIBUTE);
+ final String encoding = attributes.getValue(OUTLET_ENCODING_ATTRIBUTE);
+ final String path = attributes.getValue(OUTLET_PATH_ATTRIBUTE);
+ final String template = attributes.getValue(OUTLET_TEMPLATE_ATTRIBUTE);
try
{
- GroovyOutlet result
- = new GroovyOutlet(
+ GroovyOutlet result;
+ boolean isScript = false;
+ if ("true".equals(template))
+ {
+ isScript = false;
+ }
+ else if ("false".equals(template))
+ {
+ isScript = true;
+ }
+ else if (path.endsWith(GROOVY_SCRIPT_FILE_SUFFIX))
+ {
+ isScript = true;
+ }
+
+ if (isScript)
+ {
+ result = new GroovyScriptOutlet(
outletName,
getConfigurationProvider(),
path,
encoding);
- Boolean optionsInContext = SaxHelper.getBooleanAttribute(
+ }
+ else
+ {
+ result = new GroovyTemplateOutlet(
+ outletName,
+ getConfigurationProvider(),
+ path,
+ encoding);
+ }
+ final Boolean optionsInContext = SaxHelper.getBooleanAttribute(
OUTLET_OPTIONS_IN_BINDING_ATTRIBUTE,
attributes,
"the groovyOutlet" + outletName);
@@ -134,7 +170,7 @@ class GroovyOutletSaxHandler extends Out
{
result.setOptionsInBinding(optionsInContext);
}
- Boolean sourceElementAttributesInContext
+ final Boolean sourceElementAttributesInContext
= SaxHelper.getBooleanAttribute(
OUTLET_SOURCE_ATTRIBUTES_IN_BINDING_ATTRIBUTE,
attributes,
@@ -144,7 +180,7 @@ class GroovyOutletSaxHandler extends Out
result.setSourceAttributesInBinding(
sourceElementAttributesInContext);
}
- Boolean variablesInContext = SaxHelper.getBooleanAttribute(
+ final Boolean variablesInContext = SaxHelper.getBooleanAttribute(
OUTLET_VARIABLES_IN_BINDING_ATTRIBUTE,
attributes,
"the groovyOutlet" + outletName);
@@ -154,7 +190,7 @@ class GroovyOutletSaxHandler extends Out
}
return result;
}
- catch (ConfigurationException e)
+ catch (final ConfigurationException e)
{
throw new SAXException(e);
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTags.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTags.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTags.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletConfigurationTags.java Sat Apr 20 21:23:39 2013
@@ -52,6 +52,9 @@ public final class OutletConfigurationTa
/** Attribute name for the attribute "class" of the "outlet" tag. */
public static final String OUTLET_CLASS_ATTRIBUTE = "class";
+ /** Attribute name for the attribute "template" of the "outlet" tag. */
+ public static final String OUTLET_TEMPLATE_ATTRIBUTE = "template";
+
/**
* Attribute name for the attribute "optionsInContext"
* of the "outlet" tag.
@@ -101,4 +104,7 @@ public final class OutletConfigurationTa
/** Attribute name for the attribute "elementName" of the "input" tag. */
public static final String INPUT_ELEMENT_NAME_ATTRIBUTE = "elementName";
+
+ /** Attribute name for the attribute "class" of the "input" tag. */
+ public static final String INPUT_CLASS_ATTRIBUTE = "class";
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandler.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/outlet/OutletSaxHandler.java Sat Apr 20 21:23:39 2013
@@ -20,6 +20,7 @@ package org.apache.torque.generator.conf
*/
import static org.apache.torque.generator.configuration.mergepoint.MergepointConfigurationTags.MERGEPOINT_TAG;
+import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.INPUT_CLASS_ATTRIBUTE;
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.INPUT_ELEMENT_NAME_ATTRIBUTE;
import static org.apache.torque.generator.configuration.outlet.OutletConfigurationTags.INPUT_TAG;
@@ -147,14 +148,19 @@ public abstract class OutletSaxHandler e
else if (INPUT_TAG.equals(rawName))
{
String element = attributes.getValue(INPUT_ELEMENT_NAME_ATTRIBUTE);
- if (element == null)
+ String className = attributes.getValue(INPUT_CLASS_ATTRIBUTE);
+ if (element == null && className == null
+ || (element != null && className != null))
{
- throw new SAXException("The attribute "
+ throw new SAXException("Either the attribute "
+ INPUT_ELEMENT_NAME_ATTRIBUTE
+ + " or the attribute "
+ + INPUT_CLASS_ATTRIBUTE
+ " must be set for the tag "
+ INPUT_TAG);
}
outlet.setInputElementName(element);
+ outlet.setInputClass(className);
}
else if (MERGEPOINT_TAG.equals(rawName))
{
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceConfigurationTags.java Sat Apr 20 21:23:39 2013
@@ -40,9 +40,6 @@ public final class SourceConfigurationTa
/** Attribute name for the "skipDecider" attribute. */
public static final String SKIP_DECIDER_ARRTIBUTE = "skipDecider";
- /** Attribute name for the "modelRootClass" attribute. */
- public static final String MODEL_ROOT_CLASS_ATTRIBUTE = "modelRootClass";
-
/** Attribute name for the "format" attribute. */
public static final String FORMAT_ATTRIBUTE = "format";
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceSaxHandler.java Sat Apr 20 21:23:39 2013
@@ -20,7 +20,6 @@ package org.apache.torque.generator.conf
*/
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.ELEMENTS_ATTRIBUTE;
-import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.MODEL_ROOT_CLASS_ATTRIBUTE;
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SKIP_DECIDER_ARRTIBUTE;
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.SOURCE_TAG;
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.TRANSFORMER_TAG;
@@ -138,9 +137,6 @@ public abstract class SourceSaxHandler e
sourceProcessConfiguration.setSkipDecider(
attributes.getValue(SKIP_DECIDER_ARRTIBUTE),
unitDescriptor);
- sourceProcessConfiguration.setModelRootClass(
- attributes.getValue(MODEL_ROOT_CLASS_ATTRIBUTE),
- unitDescriptor);
}
catch (ConfigurationException e)
{
@@ -171,8 +167,7 @@ public abstract class SourceSaxHandler e
if (transformerSaxHandler.isFinished())
{
transformerDefinitions.add(new SourceTransformerDefinition(
- transformerSaxHandler.getSourceTransformer(),
- transformerSaxHandler.getElements()));
+ transformerSaxHandler.getSourceTransformer()));
transformerSaxHandler = null;
}
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/configuration/source/SourceTransformerSaxHandler.java Sat Apr 20 21:23:39 2013
@@ -19,7 +19,6 @@ package org.apache.torque.generator.conf
* under the License.
*/
-import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.ELEMENTS_ATTRIBUTE;
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.TRANSFORMER_CLASS_ATTRIBUTE;
import static org.apache.torque.generator.configuration.source.SourceConfigurationTags.TRANSFORMER_TAG;
@@ -53,9 +52,6 @@ public class SourceTransformerSaxHandler
/** The SourceTransformer which is currently configured. */
private SourceTransformer sourceTransformer;
- /** On which Elements the sourceTransformer should be applied. */
- private String elements;
-
/** The current nesting level inside the processed element. */
private int level = 0;
@@ -133,7 +129,6 @@ public class SourceTransformerSaxHandler
+ " must not be null for the element "
+ TRANSFORMER_TAG);
}
- elements = attributes.getValue(ELEMENTS_ATTRIBUTE);
sourceTransformer = createJavaSourceTransformer(
className, unitDescriptor);
}
@@ -275,17 +270,6 @@ public class SourceTransformerSaxHandler
}
/**
- * Returns the path to source elements to which the transformer is applied.
- *
- * @return the path to the source element, or null to apply the transformer
- * to the root element.
- */
- public String getElements()
- {
- return elements;
- }
-
- /**
* Returns the configuration filled with the contents of the parsed snippet.
*
* @return the configuration which was filled, not null if a
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/Controller.java Sat Apr 20 21:23:39 2013
@@ -24,11 +24,9 @@ import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
-import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
-import java.util.Map;
import java.util.Properties;
import org.apache.commons.logging.Log;
@@ -49,17 +47,12 @@ import org.apache.torque.generator.contr
import org.apache.torque.generator.control.existingtargetstrategy.SkipExistingTargetFileStrategy;
import org.apache.torque.generator.outlet.Outlet;
import org.apache.torque.generator.outlet.OutletResult;
-import org.apache.torque.generator.processor.string.Camelbacker;
-import org.apache.torque.generator.processor.string.WrapReservedJavaWords;
import org.apache.torque.generator.source.Source;
-import org.apache.torque.generator.source.SourceElement;
import org.apache.torque.generator.source.SourceException;
import org.apache.torque.generator.source.SourcePath;
import org.apache.torque.generator.source.SourceProcessConfiguration;
import org.apache.torque.generator.source.SourceProvider;
import org.apache.torque.generator.source.SourceTransformerDefinition;
-import org.apache.torque.generator.source.model.NoSuchPropertyException;
-import org.apache.torque.generator.source.model.PropertyAccess;
import org.apache.torque.generator.source.skipDecider.SkipDecider;
import org.apache.torque.generator.source.transform.SourceTransformer;
import org.apache.torque.generator.source.transform.SourceTransformerException;
@@ -73,23 +66,6 @@ public class Controller
private static Log log = LogFactory.getLog(Controller.class);
/**
- * The field name in the model which is filled if tthe sttribute name
- * <code>null</code> appears in the source graph.
- */
- public static final String NULL_ATTRIBUTE_FIELD_NAME = "value";
-
- /**
- * The processor which does the camelback processing.
- */
- private final Camelbacker camelbacker = new Camelbacker();
-
- /**
- * The processor which wraps reserved java words.
- */
- private final WrapReservedJavaWords reservedWordsWrapper
- = new WrapReservedJavaWords();
-
- /**
* All known ExistingTargetStrategies.
* TODO: move to a better place.
*/
@@ -98,7 +74,7 @@ public class Controller
static
{
- List<ExistingTargetStrategy> existingTargetStrategies
+ final List<ExistingTargetStrategy> existingTargetStrategies
= new ArrayList<ExistingTargetStrategy>();
existingTargetStrategies.add(new ReplaceTargetFileStrategy());
existingTargetStrategies.add(new SkipExistingTargetFileStrategy());
@@ -109,15 +85,6 @@ public class Controller
}
/**
- * Standard constructor.
- */
- public Controller()
- {
- camelbacker.setDefaultLowerCase(false);
- camelbacker.setFirstCharUppercase(false);
- }
-
- /**
* Executes the controller action.
*
* @param unitDescriptors the units of generation to execute.
@@ -130,16 +97,16 @@ public class Controller
* processing.
* @throws IOException if a IOException occurs during processing.
*/
- public void run(List<UnitDescriptor> unitDescriptors)
+ public void run(final List<UnitDescriptor> unitDescriptors)
throws GeneratorException
{
initLogging();
- Configuration configuration = readConfiguration(unitDescriptors);
+ final Configuration configuration = readConfiguration(unitDescriptors);
- List<UnitConfiguration> unitConfigurations
+ final List<UnitConfiguration> unitConfigurations
= configuration.getUnitConfigurations();
- ControllerState controllerState = new ControllerState();
- for (UnitConfiguration unitConfiguration : unitConfigurations)
+ final ControllerState controllerState = new ControllerState();
+ for (final UnitConfiguration unitConfiguration : unitConfigurations)
{
processGenerationUnit(
controllerState,
@@ -153,15 +120,15 @@ public class Controller
*/
protected void initLogging()
{
- InputStream log4jStream
+ final InputStream log4jStream
= Controller.class.getClassLoader().getResourceAsStream(
"org/apache/torque/generator/log4j.properties");
- Properties log4jProperties = new Properties();
+ final Properties log4jProperties = new Properties();
try
{
log4jProperties.load(log4jStream);
}
- catch (IOException e)
+ catch (final IOException e)
{
throw new RuntimeException(e);
}
@@ -179,11 +146,11 @@ public class Controller
* @throws ConfigurationException if the configuration is faulty.
*/
private Configuration readConfiguration(
- List<UnitDescriptor> unitDescriptors)
+ final List<UnitDescriptor> unitDescriptors)
throws ConfigurationException
{
log.info("readConfiguration() : Starting to read configuration files");
- Configuration configuration = new Configuration();
+ final Configuration configuration = new Configuration();
configuration.addUnits(unitDescriptors);
configuration.read();
log.info("readConfiguration() : Configuration read.");
@@ -200,16 +167,16 @@ public class Controller
* @throws GeneratorException if a generation error occurs.
*/
protected void processGenerationUnit(
- ControllerState controllerState,
- UnitConfiguration unitConfiguration)
+ final ControllerState controllerState,
+ final UnitConfiguration unitConfiguration)
throws GeneratorException
{
log.debug("processGenerationUnit() : start");
unitConfiguration.getLoglevel().apply();
log.debug("processGenerationUnit() : Loglevel applied.");
controllerState.setUnitConfiguration(unitConfiguration);
- List<Output> outputList = unitConfiguration.getOutputList();
- for (Output output : outputList)
+ final List<Output> outputList = unitConfiguration.getOutputList();
+ for (final Output output : outputList)
{
processOutput(
output,
@@ -229,9 +196,9 @@ public class Controller
* @throws GeneratorException if a generation error occurs.
*/
private void processOutput(
- Output output,
- ControllerState controllerState,
- UnitConfiguration unitConfiguration)
+ final Output output,
+ final ControllerState controllerState,
+ final UnitConfiguration unitConfiguration)
throws GeneratorException
{
log.info("Processing output " + output.getName());
@@ -257,7 +224,7 @@ public class Controller
while (sourceProvider.hasNext())
{
- Source source = sourceProvider.next();
+ final Source source = sourceProvider.next();
processSourceInOutput(
source,
output,
@@ -279,40 +246,39 @@ public class Controller
* @throws GeneratorException if a generation error occurs.
*/
private void processSourceInOutput(
- Source source,
- Output output,
- ControllerState controllerState,
- UnitConfiguration unitConfiguration)
+ final Source source,
+ final Output output,
+ final ControllerState controllerState,
+ final UnitConfiguration unitConfiguration)
throws GeneratorException
{
log.info("Processing source " + source.getDescription());
- SourceElement rootElement = source.getRootElement();
+ Object modelRoot = source.getRootElement();
controllerState.setSourceFile(source.getSourceFile());
- SourceProcessConfiguration sourceProcessConfiguration
+ final SourceProcessConfiguration sourceProcessConfiguration
= output.getSourceProcessConfiguration();
- Object modelRoot = sourceProcessConfiguration.getModelRoot();
- fillModelRoot(modelRoot, rootElement, unitConfiguration);
- rootElement = transformSource(
- rootElement,
+ modelRoot = transformSource(
+ modelRoot,
sourceProcessConfiguration.getTransformerDefinitions(),
controllerState);
- controllerState.setRootElement(rootElement);
+ controllerState.setModelRoot(modelRoot);
- String startElementsPath
+ final String startElementsPath
= sourceProcessConfiguration.getStartElementsPath();
- List<SourceElement> startElements
- = SourcePath.getElementsFromRoot(
- rootElement,
- startElementsPath);
- if (startElements.isEmpty())
+
+ final Iterator<?> iterator = SourcePath.iterate(
+ modelRoot,
+ startElementsPath);
+ if (!iterator.hasNext())
{
log.info("No start Elements found for path "
+ startElementsPath);
}
- for (SourceElement startElement : startElements)
+ while (iterator.hasNext())
{
- processStartElement(
- startElement,
+ final Object model = iterator.next();
+ processModel(
+ model,
output,
source,
unitConfiguration,
@@ -321,126 +287,6 @@ public class Controller
}
/**
- * Constructs the model from the source graph. This is done by recursively
- * walking through the source graph and setting the fields corresponding
- * to the names of the attributes resp. child elements.
- *
- * @param modelRoot the root object to fill, not null.
- * @param rootSourceElement the root source element to traverse, not null.
- * @param unitConfiguration the unit configuration, not null.
- *
- * @throws SourceException if filling the source graph fails, e.g. if
- * an attribute name or element name has no corresponding
- * field in a model element.
- */
- private void fillModelRoot(
- Object modelRoot,
- SourceElement rootSourceElement,
- UnitConfiguration unitConfiguration)
- throws SourceException
- {
- if (modelRoot == null)
- {
- return;
- }
- fillModelElement(
- modelRoot,
- rootSourceElement,
- unitConfiguration,
- new HashMap<SourceElement, Object>());
-
- }
-
- /**
- * Constructs a part of the model from a part of the source graph.
- * This is done by recursively walking through the source graph
- * and setting the fields corresponding to the names of the attributes
- * resp. child elements.
- *
- * @param modelElement the model object to fill, not null.
- * @param sourceElement the source element corresponding to the
- * model object, not null.
- * @param unitConfiguration the unit configuration, not null.
- * @param alreadyMapped a map of already mapped source elements,
- * mapped to the corresponding model elements.
- *
- * @throws SourceException if filling the source graph fails, e.g. if
- * an attribute name or element name has no corresponding
- * field in a model element.
- */
- private void fillModelElement(
- Object modelElement,
- SourceElement sourceElement,
- UnitConfiguration unitConfiguration,
- Map<SourceElement, Object> alreadyMapped)
- throws SourceException
- {
- for (String attributeName : sourceElement.getAttributeNames())
- {
- attributeName = camelbacker.process(attributeName);
- attributeName = reservedWordsWrapper.process(attributeName);
- if (attributeName == null)
- {
- attributeName = NULL_ATTRIBUTE_FIELD_NAME;
- }
- Object attributeValue = sourceElement.getAttribute(attributeName);
- PropertyAccess propertyAccess = new PropertyAccess(
- modelElement,
- attributeName);
- propertyAccess.setProperty(attributeValue);
- }
- for (SourceElement child : sourceElement.getChildren())
- {
- String propertyName = child.getName();
- propertyName = camelbacker.process(propertyName);
- propertyName = reservedWordsWrapper.process(propertyName);
- PropertyAccess propertyAccess = new PropertyAccess(
- modelElement,
- propertyName);
- if (!propertyAccess.isPropertyAccessible())
- {
- throw new NoSuchPropertyException(
- modelElement,
- propertyName,
- propertyAccess.getPrefixList(),
- propertyAccess.getSuffixList());
- }
- Object childModelElement = alreadyMapped.get(child);
- if (childModelElement != null)
- {
- propertyAccess.setProperty(childModelElement);
- continue;
- }
- if (Collection.class.isAssignableFrom(
- propertyAccess.getPropertyType()))
- {
- childModelElement = ControllerHelper.getInstance(
- propertyAccess.getFirstGenericTypeArgument().getName(),
- unitConfiguration);
- }
- else if (propertyAccess.getPropertyType().isArray())
- {
- childModelElement = ControllerHelper.getInstance(
- propertyAccess.getPropertyType().getComponentType().getName(),
- unitConfiguration);
- }
- else
- {
- childModelElement = ControllerHelper.getInstance(
- propertyAccess.getPropertyType().getName(),
- unitConfiguration);
- }
- propertyAccess.setProperty(childModelElement);
- alreadyMapped.put(child, childModelElement);
- fillModelElement(
- childModelElement,
- child,
- unitConfiguration,
- alreadyMapped);
- }
- }
-
- /**
* Creates the output file name and sets it in the output.
* The filename is calculated either by the filenameConfigurator in
* <code>output</code> or is given explicitly (in the latter case
@@ -456,8 +302,8 @@ public class Controller
* the output filename.
*/
protected void createOutputFilename(
- Output output,
- ControllerState controllerState)
+ final Output output,
+ final ControllerState controllerState)
throws GeneratorException
{
if (output.getFilenameOutlet() == null)
@@ -477,8 +323,8 @@ public class Controller
}
controllerState.setOutputFile(null);
- Outlet filenameOutlet = output.getFilenameOutlet();
- OutletReference contentOutletReference
+ final Outlet filenameOutlet = output.getFilenameOutlet();
+ final OutletReference contentOutletReference
= new OutletReference(
filenameOutlet.getName());
controllerState.setRootOutletReference(
@@ -489,7 +335,7 @@ public class Controller
controllerState.setOutletNamespace(
output.getContentOutlet().getNamespace());
filenameOutlet.beforeExecute(controllerState);
- OutletResult filenameResult
+ final OutletResult filenameResult
= filenameOutlet.execute(controllerState);
if (!filenameResult.isStringResult())
{
@@ -497,7 +343,7 @@ public class Controller
"The result of a filename generation must be a String,"
+ " not a byte array");
}
- String filename = filenameResult.getStringResult();
+ final String filename = filenameResult.getStringResult();
filenameOutlet.afterExecute(controllerState);
if (log.isDebugEnabled())
{
@@ -509,9 +355,9 @@ public class Controller
}
/**
- * Processes the generation for a single start Element in a source.
+ * Processes the generation for a single model object in a source.
*
- * @param startElement the start element to process.
+ * @param model the source model object to process.
* @param output the current output, not null.
* @param source the current source, not null.
* @param unitConfiguration the current unit configuration, not null.
@@ -523,15 +369,15 @@ public class Controller
* @throws GeneratorException if the outlet throws an exception
* during execution.
*/
- private void processStartElement(
- SourceElement startElement,
- Output output,
- Source source,
- UnitConfiguration unitConfiguration,
- ControllerState controllerState)
+ private void processModel(
+ final Object model,
+ final Output output,
+ final Source source,
+ final UnitConfiguration unitConfiguration,
+ final ControllerState controllerState)
throws GeneratorException
{
- if (startElement == null)
+ if (model == null)
{
throw new ControllerException(
"Null start element found in source "
@@ -539,12 +385,11 @@ public class Controller
+ "of output file "
+ output);
}
- controllerState.setSourceElement(startElement);
- log.debug("Processing new startElement "
- + startElement.getName());
+ controllerState.setModel(model);
+ log.debug("Processing new model " + model);
ExistingTargetStrategy existingTargetStrategy = null;
- for (ExistingTargetStrategy candidate : EXISTING_TARGET_STRATEGIES)
+ for (final ExistingTargetStrategy candidate : EXISTING_TARGET_STRATEGIES)
{
if (candidate.getStrategyName().equals(
output.getExistingTargetStrategy()))
@@ -561,7 +406,7 @@ public class Controller
}
createOutputFilename(output, controllerState);
- File outputFile = ControllerHelper.getOutputFile(
+ final File outputFile = ControllerHelper.getOutputFile(
output.getOutputDirKey(),
output.getFilename(),
unitConfiguration);
@@ -585,17 +430,17 @@ public class Controller
+ outputFile.getAbsolutePath());
}
- OutletReference contentOutletConfiguration
+ final OutletReference contentOutletConfiguration
= output.getContentOutlet();
controllerState.setOutletNamespace(
contentOutletConfiguration.getNamespace());
controllerState.setRootOutletReference(
contentOutletConfiguration);
- OutletConfiguration outletConfiguration
+ final OutletConfiguration outletConfiguration
= unitConfiguration.getOutletConfiguration();
- Outlet outlet = outletConfiguration.getOutlet(
+ final Outlet outlet = outletConfiguration.getOutlet(
contentOutletConfiguration.getName());
if (outlet == null)
{
@@ -605,7 +450,7 @@ public class Controller
+ "\"");
}
- SkipDecider skipDecider
+ final SkipDecider skipDecider
= output.getSourceProcessConfiguration().getSkipDecider();
if (skipDecider != null)
{
@@ -625,12 +470,12 @@ public class Controller
}
{
- File parentOutputDir
+ final File parentOutputDir
= controllerState.getOutputFile().getParentFile();
if (parentOutputDir != null
&& !parentOutputDir.isDirectory())
{
- boolean success = parentOutputDir.mkdirs();
+ final boolean success = parentOutputDir.mkdirs();
if (!success)
{
throw new ControllerException(
@@ -642,7 +487,7 @@ public class Controller
}
outlet.beforeExecute(controllerState);
- OutletResult result = outlet.execute(controllerState);
+ final OutletResult result = outlet.execute(controllerState);
outlet.afterExecute(controllerState);
existingTargetStrategy.afterGeneration(
@@ -661,7 +506,7 @@ public class Controller
}
/**
- * Applies all tarnsformer definitions to the current source.
+ * Applies all transformer definitions to the current source.
*
* @param rootElement the root element of the source to transform,
* not null.
@@ -671,57 +516,35 @@ public class Controller
*
* @return the transformed root element, not null.
*/
- public SourceElement transformSource(
- final SourceElement rootElement,
+ public Object transformSource(
+ final Object sourceRoot,
final List<SourceTransformerDefinition> transformerDefinitions,
final ControllerState controllerState)
throws SourceTransformerException, SourceException
{
- SourceElement result = rootElement;
- for (SourceTransformerDefinition transformerDefinition
+ Object toTransform = sourceRoot;
+ Object result = sourceRoot;
+ for (final SourceTransformerDefinition transformerDefinition
: transformerDefinitions)
{
- SourceTransformer sourceTransformer
+ final SourceTransformer sourceTransformer
= transformerDefinition.getSourceTransformer();
- String elements = transformerDefinition.getElements();
log.debug("Applying source transformer "
+ sourceTransformer.getClass().getName()
- + (elements == null
- ? " to the root element"
- : " to the elements " + elements));
-
- List<SourceElement> toTransform
- = SourcePath.getElementsFromRoot(rootElement, elements);
- if (toTransform.isEmpty())
- {
- log.debug("No element found, nothing transformed");
- }
- for (SourceElement sourceElement : toTransform)
+ + " to source root object " + toTransform);
+
+ result = sourceTransformer.transform(
+ result,
+ controllerState);
+ if (result == null)
{
- log.debug("transforming element " + sourceElement);
- SourceElement transformedElement = sourceTransformer.transform(
- sourceElement,
- controllerState);
- if (transformedElement == null)
- {
- throw new SourceTransformerException("Transformer "
- + sourceTransformer.getClass().getName()
- + " returned null for element "
- + sourceElement.getName());
- }
- SourceElement parent = sourceElement.getParent();
- if (parent == null)
- {
- result = transformedElement;
- }
- else
- {
- List<SourceElement> children = parent.getChildren();
- int index = children.indexOf(sourceElement);
- children.set(index, transformedElement);
- }
+ throw new SourceTransformerException("Transformer "
+ + sourceTransformer.getClass().getName()
+ + " returned null for element "
+ + toTransform);
}
log.debug("Transformation ended");
+ toTransform = result;
}
return result;
}
@@ -736,8 +559,8 @@ public class Controller
* @return the encoding, not null.
*/
private String getOutputEncoding(
- Output output,
- UnitConfiguration unitConfiguration)
+ final Output output,
+ final UnitConfiguration unitConfiguration)
{
if (output.getEncoding() != null)
{
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerHelper.java Sat Apr 20 21:23:39 2013
@@ -21,9 +21,7 @@ package org.apache.torque.generator.cont
import java.io.File;
-import org.apache.torque.generator.configuration.ClassHelper;
import org.apache.torque.generator.configuration.UnitConfiguration;
-import org.apache.torque.generator.source.SourceException;
/**
* Helper methods for the controller.
@@ -61,56 +59,4 @@ public final class ControllerHelper
outputPath);
return outputFile;
}
-
- /**
- * Creates an instance of a class.
- *
- * @param className the fully qualified name of the class to instantiate.
- * @param unitDescriptor The description of the generation unit, not null.
- *
- * @throws SourceException if the class cannot be instantiated.
- */
- public static Object getInstance(
- String className,
- UnitConfiguration unitConfiguration)
- throws SourceException
- {
- if (className == null)
- {
- return null;
- }
- Object result;
- try
- {
- ClassLoader classLoader = unitConfiguration.getClassLoader();
- if (classLoader == null)
- {
- classLoader = ClassHelper.class.getClassLoader();
- }
- Class<?> clazz = Class.forName(className, true, classLoader);
- result = clazz.newInstance();
- }
- catch (ClassNotFoundException e)
- {
- throw new SourceException("The class "
- + className
- + " could not be found.",
- e);
- }
- catch (IllegalAccessException e)
- {
- throw new SourceException("Instantiating "
- + className
- + " is not allowed",
- e);
- }
- catch (InstantiationException e)
- {
- throw new SourceException("The class "
- + className
- + " has no standard constructor.",
- e);
- }
- return result;
- }
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/ControllerState.java Sat Apr 20 21:23:39 2013
@@ -32,7 +32,6 @@ import org.apache.torque.generator.optio
import org.apache.torque.generator.outlet.Outlet;
import org.apache.torque.generator.qname.Namespace;
import org.apache.torque.generator.qname.QualifiedName;
-import org.apache.torque.generator.source.SourceElement;
import org.apache.torque.generator.source.SourceProvider;
import org.apache.torque.generator.variable.VariableStore;
@@ -58,14 +57,14 @@ public class ControllerState
private final List<Outlet> outlets = new ArrayList<Outlet>();
/**
- * The root element of the source graph.
+ * The root object of the source model.
*/
- private SourceElement rootElement;
+ private Object modelRoot;
/**
- * The current element within the source.
+ * The current model object within the source.
*/
- private SourceElement sourceElement;
+ private Object model;
/**
* The generation unit which is currently processed.
@@ -186,47 +185,47 @@ public class ControllerState
}
/**
- * Returns the current source element. Does not return null
- * during generation.
+ * Returns the current model object within the source.
+ * Does not return null during generation.
*
- * @return the current source element.
+ * @return the current model object.
*/
- public SourceElement getSourceElement()
+ public Object getModel()
{
- return sourceElement;
+ return model;
}
/**
- * Sets the current source element.
+ * Sets the current source model object.
*
- * @param sourceElement the new current source element, or null
- * to remove the current source element.
+ * @param sourceElement the new current source model object, or null
+ * to remove the current source mdoel object.
*/
- public void setSourceElement(SourceElement sourceElement)
+ public void setModel(Object model)
{
- this.sourceElement = sourceElement;
+ this.model = model;
}
/**
- * Returns the root element of the current source.
+ * Returns the root object of the current source.
*
- * @return The the root element of the current source;
+ * @return The the root object of the current source;
* may be null only if no source is currently processed.
*/
- public SourceElement getRootElement()
+ public Object getModelRoot()
{
- return rootElement;
+ return modelRoot;
}
/**
- * Sets the root element of the current source.
+ * Sets the root object of the current source.
*
- * @param rootElement the the root element of the current source,
- * or null to remove the current root element.
+ * @param modelRoot the the root object of the current source,
+ * or null to remove the current root object.
*/
- public void setRootElement(SourceElement rootElement)
+ public void setModelRoot(Object modelRoot)
{
- this.rootElement = rootElement;
+ this.modelRoot = modelRoot;
}
/**
@@ -511,8 +510,8 @@ public class ControllerState
.append("outputFilePath=").append(outputFile)
.append("\noutletNamespace=").append(outletNamespace)
.append("\noutlets=").append(outlets)
- .append("\nrootElement=").append(rootElement)
- .append("\nsourceElement").append(sourceElement)
+ .append("\nmodelRoot=").append(modelRoot)
+ .append("\nmodel").append(model)
.append("\nrootOutletReference=")
.append(rootOutletReference)
.append("\nunitConfiguration=").append(unitConfiguration)
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/ApplyAction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/ApplyAction.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/ApplyAction.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/ApplyAction.java Sat Apr 20 21:23:39 2013
@@ -19,7 +19,7 @@ package org.apache.torque.generator.cont
* under the License.
*/
-import java.util.List;
+import java.util.Iterator;
import org.apache.torque.generator.GeneratorException;
import org.apache.torque.generator.control.ControllerState;
@@ -28,7 +28,6 @@ import org.apache.torque.generator.outle
import org.apache.torque.generator.outlet.OutletResult;
import org.apache.torque.generator.qname.Namespace;
import org.apache.torque.generator.qname.QualifiedName;
-import org.apache.torque.generator.source.SourceElement;
import org.apache.torque.generator.source.SourcePath;
/**
@@ -108,12 +107,12 @@ public class ApplyAction implements Merg
+ " does not exist");
}
- SourceElement currentElement = controllerState.getSourceElement();
+ Object model = controllerState.getModel();
String detokenizedPath = tokenReplacer.process(path);
- List<SourceElement> selectedElements
- = SourcePath.getElements(currentElement, detokenizedPath);
- if (selectedElements.isEmpty())
+ Iterator<?> selectedObjectsIt
+ = SourcePath.iterate(model, detokenizedPath);
+ if (!selectedObjectsIt.hasNext())
{
if (!acceptNotSet)
{
@@ -125,21 +124,20 @@ public class ApplyAction implements Merg
}
return new OutletResult("");
}
- if (selectedElements.size() > 1)
+ Object selectedObject = selectedObjectsIt.next();
+ if (selectedObjectsIt.hasNext())
{
throw new GeneratorException(
"ApplyAction : selected path "
+ path
- + " contains more than one element ("
- + selectedElements.size()
- + " times)");
+ + " contains more than one element");
}
- // selectedElements has size 1
- controllerState.setSourceElement(selectedElements.get(0));
+
+ controllerState.setModel(selectedObject);
outlet.beforeExecute(controllerState);
OutletResult result = outlet.execute(controllerState);
outlet.afterExecute(controllerState);
- controllerState.setSourceElement(currentElement);
+ controllerState.setModel(model);
return result;
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/SourceElementAttributeAction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/SourceElementAttributeAction.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/SourceElementAttributeAction.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/SourceElementAttributeAction.java Sat Apr 20 21:23:39 2013
@@ -96,7 +96,7 @@ public class SourceElementAttributeActio
String detonizedElementPath = tokenReplacer.process(elementPath);
SourceElement sourceElement = SourcePath.getElement(
- controllerState.getSourceElement(),
+ (SourceElement) controllerState.getModel(),
detonizedElementPath,
acceptNotSet);
if (sourceElement == null)
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/TraverseAllAction.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/TraverseAllAction.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/TraverseAllAction.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/control/action/TraverseAllAction.java Sat Apr 20 21:23:39 2013
@@ -20,6 +20,7 @@ package org.apache.torque.generator.cont
*/
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import org.apache.torque.generator.GeneratorException;
@@ -30,7 +31,6 @@ import org.apache.torque.generator.outle
import org.apache.torque.generator.outlet.OutletResult;
import org.apache.torque.generator.qname.Namespace;
import org.apache.torque.generator.qname.QualifiedName;
-import org.apache.torque.generator.source.SourceElement;
import org.apache.torque.generator.source.SourcePath;
/**
@@ -65,9 +65,9 @@ public class TraverseAllAction implement
* null means true.
*/
public TraverseAllAction(
- String elementsToTraverseName,
- String outletName,
- Boolean acceptEmpty)
+ final String elementsToTraverseName,
+ final String outletName,
+ final Boolean acceptEmpty)
{
if (elementsToTraverseName == null)
{
@@ -95,19 +95,19 @@ public class TraverseAllAction implement
* ${...} Tokens are replaced within outletName and
* elementsToTraverseName.
*/
- public OutletResult execute(ControllerState controllerState)
+ public OutletResult execute(final ControllerState controllerState)
throws GeneratorException
{
- TokenReplacer tokenReplacer = new TokenReplacer(controllerState);
+ final TokenReplacer tokenReplacer = new TokenReplacer(controllerState);
Outlet outlet;
{
- OutletConfiguration outletConfiguration
+ final OutletConfiguration outletConfiguration
= controllerState.getUnitConfiguration()
.getOutletConfiguration();
- String detokenizedOutletName
+ final String detokenizedOutletName
= tokenReplacer.process(outletName);
- QualifiedName outletQName = new QualifiedName(
+ final QualifiedName outletQName = new QualifiedName(
detokenizedOutletName,
Namespace.ROOT_NAMESPACE);
@@ -120,15 +120,15 @@ public class TraverseAllAction implement
}
}
- SourceElement currentElement = controllerState.getSourceElement();
- String detokenizedElementToTraverseName
+ final String detokenizedElementToTraverseName
= tokenReplacer.process(elementsToTraverseName);
- List<SourceElement> selectedElements
- = SourcePath.getElements(
- currentElement,
+ final Object currentModel = controllerState.getModel();
+ final Iterator<?> toTraverseIt
+ = SourcePath.iterate(
+ currentModel,
detokenizedElementToTraverseName);
- if (!acceptEmpty && selectedElements.isEmpty())
+ if (!acceptEmpty && toTraverseIt.hasNext())
{
throw new GeneratorException(
"TraverseAllAction : selected element "
@@ -136,16 +136,17 @@ public class TraverseAllAction implement
+ " does not exist and acceptEmpty was set to false");
}
- List<OutletResult> resultList
- = new ArrayList<OutletResult>(selectedElements.size());
- for (SourceElement sourceElement : selectedElements)
+ final List<OutletResult> resultList
+ = new ArrayList<OutletResult>();
+ while (toTraverseIt.hasNext())
{
- controllerState.setSourceElement(sourceElement);
+ final Object model = toTraverseIt.next();
+ controllerState.setModel(model);
outlet.beforeExecute(controllerState);
resultList.add(outlet.execute(controllerState));
outlet.afterExecute(controllerState);
}
- controllerState.setSourceElement(currentElement);
+ controllerState.setModel(currentModel);
if (resultList.isEmpty())
{
return new OutletResult("");
@@ -179,7 +180,7 @@ public class TraverseAllAction implement
}
@Override
- public boolean equals(Object obj)
+ public boolean equals(final Object obj)
{
if (this == obj)
{
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/DebuggingOutletWrapper.java Sat Apr 20 21:23:39 2013
@@ -132,8 +132,8 @@ public class DebuggingOutletWrapper impl
/**
* Returns the name of the input root element from the delegate.
*
- * @return inputName the name of the root element of the source,
- * or if any input name is accepted.
+ * @return the name of the root element of the source,
+ * or null if any input name is accepted.
*/
public String getInputElementName()
{
@@ -141,6 +141,28 @@ public class DebuggingOutletWrapper impl
}
/**
+ * Sets the class name of the input root object in the delegate.
+ *
+ * @param className the class name of the root object of the source,
+ * or null to accept any object class.
+ */
+ public void setInputClass(String className)
+ {
+ delegate.setInputClass(className);
+ }
+
+ /**
+ * Returns the class name of the input root object from the delegate.
+ *
+ * @return the class name of the root object of the source,
+ * or null if any object class is accepted.
+ */
+ public String getInputClass()
+ {
+ return delegate.getInputClass();
+ }
+
+ /**
* Calls the beforeExecute method in the delegate.
*
* @param controllerState the current controller state, not null.
@@ -221,8 +243,8 @@ public class DebuggingOutletWrapper impl
protected String getCommentAtStart(ControllerState controllerState)
{
return "start output of outlet " + controllerState.getOutlet().getName()
- + ", current source element is "
- + controllerState.getSourceElement().getName();
+ + ", current model element is "
+ + controllerState.getModel();
}
/**
@@ -236,7 +258,7 @@ public class DebuggingOutletWrapper impl
protected String getCommentAtEnd(ControllerState controllerState)
{
return "end output of outlet " + controllerState.getOutlet().getName()
- + ", current source element is "
- + controllerState.getSourceElement().getName();
+ + ", current model is "
+ + controllerState.getModel();
}
}
Modified: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Outlet.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Outlet.java?rev=1470235&r1=1470234&r2=1470235&view=diff
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Outlet.java (original)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/generator/outlet/Outlet.java Sat Apr 20 21:23:39 2013
@@ -83,9 +83,19 @@ public interface Outlet
Map<String, MergepointMapping> getMergepointMappings();
/**
- * Sets the name of the input root element. If set, the outlet must
- * check if the name of the input root element corresponds to the set
- * element name and throw an exception if the names do not match.
+ * Returns the name of the input root element. If not null, the outlet
+ * checks if the name of the input root element corresponds to the set
+ * element name and throws an exception if the names do not match.
+ *
+ * @return inputName the name of the root element of the source,
+ * or if any input name is accepted.
+ */
+ String getInputElementName();
+
+ /**
+ * Sets the name of the input root element. If set, the outlet
+ * checks if the name of the input root element corresponds to the set
+ * element name and throws an exception if the names do not match.
*
* @param inputName the name of the root element of the source,
* or null to accept any input name.
@@ -93,14 +103,26 @@ public interface Outlet
void setInputElementName(String inputName);
/**
- * Returns the name of the input root element. If not null, the outlet
- * checks if the name of the input root element corresponds to the set
- * element name and throw an exception if the names do not match.
+ * Returns the fully qualified name of the input root class.
+ * If not null, the outlet checks if the class name of the input root
+ * corresponds to the set class name
+ * and throws an exception if the names do not match.
*
* @return inputName the name of the root element of the source,
* or if any input name is accepted.
*/
- String getInputElementName();
+ String getInputClass();
+
+ /**
+ * Sets the fully qualified name of the input model root class.
+ * If set, the outlet checks if the class name of the input model root
+ * corresponds to the set class name
+ * and throws an exception if the names do not match.
+ *
+ * @param inputName the name of the root element of the source,
+ * or null to accept any input name.
+ */
+ void setInputClass(String inputClass);
/**
* Adjusts the state of the Controller before generation.
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org