You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jaxme-dev@ws.apache.org by jo...@apache.org on 2006/08/21 11:53:47 UTC

svn commit: r433208 - in /webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin: ./ src/main/java/org/apache/ws/jaxme/maven/plugins/ src/site/apt/ src/test/ src/test/it1/ src/test/it1/src/ src/test/it1/src/main/ src/test/it1/src/main/jaxme/ src/test/it2/...

Author: jochen
Date: Mon Aug 21 02:53:45 2006
New Revision: 433208

URL: http://svn.apache.org/viewvc?rev=433208&view=rev
Log:
Introduced the "schema collection" and the possibility to process multiple
schema collections with a single invocation.

Added:
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/FileSet.java
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/ISchemaCollection.java
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeMojo.java
      - copied, changed from r432567, webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeGoal.java
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollection.java
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollectionProcessor.java
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/   (with props)
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/pom.xml
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/it1.xsd
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/   (with props)
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/pom.xml
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/it2.xsd
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/BaseTest.java
Removed:
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeGoal.java
Modified:
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/pom.xml
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/properties.apt
    webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/use.apt

Modified: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/pom.xml
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/pom.xml?rev=433208&r1=433207&r2=433208&view=diff
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/pom.xml (original)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/pom.xml Mon Aug 21 02:53:45 2006
@@ -16,13 +16,16 @@
   limitations under the License.
 
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0">
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.ws.jaxme</groupId>
   <artifactId>maven-jaxme-plugin</artifactId>
   <packaging>maven-plugin</packaging>
   <name>Maven JaxMe Plugin</name>
-  <version>1.0.4-SNAPSHOT</version>
+  <version>1.1-SNAPSHOT</version>
   <description>
     This plugin allows running the JaxMe binding compiler on
     your XML schema files and add the generated sources to
@@ -154,6 +157,18 @@
       <groupId>plexus</groupId>
       <version>1.0.3</version>
       <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.2</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.0-beta-2-SNAPSHOT</version>
+      <scope>test</scope>
     </dependency>
   </dependencies>
   <reporting>

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/FileSet.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/FileSet.java?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/FileSet.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/FileSet.java Mon Aug 21 02:53:45 2006
@@ -0,0 +1,88 @@
+/*
+ * Copyright 2006  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.
+ */
+package org.apache.ws.jaxme.maven.plugins;
+
+import java.io.File;
+
+
+/**
+ * Container object for specifying set of files.
+ */
+public class FileSet {
+	private File directory;
+	private String[] includes, excludes;
+	private boolean disableDefaultExcludes;
+
+	/**
+	 * Returns the file sets base directory.
+	 */
+	public File getDirectory() {
+		return directory;
+	}
+
+	/**
+	 * Sets the file sets base directory.
+	 */
+	public void setDirectory(File directory) {
+		this.directory = directory;
+	}
+
+	/**
+	 * Returns the file sets inclusion patterns.
+	 */
+	public String[] getIncludes() {
+		return includes;
+	}
+
+	/**
+	 * Sets the file sets inclusion patterns.
+	 */
+	public void setIncludes(String[] includes) {
+		this.includes = includes;
+	}
+
+	/**
+	 * Sets the file sets inclusion patterns.
+	 */
+	public String[] getExcludes() {
+		return excludes;
+	}
+
+	/**
+	 * Returns the file sets inclusion patterns.
+	 */
+	public void setExcludes(String[] excludes) {
+		this.excludes = excludes;
+	}
+
+	/**
+	 * Returns, whether default excludes are being disabled.
+	 * Defaults to false (default excludes are enabled).
+	 */
+	public boolean isDisableDefaultExcludes() {
+		return disableDefaultExcludes;
+	}
+
+	/**
+	 * Sets, whether default excludes are being disabled.
+	 * Defaults to false (default excludes are enabled).
+	 */
+	public void setDisableDefaultExcludes(boolean disableDefaultExcludes) {
+		this.disableDefaultExcludes = disableDefaultExcludes;
+	}
+
+
+}

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/ISchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/ISchemaCollection.java?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/ISchemaCollection.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/ISchemaCollection.java Mon Aug 21 02:53:45 2006
@@ -0,0 +1,134 @@
+/*
+ * Copyright 2006  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.
+ */
+package org.apache.ws.jaxme.maven.plugins;
+
+import java.util.Map;
+
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+
+
+/**
+ * Specifies the details of one schema collection, which is being
+ * compiled.
+ */
+public interface ISchemaCollection {
+	/**
+	 * Returns the sets of external binding files, which are
+	 * being applied.
+	 */
+	FileSet[] getBindings();
+
+	/**
+	 * Specifies the sets of files, which are referenced from within
+	 * the XML schema files, but aren't processed as XML schema
+	 * files for themselves. Specifying files in the "depends" set
+	 * allows to include them into the uptodate check.
+	 */
+	FileSet[] getDepends();
+
+	/**
+	 * Setting this property to true enables JaxMe's extension
+	 * mode. Several vendor extensions are available, including
+	 * some extensions, which are originally specified by the
+	 * JAXB reference implementation.
+	 */
+	boolean isExtension();
+
+	/**
+	 * Specifies the Java package name.
+	 */
+	String getPackageName();
+
+	/**
+	 * Specifies the sets of files, which are being produced by the
+	 * source generator. Any element in the set may contain wildcards.
+	 * The set of produced files is used for checking,
+	 * whether the generated files are uptodate. If that is
+	 * the case, then the generator will omit recreating
+	 * them. If the uptodate check fails, or if the "force"
+	 * property is turned on, then the source generator
+	 * will actually be invoked. In that case, the set of
+	 * produces files will also be used for removing old
+	 * files, if the "removeOldOutput" feature is turned
+	 * on.
+	 */
+	FileSet[] getProduces();
+
+	/**
+	 * If this property is set to true, and one or more
+	 * produces "produces" elements are specified, then the plugin
+	 * will remove all files matching the "produces" elements
+	 * before running the source generator.
+	 * @parameter expression="false"
+	 */
+	boolean isRemovingOldOutput();
+
+	/**
+	 * Specifies the schema reader being used. The default
+	 * schema reader is an instance of {@link JAXBSchemaReader}.
+	 * The default changes, if "extension" is set to true,
+	 * in which case the {@link JaxMeSchemaReader} is being
+	 * used.
+	 */
+	String getSchemaReader();
+	
+	/**
+	 * Specifies the set of schemas being compiled.
+	 */
+	FileSet[] getSchemas();
+
+	/**
+	 * The set of factory chains, which are being added to the
+	 * generator. Factory chains are modifying the generators
+	 * behaviour. A good example is the
+	 * <code>org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG</code>.
+	 */
+	String[] getSgFactoryChain();
+
+	/**
+	 * The target directory for source files. Defaults to
+	 */
+	String getSrcTarget();
+
+	/**
+	 * The target directory for resource files. Defaults to
+	 * ${project.build.directory}/generated-sources/jaxme/resources.
+	 */
+	String getResourceTarget();
+
+	/**
+	 * Setting this property to true advices the plugin to use
+	 * a validating XML parser for reading the schema files.
+	 * By default, validation is disabled.
+	 */
+	boolean isValidating();
+
+	/**
+	 * Returns a set of properties, which are being set on the
+	 * generator.
+	 */
+	public Map getProperties();
+
+
+	/**
+	 * Returns a prefix, where to add the schema files to the generated jar
+	 * file, if you want that. Defaults to null, in which case no schema
+	 * files are being added. Use "" or "/" to add schema files to the
+	 * jar files root directory.
+	 */
+	public String getSchemaTargetPrefix();
+}

Copied: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeMojo.java (from r432567, webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeGoal.java)
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeMojo.java?p2=webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeMojo.java&p1=webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeGoal.java&r1=432567&r2=433208&rev=433208&view=diff
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeGoal.java (original)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/JaxMeMojo.java Mon Aug 21 02:53:45 2006
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005  The Apache Software Foundation
+ * Copyright 2005-2006  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.
@@ -16,33 +16,22 @@
 package org.apache.ws.jaxme.maven.plugins;
 
 import java.io.File;
-import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.net.URLClassLoader;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.apache.maven.model.Resource;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.project.MavenProject;
-import org.apache.ws.jaxme.generator.Generator;
 import org.apache.ws.jaxme.generator.SchemaReader;
-import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
-import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
 import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
 import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
 import org.apache.ws.jaxme.logging.Logger;
 import org.apache.ws.jaxme.logging.LoggerAccess;
 import org.apache.ws.jaxme.logging.LoggerFactory;
-import org.codehaus.plexus.util.DirectoryScanner;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
 
 /**
@@ -51,12 +40,12 @@
  * @description Runs the JaxMe binding compiler and generates the source files.
  * @requiresDependencyResolution test
  */
-public class JaxMeGoal extends AbstractMojo {
+public class JaxMeMojo extends AbstractMojo implements ISchemaCollection {
 	/** This property specifies a set of external
 	 * binding files, which are being applied.
 	 * @parameter
 	 */
-	private String[] bindings;
+	private FileSet[] bindings;
 
 	/** Specifies classpath elements, which should be added to
 	 * the plugins classpath.
@@ -73,7 +62,7 @@
 	 * allows to include them into the uptodate check.
 	 * @parameter
 	 */
-	private String[] depends;
+	private FileSet[] depends;
 
 	/** Setting this property to true enables JaxMe's extension
 	 * mode. Several vendor extensions are available, including
@@ -108,7 +97,7 @@
 	 * on.
 	 * @parameter
 	 */
-	private String[] produces;
+	private FileSet[] produces;
 
 	/** The Maven project.
 	 * @parameter expression="${project}"
@@ -146,10 +135,11 @@
 	private String schemaReader;
 	
 	/** The set of schemas being compiled. Schema names may
-	 * include wildcards.
+	 * include wildcards. By default the fileset "src/main/jaxme/*"
+	 * is used.
 	 * @parameter
 	 */
-	private String[] schemas;
+	private FileSet[] schemas;
 
 	/** The set of factory chains, which are being added to the
 	 * generator. Factory chains are modifying the generators
@@ -160,12 +150,12 @@
 	private String[] sgFactoryChain;
 
 	/** The target directory for source files. Defaults to
-	 * @parameter expression="${project.build.directory}/jaxme/java"
+	 * @parameter expression="${project.build.directory}/generated-sources/jaxme/java"
 	 */
 	private String srcTarget;
 
 	/** The target directory for resource files. Defaults to
-	 * @parameter expression="${project.build.directory}/jaxme/resources"
+	 * @parameter expression="${project.build.directory}/generated-sources/jaxme/resources"
 	 */
 	private String resourceTarget;
 
@@ -176,7 +166,22 @@
 	 */
 	private boolean validating;
 
-	protected String[] getBindings() {
+	/**
+	 * Specifies additional sets of schema collections.
+	 * @parameter component="org.apache.ws.jaxme.maven.plugins.SchemaCollectionImpl"
+	 */
+	private SchemaCollection[] schemaCollections;
+
+	/**
+	 * Returns a prefix, where to add the schema files to the generated jar
+	 * file, if you want that. Defaults to null, in which case no schema
+	 * files are being added. Use "" or "/" to add schema files to the
+	 * jar files root directory.
+	 * @parameter
+	 */
+	private String schemaTargetPrefix;
+
+	public FileSet[] getBindings() {
 		return bindings;
 	}
 
@@ -184,11 +189,11 @@
 		return classpathElements;
 	}
 
-	protected String[] getDepends() {
+	public FileSet[] getDepends() {
 		return depends;
 	}
 
-	protected boolean isExtension() {
+	public boolean isExtension() {
 		return extension;
 	}
 
@@ -197,11 +202,11 @@
 		return force;
 	}
 
-	protected String getPackageName() {
+	public String getPackageName() {
 		return packageName;
 	}
 
-	protected String[] getProduces() {
+	public FileSet[] getProduces() {
 		return produces;
 	}
 
@@ -209,7 +214,7 @@
 		return project;
 	}
 
-	protected Map getProperties() {
+	public Map getProperties() {
 		return properties;
 	}
 
@@ -217,168 +222,32 @@
 		return readOnly;
 	}
 
-	protected boolean isRemovingOldOutput() {
+	public boolean isRemovingOldOutput() {
 		return removingOldOutput;
 	}
 
-	protected String getSchemaReader() {
+	public String getSchemaReader() {
 		return schemaReader;
 	}
 
-	protected String[] getSgFactoryChain() {
+	public String[] getSgFactoryChain() {
 		return sgFactoryChain;
 	}
 
-	protected String getSrcTarget() {
+	public String getSrcTarget() {
 		return srcTarget;
 	}
 
-	protected String getResourceTarget() {
+	public String getResourceTarget() {
 		return resourceTarget;
 	}
 
-	protected boolean isValidating() {
+	public boolean isValidating() {
 		return validating;
 	}
 
-	private File[] getProducedFiles() {
-		String[] prdcs = getProduces();
-		if (prdcs == null) {
-			String t1 = getSrcTarget();
-			String t2 = getResourceTarget();
-			if (t2 == null) {
-				prdcs = new String[]{t1};
-			} else {
-				prdcs = new String[]{t1, t2};
-			}
-		}
-		return getFiles(prdcs);
-	}
-
-	private File[] getFiles(String[] pSpec) {
-		if (pSpec == null  ||  pSpec.length == 0) {
-			return new File[0];
-		}
-		DirectoryScanner ds = new DirectoryScanner();
-		final File baseDir = getProject().getBasedir();
-		ds.setBasedir(baseDir);
-		ds.setIncludes(pSpec);
-		ds.scan();
-		String[] files = ds.getIncludedFiles();
-		File[] result = new File[files.length];
-		for (int i = 0;  i < result.length;  i++) {
-			result[i] = new File(baseDir, files[i]);
-		}
-		return result;
-	}
-
-	private File[] getSchemaFiles() {
-		if (schemas == null  ||  schemas.length == 0) {
-			schemas = new String[]{"src/jaxme/*.xsd"};
-		}
-		File[] schemaFiles = getFiles(schemas);
-		if (schemaFiles.length == 0) {
-			StringBuffer sb = new StringBuffer();
-			sb.append("Schema specification returns no result: ");
-			for (int i = 0;  i < schemas.length;  i++) {
-				if (i > 0) {
-					sb.append(",");
-				}
-				sb.append(schemas[i]);
-			}
-			getLog().warn(sb);
-		}
-		return schemaFiles;
-	}
-
-	private File[] getBindingFiles() {
-		return getFiles(getBindings());
-	}
-
-	private File[] getDependencies() {
-		return getFiles(getDepends());
-	}
-
-	private boolean isUptodate(File[] pSourceFiles, File[] pProducedFiles) {
-		if (isForce()) {
-			getLog().debug("Force flag set, disabling uptodate check.");
-			return false;
-		}
-		if (pProducedFiles.length == 0) {
-			getLog().debug("No produced files found, disabling uptodate check.");
-			return false;
-		}
-		File minProducedFile = null;
-		long minProducedTime = 0;
-		for (int i = 0;  i < pProducedFiles.length;  i++) {
-			File f = pProducedFiles[i];
-			long l = f.lastModified();
-			if (l == 0) {
-				getLog().debug("Produced file " + f + " has unknown timestamp, disabling uptodate check.");
-				return false;
-			}
-			if (minProducedTime == 0  ||  minProducedTime > l) {
-				minProducedTime = l;
-				minProducedFile = f;
-			}
-		}
-
-		final File[] deps = pSourceFiles;
-		long maxDepTime = 0;
-		File maxDepFile = null;
-		for (int i = 0;  i < deps.length;  i++) {
-			File f = deps[i];
-			long l = f.lastModified();
-			if (l == 0) {
-				getLog().debug("Dependency file " + f + " has unknown timestamp, disabling uptodate check.");
-				return false;
-			}
-			if (maxDepTime == 0  ||  maxDepTime < l) {
-				maxDepTime = l;
-				maxDepFile = f;
-			}
-		}
-
-		if (maxDepTime >= minProducedTime) {
-			getLog().debug("Dependency file " + maxDepFile + " is more recent than produced file " + minProducedFile);
-			return true;
-		} else {
-			getLog().debug("All produced files are uptodate.");
-			return false;
-		}
-	}
-
-	private File[] concat(File[] pFiles1, File[] pFiles2) {
-		final File[] deps = new File[pFiles1.length + pFiles2.length];
-		System.arraycopy(pFiles1, 0, deps, 0, pFiles1.length);
-		System.arraycopy(pFiles2, 0, deps, pFiles1.length, pFiles2.length);
-		return deps;
-	}
-
-	private void removeOldOutput(File[] pProducedFiles) throws MojoExecutionException {
-		if (isRemovingOldOutput()) {
-			for (int i = 0;  i < pProducedFiles.length;  i++) {
-				File f = pProducedFiles[i];
-				if (f.isFile()  &&  !f.delete()) {
-					throw new MojoExecutionException("Unable to delete file: " + f.getAbsolutePath());
-				}
-			}
-		}
-	}
-
-	private Class getSgFactoryChainClass(String pClass)
-			throws MojoFailureException {
-		Class c;
-		try {
-			c = Thread.currentThread().getContextClassLoader().loadClass(pClass);
-		} catch (ClassNotFoundException e) {
-			throw new MojoFailureException("The factory chain class " + pClass + " was not found.");
-		}
-		if (!SGFactoryChain.class.isAssignableFrom(c)) {
-			throw new MojoFailureException("The factory chain class " + c.getName()
-					+ " is not implementing " + SGFactoryChain.class);
-		}
-		return c;
+	public String getSchemaTargetPrefix() {
+		return schemaTargetPrefix;
 	}
 
 	private ClassLoader getClassLoader(ClassLoader pParent) throws MojoFailureException {
@@ -395,7 +264,7 @@
 				f = new File(getProject().getBasedir(), elem);
 			}
 			try {
-				urls[i] = f.toURL();
+				urls[i] = f.toURI().toURL();
 			} catch (MalformedURLException e) {
 				throw new MojoFailureException("Invalid classpath element: " + elem);
 			}
@@ -408,70 +277,25 @@
 		return new URLClassLoader(urls, pParent);
 	}
 
-	private SchemaReader getSchemaReaderInstance() throws MojoFailureException, MojoExecutionException {
-		final SchemaReader result = newSchemaReaderInstance();
-		getLog().debug("Schema reader class: " + result.getClass().getName());
-
-		String[] chains = getSgFactoryChain();
-		if (chains != null) {
-			for (int i = 0;  i < chains.length;  i++) {
-				Class c = getSgFactoryChainClass(chains[i]);
-				getLog().debug("Adding SG Factory chain: " + c.getName());
-				result.addSGFactoryChain(c);
-			}
-		}
-
-		return result;
+	public FileSet[] getSchemas() {
+		return schemas;
 	}
 
-	private SchemaReader newSchemaReaderInstance() throws MojoFailureException, MojoExecutionException {
-		final SchemaReader result;
-		final String s = getSchemaReader();
-		if (s == null  ||  s.length() == 0) {
-			if (isExtension()) {
-				result = new JaxMeSchemaReader();
-			} else {
-				result = new JAXBSchemaReader();
-			}
-		} else {
-			Class c;
-			try {
-				c = Thread.currentThread().getContextClassLoader().loadClass(s);
-			} catch (ClassNotFoundException e) {
-				throw new MojoFailureException("The schema reader class " + s + " was not found.");
-			}
-			Object o;
-			try {
-				o = c.newInstance();
-			} catch (InstantiationException e) {
-				throw new MojoExecutionException("Failed to instantiate schema reader class " + c.getName(), e);
-			} catch (IllegalAccessException e) {
-				throw new MojoExecutionException("Illegal access to schema reader class " + c.getName(), e);
-			}
-			try {
-				result = (SchemaReader) o;
-			} catch (ClassCastException e) {
-				throw new MojoFailureException("The configured schema reader class " + c.getName()
-						+ " is not implementing " + SchemaReader.class.getName());
-			}
-		}
-		return result;
+	private boolean isEmpty(String pValue) {
+		return pValue == null  ||  pValue.length() == 0;
 	}
 
-	private File getSrcTargetDirectory() {
-		return getTargetDir(getSrcTarget());
+	private boolean isEmpty(Object[] pArray) {
+		return pArray == null  ||  pArray.length == 0;
 	}
 
-	private File getTargetDir(String pDir) {
-		File f = new File(pDir);
-		if (!f.isAbsolute()) {
-			f = new File(getProject().getBasedir(), getSrcTarget());
+	private void configure(ISchemaCollection pCollection) {
+		if (isEmpty(pCollection.getSrcTarget())) {
+			((SchemaCollection) pCollection).setSrcTarget(new File(project.getBuild().getDirectory(), "generated-sources/jaxme/java").getPath());
+		}
+		if (isEmpty(pCollection.getResourceTarget())) {
+			((SchemaCollection) pCollection).setResourceTarget(new File(project.getBuild().getDirectory(), "generated-sources/jaxme/resources").getPath());
 		}
-		return f;
-	}
-
-	private File getResourceTargetDirectory() {
-		return getTargetDir(getResourceTarget());
 	}
 
 	public void execute() throws MojoExecutionException, MojoFailureException {
@@ -484,72 +308,31 @@
 					return new MavenProjectLogger(getLog(), pName);
 				}
 			});
-			final File[] schemaFiles = getSchemaFiles();
-			if (schemaFiles.length == 0) {
-				return;
+
+			FileSet[] schemaArray = getSchemas();
+			final ISchemaCollection[] collections = schemaCollections;
+			SchemaCollectionProcessor processor = new SchemaCollectionProcessor(project, getLog(), isForce(), isReadOnly());
+			if (isEmpty(schemaArray)) {
+				if (schemaCollections == null  ||  schemaCollections.length == 0) {
+					FileSet fileSet = new FileSet();
+					fileSet.setDirectory(new File(project.getBasedir(), "src/main/jaxme"));
+					schemaArray = schemas = new FileSet[]{fileSet};
+				}
 			}
-			final File[] producedFiles = getProducedFiles();
-			final File[] dependencies = getDependencies();
-			final File[] bindingFiles = getBindingFiles();
-			final boolean uptodate = isUptodate(concat(concat(schemaFiles, dependencies), bindingFiles), producedFiles);
-			if (uptodate) {
-				getLog().info("Generated files are uptodate.");
-			} else {
-				runGenerator(schemaFiles, producedFiles, bindingFiles);
+			if (!isEmpty(schemaArray)) {
+				configure(this);
+				processor.process(this);
+			}
+			if (collections != null) {
+				for (int i = 0;  i < collections.length;  i++) {
+					configure(collections[i]);
+					processor.process(collections[i]);
+				}
 			}
-	
-			getProject().addCompileSourceRoot(getSrcTarget());
-			Resource resource = new Resource();
-			resource.setDirectory(getResourceTarget());
-			getProject().addResource(resource);
+			processor.fixProjectSettings();
 		} finally {
 			Thread.currentThread().setContextClassLoader(oldCl);
 			LoggerAccess.setLoggerFactory(lf);
-		}
-	}
-
-	private void runGenerator(final File[] schemaFiles, final File[] producedFiles, final File[] bindingFiles) throws MojoExecutionException, MojoFailureException {
-		removeOldOutput(producedFiles);
-
-		Generator g = new GeneratorImpl();
-		for (int i = 0;  i < bindingFiles.length;  i++) {
-			File f = bindingFiles[i];
-			try {
-				g.addBindings(new InputSource(f.toURL().toExternalForm()));
-			} catch (ParserConfigurationException e) {
-				throw new MojoExecutionException("Failed to add binding file "
-						+ f.getPath() + ": " + e.getMessage(), e);
-			} catch (SAXException e) {
-				throw new MojoExecutionException("Failed to add binding file "
-						+ f.getPath() + ": " + e.getMessage(), e);
-			} catch (IOException e) {
-				throw new MojoExecutionException("Failed to add binding file "
-						+ f.getPath() + ": " + e.getMessage(), e);
-			}
-		}
-		for (int i = 0;  i < schemaFiles.length;  i++) {
-			final SchemaReader reader = getSchemaReaderInstance();
-			g.setSchemaReader(reader);
-			g.setForcingOverwrite(isForce());
-			g.setSettingReadOnly(isReadOnly());
-			g.setTargetDirectory(getSrcTargetDirectory());
-			g.setResourceTargetDirectory(getResourceTargetDirectory());
-			g.setValidating(isValidating());
-			if (getPackageName() != null) {
-				g.setProperty("jaxme.package.name", getPackageName());
-			}
-			Map props = getProperties();
-			if (props != null) {
-				for (Iterator iter = props.entrySet().iterator();  iter.hasNext();  ) {
-					Map.Entry entry = (Map.Entry) iter.next();
-					g.setProperty((String) entry.getKey(), (String) entry.getValue());
-				}
-			}
-			try {
-				g.generate(schemaFiles[i]);
-			} catch (Exception e) {
-				throw new MojoExecutionException(e.getMessage(), e);
-			}
 		}
 	}
 }

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollection.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollection.java?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollection.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollection.java Mon Aug 21 02:53:45 2006
@@ -0,0 +1,225 @@
+/*
+ * Copyright 2006  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.
+ */
+package org.apache.ws.jaxme.maven.plugins;
+
+import java.util.Map;
+
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+
+
+/**
+ * Default implementation of {@link ISchemaCollection}.
+ */
+public class SchemaCollection implements ISchemaCollection {
+	private FileSet[] bindings, depends, produces, schemas;
+	private String[] sgFactoryChain;
+	private String packageName, srcTarget, resourceTarget, schemaReader;
+	private String schemaTargetPrefix;
+	private boolean extension, removingOldOutput, validating;
+	private Map properties;
+
+	/**
+	 * Sets a set of external binding files, which are
+	 * being applied.
+	 */
+	public void setBindings(FileSet[] pBindings) {
+		bindings = pBindings;
+	}
+
+	public FileSet[] getBindings() {
+		return bindings;
+	}
+
+	/**
+	 * Sets a set of files, which are referenced from within
+	 * the XML schema files, but aren't processed as XML schema
+	 * files for themselves. Specifying files in the "depends" set
+	 * allows to include them into the uptodate check.
+	 */
+	public void setDepends(FileSet[] pDepends) {
+		depends = pDepends;
+	}
+
+	public FileSet[] getDepends() {
+		return depends;
+	}
+
+	/**
+	 * Sets the Java package name.
+	 */
+	public void setPackageName(String pPackageName) {
+		packageName = pPackageName;
+	}
+
+	public String getPackageName() {
+		return packageName;
+	}
+
+	/**
+	 * Specifies a set of files, which are being produced by the
+	 * source generator. Any element in the set may contain wildcards.
+	 * The set of produced files is used for checking,
+	 * whether the generated files are uptodate. If that is
+	 * the case, then the generator will omit recreating
+	 * them. If the uptodate check fails, or if the "force"
+	 * property is turned on, then the source generator
+	 * will actually be invoked. In that case, the set of
+	 * produces files will also be used for removing old
+	 * files, if the "removeOldOutput" feature is turned
+	 * on.
+	 */
+	public void setProduces(FileSet[] pProduces) {
+		produces = pProduces;
+	}
+
+	public FileSet[] getProduces() {
+		return produces;
+	}
+
+	/**
+	 * The target directory for resource files. Defaults to
+	 * ${project.build.directory}/generated-sources/jaxme/resources.
+	 */
+	public void setResourceTarget(String pResourceTarget) {
+		resourceTarget = pResourceTarget;
+	}
+
+	public String getResourceTarget() {
+		return resourceTarget;
+	}
+
+	/**
+	 * Specifies the schema reader being used. The default
+	 * schema reader is an instance of {@link JAXBSchemaReader}.
+	 * The default changes, if "extension" is set to true,
+	 * in which case the {@link JaxMeSchemaReader} is being
+	 * used.
+	 */
+	public void setSchemaReader(String pSchemaReader) {
+		schemaReader = pSchemaReader;
+	}
+
+	public String getSchemaReader() {
+		return schemaReader;
+	}
+
+	/**
+	 * Sets the set of schemas being compiled. Schema names may
+	 * include wildcards.
+	 */
+	public void setSchemas(FileSet[] pSchemas) {
+		schemas = pSchemas;
+	}
+
+	public FileSet[] getSchemas() {
+		return schemas;
+	}
+
+	/**
+	 * The set of factory chains, which are being added to the
+	 * generator. Factory chains are modifying the generators
+	 * behaviour. A good example is the
+	 * <code>org.apache.ws.jaxme.pm.generator.jdbc.JaxMeJdbcSG</code>.
+	 */
+	public void sgFactoryChain(String[] pSgFactoryChain) {
+		sgFactoryChain = pSgFactoryChain;
+	}
+
+	public String[] getSgFactoryChain() {
+		return sgFactoryChain;
+	}
+
+	/**
+	 * The target directory for resource files. Defaults to
+	 * ${project.build.directory}/generated-sources/jaxme/java.
+	 */
+	public void setSrcTarget(String pSrcTarget) {
+		srcTarget = pSrcTarget;
+	}
+
+	public String getSrcTarget() {
+		return srcTarget;
+	}
+
+	/**
+	 * Setting this property to true enables JaxMe's extension
+	 * mode. Several vendor extensions are available, including
+	 * some extensions, which are originally specified by the
+	 * JAXB reference implementation.
+	 */
+	public void setExtension(boolean pExtension) {
+		extension = pExtension;
+	}
+
+	public boolean isExtension() {
+		return extension;
+	}
+
+	/**
+	 * If this property is set to true, and one or more
+	 * produces "produces" elements are specified, then the plugin
+	 * will remove all files matching the "produces" elements
+	 * before running the source generator.
+	 * @parameter expression="false"
+	 */
+	public void setRemovingOldOutput(boolean pRemovingOldOutput) {
+		removingOldOutput = pRemovingOldOutput;
+	}
+
+	public boolean isRemovingOldOutput() {
+		return removingOldOutput;
+	}
+
+	/**
+	 * Setting this property to true advices the plugin to use
+	 * a validating XML parser for reading the schema files.
+	 * By default, validation is disabled.
+	 */
+	public void setValidating(boolean pValidating) {
+		validating = pValidating;
+	}
+
+	public boolean isValidating() {
+		return validating;
+	}
+
+	/**
+	 * Sets a set of properties, which are being set on the
+	 * generator.
+	 */
+	public void setProperties(Map pProperties) {
+		properties = pProperties;
+	}
+
+	public Map getProperties() {
+		return properties;
+	}
+
+	/**
+	 * Sets a prefix, where to add the schema files to the generated jar
+	 * file, if you want that. Defaults to null, in which case no schema
+	 * files are being added. Use "" or "/" to add schema files to the
+	 * jar files root directory.
+	 */
+	public void setSchemaTargetPrefix(String schemaTargetPrefix) {
+		this.schemaTargetPrefix = schemaTargetPrefix;
+	}
+
+	public String getSchemaTargetPrefix() {
+		return schemaTargetPrefix;
+	}
+}

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollectionProcessor.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollectionProcessor.java?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollectionProcessor.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/main/java/org/apache/ws/jaxme/maven/plugins/SchemaCollectionProcessor.java Mon Aug 21 02:53:45 2006
@@ -0,0 +1,460 @@
+/*
+ * Copyright 2006  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.
+ */
+package org.apache.ws.jaxme.maven.plugins;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.apache.maven.model.Resource;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.plugin.logging.Log;
+import org.apache.maven.project.MavenProject;
+import org.apache.ws.jaxme.generator.Generator;
+import org.apache.ws.jaxme.generator.SchemaReader;
+import org.apache.ws.jaxme.generator.impl.GeneratorImpl;
+import org.apache.ws.jaxme.generator.sg.SGFactoryChain;
+import org.apache.ws.jaxme.generator.sg.impl.JAXBSchemaReader;
+import org.apache.ws.jaxme.generator.sg.impl.JaxMeSchemaReader;
+import org.codehaus.plexus.util.DirectoryScanner;
+import org.codehaus.plexus.util.FileUtils;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ * An instance of this class is responsible for processing a single
+ * schema collection.
+ */
+class SchemaCollectionProcessor {
+	private static class FileSpec {
+		private final File baseDir;
+		private final String path;
+		private final File file;
+		FileSpec(File pBaseDir, String pPath) {
+			baseDir = pBaseDir;
+			path = pPath;
+			file = new File(baseDir, path);
+		}
+		File getFile() { return file; }
+		String getPath() { return path; }
+	}
+
+	private final Log log;
+	private final MavenProject project;
+	private final boolean forced, readOnly;
+	private final Map sourceDirectories = new HashMap(), resourcecDirectories = new HashMap();
+
+	SchemaCollectionProcessor(MavenProject pProject, Log pLog, boolean pForced,
+							  boolean pReadOnly) {
+		project = pProject;
+		log = pLog;
+		forced = pForced;
+		readOnly = pReadOnly;
+	}
+
+	private FileSpec[] getFiles(FileSet[] pSpec) {
+		if (pSpec == null  ||  pSpec.length == 0) {
+			return new FileSpec[0];
+		}
+		final List list = new ArrayList();
+		for (int i = 0;  i < pSpec.length;  i++) {
+			FileSet set = pSpec[i];
+			File dir = set.getDirectory();
+			if (!dir.isAbsolute()) {
+				dir = new File(project.getBasedir(), dir.getPath());
+			}
+			DirectoryScanner ds = new DirectoryScanner();
+			ds.setBasedir(dir);
+			ds.setIncludes(set.getIncludes());
+			ds.setExcludes(set.getExcludes());
+			if (!set.isDisableDefaultExcludes()) {
+				ds.addDefaultExcludes();
+			}
+			ds.scan();
+			String[] files = ds.getIncludedFiles();
+			for (int j = 0;  j < files.length;  j++) {
+				list.add(new FileSpec(dir, files[j]));
+			}
+		}
+		return (FileSpec[]) list.toArray(new FileSpec[list.size()]);
+	}
+
+	private FileSpec[] getSchemaFiles(ISchemaCollection pCollection)
+			throws MojoFailureException {
+		final FileSet[] schemas = pCollection.getSchemas();
+		if (schemas == null  ||  schemas.length == 0) {
+			throw new MojoFailureException("A SchemaCollection must have a set of schema files specified.");
+		}
+		FileSpec[] schemaFiles = getFiles(schemas);
+		if (schemaFiles.length == 0) {
+			StringBuffer sb = new StringBuffer();
+			sb.append("Schema specification returns no result: ");
+			for (int i = 0;  i < schemas.length;  i++) {
+				if (i > 0) {
+					sb.append(",");
+				}
+				sb.append(schemas[i]);
+			}
+			log.warn(sb);
+		}
+		return schemaFiles;
+	}
+
+	private FileSpec[] getProducedFiles(ISchemaCollection pCollection) {
+		List producesList = new ArrayList();
+		FileSet[] prdcs = pCollection.getProduces();
+		if (prdcs == null) {
+			FileSet f1 = new FileSet();
+			f1.setDirectory(new File(pCollection.getSrcTarget()));
+			producesList.add(f1);
+			FileSet f2 = new FileSet();
+			f2.setDirectory(new File(pCollection.getResourceTarget()));
+			producesList.add(f2);
+		} else {
+			producesList.addAll(Arrays.asList(prdcs));
+		}
+		for (Iterator iter = producesList.iterator();  iter.hasNext();  ) {
+			FileSet fileSet = (FileSet) iter.next();
+			if (!fileSet.getDirectory().exists()) {
+				iter.remove();
+			}
+		}
+		
+		return getFiles((FileSet[]) producesList.toArray(new FileSet[producesList.size()]));
+	}
+
+	private FileSpec[] getBindingFiles(ISchemaCollection pCollection) {
+		return getFiles(pCollection.getBindings());
+	}
+
+	private FileSpec[] getDependencies(ISchemaCollection pCollection) {
+		return getFiles(pCollection.getDepends());
+	}
+
+	private FileSpec[] concat(FileSpec[] pFiles1, FileSpec[] pFiles2) {
+		final FileSpec[] deps = new FileSpec[pFiles1.length + pFiles2.length];
+		System.arraycopy(pFiles1, 0, deps, 0, pFiles1.length);
+		System.arraycopy(pFiles2, 0, deps, pFiles1.length, pFiles2.length);
+		return deps;
+	}
+
+	private boolean isUptodate(FileSpec[] pSourceFiles, FileSpec[] pProducedFiles) {
+		if (forced) {
+			log.debug("Force flag set, disabling uptodate check.");
+			return false;
+		}
+		if (pProducedFiles.length == 0) {
+			log.debug("No produced files found, disabling uptodate check.");
+			return false;
+		}
+		File minProducedFile = null;
+		long minProducedTime = 0;
+		for (int i = 0;  i < pProducedFiles.length;  i++) {
+			File f = pProducedFiles[i].getFile();
+			long l = f.lastModified();
+			if (l == 0) {
+				log.debug("Produced file " + f + " has unknown timestamp, disabling uptodate check.");
+				return false;
+			}
+			if (minProducedTime == 0  ||  minProducedTime > l) {
+				minProducedTime = l;
+				minProducedFile = f;
+			}
+		}
+
+		final FileSpec[] deps = pSourceFiles;
+		long maxDepTime = 0;
+		File maxDepFile = null;
+		for (int i = 0;  i < deps.length;  i++) {
+			File f = deps[i].getFile();
+			long l = f.lastModified();
+			if (l == 0) {
+				log.debug("Dependency file " + f + " has unknown timestamp, disabling uptodate check.");
+				return false;
+			}
+			if (maxDepTime == 0  ||  maxDepTime < l) {
+				maxDepTime = l;
+				maxDepFile = f;
+			}
+		}
+
+		if (maxDepTime >= minProducedTime) {
+			log.debug("Dependency file " + maxDepFile + " is more recent than produced file " + minProducedFile);
+			return true;
+		} else {
+			log.debug("All produced files are uptodate.");
+			return false;
+		}
+	}
+
+	void process(ISchemaCollection pCollection) throws MojoExecutionException, MojoFailureException {
+		final FileSpec[] schemaFiles = getSchemaFiles(pCollection);
+		if (schemaFiles.length == 0) {
+			return;
+		}
+		final FileSpec[] producedFiles = getProducedFiles(pCollection);
+		final FileSpec[] dependencies = getDependencies(pCollection);
+		final FileSpec[] bindingFiles = getBindingFiles(pCollection);
+		final boolean uptodate = isUptodate(concat(concat(schemaFiles, dependencies), bindingFiles), producedFiles);
+		if (uptodate) {
+			log.info("Generated files are uptodate.");
+		} else {
+			runGenerator(pCollection, schemaFiles, producedFiles, bindingFiles, dependencies);
+		}
+
+		project.addCompileSourceRoot(pCollection.getSrcTarget());
+		Resource resource = new Resource();
+		resource.setDirectory(pCollection.getResourceTarget());
+		project.addResource(resource);
+	}
+
+	private void removeOldOutput(ISchemaCollection pCollection, FileSpec[] pProducedFiles) throws MojoExecutionException {
+		if (pCollection.isRemovingOldOutput()) {
+			for (int i = 0;  i < pProducedFiles.length;  i++) {
+				File f = pProducedFiles[i].getFile();
+				if (f.isFile()  &&  !f.delete()) {
+					throw new MojoExecutionException("Unable to delete file: " + f.getAbsolutePath());
+				}
+			}
+		}
+	}
+
+	private SchemaReader newSchemaReaderInstance(ISchemaCollection pCollection)
+			throws MojoFailureException, MojoExecutionException {
+		final SchemaReader result;
+		final String s = pCollection.getSchemaReader();
+		if (s == null  ||  s.length() == 0) {
+			if (pCollection.isExtension()) {
+				result = new JaxMeSchemaReader();
+			} else {
+				result = new JAXBSchemaReader();
+			}
+		} else {
+			Class c;
+			try {
+				c = Thread.currentThread().getContextClassLoader().loadClass(s);
+			} catch (ClassNotFoundException e) {
+				throw new MojoFailureException("The schema reader class " + s + " was not found.");
+			}
+			Object o;
+			try {
+				o = c.newInstance();
+			} catch (InstantiationException e) {
+				throw new MojoExecutionException("Failed to instantiate schema reader class " + c.getName(), e);
+			} catch (IllegalAccessException e) {
+				throw new MojoExecutionException("Illegal access to schema reader class " + c.getName(), e);
+			}
+			try {
+				result = (SchemaReader) o;
+			} catch (ClassCastException e) {
+				throw new MojoFailureException("The configured schema reader class " + c.getName()
+						+ " is not implementing " + SchemaReader.class.getName());
+			}
+		}
+		return result;
+	}
+
+	private Class getSgFactoryChainClass(String pClass)
+			throws MojoFailureException {
+		Class c;
+		try {
+			c = Thread.currentThread().getContextClassLoader().loadClass(pClass);
+		} catch (ClassNotFoundException e) {
+			throw new MojoFailureException("The factory chain class " + pClass + " was not found.");
+		}
+		if (!SGFactoryChain.class.isAssignableFrom(c)) {
+			throw new MojoFailureException("The factory chain class " + c.getName()
+					+ " is not implementing " + SGFactoryChain.class);
+		}
+		return c;
+	}
+
+	private SchemaReader getSchemaReaderInstance(ISchemaCollection pCollection)
+			throws MojoFailureException, MojoExecutionException {
+		final SchemaReader result = newSchemaReaderInstance(pCollection);
+		log.debug("Schema reader class: " + result.getClass().getName());
+
+		String[] chains = pCollection.getSgFactoryChain();
+		if (chains != null) {
+			for (int i = 0;  i < chains.length;  i++) {
+				Class c = getSgFactoryChainClass(chains[i]);
+				log.debug("Adding SG Factory chain: " + c.getName());
+				result.addSGFactoryChain(c);
+			}
+		}
+
+		return result;
+	}
+
+	private File getSrcTargetDirectory(ISchemaCollection pCollection) {
+		final String prefix = pCollection.getSrcTarget();
+		final File f = getTargetDir(prefix);
+		sourceDirectories.put(prefix, f);
+		return f;
+	}
+
+	private File getTargetDir(String pDir) {
+		File f = new File(pDir);
+		if (!f.isAbsolute()) {
+			f = new File(project.getBasedir(), pDir);
+		}
+		return f;
+	}
+
+	private File getResourceTargetDirectory(ISchemaCollection pCollection) {
+		final String prefix = pCollection.getResourceTarget();
+		final File f = getTargetDir(prefix);
+		resourcecDirectories.put(prefix, f);
+		return f;
+	}
+
+	private void runGenerator(ISchemaCollection pCollection, final FileSpec[] pSchemaFiles,
+							  final FileSpec[] pProducedFiles, final FileSpec[] pBindingFiles,
+							  final FileSpec[] pDependencies)
+			throws MojoExecutionException, MojoFailureException {
+		removeOldOutput(pCollection, pProducedFiles);
+
+		Generator g = new GeneratorImpl();
+		for (int i = 0;  i < pBindingFiles.length;  i++) {
+			File f = pBindingFiles[i].getFile();
+			try {
+				g.addBindings(new InputSource(f.toURI().toURL().toExternalForm()));
+			} catch (ParserConfigurationException e) {
+				throw new MojoExecutionException("Failed to add binding file "
+						+ f.getPath() + ": " + e.getMessage(), e);
+			} catch (SAXException e) {
+				throw new MojoExecutionException("Failed to add binding file "
+						+ f.getPath() + ": " + e.getMessage(), e);
+			} catch (IOException e) {
+				throw new MojoExecutionException("Failed to add binding file "
+						+ f.getPath() + ": " + e.getMessage(), e);
+			}
+		}
+		File resourceTargetDir = getResourceTargetDirectory(pCollection);
+		for (int i = 0;  i < pSchemaFiles.length;  i++) {
+			final SchemaReader reader = getSchemaReaderInstance(pCollection);
+			g.setSchemaReader(reader);
+			g.setForcingOverwrite(forced);
+			g.setSettingReadOnly(readOnly);
+			g.setTargetDirectory(getSrcTargetDirectory(pCollection));
+			g.setResourceTargetDirectory(resourceTargetDir);
+			g.setValidating(pCollection.isValidating());
+			if (pCollection.getPackageName() != null) {
+				g.setProperty("jaxme.package.name", pCollection.getPackageName());
+			}
+			Map props = pCollection.getProperties();
+			if (props != null) {
+				for (Iterator iter = props.entrySet().iterator();  iter.hasNext();  ) {
+					Map.Entry entry = (Map.Entry) iter.next();
+					g.setProperty((String) entry.getKey(), (String) entry.getValue());
+				}
+			}
+			try {
+				g.generate(pSchemaFiles[i].getFile());
+			} catch (Exception e) {
+				throw new MojoExecutionException(e.getMessage(), e);
+			}
+		}
+
+		copySchemaFiles(pCollection, pSchemaFiles, pBindingFiles,
+				pDependencies, resourceTargetDir);
+	}
+
+	private void copySchemaFiles(ISchemaCollection pCollection,
+			final FileSpec[] pSchemaFiles, final FileSpec[] pBindingFiles,
+			final FileSpec[] pDependencies, File resourceTargetDir)
+			throws MojoExecutionException {
+		final String schemaTargetPrefix = pCollection.getSchemaTargetPrefix();
+		if (schemaTargetPrefix != null) {
+			copySchemaFiles(resourceTargetDir, pSchemaFiles, schemaTargetPrefix);
+			copySchemaFiles(resourceTargetDir, pBindingFiles, schemaTargetPrefix);
+			copySchemaFiles(resourceTargetDir, pDependencies, schemaTargetPrefix);
+		}
+	}
+
+	private void copySchemaFiles(File pTarget, FileSpec[] pFiles, String pPrefix)
+			throws MojoExecutionException {
+		final File dir;
+		if ("".equals(pPrefix)  ||  "/".equals(pPrefix)  ||  File.separator.equals(pPrefix)) {
+			dir = pTarget;
+		} else {
+			dir = new File(pTarget, pPrefix);
+		}
+		for (int i = 0;  i < pFiles.length;  i++) {
+			final File src = pFiles[i].getFile();
+			final File target = new File(dir, pFiles[i].getPath());
+			try {
+				FileUtils.copyFile(src, target);
+			} catch (IOException e) {
+				throw new MojoExecutionException("Failed to copy file " + src + " to " +
+						target + ": " + e.getMessage(), e);
+			}
+		}
+	}
+
+	void fixProjectSettings() {
+		fixCompileSourceRoots();
+		fixResourceDirectories();
+	}
+
+	private void fixCompileSourceRoots() {
+		for (Iterator iter = sourceDirectories.entrySet().iterator();  iter.hasNext();  ) {
+			final Map.Entry entry = (Map.Entry) iter.next();
+			final String dir = (String) entry.getKey();
+			boolean found = false;
+			for (Iterator iter2 = project.getCompileSourceRoots().iterator();  iter2.hasNext();  ) {
+				String s = (String) iter2.next();
+				if (dir.equals(s)) {
+					found = true;
+					break;
+				}
+			}
+			if (!found) {
+				project.addCompileSourceRoot(dir);
+			}
+		}
+	}
+
+	private void fixResourceDirectories() {
+		for (Iterator iter = resourcecDirectories.entrySet().iterator();  iter.hasNext();  ) {
+			final Map.Entry entry = (Map.Entry) iter.next();
+			final String dir = (String) entry.getKey();
+			boolean found = false;
+			for (Iterator iter2 = project.getBuild().getResources().iterator();  iter2.hasNext();  ) {
+				Resource resource = (Resource) iter2.next();
+				if (dir.equals(resource.getDirectory())) {
+					found = true;
+					break;
+				}
+			}
+			if (!found) {
+				Resource resource = new Resource();
+				resource.setDirectory(dir);
+				resource.setFiltering(false);
+				project.getBuild().addResource(resource);
+			}
+		}
+	}
+}

Modified: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/properties.apt
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/properties.apt?rev=433208&r1=433207&r2=433208&view=diff
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/properties.apt (original)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/properties.apt Mon Aug 21 02:53:45 2006
@@ -29,13 +29,13 @@
 *-------------------+--------------------------------------------------+-----------------------+
 | bindings          | Specifies a set of external binding files, which | \<bindings\>          |
 |                   | are being applied. Multiple bindings may be      |   \<value\>           |
-|                   | specified, each of which containing wildcards.   |     src/jaxme/*.jxb   |
+|                   | specified, each of which containing wildcards.   |  src/main/jaxme/*.jxb |
 |                   |                                                  |   \</value\>          |
 |                   |                                                  | \</bindings\>         |
 *-------------------+--------------------------------------------------+-----------------------+
 | depends           | Specifies additional dependencies. Typically,    | \<depends\>           |
 |                   | these are files, which are imported from within  |   \<value\>           |
-|                   | some schema, but aren't compiled themselves.     |     src/jaxme/*.xsi   |
+|                   | some schema, but aren't compiled themselves.     |  src/main/jaxme/*.xsi |
 |                   | The plugin uses these files within the uptodate  |   \</value>           |
 |                   | check: Generated sources aren't considered       | \</depends\>          |
 |                   | uptodate, if an additional dependency has a more |                       |
@@ -101,10 +101,10 @@
 *-------------------+--------------------------------------------------+-----------------------+
 | schemas           | Specifies the set of input schemata, which are   | \<schemas\>           |
 |                   | being processed by the generator. You may have   |   \<value\>           |
-|                   | multiple "schema" elements, each of which        |     src/jaxme/*.xsd   |
+|                   | multiple "schema" elements, each of which        |  src/main/jaxme/*.xsd |
 |                   | containing wildcard characters. The default      |   \</value>           |
-|                   | "src/jaxme/*.xsd" is used, if you do not specify | \</schemas\>          |
-|                   | any "schemas" element.                           |                       |
+|                   | "src/main/jaxme/*.xsd" is used, if you do not    | \</schemas\>          |
+|                   | specify any "schemas" element.                   |                       |
 *-------------------+--------------------------------------------------+-----------------------+
 | sgFactoryChain    | An instance of SGFactoryChain is an object,      | \<sgFactoryChain\>    |
 |                   | which modifies the source generators behaviour.  |   \<value\>           |

Modified: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/use.apt
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/use.apt?rev=433208&r1=433207&r2=433208&view=diff
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/use.apt (original)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/site/apt/use.apt Mon Aug 21 02:53:45 2006
@@ -26,9 +26,9 @@
 * Creating a schema folder
 
   By default, the plugin searches for schema files in
-  <<<src/jaxme>>>. More precisely, it uses the wildcard
-  <<<src/jaxme/*.xsd>>> when looking for schema files. In other
-  words, you put your schema files into <<<src/jaxme>>>, and
+  <<<src/main/jaxme>>>. More precisely, it uses the wildcard
+  <<<src/main/jaxme/*.xsd>>> when looking for schema files. In other
+  words, you put your schema files into <<<src/main/jaxme>>>, and
   call them <<<something.xsd>>>. That way, the plugin will
   automatically detect them.
 
@@ -60,7 +60,7 @@
   Note, that the "plugin" section might also contain a
   "configuration" element, if you need additional configuration.
   For example, the following might advice the plugin to search
-  for schema files in "src/xsd", rather than "src/jaxme":
+  for schema files in "src/xsd", rather than "src/main/jaxme":
 
 --------------------------------------------------------------------
         <configuration>

Propchange: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 21 02:53:45 2006
@@ -0,0 +1 @@
+target

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/pom.xml
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/pom.xml?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/pom.xml (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/pom.xml Mon Aug 21 02:53:45 2006
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<!--
+
+  Copyright 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.
+
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-jaxme-plugin</artifactId>
+        <configuration>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/it1.xsd
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/it1.xsd?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/it1.xsd (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it1/src/main/jaxme/it1.xsd Mon Aug 21 02:53:45 2006
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.w3schools.com"
+    xmlns="http://www.w3schools.com"
+    elementFormDefault="qualified">
+  <xs:element name="note">
+    <xs:complexType>
+      <xs:sequence>
+	<xs:element name="to" type="xs:string"/>
+	<xs:element name="from" type="xs:string"/>
+	<xs:element name="heading" type="xs:string"/>
+	<xs:element name="body" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Propchange: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Mon Aug 21 02:53:45 2006
@@ -0,0 +1 @@
+target

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/pom.xml
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/pom.xml?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/pom.xml (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/pom.xml Mon Aug 21 02:53:45 2006
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<!--
+
+  Copyright 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.
+
+-->
+<project
+    xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-jaxme-plugin</artifactId>
+        <configuration>
+          <schemaCollections>
+            <schemaCollection>
+              <schemas>
+                <schema>
+                  <directory>src/jaxme</directory>
+                </schema>
+              </schemas>
+              <schemaTargetPrefix>META-INF/schema</schemaTargetPrefix>
+            </schemaCollection>
+          </schemaCollections>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/it2.xsd
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/it2.xsd?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/it2.xsd (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/it2/src/jaxme/it2.xsd Mon Aug 21 02:53:45 2006
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.w3schools.com"
+    xmlns="http://www.w3schools.com"
+    elementFormDefault="qualified">
+  <xs:element name="note">
+    <xs:complexType>
+      <xs:sequence>
+	<xs:element name="to" type="xs:string"/>
+	<xs:element name="from" type="xs:string"/>
+	<xs:element name="heading" type="xs:string"/>
+	<xs:element name="body" type="xs:string"/>
+      </xs:sequence>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>

Added: webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/BaseTest.java
URL: http://svn.apache.org/viewvc/webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/BaseTest.java?rev=433208&view=auto
==============================================================================
--- webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/BaseTest.java (added)
+++ webservices/jaxme/trunk/ws-jaxme/maven-jaxme-plugin/src/test/java/org/apache/ws/jaxme/maven/plugins/BaseTest.java Mon Aug 21 02:53:45 2006
@@ -0,0 +1,71 @@
+/*
+ * Copyright 2006  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.
+ */
+package org.apache.ws.jaxme.maven.plugins;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.apache.maven.model.Build;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+
+/**
+ * Runs the various integration tests.
+ */
+public class BaseTest extends AbstractMojoTestCase {
+	private JaxMeMojo getMojo(final File pBaseDir) throws Exception {
+		 File testPom = new File(pBaseDir, "pom.xml" );
+		 JaxMeMojo mojo = (JaxMeMojo) lookupMojo("jaxme", testPom);
+		 final Build build = new Build();
+		 build.setDirectory("target");
+		 build.setOutputDirectory("target/classes");
+		 build.setResources(new ArrayList());
+		 MavenProjectStub project = new MavenProjectStub(){
+			public File getBasedir() {
+				return pBaseDir;
+			}
+			public Build getBuild() {
+				return build;
+			}
+		 };
+		 setVariableValueToObject(mojo, "project", project);
+		 setVariableValueToObject(mojo, "srcTarget", "target/classes/generated-sources/jaxme/java");
+		 setVariableValueToObject(mojo, "resourceTarget", "target/classes/generated-sources/jaxme/resources");
+		 setVariableValueToObject(mojo, "classpathElements", new ArrayList());
+		 return mojo;
+	}
+
+	private void runTest(String pDir) throws Exception {
+		File baseDir = new File(getBasedir(), pDir);
+		JaxMeMojo mojo = getMojo(baseDir);
+		mojo.execute();
+	}
+
+	/**
+	 * Runs the integration test in the it1 directory.
+	 */
+	public void testIt1() throws Exception {
+		runTest("src/test/it1");
+	}
+
+	/**
+	 * Runs the integration test in the it2 directory.
+	 */
+	public void testIt2() throws Exception {
+		runTest("src/test/it2");
+	}
+}



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