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 2010/02/16 18:16:02 UTC
svn commit: r910600 [3/29] - in /db/torque/torque4/trunk:
maven-torque-gf-plugin/ maven-torque-gf-plugin/src/
maven-torque-gf-plugin/src/main/ maven-torque-gf-plugin/src/main/java/
maven-torque-gf-plugin/src/main/java/org/ maven-torque-gf-plugin/src/ma...
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/DirectoryConfigurationProvider.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/DirectoryConfigurationProvider.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/DirectoryConfigurationProvider.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/DirectoryConfigurationProvider.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,241 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.gf.configuration.paths.TorqueGfPaths;
+import org.apache.torque.gf.configuration.paths.ProjectPaths;
+
+/**
+ * Provides InputStreams to read the configuration from a directory.
+ */
+public class DirectoryConfigurationProvider implements ConfigurationProvider
+{
+ /** The logger. */
+ private static Log log
+ = LogFactory.getLog(DirectoryConfigurationProvider.class);
+
+ /**
+ * The paths needed to interact with the enclosing project, not null.
+ */
+ private ProjectPaths projectPaths;
+
+ /**
+ * The internal directory structure of the generator configuration files,
+ * not null.
+ */
+ private TorqueGfPaths configurationPaths;
+
+ /**
+ * Constructor.
+ *
+ * @param projectPaths the paths needed to interact with the enclosing
+ * project, not null.
+ * @param configurationPaths The internal directory structure of the
+ * generator configuration files, not null.
+ *
+ * @throws NullPointerException if projectPaths or configurationPaths
+ * are null.
+ */
+ public DirectoryConfigurationProvider(
+ ProjectPaths projectPaths,
+ TorqueGfPaths configurationPaths)
+ {
+ if (projectPaths == null)
+ {
+ throw new NullPointerException("projectPaths is null");
+ }
+ if (configurationPaths == null)
+ {
+ throw new NullPointerException("configurationPaths is null");
+ }
+ this.projectPaths = projectPaths;
+ this.configurationPaths = configurationPaths;
+ }
+
+ public InputStream getControlConfigurationInputStream()
+ throws ConfigurationException
+ {
+ File configFile;
+ {
+ File configDirectory = new File(
+ projectPaths.getConfigurationPath(),
+ configurationPaths.getConfigurationDirectory());
+ configFile = new File(
+ configDirectory,
+ configurationPaths.getControlConfigurationFile());
+ }
+
+ InputStream inputStream = null;
+ try
+ {
+ inputStream = new FileInputStream(configFile);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new ConfigurationException("Controller configuration file "
+ + configFile.getAbsolutePath()
+ + " not found");
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Using control file: '"
+ + configFile.getAbsolutePath() + "'");
+ }
+ return bis;
+ }
+
+ public InputStream getTemplateInputStream(String name)
+ throws ConfigurationException
+ {
+ File templateFile;
+ {
+ File templateDir = new File(
+ projectPaths.getConfigurationPath(),
+ configurationPaths.getTemplateSubdirectory());
+ templateFile = new File(
+ templateDir,
+ name);
+ }
+
+ InputStream inputStream = null;
+ try
+ {
+ inputStream = new FileInputStream(templateFile);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new ConfigurationException("Template file "
+ + templateFile.getAbsolutePath()
+ + " not found");
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading Template: '"
+ + templateFile.getAbsolutePath() + "'");
+ }
+ return bis;
+ }
+
+ public InputStream getGeneratorConfigurationInputStream(String name)
+ throws ConfigurationException
+ {
+ File generatorConfigFile;
+ {
+ File generatorConfigDir = new File(
+ projectPaths.getConfigurationPath(),
+ configurationPaths.getGeneratorDefDirectory());
+
+ generatorConfigFile = new File(generatorConfigDir, name);
+ }
+
+ InputStream inputStream = null;
+ try
+ {
+ inputStream = new FileInputStream(generatorConfigFile);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new ConfigurationException("Generator configuration file "
+ + generatorConfigFile.getAbsolutePath()
+ + " not found");
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading Generator configuration file: '"
+ + generatorConfigFile.getAbsolutePath() + "'");
+ }
+ return bis;
+
+ }
+
+ public Collection<String> getGeneratorConfigurationNames()
+ throws ConfigurationException
+ {
+ File generatorConfigDir = new File(
+ projectPaths.getConfigurationPath(),
+ configurationPaths.getGeneratorDefDirectory());
+
+ List<String> result = new ArrayList<String>();
+ if (!generatorConfigDir.isDirectory())
+ {
+ throw new ConfigurationException(
+ "GeneratorsConfigDirectory "
+ + generatorConfigDir.getAbsolutePath()
+ + "must be a directory");
+ }
+
+ File[] sourceFiles = generatorConfigDir.listFiles();
+ for (int fileNr = 0; fileNr < sourceFiles.length; ++fileNr)
+ {
+ if (!sourceFiles[fileNr].isDirectory()
+ && sourceFiles[fileNr].getPath().endsWith("xml"))
+ {
+ String name = sourceFiles[fileNr].getName();
+ result.add(name);
+ }
+ }
+ return result;
+ }
+
+ public InputStream getOptionsInputStream(String name)
+ throws ConfigurationException
+ {
+ File optionsFile;
+ {
+ File configDirectory = new File(
+ projectPaths.getConfigurationPath(),
+ configurationPaths.getConfigurationDirectory());
+ optionsFile = new File(configDirectory, name);
+ }
+
+ InputStream inputStream = null;
+ try
+ {
+ inputStream = new FileInputStream(optionsFile);
+ }
+ catch (FileNotFoundException e)
+ {
+ throw new ConfigurationException("Options file "
+ + optionsFile.getAbsolutePath()
+ + " not found");
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading Options file: '"
+ + optionsFile.getAbsolutePath() + "'");
+ }
+ return bis;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/GeneratorTypes.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/GeneratorTypes.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/GeneratorTypes.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/GeneratorTypes.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,111 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.torque.gf.configuration.generator.GeneratorSaxHandlerFactory;
+import org.apache.torque.gf.configuration.generator.JavaGeneratorSaxHandlerFactory;
+import org.apache.torque.gf.configuration.generator.VelocityGeneratorSaxHandlerFactory;
+
+/**
+ * Manages the types of known Generators. This include information
+ * about how to read the configuration of each generator type.
+ */
+public class GeneratorTypes
+{
+ /**
+ * A map containing all known GeneratorSaxHandlerFactories,
+ * keyed by the type of the generator.
+ */
+ private Map<String, GeneratorSaxHandlerFactory>
+ generatorHandlerFactories
+ = new HashMap<String, GeneratorSaxHandlerFactory>();
+
+ /**
+ * Constructor. Creates a new instance containing the mappings to the
+ * default generator types.
+ */
+ public GeneratorTypes()
+ {
+ // register default generator types
+ try
+ {
+ registerGeneratorHandlerFactory(
+ new VelocityGeneratorSaxHandlerFactory());
+ registerGeneratorHandlerFactory(
+ new JavaGeneratorSaxHandlerFactory());
+ }
+ catch (ConfigurationException e)
+ {
+ // should not happen
+ throw new RuntimeException(e);
+ }
+ }
+
+ /**
+ * Registers a handler for a new type of generators.
+ *
+ * @param factory the factory which handles the generators of the
+ * given type.
+ *
+ * @throws NullPointerException if factory is null.
+ * @throws ConfigurationException if a factory already exists
+ * for the type of the generator.
+ */
+ public void registerGeneratorHandlerFactory(
+ GeneratorSaxHandlerFactory factory)
+ throws ConfigurationException
+ {
+ if (factory == null)
+ {
+ throw new NullPointerException("factory must not be null");
+ }
+ GeneratorSaxHandlerFactory oldFactory
+ = generatorHandlerFactories.get(factory.getType());
+ if (oldFactory != null)
+ {
+ throw new ConfigurationException(
+ "Attempted to register a GeneratorSaxHandlerFactory "
+ + "of type "
+ + factory.getType()
+ + " and class "
+ + factory.getClass().getName()
+ + " : A factory with this type already exists, "
+ + " it has the class "
+ + oldFactory.getClass().getName());
+ }
+ generatorHandlerFactories.put(factory.getType(), factory);
+ }
+
+ /**
+ * Returns an unmodifiable map containing all the generator handler
+ * factories, keyed by their type.
+ *
+ * @return all generator handler factories, not null.
+ */
+ public Map<String, GeneratorSaxHandlerFactory>
+ getGeneratorHandlerFactories()
+ {
+ return Collections.unmodifiableMap(generatorHandlerFactories);
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/JarConfigurationProvider.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/JarConfigurationProvider.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/JarConfigurationProvider.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/JarConfigurationProvider.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,309 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.gf.configuration.paths.TorqueGfPaths;
+import org.apache.torque.gf.configuration.paths.ProjectPaths;
+
+/**
+ * Provides InputStreams to read a configuration of a unit of generation from a
+ * jar file.
+ */
+public class JarConfigurationProvider implements ConfigurationProvider
+{
+ /** The logger. */
+ private static Log log
+ = LogFactory.getLog(JarConfigurationProvider.class);
+
+ /**
+ * The paths needed to interact with the enclosing project, not null.
+ */
+ private ProjectPaths projectPaths;
+
+ /**
+ * The internal directory structure of the generator configuration files,
+ * not null.
+ */
+ private TorqueGfPaths configurationPaths;
+
+ /**
+ * The jar file from which the configuration should be read, not null.
+ */
+ private JarFile jarFile;
+
+ /**
+ * Constructor.
+ * @param projectPaths the paths needed to interact with the enclosing
+ * project, not null.
+ * @param configurationPaths The internal directory structure of the
+ * generator configuration files, not null.
+ *
+ * @throws NullPointerException if projectPaths or configurationPaths
+ * are null.
+ * @throws ConfigurationException if the jar file can not be accessed.
+ */
+ public JarConfigurationProvider(
+ ProjectPaths projectPaths,
+ TorqueGfPaths configurationPaths)
+ throws ConfigurationException
+ {
+ if (projectPaths == null)
+ {
+ throw new NullPointerException("projectPaths is null");
+ }
+ if (configurationPaths == null)
+ {
+ throw new NullPointerException("configurationPaths is null");
+ }
+ this.projectPaths = projectPaths;
+ this.configurationPaths = configurationPaths;
+
+ try
+ {
+ jarFile = new JarFile(projectPaths.getConfigurationPath());
+ }
+ catch (IOException e)
+ {
+ log.error("Could not open jar File "
+ + projectPaths.getConfigurationPath()
+ .getAbsolutePath());
+ throw new ConfigurationException(e);
+ }
+
+ }
+
+ public InputStream getControlConfigurationInputStream()
+ throws ConfigurationException
+ {
+ String configFileName
+ = configurationPaths.getConfigurationDirectory()
+ + "/"
+ + configurationPaths.getControlConfigurationFile();
+
+
+ InputStream inputStream = null;
+ try
+ {
+ JarEntry jarEntry = jarFile.getJarEntry(configFileName);
+ if (jarEntry == null)
+ {
+ throw new ConfigurationException("File " + configFileName
+ + " not found in Jar file.");
+ }
+ inputStream = jarFile.getInputStream(jarEntry);
+ }
+ catch (IOException e)
+ {
+ throw new ConfigurationException("Could not read entry "
+ + configFileName
+ + " in jar file "
+ + projectPaths.getConfigurationPath(),
+ e);
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Using control file: '"
+ + configFileName
+ + "' in jar file "
+ + projectPaths.getConfigurationPath());
+ }
+ return bis;
+ }
+
+ public InputStream getTemplateInputStream(String name)
+ throws ConfigurationException
+ {
+ String templateFileName
+ = configurationPaths.getTemplateSubdirectory()
+ + "/"
+ + name;
+
+ InputStream inputStream = null;
+ try
+ {
+ JarEntry jarEntry = jarFile.getJarEntry(templateFileName);
+ inputStream = jarFile.getInputStream(jarEntry);
+ }
+ catch (IOException e)
+ {
+ throw new ConfigurationException("Could not read template file "
+ + templateFileName
+ + " in jar file "
+ + projectPaths.getConfigurationPath(),
+ e);
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading template: '"
+ + projectPaths.getConfigurationPath()
+ + "' in jar file "
+ + projectPaths.getConfigurationPath());
+ }
+ return bis;
+ }
+
+ public InputStream getGeneratorConfigurationInputStream(String name)
+ throws ConfigurationException
+ {
+ String generatorConfigFileName
+ = configurationPaths.getGeneratorDefDirectory()
+ + "/"
+ + name;
+
+ InputStream inputStream = null;
+ try
+ {
+ JarEntry jarEntry = jarFile.getJarEntry(generatorConfigFileName);
+ inputStream = jarFile.getInputStream(jarEntry);
+ }
+ catch (IOException e)
+ {
+ throw new ConfigurationException(
+ "Could not read generator configuration file "
+ + generatorConfigFileName
+ + " in jar file "
+ + projectPaths.getConfigurationPath(),
+ e);
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading generator configuration file: '"
+ + projectPaths.getConfigurationPath()
+ + "' in jar file "
+ + projectPaths.getConfigurationPath());
+ }
+ return bis;
+ }
+
+ public Collection<String> getGeneratorConfigurationNames()
+ throws ConfigurationException
+ {
+ return getGeneratorConfigurationNames(
+ jarFile,
+ configurationPaths.getGeneratorDefDirectory());
+ }
+
+ /**
+ * Extracts the generator configuration files from a jar file.
+ * @param jarFile the jar file to process, not null.
+ * @param generatorConfigurationDirectory the name of the directory
+ * which contains the generator configuration files. Cannot be
+ * a composite path like parent/child.
+ * @return a set with the names of all generator configuration files
+ * contained in the jar file.
+ * @throws NullPointerException if jarFile
+ * or generatorConfigurationDirectory is null
+ */
+ static Collection<String> getGeneratorConfigurationNames(
+ JarFile jarFile,
+ String generatorConfigurationDirectory)
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Analyzing jar file " + jarFile.getName()
+ + " seeking Directory " + generatorConfigurationDirectory);
+ }
+
+ List<String> result = new ArrayList<String>();
+
+ Enumeration<JarEntry> entries = jarFile.entries();
+ while (entries.hasMoreElements())
+ {
+ JarEntry jarEntry = entries.nextElement();
+ if (jarEntry.isDirectory())
+ {
+ continue;
+ }
+ String rawName = jarEntry.getName();
+ if (!rawName.startsWith(generatorConfigurationDirectory))
+ {
+ continue;
+ }
+ String name = rawName.substring(rawName.lastIndexOf('/') + 1);
+
+ int expectedRawNameLength
+ = generatorConfigurationDirectory.length()
+ + name.length()
+ + 1;
+ if (rawName.length() != expectedRawNameLength)
+ {
+ // file is in a subdirectory of generatorConfigurationSubdir,
+ // we only consider files directly in
+ // generatorConfigurationSubdir
+ continue;
+ }
+ result.add(name);
+ }
+ if (log.isDebugEnabled())
+ {
+ log.debug("Found the following generator configuration files "
+ + result);
+ }
+ return result;
+ }
+
+ public InputStream getOptionsInputStream(String name)
+ throws ConfigurationException
+ {
+ String optionsFileName
+ = configurationPaths.getConfigurationDirectory()
+ + "/"
+ + name;
+
+ InputStream inputStream = null;
+ try
+ {
+ JarEntry jarEntry = jarFile.getJarEntry(optionsFileName);
+ inputStream = jarFile.getInputStream(jarEntry);
+ }
+ catch (IOException e)
+ {
+ throw new ConfigurationException("Could not read options file "
+ + optionsFileName
+ + " in jar file "
+ + projectPaths.getConfigurationPath(),
+ e);
+ }
+ BufferedInputStream bis = new BufferedInputStream(inputStream);
+ if (log.isInfoEnabled())
+ {
+ log.info("Reading options file: '"
+ + projectPaths.getConfigurationPath()
+ + "' in jar file "
+ + projectPaths.getConfigurationPath());
+ }
+ return bis;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/SaxHelper.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/SaxHelper.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/SaxHelper.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/SaxHelper.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,102 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.lang.StringUtils;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+/**
+ * Helper methods for SAX handlers.
+ */
+public final class SaxHelper
+{
+ /**
+ * private constructor for utility class.
+ */
+ private SaxHelper()
+ {
+ }
+
+ /**
+ * Retrieves an attribute as boolean value.
+ *
+ * @param attributeName the name of the attribute to retrieve, not null.
+ * @param attributes The attributes of the current element.
+ * @param elementDescription the description of the parsed element,
+ * for producing a user-readable error message. E.g
+ * "the optionAction ${nameOfTheAction}"
+ *
+ * @return the value of the attribute, or null if the attribute is not set.
+ *
+ * @throws SAXException if the attribute contains content
+ * other than "true" or "false"
+ */
+ public static Boolean getBooleanAttribute(
+ String attributeName,
+ Attributes attributes,
+ String elementDescription)
+ throws SAXException
+ {
+ String acceptNotSet = attributes.getValue(attributeName);
+ if (acceptNotSet == null)
+ {
+ return null;
+ }
+ if ("false".equals(acceptNotSet))
+ {
+ return false;
+ }
+ else if ("true".equals(acceptNotSet))
+ {
+ return true;
+ }
+ else
+ {
+ throw new SAXException("The attribute "
+ + attributeName
+ + "of "
+ + elementDescription
+ + " must either be false or true");
+ }
+ }
+
+ /**
+ * Retrieves the unqualified part of an XML element name name,
+ * regardless whether namespace processing is switched on or off.
+ *
+ * @param localName The local name (without prefix), or the
+ * empty string if namespace processing is not being
+ * performed.
+ * @param qName The qualified name (with prefix), or the
+ * empty string if qualified names are not available.
+ *
+ * @return the unqualified part of the name.
+ */
+ public static String getUnqualifiedName(String localName, String qName)
+ {
+ if (!StringUtils.isEmpty(localName))
+ {
+ return localName;
+ }
+ return qName;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfiguration.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfiguration.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfiguration.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfiguration.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,308 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.apache.torque.gf.configuration.controller.Loglevel;
+import org.apache.torque.gf.configuration.controller.Output;
+import org.apache.torque.gf.configuration.generator.GeneratorConfiguration;
+import org.apache.torque.gf.option.Options;
+
+/**
+ * A container for the configuration for a generation unit.
+ * Provides state checking, i.e. getters can only be called
+ * after all setters has been called.
+ */
+public class UnitConfiguration
+{
+ /** The list of all activities of the generation unit. */
+ private List<Output> outputFiles = new ArrayList<Output>();
+
+ /**
+ * All options for the generation unit.
+ */
+ private Options options;
+
+ /**
+ * The configuration for the available generators.
+ */
+ private GeneratorConfiguration generatorConfiguration;
+
+ /**
+ * The root directory where the generated file which are generated
+ * each time anew are put into.
+ */
+ private File newFileTargetDirectory;
+
+ /**
+ * The root directory where the generated file which are not generated
+ * each time anew are put into.
+ */
+ private File modifiedFileTargetDirectory;
+
+ /** The Loglevel for generation. */
+ private Loglevel loglevel = Loglevel.INFO;
+
+ /**
+ * Returns the configuration of the generators in this generation unit.
+ *
+ * @return the generator configuration, or null if not set.
+ *
+ * @throws IllegalStateException if generatorConfiguration was not set.
+ */
+ public GeneratorConfiguration getGeneratorConfiguration()
+ {
+ if (generatorConfiguration == null)
+ {
+ throw new IllegalStateException(
+ "generatorConfiguration is not initialized");
+ }
+ return generatorConfiguration;
+ }
+
+ /**
+ * Sets the generator configuration of the associated configuration unit.
+ *
+ * @param generatorConfiguration the generator configuration, not null.
+ *
+ * @throws NullPointerException if generatorConfiguration is null.
+ */
+ public void setGeneratorConfiguration(
+ GeneratorConfiguration generatorConfiguration)
+ {
+ if (generatorConfiguration == null)
+ {
+ throw new NullPointerException(
+ "generatorConfiguration cannot be null");
+ }
+ this.generatorConfiguration = generatorConfiguration;
+ }
+
+ /**
+ * Returns the options of the associated configuration unit.
+ *
+ * @return the options, not null.
+ *
+ * @throws IllegalStateException if options were not yet set.
+ */
+ public Options getOptions()
+ {
+ if (options == null)
+ {
+ throw new IllegalStateException(
+ "options are not initialized");
+ }
+ return options;
+ }
+
+ /**
+ * Sets the options of the associated configuration unit.
+ *
+ * @param options the options, not null.
+ *
+ * @throws NullPointerException if options is null.
+ */
+ public void setOptions(Options options)
+ {
+ if (options == null)
+ {
+ throw new NullPointerException(
+ "options cannot be null");
+ }
+ this.options = options;
+ }
+
+ /**
+ * Returns the target directory for the files which are generated
+ * each time anew of the associated configuration unit.
+ *
+ * @return the target directory for the files which are generated
+ * each time anew, not null.
+ *
+ * @throws IllegalStateException if the target directory was not yet set.
+ */
+ public File getNewFileTargetDirectory()
+ {
+ if (newFileTargetDirectory == null)
+ {
+ throw new IllegalStateException(
+ "newFileTargetDirectory is not initialized");
+ }
+ return newFileTargetDirectory;
+ }
+
+ /**
+ * Returns the target directory for the files which are not generated
+ * each time anew of the associated configuration unit.
+ *
+ * @return the target directory for the files which are generated
+ * each time anew, not null.
+ *
+ * @throws IllegalStateException if the target directory was not yet set.
+ */
+ public File getModifiedFileTargetDirectory()
+ {
+ if (modifiedFileTargetDirectory == null)
+ {
+ throw new IllegalStateException(
+ "modifiedFileTargetDirectory is not initialized");
+ }
+ return modifiedFileTargetDirectory;
+ }
+
+ /**
+ * Sets the target directory for the files which are generated
+ * each time anew of the associated configuration unit.
+ *
+ * @param newFileTargetDirectory the target directory, not null.
+ *
+ * @throws NullPointerException if targetDirectory is null.
+ */
+ public void setNewFileTargetDirectory(File newFileTargetDirectory)
+ {
+ if (newFileTargetDirectory == null)
+ {
+ throw new NullPointerException(
+ "newFileTargetDirectory cannot be null");
+ }
+ this.newFileTargetDirectory = newFileTargetDirectory;
+ }
+
+ /**
+ * Sets the target directory for the files which are not generated
+ * each time anew of the associated configuration unit.
+ *
+ * @param modifiedFileTargetDirectory the target directory, not null.
+ *
+ * @throws NullPointerException if targetDirectory is null.
+ */
+ public void setModifiedFileTargetDirectory(File modifiedFileTargetDirectory)
+ {
+ if (modifiedFileTargetDirectory == null)
+ {
+ throw new NullPointerException(
+ "modifiedFileTargetDirectory cannot be null");
+ }
+ this.modifiedFileTargetDirectory = modifiedFileTargetDirectory;
+ }
+
+ /**
+ * Sets the output files of the associated configuration unit.
+ *
+ * @param outputFiles the output files, not null.
+ *
+ * @throws NullPointerException if outputFiles is null.
+ */
+ public void setOutputFiles(List<Output> outputFiles)
+ {
+ if (outputFiles == null)
+ {
+ throw new NullPointerException(
+ "outputFiles cannot be null");
+ }
+ this.outputFiles = outputFiles;
+ }
+
+ /**
+ * Returns the output files of the associated configuration unit.
+ *
+ * @return the output files, not null.
+ *
+ * @throws IllegalStateException if the output files were not yet set.
+ */
+ public List<Output> getOutputFiles()
+ {
+ if (outputFiles == null)
+ {
+ throw new IllegalStateException(
+ "outputFiles are not initialized");
+ }
+ return Collections.unmodifiableList(outputFiles);
+ }
+
+ /**
+ * Returns the Loglevel during generation.
+ *
+ * @return the Loglevel, not null.
+ */
+ public Loglevel getLoglevel()
+ {
+ return loglevel;
+ }
+
+ /**
+ * Sets the Loglevel during generation.
+ *
+ * @param loglevel the Loglevel, not null.
+ *
+ * @throws NullPointerException if loglevel is set to null.
+ */
+ public void setLoglevel(Loglevel loglevel)
+ {
+ if (loglevel == null)
+ {
+ throw new NullPointerException("loglevel is null");
+ }
+ this.loglevel = loglevel;
+ }
+
+ /**
+ * Checks whether the unit configuration is fully initialized.
+ *
+ * @return true if the unit configuration is fully initialized,
+ * false otherwise.
+ */
+ public boolean isInit()
+ {
+ if (outputFiles == null
+ || options == null
+ || generatorConfiguration == null
+ || newFileTargetDirectory == null
+ || modifiedFileTargetDirectory == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append("(outputFiles=")
+ .append(outputFiles.toString())
+ .append(", options=")
+ .append(options)
+ .append(", generatorConfiguration=")
+ .append(generatorConfiguration)
+ .append(", newFileTargetDirectory=")
+ .append(newFileTargetDirectory)
+ .append(", modifiedFileTargetDirectory=")
+ .append(modifiedFileTargetDirectory)
+ .append(", loglevel=")
+ .append(loglevel)
+ .append(")");
+ return result.toString();
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfigurationReader.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfigurationReader.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfigurationReader.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitConfigurationReader.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,375 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.torque.gf.configuration.UnitDescriptor.Packaging;
+import org.apache.torque.gf.configuration.controller.ControlConfiguration;
+import org.apache.torque.gf.configuration.controller.ControlConfigurationXmlParser;
+import org.apache.torque.gf.configuration.controller.Output;
+import org.apache.torque.gf.configuration.generator.GeneratorConfiguration;
+import org.apache.torque.gf.configuration.generator.GeneratorConfigurationXmlParser;
+import org.apache.torque.gf.configuration.option.OptionsConfiguration;
+import org.apache.torque.gf.generator.Generator;
+import org.apache.torque.gf.option.Option;
+import org.apache.torque.gf.option.Options;
+import org.apache.torque.gf.qname.QualifiedName;
+
+/**
+ * Reads the configuration of a unit of generation.
+ */
+class UnitConfigurationReader
+{
+ /**
+ * The logger.
+ */
+ private static Log log = LogFactory.getLog(UnitConfigurationReader.class);
+
+ /**
+ * Reads the configuration for a unit of generation.
+ * @param unitDescriptor the descriptor of the generation unit, not null.
+ * @param configurationHandlers the available configuration handlers,
+ * not null.
+ *
+ * @return the configuration of the unit of generation.
+ * @throws ConfigurationException if the configuration is incorrect
+ * or cannot be read.
+ * @throws NullPointerException if the unitDescriptor or generatorTypes
+ * is null.
+ * @throws IllegalArgumentException if a reader is the wrong type of reader
+ * for the given configuration type.
+ */
+ public UnitConfiguration read(
+ UnitDescriptor unitDescriptor,
+ ConfigurationHandlers configurationHandlers)
+ throws ConfigurationException
+ {
+ if (unitDescriptor == null)
+ {
+ throw new NullPointerException("unitDescriptor must not be null");
+ }
+ if (configurationHandlers == null)
+ {
+ throw new NullPointerException(
+ "configurationHandlers must not be null");
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Start reading unitConfiguration for unit "
+ + getUnitDisplayName(unitDescriptor));
+ }
+
+ UnitConfiguration unitConfiguration = new UnitConfiguration();
+ unitConfiguration.setNewFileTargetDirectory(
+ unitDescriptor.getProjectPaths().getNewFileTargetPath());
+ unitConfiguration.setModifiedFileTargetDirectory(
+ unitDescriptor.getProjectPaths().getModifiedFileTargetPath());
+
+ ConfigurationProvider configurationProvider
+ = createConfigurationProvider(unitDescriptor);
+ readControlConfiguration(
+ unitConfiguration,
+ unitDescriptor,
+ configurationHandlers,
+ configurationProvider);
+
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Start reading generator configuration");
+ }
+ GeneratorConfiguration generatorConfiguration
+ = new GeneratorConfigurationXmlParser()
+ .readGeneratorConfiguration(
+ configurationProvider,
+ unitDescriptor.getProjectPaths(),
+ configurationHandlers);
+ unitConfiguration.setGeneratorConfiguration(generatorConfiguration);
+ }
+
+ if (log.isDebugEnabled())
+ {
+ log.debug("Sucessfully read unitConfiguration for unit "
+ + getUnitDisplayName(unitDescriptor));
+ }
+
+
+ if (unitDescriptor.getInheritsFrom() == null)
+ {
+ GeneratorConfiguration generatorConfiguration
+ = unitConfiguration.getGeneratorConfiguration();
+ generatorConfiguration.resolveMergepointMappings();
+ return unitConfiguration;
+ }
+ UnitConfiguration inherited = read(
+ unitDescriptor.getInheritsFrom(),
+ configurationHandlers);
+
+ // Loglevel of inherited may have changed during reading.
+ // Restore this loglevel.
+ unitConfiguration.getLoglevel().apply();
+
+ mergeInheritedGeneratorConfiguration(unitConfiguration, inherited);
+ mergeInheritedOptionConfiguration(unitConfiguration, inherited);
+ mergeInheritedOutputFiles(unitConfiguration, inherited);
+ // target directory cannot be null and thus the current target directory
+ // always overrides the inherited target directory.
+
+ return unitConfiguration;
+ }
+
+ /**
+ * Merges the inherited output files with the output files
+ * of the current unit configuration.
+ *
+ * @param unitConfiguration the current unit configuration
+ * @param inheritedConfiguration the inherited unit configuration
+ * which option configuration should be merged.
+ */
+ private void mergeInheritedOutputFiles(
+ UnitConfiguration unitConfiguration,
+ UnitConfiguration inheritedConfiguration)
+ {
+ List<Output> outputFiles = new ArrayList<Output>();
+ // inherited Files are generated first.
+ Set<QualifiedName> qualifiedNames = new HashSet<QualifiedName>();
+ for (Output output : inheritedConfiguration.getOutputFiles())
+ {
+ outputFiles.add(output);
+ qualifiedNames.add(output.getName());
+ }
+ for (Output output : unitConfiguration.getOutputFiles())
+ {
+ if (qualifiedNames.contains(output.getName()))
+ {
+ Iterator<Output> addedOutputIt = outputFiles.iterator();
+ while (addedOutputIt.hasNext())
+ {
+ if (addedOutputIt.next().getName().equals(output.getName()))
+ {
+ addedOutputIt.remove();
+ log.info("Output with name " + output.getName()
+ + " is overriden in child and is replaced.");
+ break;
+ }
+ }
+ }
+ outputFiles.add(output);
+ }
+ unitConfiguration.setOutputFiles(outputFiles);
+ }
+
+ /**
+ * Merges an inherited option configuration into the option
+ * configuration of the current unit configuration.
+ *
+ * @param unitConfiguration the current unit configuration
+ * @param inheritedConfiguration the inherited unit configuration
+ * which option configuration should be merged.
+ */
+ private void mergeInheritedOptionConfiguration(
+ UnitConfiguration unitConfiguration,
+ UnitConfiguration inheritedConfiguration)
+ {
+ Options options = unitConfiguration.getOptions();
+ Options inheritedOptions = inheritedConfiguration.getOptions();
+ for (Map.Entry<QualifiedName, Option> entry
+ : inheritedOptions.getGlobalScope().entrySet())
+ {
+ QualifiedName optionName = entry.getKey();
+ Option option = entry.getValue();
+ if (!options.getGlobalScope().containsKey(optionName))
+ {
+ options.setGlobalOption(option);
+ }
+ }
+ }
+
+ /**
+ * Merges an inherited generator configuration into the generator
+ * configuration of the current unit configuration.
+ *
+ * @param unitConfiguration the current unit configuration
+ * @param inheritedConfiguration the inherited unit configuration
+ * which generators should be merged.
+ *
+ * @throws ConfigurationException will not normally happen.
+ */
+ private void mergeInheritedGeneratorConfiguration(
+ UnitConfiguration unitConfiguration,
+ UnitConfiguration inheritedConfiguration)
+ throws ConfigurationException
+ {
+ GeneratorConfiguration generatorConfiguration
+ = unitConfiguration.getGeneratorConfiguration();
+
+ GeneratorConfiguration inheritedGeneratorConfiguration
+ = inheritedConfiguration.getGeneratorConfiguration();
+ Map<QualifiedName, Generator> inheritedGenerators
+ = inheritedGeneratorConfiguration.getGenerators();
+
+ for (Map.Entry<QualifiedName, Generator> entry
+ : inheritedGenerators.entrySet())
+ {
+ if (!generatorConfiguration.generatorExists(entry.getKey()))
+ {
+ generatorConfiguration.addGenerator(entry.getValue());
+ }
+ }
+ generatorConfiguration.resolveMergepointMappings();
+ }
+
+ /**
+ * Reads the control configuration and stores it in the unitConfiguration.
+ *
+ * @param unitConfiguration the configuration into which the control
+ * configuration should be read.
+ * @param unitDescriptor The unit descriptor for the generation unit to
+ * use.
+ * @param configurationHandlers the available configuration handlers,
+ * not null.
+ * @param configurationProvider The provider for accessing the
+ * configuration files.
+ *
+ * @throws ConfigurationException if an error occurs while reading
+ * the configuration.
+ */
+ private void readControlConfiguration(
+ UnitConfiguration unitConfiguration,
+ UnitDescriptor unitDescriptor,
+ ConfigurationHandlers configurationHandlers,
+ ConfigurationProvider configurationProvider)
+ throws ConfigurationException
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Start reading control configuration");
+ }
+ ControlConfiguration controlConfiguration
+ = new ControlConfigurationXmlParser()
+ .readControllerConfiguration(
+ configurationProvider,
+ unitDescriptor.getProjectPaths(),
+ configurationHandlers);
+ if (unitDescriptor.getLoglevel() == null)
+ {
+ unitConfiguration.setLoglevel(controlConfiguration.getLoglevel());
+ controlConfiguration.getLoglevel().apply();
+ }
+ unitConfiguration.setOutputFiles(
+ controlConfiguration.getOutputFiles());
+
+ {
+ if (log.isDebugEnabled())
+ {
+ log.debug("Start reading options");
+ }
+ List<OptionsConfiguration> optionConfigurations
+ = new ArrayList<OptionsConfiguration>();
+ optionConfigurations.addAll(
+ controlConfiguration.getOptionsConfigurations());
+ if (unitDescriptor.getOverrideOptions() != null)
+ {
+ optionConfigurations.add(unitDescriptor.getOverrideOptions());
+ }
+
+ Options options = new Options();
+ for (OptionsConfiguration optionConfiguration
+ : optionConfigurations)
+ {
+ options.addGlobalOptions(
+ optionConfiguration.getOptions(
+ configurationProvider));
+ }
+ unitConfiguration.setOptions(options);
+
+ }
+ if (log.isDebugEnabled())
+ {
+ log.debug("Control configuration successfully read.");
+ }
+ }
+
+ /**
+ * Creates the matching configuration provider for the packaging type
+ * of the unit descriptor.
+ *
+ * @param unitDescriptor the unit descriptor to create the
+ * configuration provider for, not null.
+ *
+ * @return a configuration provider for the unit descriptor, not null.
+ *
+ * @throws ConfigurationException if an unknown packaging is encountered
+ * or if a jar file cannot be accessed.
+ */
+ private ConfigurationProvider createConfigurationProvider(
+ UnitDescriptor unitDescriptor)
+ throws ConfigurationException
+ {
+ ConfigurationProvider configurationProvider;
+ if (UnitDescriptor.Packaging.DIRECTORY == unitDescriptor.getPackaging())
+ {
+ configurationProvider = new DirectoryConfigurationProvider(
+ unitDescriptor.getProjectPaths(),
+ unitDescriptor.getConfigurationPaths());
+ }
+ else if (UnitDescriptor.Packaging.JAR == unitDescriptor.getPackaging())
+ {
+ configurationProvider = new JarConfigurationProvider(
+ unitDescriptor.getProjectPaths(),
+ unitDescriptor.getConfigurationPaths());
+ }
+ else if (UnitDescriptor.Packaging.CLASSPATH
+ == unitDescriptor.getPackaging())
+ {
+ configurationProvider = new ClasspathConfigurationProvider(
+ unitDescriptor.getProjectPaths(),
+ unitDescriptor.getConfigurationPaths());
+ }
+ else
+ {
+ throw new ConfigurationException("Unknown Unit type "
+ + unitDescriptor.getPackaging());
+ }
+ return configurationProvider;
+ }
+
+ private String getUnitDisplayName(UnitDescriptor unitDescriptor)
+ {
+ if (Packaging.CLASSPATH == unitDescriptor.getPackaging())
+ {
+ return unitDescriptor.getProjectPaths().getConfigurationPackage();
+ }
+ else
+ {
+ return unitDescriptor.getProjectPaths().getConfigurationPath()
+ .toString();
+ }
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitDescriptor.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitDescriptor.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitDescriptor.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/UnitDescriptor.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,197 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.torque.gf.configuration.controller.Loglevel;
+import org.apache.torque.gf.configuration.option.OptionsConfiguration;
+import org.apache.torque.gf.configuration.paths.TorqueGfPaths;
+import org.apache.torque.gf.configuration.paths.ProjectPaths;
+
+/**
+ * Contains all necessary information about a generation unit.
+ */
+public class UnitDescriptor
+{
+ /**
+ * Possible packaging forms of a unit of generation.
+ */
+ public enum Packaging
+ {
+ /** the generation unit is provided as a jar file .*/
+ JAR,
+ /** the generation unit is provided in a local directory. */
+ DIRECTORY,
+ /** the generation unit is provided in the classpath. */
+ CLASSPATH
+ }
+
+ /**
+ * The packaging of the generation unit.
+ */
+ private Packaging packaging;
+
+ /**
+ * The paths the code generator must know about the surrounding project.
+ */
+ private ProjectPaths projectPaths;
+
+ /**
+ * How the code generator's configuration is organized internally.
+ */
+ private TorqueGfPaths configurationPaths;
+
+ /**
+ * The parent of this generation unit, or null if it has no parent.
+ */
+ private UnitDescriptor inheritsFrom;
+
+ /** Options to override the settings in the project Directory. */
+ private OptionsConfiguration overrideOptions;
+
+ /** The Loglevel to override the loglevel in the generator configuration. */
+ private Loglevel loglevel;
+
+ /**
+ * Constructor without inheritance, override options and loglevel.
+ *
+ * @param packaging The packaging of the generation unit, not null.
+ * @param projectPaths The paths the code generator must know about
+ * the surrounding project, not null.
+ * @param configurationPaths The paths within the configuration
+ * of the configuration unit, not null.
+ */
+ public UnitDescriptor(
+ Packaging packaging,
+ ProjectPaths projectPaths,
+ TorqueGfPaths configurationPaths)
+ {
+ this(packaging, projectPaths, configurationPaths, null, null, null);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param packaging The packaging of the generation unit, not null.
+ * @param projectPaths The paths the code generator must know about
+ * the surrounding project, not null.
+ * @param configurationPaths The paths within the configuration
+ * of the configuration unit, not null.
+ * @param inheritsFrom the parent of this generation unit,
+ * or null if it does not inherit from a generation unit.
+ * @param overrideOptions Options to override the settings in the project
+ * Directory, or null if no options are overridden.
+ * @param loglevel The loglevel to override the log level, or null to use
+ * the log level defined in the configuration.
+ */
+ public UnitDescriptor(
+ Packaging packaging,
+ ProjectPaths projectPaths,
+ TorqueGfPaths configurationPaths,
+ UnitDescriptor inheritsFrom,
+ OptionsConfiguration overrideOptions,
+ Loglevel loglevel)
+ {
+ if (packaging == null)
+ {
+ throw new NullPointerException("packaging must not be null");
+ }
+ if (projectPaths == null)
+ {
+ throw new NullPointerException(
+ "projectPaths must not be null");
+ }
+ if (configurationPaths == null)
+ {
+ throw new NullPointerException(
+ "configurationPaths must not be null");
+ }
+
+ this.packaging = packaging;
+ this.projectPaths = projectPaths;
+ this.configurationPaths = configurationPaths;
+ this.inheritsFrom = inheritsFrom;
+ this.overrideOptions = overrideOptions;
+ this.loglevel = loglevel;
+ }
+
+ /**
+ * Returns the packaging of the unit of generation.
+ *
+ * @return the packaging of the unit of generation, not null.
+ */
+ public Packaging getPackaging()
+ {
+ return packaging;
+ }
+
+ /**
+ * Returns the paths which the code generator must know about the
+ * surrounding project.
+ *
+ * @return the paths of the surrounding project, not null.
+ */
+ public ProjectPaths getProjectPaths()
+ {
+ return projectPaths;
+ }
+
+ /**
+ * Returns the paths in the configuration of this generation unit.
+ * @return the paths in the configuration of this generation unit,
+ * not null.
+ */
+ public TorqueGfPaths getConfigurationPaths()
+ {
+ return configurationPaths;
+ }
+
+ /**
+ * Returns the descriptor of the generation unit from which this generation
+ * unit inherits, or null if this generation unit does not inherit from
+ * another generation unit.
+ *
+ * @return the parents unit descriptor, or null if no parent exists.
+ */
+ public UnitDescriptor getInheritsFrom()
+ {
+ return inheritsFrom;
+ }
+
+ /**
+ * Returns the configuration of the overriding options, if any.
+ *
+ * @return the configuration of the overriding options, or null.
+ */
+ public OptionsConfiguration getOverrideOptions()
+ {
+ return overrideOptions;
+ }
+
+ /**
+ * Returns the log level overriding the loglevel defined in the
+ * configuration unit.
+ *
+ * @return the log level, or null.
+ */
+ public Loglevel getLoglevel()
+ {
+ return loglevel;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/XMLConstants.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/XMLConstants.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/XMLConstants.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/XMLConstants.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,63 @@
+package org.apache.torque.gf.configuration;
+
+/*
+ * 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.
+ */
+
+/**
+ * Contains commonly used XML Namespaces and other constants.
+ */
+public final class XMLConstants
+{
+ /**
+ * private constructor for utility class.
+ */
+ private XMLConstants()
+ {
+ }
+
+ /**
+ * The XML Schema Namespace.
+ */
+ public static final String XS_NAMESPACE
+ = "http://www.w3.org/2001/XMLSchema";
+
+ /**
+ * The XML Schema Instance Namespace.
+ */
+ public static final String XSI_NAMESPACE
+ = "http://www.w3.org/2001/XMLSchema-instance";
+
+ /**
+ * The Torque GF configuration Namespace.
+ */
+ public static final String GF_CONFIGURATION_NAMESPACE
+ = "http://db.apache.org/torque/gf/4.0/configuration";
+
+ /**
+ * The Torque GF generator Namespace.
+ */
+ public static final String GF_GENERATOR_NAMESPACE
+ = "http://db.apache.org/torque/gf/4.0/generator";
+
+ /**
+ * The name of the XSI type attribute.
+ */
+ public static final String XSI_TYPE_ATTRBUTE_NAME = "type";
+
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfiguration.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfiguration.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfiguration.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfiguration.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,163 @@
+package org.apache.torque.gf.configuration.controller;
+
+/*
+ * 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.
+ */
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed 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.Collections;
+import java.util.List;
+
+import org.apache.torque.gf.configuration.ConfigurationException;
+import org.apache.torque.gf.configuration.option.OptionsConfiguration;
+
+
+/**
+ * Represents the control configuration of a generation unit.
+ *
+ * @version $Id: XmlToAppData.java 239626 2005-08-24 12:19:51Z henning $
+ */
+public class ControlConfiguration
+{
+ /** The list of all activities of the generation unit. */
+ private List<Output> outputList = new ArrayList<Output>();
+
+ /** The list of all options definitions within the generation unit. */
+ private List<OptionsConfiguration> optionsConfigurations
+ = new ArrayList<OptionsConfiguration>();
+
+ /** The loglevel during generation, not null. */
+ private Loglevel loglevel = Loglevel.INFO;
+
+ /**
+ * Adds an output file to the list of output files.
+ *
+ * @param output the output to add, not null.
+ *
+ * @throws NullPointerException if outputFile is null.
+ * @throws ConfigurationException if an output
+ * with the same name already exists.
+ */
+ void addOutput(Output output) throws ConfigurationException
+ {
+ if (output == null)
+ {
+ throw new NullPointerException("output must not be null");
+ }
+ for (Output existing : outputList)
+ {
+ if (existing.getName().equals(output.getName()))
+ {
+ throw new ConfigurationException("Output with name "
+ + output.getName() + " already exists");
+ }
+ }
+ outputList.add(output);
+ }
+
+ /**
+ * Returns all output files.
+ *
+ * @return an unmodifiable list of output files, not null.
+ */
+ public List<Output> getOutputFiles()
+ {
+ return Collections.unmodifiableList(outputList);
+ }
+
+ /**
+ * Adds a configuration for options.
+ *
+ * @param optionsConfiguration the option configuration to add, not null.
+ *
+ * @throws NullPointerException if optionConfiguration is null.
+ */
+ void addOptionsConfiguration(
+ OptionsConfiguration optionsConfiguration)
+ {
+ if (optionsConfiguration == null)
+ {
+ throw new NullPointerException("optionsConfiguration is null");
+ }
+ optionsConfigurations.add(optionsConfiguration);
+ }
+
+ /**
+ * Returns all options configurations.
+ *
+ * @return a unmodifiable list of option configurations, not null.
+ */
+ public List<OptionsConfiguration> getOptionsConfigurations()
+ {
+ return Collections.unmodifiableList(optionsConfigurations);
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append("(outputFiles=")
+ .append(outputList.toString())
+ .append(", optionsConfigurations=")
+ .append(optionsConfigurations.toString())
+ .append(")");
+ return result.toString();
+ }
+
+ /**
+ * Returns the loglevel during generation.
+ *
+ * @return the loglevel during generation.
+ */
+ public Loglevel getLoglevel()
+ {
+ return loglevel;
+ }
+
+ /**
+ * Set the loglevel during generation.
+ *
+ * @param loglevel the loglevel, not null.
+ *
+ * @throws NullPointerException if loglevel is null.
+ */
+ public void setLoglevel(Loglevel loglevel)
+ {
+ if (loglevel == null)
+ {
+ throw new NullPointerException("loglevel is null");
+ }
+ this.loglevel = loglevel;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationSaxHandler.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationSaxHandler.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationSaxHandler.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationSaxHandler.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,299 @@
+package org.apache.torque.gf.configuration.controller;
+
+/*
+ * 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 static org.apache.torque.gf.configuration.controller.ControlConfigurationTags.CONTROL_LOGLEVEL_ATTRIBUTE;
+import static org.apache.torque.gf.configuration.controller.ControlConfigurationTags.CONTROL_TAG;
+import static org.apache.torque.gf.configuration.controller.OutputConfigurationTags.OUTPUT_TAG;
+import static org.apache.torque.gf.configuration.option.OptionTags.OPTIONS_TAG;
+
+import java.io.IOException;
+
+import org.apache.torque.gf.configuration.ConfigurationEntityResolver;
+import org.apache.torque.gf.configuration.ConfigurationException;
+import org.apache.torque.gf.configuration.ConfigurationHandlers;
+import org.apache.torque.gf.configuration.ConfigurationProvider;
+import org.apache.torque.gf.configuration.SaxHelper;
+import org.apache.torque.gf.configuration.XMLConstants;
+import org.apache.torque.gf.configuration.mergepoint.OptionsSaxHandlerFactories;
+import org.apache.torque.gf.configuration.option.OptionsConfiguration;
+import org.apache.torque.gf.configuration.option.OptionsSaxHandler;
+import org.apache.torque.gf.configuration.option.OptionsSaxHandlerFactory;
+import org.apache.torque.gf.configuration.paths.ProjectPaths;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Reads the controller configuration from the controller configuration file.
+ */
+public class ControlConfigurationSaxHandler extends DefaultHandler
+{
+ /** The Controller configuration which is configured by this Handler. */
+ private ControlConfiguration controllerConfiguration;
+
+ /** The known configuration handlers. */
+ private ConfigurationHandlers configurationHandlers;
+
+ /**
+ * The SAX handler which handles the output declarations, or null
+ * if output declarations need not currently be handled.
+ */
+ private OutputSaxHandler outputSaxHandler;
+
+ /**
+ * The SAX handler which handles the options declarations, or null
+ * if options declarations need not currently be handled.
+ */
+ private OptionsSaxHandler optionsSaxHandler;
+
+ /**
+ * Object for accessing the configuration.
+ */
+ private ConfigurationProvider configurationProvider;
+
+ /**
+ * The paths in the configuration.
+ */
+ private ProjectPaths projectPaths;
+
+ /**
+ * Constructor.
+ *
+ * @param controllerConfiguration the configuration object to fill, no null.
+ * @param configurationProvider the Object for accessing the configuration,
+ * not null.
+ * @param projectPaths the paths in the configuration, not null.
+ * @param configurationHandlers the available configuration handlers,
+ * not null.
+ *
+ * @throws NullPointerException if an argument is null.
+ */
+ public ControlConfigurationSaxHandler(
+ ControlConfiguration controllerConfiguration,
+ ConfigurationProvider configurationProvider,
+ ProjectPaths projectPaths,
+ ConfigurationHandlers configurationHandlers)
+ {
+ if (controllerConfiguration == null)
+ {
+ throw new NullPointerException(
+ "controllerConfiguration must not be null");
+ }
+ if (configurationProvider == null)
+ {
+ throw new NullPointerException(
+ "configurationProvider must not be null");
+ }
+ if (projectPaths == null)
+ {
+ throw new NullPointerException(
+ "projectPaths must not be null");
+ }
+ if (configurationHandlers == null)
+ {
+ throw new NullPointerException(
+ "configurationHandlers must not be null");
+ }
+ this.configurationProvider = configurationProvider;
+ this.controllerConfiguration = controllerConfiguration;
+ this.configurationHandlers = configurationHandlers;
+ this.projectPaths = projectPaths;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes)
+ throws SAXException
+ {
+ String unqualifiedName = SaxHelper.getUnqualifiedName(localName, qName);
+ if (outputSaxHandler != null)
+ {
+ outputSaxHandler.startElement(
+ uri,
+ localName,
+ qName,
+ attributes);
+ }
+ else if (optionsSaxHandler != null)
+ {
+ optionsSaxHandler.startElement(
+ uri,
+ localName,
+ qName,
+ attributes);
+ }
+ else if (CONTROL_TAG.equals(unqualifiedName))
+ {
+ String loglevel = attributes.getValue(CONTROL_LOGLEVEL_ATTRIBUTE);
+ if (loglevel != null)
+ {
+ Loglevel level = Loglevel.getByKey(loglevel);
+ controllerConfiguration.setLoglevel(level);
+ }
+ }
+ else if (OPTIONS_TAG.equals(unqualifiedName))
+ {
+ String type = attributes.getValue(
+ XMLConstants.XSI_NAMESPACE,
+ XMLConstants.XSI_TYPE_ATTRBUTE_NAME);
+ if (type == null)
+ {
+ throw new SAXException("The tag " + OPTIONS_TAG
+ + " requires the attribute "
+ + XMLConstants.XSI_NAMESPACE
+ + ":"
+ + XMLConstants.XSI_TYPE_ATTRBUTE_NAME);
+ }
+
+ OptionsSaxHandlerFactories optionsSaxHandlerFactories
+ = configurationHandlers.getOptionsSaxHandlerFactories();
+ OptionsSaxHandlerFactory optionsSaxHandlerFactory
+ = optionsSaxHandlerFactories.getOptionsSaxHandlerFactory(
+ type);
+ if (optionsSaxHandlerFactory == null)
+ {
+ throw new SAXException("No handler found for the action "
+ + "of type "
+ + type);
+ }
+ optionsSaxHandler = optionsSaxHandlerFactory.getOptionsSaxHandler();
+ optionsSaxHandler.startElement(uri, localName, qName, attributes);
+ }
+ else if (OUTPUT_TAG.equals(unqualifiedName))
+ {
+ outputSaxHandler = new OutputSaxHandler(
+ configurationProvider,
+ projectPaths,
+ configurationHandlers);
+ outputSaxHandler.startElement(
+ uri,
+ localName,
+ qName,
+ attributes);
+ }
+ else
+ {
+ throw new SAXException("Unknown element " + unqualifiedName);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void endElement(String uri, String localName, String rawName)
+ throws SAXException
+ {
+ if (optionsSaxHandler != null)
+ {
+ optionsSaxHandler.endElement(uri, localName, rawName);
+ if (optionsSaxHandler.isFinished())
+ {
+ OptionsConfiguration optionsConfiguration
+ = optionsSaxHandler.getOptionsConfiguration();
+ controllerConfiguration.addOptionsConfiguration(
+ optionsConfiguration);
+ optionsSaxHandler = null;
+ }
+ }
+ else if (OUTPUT_TAG.equals(rawName))
+ {
+ outputSaxHandler.endElement(uri, localName, rawName);
+ Output outputFile = outputSaxHandler.getOutputFile();
+ try
+ {
+ controllerConfiguration.addOutput(outputFile);
+ }
+ catch (ConfigurationException e)
+ {
+ throw new SAXException("Could not add output "
+ + outputFile.getName(), e);
+ }
+ outputSaxHandler = null;
+ }
+ else if (outputSaxHandler != null)
+ {
+ outputSaxHandler.endElement(uri, localName, rawName);
+ }
+ }
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ @Override
+ public void characters(char[] ch, int start, int length)
+ throws SAXException
+ {
+ if (outputSaxHandler != null)
+ {
+ outputSaxHandler.characters(ch, start, length);
+ }
+ }
+
+ /**
+ * EntityResolver implementation. Called by the XML parser
+ *
+ * @param publicId The public identifier of the external entity.
+ * @param systemId The system identifier of the external entity.
+ *
+ * @return an InputSource for the entity, or null if the URI is not known.
+ *
+ * @see ConfigurationEntityResolver#resolveEntity(String, String)
+ */
+ public InputSource resolveEntity(String publicId, String systemId)
+ throws SAXException, IOException
+ {
+ return new ConfigurationEntityResolver().resolveEntity(
+ publicId, systemId);
+ }
+
+ @Override
+ public void error(SAXParseException exception) throws SAXParseException
+ {
+ throw exception;
+ }
+
+ @Override
+ public void fatalError(SAXParseException exception)
+ throws SAXParseException
+ {
+ throw exception;
+ }
+
+ @Override
+ public void warning(SAXParseException exception) throws SAXParseException
+ {
+ throw exception;
+ }
+}
Added: db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationTags.java
URL: http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationTags.java?rev=910600&view=auto
==============================================================================
--- db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationTags.java (added)
+++ db/torque/torque4/trunk/torque-generator/src/main/java/org/apache/torque/gf/configuration/controller/ControlConfigurationTags.java Tue Feb 16 17:15:43 2010
@@ -0,0 +1,39 @@
+package org.apache.torque.gf.configuration.controller;
+
+/*
+ * 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.
+ */
+
+/**
+ * Tag and attribute names for the control configuration files.
+ */
+public final class ControlConfigurationTags
+{
+ /**
+ * private constructor for utility class.
+ */
+ private ControlConfigurationTags()
+ {
+ }
+
+ /** Tag name for the "control" tag. */
+ public static final String CONTROL_TAG = "control";
+
+ /** Attribute name for the "loglevel" attribute of the "control" tag. */
+ public static final String CONTROL_LOGLEVEL_ATTRIBUTE = "loglevel";
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org