You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2004/02/11 00:06:31 UTC
cvs commit: incubator-geronimo/specs/schema/src/catalog resolver-catalog.xml
djencks 2004/02/10 15:06:31
Modified: modules/maven-xmlbeans-plugin/src/java/org/apache/geronimo/tools/xmlbeans
SchemaCompilerWrapper.java
modules/connector maven.xml
modules/deployment maven.xml
modules/jetty maven.xml
modules/maven-xmlbeans-plugin plugin.jelly
specs/schema maven.xml
Added: modules/maven-xmlbeans-plugin/src/java/org/apache/geronimo/tools/xmlbeans
SchemaCompiler.java
specs/schema/src/catalog resolver-catalog.xml
Log:
made xmlbeans plugin work offline and made it regenerate if sources schemas change
Revision Changes Path
1.2 +37 -4 incubator-geronimo/modules/maven-xmlbeans-plugin/src/java/org/apache/geronimo/tools/xmlbeans/SchemaCompilerWrapper.java
Index: SchemaCompilerWrapper.java
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/maven-xmlbeans-plugin/src/java/org/apache/geronimo/tools/xmlbeans/SchemaCompilerWrapper.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SchemaCompilerWrapper.java 2 Feb 2004 22:04:21 -0000 1.1
+++ SchemaCompilerWrapper.java 10 Feb 2004 23:06:31 -0000 1.2
@@ -57,13 +57,19 @@
package org.apache.geronimo.tools.xmlbeans;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
-import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
+
/**
*
@@ -73,11 +79,12 @@
* */
public class SchemaCompilerWrapper {
- public static void CompileSchemas(String sourceSchemas, String xmlConfigs, String targetDir) throws Exception {
+ public static void CompileSchemas(String sourceDir, String sourceSchemas, String xmlConfigs, String targetDir, String catalogLocation) throws Exception {
List schemas = new ArrayList();
+ File base = new File(sourceDir);
for (StringTokenizer st = new StringTokenizer(sourceSchemas, ","); st.hasMoreTokens();) {
String schemaName = st.nextToken();
- schemas.add(new File(schemaName));
+ schemas.add(new File(base, schemaName));
}
List configs = new ArrayList();
@@ -87,6 +94,12 @@
configs.add(new File(configName));
}
}
+ EntityResolver entityResolver = null;
+ if (catalogLocation != null) {
+ CatalogManager catalogManager = CatalogManager.getStaticManager();
+ catalogManager.setCatalogFiles(catalogLocation);
+ entityResolver = new PassThroughResolver(new CatalogResolver());
+ }
SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
params.setBaseDir(null);
params.setXsdFiles((File[])schemas.toArray(new File[] {}));
@@ -114,6 +127,7 @@
params.setExtensions(null);
params.setJaxb(false);
params.setMdefNamespaces(null);
+ params.setEntityResolver(entityResolver);
boolean result = SchemaCompiler.compile(params);
if (!result) {
@@ -127,4 +141,23 @@
}
+ private static class PassThroughResolver implements EntityResolver {
+
+ private final EntityResolver delegate;
+
+ public PassThroughResolver(EntityResolver delegate) {
+ this.delegate = delegate;
+ }
+ public InputSource resolveEntity(String publicId,
+ String systemId)
+ throws SAXException, IOException {
+ InputSource is = delegate.resolveEntity(publicId, systemId);
+ if (is != null) {
+ return is;
+ }
+ System.out.println("Could not resolve publicId: " + publicId + ", systemId: " + systemId + " from catalog");
+ return new InputSource(systemId);
+ }
+
+ }
}
1.1 incubator-geronimo/modules/maven-xmlbeans-plugin/src/java/org/apache/geronimo/tools/xmlbeans/SchemaCompiler.java
Index: SchemaCompiler.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 2000-2003 BEA Systems
* Inc., <http://www.bea.com/>. For more information on the Apache Software
* Foundation, please see <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.tools.xmlbeans;
import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Collections;
import java.util.Set;
import java.util.Map;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.net.URI;
import org.apache.xmlbeans.SchemaTypeSystem;
import org.apache.xmlbeans.SchemaTypeLoader;
import org.apache.xmlbeans.XmlBeans;
import org.apache.xmlbeans.XmlOptions;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlException;
import org.apache.xmlbeans.SimpleValue;
import org.apache.xmlbeans.impl.schema.ResourceLoader;
import org.apache.xmlbeans.impl.schema.StscState;
import org.apache.xmlbeans.impl.schema.SchemaTypeLoaderImpl;
import org.apache.xmlbeans.impl.schema.SchemaTypeSystemCompiler;
import org.apache.xmlbeans.impl.schema.PathResourceLoader;
import org.apache.xmlbeans.impl.common.XmlErrorWatcher;
import org.apache.xmlbeans.impl.common.XmlErrorContext;
import org.apache.xmlbeans.impl.tool.SchemaCodeGenerator;
import org.apache.xmlbeans.impl.tool.CodeGenUtil;
import org.apache.xmlbeans.impl.tool.SchemaCompilerExtension;
import org.apache.xmlbeans.impl.tool.Extension;
import org.w3.x2001.xmlSchema.SchemaDocument;
import org.xml.sax.EntityResolver;
import com.bea.x2002.x09.xbean.config.ConfigDocument;
/**
* This is a slightly modified version of the xmlbeans v1 SchemaCompiler, enhanced to allow specification of
* an EntityResolver. Some parts not used in the maven plugin have also been removed.
*
* @version $Revision: 1.1 $ $Date: 2004/02/10 23:06:31 $
*
* */
public class SchemaCompiler {
public static class Parameters
{
private File baseDir;
private File[] xsdFiles;
private File[] wsdlFiles;
private File[] javaFiles;
private File[] configFiles;
private File[] classpath;
private File outputJar;
private String name;
private File srcDir;
private File classesDir;
private String memoryInitialSize;
private String memoryMaximumSize;
private String compiler;
private String jar;
private boolean nojavac;
private boolean quiet;
private boolean verbose;
private boolean download;
private Collection errorListener;
private boolean noUpa;
private boolean noPvr;
private boolean debug;
private String repackage;
private List extensions = Collections.EMPTY_LIST;
private boolean jaxb;
private Set mdefNamespaces = Collections.EMPTY_SET;
private EntityResolver entityResolver;
public File getBaseDir()
{
return baseDir;
}
public void setBaseDir(File baseDir)
{
this.baseDir = baseDir;
}
public File[] getXsdFiles()
{
return xsdFiles;
}
public void setXsdFiles(File[] xsdFiles)
{
this.xsdFiles = xsdFiles;
}
public File[] getWsdlFiles()
{
return wsdlFiles;
}
public void setWsdlFiles(File[] wsdlFiles)
{
this.wsdlFiles = wsdlFiles;
}
public File[] getJavaFiles()
{
return javaFiles;
}
public void setJavaFiles(File[] javaFiles)
{
this.javaFiles = javaFiles;
}
public File[] getConfigFiles()
{
return configFiles;
}
public void setConfigFiles(File[] configFiles)
{
this.configFiles = configFiles;
}
public File[] getClasspath()
{
return classpath;
}
public void setClasspath(File[] classpath)
{
this.classpath = classpath;
}
public File getOutputJar()
{
return outputJar;
}
public void setOutputJar(File outputJar)
{
this.outputJar = outputJar;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public File getSrcDir()
{
return srcDir;
}
public void setSrcDir(File srcDir)
{
this.srcDir = srcDir;
}
public File getClassesDir()
{
return classesDir;
}
public void setClassesDir(File classesDir)
{
this.classesDir = classesDir;
}
public boolean isNojavac()
{
return nojavac;
}
public void setNojavac(boolean nojavac)
{
this.nojavac = nojavac;
}
public boolean isQuiet()
{
return quiet;
}
public void setQuiet(boolean quiet)
{
this.quiet = quiet;
}
public boolean isVerbose()
{
return verbose;
}
public void setVerbose(boolean verbose)
{
this.verbose = verbose;
}
public boolean isDownload()
{
return download;
}
public void setDownload(boolean download)
{
this.download = download;
}
public boolean isNoUpa()
{
return noUpa;
}
public void setNoUpa(boolean noUpa)
{
this.noUpa = noUpa;
}
public boolean isNoPvr()
{
return noPvr;
}
public void setNoPvr(boolean noPvr)
{
this.noPvr = noPvr;
}
public boolean isDebug()
{
return debug;
}
public void setDebug(boolean debug)
{
this.debug = debug;
}
public String getMemoryInitialSize()
{
return memoryInitialSize;
}
public void setMemoryInitialSize(String memoryInitialSize)
{
this.memoryInitialSize = memoryInitialSize;
}
public String getMemoryMaximumSize()
{
return memoryMaximumSize;
}
public void setMemoryMaximumSize(String memoryMaximumSize)
{
this.memoryMaximumSize = memoryMaximumSize;
}
public String getCompiler()
{
return compiler;
}
public void setCompiler(String compiler)
{
this.compiler = compiler;
}
public String getJar()
{
return jar;
}
public void setJar(String jar)
{
this.jar = jar;
}
public void setJaxb(boolean jaxb)
{
this.jaxb = jaxb;
}
public boolean getJaxb()
{
return this.jaxb;
}
public Collection getErrorListener()
{
return errorListener;
}
public void setErrorListener(Collection errorListener)
{
this.errorListener = errorListener;
}
public String getRepackage()
{
return repackage;
}
public void setRepackage(String newRepackage)
{
repackage = newRepackage;
}
public List getExtensions() {
return extensions;
}
public void setExtensions(List extensions) {
this.extensions = extensions;
}
public Set getMdefNamespaces()
{
return mdefNamespaces;
}
public void setMdefNamespaces(Set mdefNamespaces)
{
this.mdefNamespaces = mdefNamespaces;
}
public EntityResolver getEntityResolver() {
return entityResolver;
}
public void setEntityResolver(EntityResolver entityResolver) {
this.entityResolver = entityResolver;
}
}
private static SchemaTypeSystem loadTypeSystem(
String name, File[] xsdFiles,
File[] wsdlFiles, File[] configFiles, ResourceLoader cpResourceLoader,
boolean download, boolean noUpa, boolean noPvr, Set mdefNamespaces,
File baseDir, Map sourcesToCopyMap, Collection outerErrorListener,
EntityResolver entityResolver)
{
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
// For parsing XSD and WSDL files, we should use the SchemaDocument
// classloader rather than the thread context classloader. This is
// because in some situations (such as when being invoked by ant
// underneath the ide) the context classloader is potentially weird
// (because of the design of ant).
SchemaTypeLoader loader = XmlBeans.typeLoaderForClassLoader(SchemaDocument.class.getClassLoader());
// step 1, parse all the XSD files.
ArrayList scontentlist = new ArrayList();
if (xsdFiles != null)
{
for (int i = 0; i < xsdFiles.length; i++)
{
try
{
XmlOptions options = new XmlOptions();
options.setLoadLineNumbers();
options.setLoadMessageDigest();
options.setEntityResolver(entityResolver);
XmlObject schemadoc = loader.parse(xsdFiles[i], null, options);
if (!(schemadoc instanceof SchemaDocument))
{
StscState.addError(errorListener, "Document " + xsdFiles[i] + " is not a schema file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, schemadoc);
}
else
{
StscState.addInfo(errorListener, "Loading schema file " + xsdFiles[i]);
XmlOptions opts = new XmlOptions().setErrorListener(errorListener);
if (schemadoc.validate(opts))
scontentlist.add(((SchemaDocument)schemadoc).getSchema());
}
}
catch (XmlException e)
{
errorListener.add(e.getError());
}
catch (Exception e)
{
StscState.addError(errorListener, "Cannot load file " + xsdFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_FILE, xsdFiles[i]);
}
}
}
// step 2, parse all WSDL files
if (wsdlFiles != null)
{
for (int i = 0; i < wsdlFiles.length; i++)
{
try
{
XmlOptions options = new XmlOptions();
options.setLoadLineNumbers();
options.setEntityResolver(entityResolver);
options.setLoadSubstituteNamespaces(Collections.singletonMap(
"http://schemas.xmlsoap.org/wsdl/", "http://www.apache.org/internal/xmlbeans/wsdlsubst"
));
XmlObject wsdldoc = loader.parse(wsdlFiles[i], null, options);
if (!(wsdldoc instanceof org.apache.internal.xmlbeans.wsdlsubst.DefinitionsDocument))
StscState.addError(errorListener, "Document " + wsdlFiles[i] + " is not a wsdl file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdldoc);
else
{
if (wsdlContainsEncoded(wsdldoc))
StscState.addWarning(errorListener, "The WSDL " + wsdlFiles[i] + " uses SOAP encoding. SOAP encoding is not compatible with literal XML Schema.", XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdldoc);
StscState.addInfo(errorListener, "Loading wsdl file " + wsdlFiles[i]);
XmlObject[] types = ((org.apache.internal.xmlbeans.wsdlsubst.DefinitionsDocument)wsdldoc).getDefinitions().getTypesArray();
int count = 0;
for (int j = 0; j < types.length; j++)
{
// explicit cast for paranoia
SchemaDocument.Schema[] schemas = (SchemaDocument.Schema[])types[j].selectPath("declare namespace xs=\"http://www.w3.org/2001/XMLSchema\" xs:schema");
for (int k = 0; k < schemas.length; k++)
{
if (schemas[k].validate(new XmlOptions().setErrorListener(errorListener)))
scontentlist.add(schemas[k]);
}
count += schemas.length;
}
StscState.addInfo(errorListener, "Processing " + count + " schema(s) in " + wsdlFiles[i].toString());
}
}
catch (XmlException e)
{
errorListener.add(e.getError());
}
catch (Exception e)
{
StscState.addError(errorListener, "Cannot load file " + wsdlFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_FILE, wsdlFiles[i]);
}
}
}
SchemaDocument.Schema[] sdocs = (SchemaDocument.Schema[])scontentlist.toArray(new SchemaDocument.Schema[scontentlist.size()]);
// now the config files.
ArrayList cdoclist = new ArrayList();
if (configFiles != null)
{
for (int i = 0; i < configFiles.length; i++)
{
try
{
XmlOptions options = new XmlOptions();
options.put( XmlOptions.LOAD_LINE_NUMBERS );
options.setEntityResolver(entityResolver);
XmlObject configdoc = loader.parse(configFiles[i], null, options);
if (!(configdoc instanceof ConfigDocument))
StscState.addError(errorListener, "Document " + configFiles[i] + " is not an xsd config file", XmlErrorContext.CANNOT_LOAD_XSD_FILE, configdoc);
else
{
StscState.addInfo(errorListener, "Loading config file " + configFiles[i]);
if (configdoc.validate(new XmlOptions().setErrorListener(errorListener)))
cdoclist.add(((ConfigDocument)configdoc).getConfig());
}
}
catch (XmlException e)
{
errorListener.add(e.getError());
}
catch (Exception e)
{
StscState.addError(errorListener, "Cannot load xsd config file " + configFiles[i] + ": " + e, XmlErrorContext.CANNOT_LOAD_XSD_CONFIG_FILE, configFiles[i]);
}
}
}
ConfigDocument.Config[] cdocs = (ConfigDocument.Config[])cdoclist.toArray(new ConfigDocument.Config[cdoclist.size()]);
SchemaTypeLoader linkTo = SchemaTypeLoaderImpl.build(null, cpResourceLoader, null);
URI baseURI = null;
if (baseDir != null)
baseURI = baseDir.toURI();
XmlOptions opts = new XmlOptions();
if (download)
opts.setCompileDownloadUrls();
if (noUpa)
opts.setCompileNoUpaRule();
if (noPvr)
opts.setCompileNoPvrRule();
if (mdefNamespaces != null)
opts.setCompileMdefNamespaces(mdefNamespaces);
opts.setCompileNoValidation(); // already validated here
opts.setEntityResolver(entityResolver);
// now pass it to the main compile function
SchemaTypeSystemCompiler.Parameters params = new SchemaTypeSystemCompiler.Parameters();
params.setName(name);
params.setSchemas(sdocs);
params.setConfigs(cdocs);
params.setLinkTo(linkTo);
params.setOptions(opts);
params.setErrorListener(errorListener);
params.setJavaize(true);
params.setBaseURI(baseURI);
params.setSourcesToCopyMap(sourcesToCopyMap);
return SchemaTypeSystemCompiler.compile(params);
}
public static boolean compile(SchemaCompiler.Parameters params)
{
File baseDir = params.getBaseDir();
File[] xsdFiles = params.getXsdFiles();
File[] wsdlFiles = params.getWsdlFiles();
File[] javaFiles = params.getJavaFiles();
File[] configFiles = params.getConfigFiles();
File[] classpath = params.getClasspath();
File outputJar = params.getOutputJar();
String name = params.getName();
File srcDir = params.getSrcDir();
File classesDir = params.getClassesDir();
String compiler = params.getCompiler();
String jar = params.getJar();
String memoryInitialSize = params.getMemoryInitialSize();
String memoryMaximumSize = params.getMemoryMaximumSize();
boolean nojavac = params.isNojavac();
boolean debug = params.isDebug();
boolean verbose = params.isVerbose();
boolean quiet = params.isQuiet();
boolean download = params.isDownload();
boolean noUpa = params.isNoUpa();
boolean noPvr = params.isNoPvr();
Collection outerErrorListener = params.getErrorListener();
String repackage = params.getRepackage();
List extensions = params.getExtensions();
boolean jaxb = params.getJaxb();
Set mdefNamespaces = params.getMdefNamespaces();
EntityResolver entityResolver = params.getEntityResolver();
if (srcDir == null || classesDir == null)
throw new IllegalArgumentException("src and class gen directories may not be null.");
long start = System.currentTimeMillis();
// Calculate the usenames based on the relativized filenames on the filesystem
if (baseDir == null)
baseDir = new File(System.getProperty("user.dir"));
ResourceLoader cpResourceLoader = null;
Map sourcesToCopyMap = new HashMap();
if (classpath != null)
cpResourceLoader = new PathResourceLoader(classpath);
boolean result = true;
// build the in-memory type system
XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, configFiles, cpResourceLoader, download, noUpa, noPvr, mdefNamespaces, baseDir, sourcesToCopyMap, errorListener, entityResolver);
if (errorListener.hasError())
result = false;
long finish = System.currentTimeMillis();
if (!quiet)
System.out.println("Time to build schema type system: " + ((double)(finish - start) / 1000.0) + " seconds" );
// now code generate and compile the JAR
if (result && system != null) // todo: don't check "result" here if we want to compile anyway, ignoring invalid schemas
{
start = System.currentTimeMillis();
// generate source and .xsb
List sourcefiles = new ArrayList();
result &= SchemaCodeGenerator.compileTypeSystem(system, srcDir, javaFiles, sourcesToCopyMap, classpath, classesDir, outputJar, nojavac, jaxb, errorListener, repackage, verbose, sourcefiles);
result &= !errorListener.hasError();
if (result)
{
finish = System.currentTimeMillis();
if (!quiet)
System.out.println("Time to generate code: " + ((double)(finish - start) / 1000.0) + " seconds" );
}
// compile source
if (result && !nojavac)
{
start = System.currentTimeMillis();
if (javaFiles != null)
sourcefiles.addAll(java.util.Arrays.asList(javaFiles));
if (!CodeGenUtil.externalCompile(sourcefiles, classesDir, classpath, debug, compiler, memoryInitialSize, memoryMaximumSize, quiet, verbose))
result = false;
finish = System.currentTimeMillis();
if (result && !params.isQuiet())
System.out.println("Time to compile code: " + ((double)(finish - start) / 1000.0) + " seconds" );
// jar classes and .xsb
if (result && outputJar != null)
{
if (!CodeGenUtil.externalJar(classesDir, outputJar, jar, quiet, verbose))
result = false;
if (result && !params.isQuiet())
System.out.println("Compiled types to: " + outputJar);
}
}
}
if (!result && !quiet)
{
System.out.println("BUILD FAILED");
}
else {
// call schema compiler extension if registered
runExtensions(extensions, system, classesDir);
}
if (cpResourceLoader != null)
cpResourceLoader.close();
return result;
}
private static void runExtensions(List extensions, SchemaTypeSystem system, File classesDir)
{
if (extensions != null && extensions.size() > 0)
{
SchemaCompilerExtension sce = null;
Iterator i = extensions.iterator();
Map extensionParms = null;
String classesDirName = null;
try
{
classesDirName = classesDir.getCanonicalPath();
}
catch(java.io.IOException e)
{
System.out.println("WARNING: Unable to get the path for schema jar file");
classesDirName = classesDir.getAbsolutePath();
}
while (i.hasNext())
{
Extension extension = (Extension) i.next();
try
{
sce = (SchemaCompilerExtension) extension.getClassName().newInstance();
}
catch (InstantiationException e)
{
System.out.println("UNABLE to instantiate schema compiler extension:" + extension.getClassName().getName());
System.out.println("EXTENSION Class was not run");
break;
}
catch (IllegalAccessException e)
{
System.out.println("ILLEGAL ACCESS Exception when attempting to instantiate schema compiler extension: " + extension.getClassName().getName());
System.out.println("EXTENSION Class was not run");
break;
}
System.out.println("Running Extension: " + sce.getExtensionName());
extensionParms = new HashMap();
Iterator parmsi = extension.getParams().iterator();
while (parmsi.hasNext())
{
Extension.Param p = (Extension.Param) parmsi.next();
extensionParms.put(p.getName(), p.getValue());
}
extensionParms.put("classesDir", classesDirName);
sce.schemaCompilerExtension(system, extensionParms);
}
}
}
private static boolean wsdlContainsEncoded(XmlObject wsdldoc)
{
// search for any <soap:body use="encoded"/> etc.
XmlObject[] useAttrs = wsdldoc.selectPath(
"declare namespace soap='http://schemas.xmlsoap.org/wsdl/soap/' " +
".//soap:body/@use|.//soap:header/@use|.//soap:fault/@use");
for (int i = 0; i < useAttrs.length; i++)
{
if ("encoded".equals(((SimpleValue)useAttrs[i]).getStringValue()))
return true;
}
return false;
}
}
1.3 +5 -3 incubator-geronimo/modules/connector/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/connector/maven.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- maven.xml 9 Feb 2004 05:52:01 -0000 1.2
+++ maven.xml 10 Feb 2004 23:06:31 -0000 1.3
@@ -10,9 +10,11 @@
<preGoal name="java:compile">
<xmlbeans:schema2java
- sourceschema="${basedir}/src/schema/geronimo-connector_1_5.xsd"
+ sourcedir="${basedir}/src"
+ sourceschema="schema/geronimo-connector_1_5.xsd"
xmlconfigs="${basedir}/src/schema/xmlconfig.xml"
- targetdir="${basedir}/target/xmlbeans"/>
+ targetdir="${basedir}/target/xmlbeans"
+ cataloglocation="${basedir}/../specs/schema/src/catalog/resolver-catalog.xml"/>
</preGoal>
<!--${basedir}/src/schema/connector_1_0.xsd,${basedir}/src/schema/connector_1_5.xsd,-->
</project>
1.2 +5 -3 incubator-geronimo/modules/deployment/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/deployment/maven.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- maven.xml 9 Feb 2004 07:17:31 -0000 1.1
+++ maven.xml 10 Feb 2004 23:06:31 -0000 1.2
@@ -7,9 +7,11 @@
<preGoal name="java:compile">
<xmlbeans:schema2java
- sourceschema="${basedir}/src/schema/geronimo-config.xsd"
+ sourcedir="${basedir}/src"
+ sourceschema="schema/geronimo-config.xsd"
xmlconfigs="${basedir}/src/schema/xmlconfig.xml"
- targetdir="${basedir}/target/xmlbeans"/>
+ targetdir="${basedir}/target/xmlbeans"
+ cataloglocation="${basedir}/../specs/schema/src/catalog/resolver-catalog.xml"/>
</preGoal>
</project>
1.2 +5 -3 incubator-geronimo/modules/jetty/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/jetty/maven.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- maven.xml 6 Feb 2004 08:55:49 -0000 1.1
+++ maven.xml 10 Feb 2004 23:06:31 -0000 1.2
@@ -10,9 +10,11 @@
<preGoal name="java:compile">
<xmlbeans:schema2java
- sourceschema="${basedir}/src/schema/geronimo-jetty.xsd"
+ sourcedir="${basedir}/src"
+ sourceschema="schema/geronimo-jetty.xsd"
xmlconfigs="${basedir}/src/schema/xmlconfig.xml"
- targetdir="${basedir}/target/xmlbeans"/>
+ targetdir="${basedir}/target/xmlbeans"
+ cataloglocation="${basedir}/../specs/schema/src/catalog/resolver-catalog.xml"/>
</preGoal>
</project>
1.4 +7 -1 incubator-geronimo/modules/maven-xmlbeans-plugin/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/incubator-geronimo/modules/maven-xmlbeans-plugin/plugin.jelly,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- plugin.jelly 8 Feb 2004 19:37:00 -0000 1.3
+++ plugin.jelly 10 Feb 2004 23:06:31 -0000 1.4
@@ -19,6 +19,9 @@
<j:if test="${targetdir == null}">
<fail>Missing required attribute: targetdir</fail>
</j:if>
+ <j:if test="${sourcedir == null}">
+ <fail>Missing required attribute: sourcedir</fail>
+ </j:if>
<j:if test="${sourceschema == null}">
<fail>Missing required attribute: sourceschema</fail>
</j:if>
@@ -33,14 +36,17 @@
<uptodate property="${uptodatePropName}"
targetfile="${uptodateFile}">
- <srcfiles dir="${targetdir}" includes="**/*.xsd*"/>
+ <srcfiles dir="${sourcedir}"
+ includes="${sourceschema}"/>
</uptodate>
<j:if test="${context.getVariable(uptodatePropName) == null}">
<j:invokeStatic var="dummy" className="org.apache.geronimo.tools.xmlbeans.SchemaCompilerWrapper" method="CompileSchemas">
+ <j:arg type="java.lang.String" value="${sourcedir}"/>
<j:arg type="java.lang.String" value="${sourceschema}"/>
<j:arg type="java.lang.String" value="${xmlconfigs}"/>
<j:arg type="java.lang.String" value="${targetdir}"/>
+ <j:arg type="java.lang.String" value="${cataloglocation}"/>
</j:invokeStatic>
<touch file="${uptodateFile}"/>
1.4 +5 -3 incubator-geronimo/specs/schema/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/incubator-geronimo/specs/schema/maven.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- maven.xml 6 Feb 2004 05:28:46 -0000 1.3
+++ maven.xml 10 Feb 2004 23:06:31 -0000 1.4
@@ -10,9 +10,11 @@
<preGoal name="java:compile">
<xmlbeans:schema2java
- sourceschema="${basedir}/src/j2ee_1_3schema/connector_1_0.xsd,${basedir}/src/j2ee_1_4schema/j2ee_1_4.xsd,${basedir}/src/j2ee_1_4schema/connector_1_5.xsd,${basedir}/src/j2ee_1_4schema/ejb-jar_2_1.xsd"
+ sourcedir="${basedir}/src"
+ sourceschema="j2ee_1_3schema/connector_1_0.xsd,j2ee_1_4schema/j2ee_1_4.xsd,j2ee_1_4schema/connector_1_5.xsd,j2ee_1_4schema/ejb-jar_2_1.xsd"
xmlconfigs="${basedir}/src/conf/xmlconfig.xml"
- targetdir="${basedir}/target/xmlbeans"/>
+ targetdir="${basedir}/target/xmlbeans"
+ cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
</preGoal>
</project>
1.1 incubator-geronimo/specs/schema/src/catalog/resolver-catalog.xml
Index: resolver-catalog.xml
===================================================================
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<public publicId="http://java.sun.com/xml/ns/j2ee"
uri="../j2ee_1_4schema/j2ee_1_4.xsd"/>
<public publicId="http://www.w3.org/XML/1998/namespace"
uri="../j2ee_1_4schema/xml.xsd"/>
<system systemId="http://www.ibm.com/webservices/xsd/j2ee_web_services_client_1_1.xsd"
uri="../j2ee_1_4schema/j2ee_web_services_client_1_1.xsd"/>
</catalog>