xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ce...@apache.org
Subject svn commit: r530930 - in /xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool: SchemaCompiler.java XMLBean.java
Date Fri, 20 Apr 2007 21:47:53 GMT
Author: cezar
Date: Fri Apr 20 14:47:53 2007
New Revision: 530930

URL: http://svn.apache.org/viewvc?view=rev&rev=530930
Log:
Fix for https://issues.apache.org/jira/browse/XMLBEANS-278 contributed by Dave Smith.

checkintest passes


Modified:
    xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
    xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java

Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java?view=diff&rev=530930&r1=530929&r2=530930
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/SchemaCompiler.java Fri Apr 20
14:47:53 2007
@@ -39,6 +39,7 @@
 import org.apache.xmlbeans.impl.util.FilerImpl;
 import org.apache.xmlbeans.impl.values.XmlListImpl;
 import org.apache.xmlbeans.impl.xb.xmlconfig.ConfigDocument;
+import org.apache.xmlbeans.impl.xb.xmlconfig.Extensionconfig;
 import org.apache.xmlbeans.impl.xb.xsdschema.SchemaDocument;
 import org.xml.sax.EntityResolver;
 import org.apache.xmlbeans.impl.config.BindingConfigImpl;
@@ -77,6 +78,7 @@
         System.out.println("    -nopvr - do not enforce the particle valid (restriction)
rule");
         System.out.println("    -noann - ignore annotations");
         System.out.println("    -novdoc - do not validate contents of <documentation>");
+        System.out.println("    -noext - ignore all extension (Pre/Post and Interface) found
in .xsdconfig files");
         System.out.println("    -compiler - path to external java compiler");
         System.out.println("    -javasource [version] - generate java source compatible for
a Java version (1.4 or 1.5)");
         System.out.println("    -ms - initial memory for external java compiler (default
'" + CodeGenUtil.DEFAULT_MEM_START + "')");
@@ -119,6 +121,7 @@
         flags.add("nopvr");
         flags.add("noann");
         flags.add("novdoc");
+        flags.add("noext");
         flags.add("srconly");
         flags.add("debug");
 
@@ -209,6 +212,7 @@
         boolean noPvr = (cl.getOpt("nopvr") != null);
         boolean noAnn = (cl.getOpt("noann") != null);
         boolean noVDoc= (cl.getOpt("novdoc") != null);
+        boolean noExt= (cl.getOpt("noext") != null);
         boolean nojavac = (cl.getOpt("srconly") != null);
         boolean debug = (cl.getOpt("debug") != null);
 
@@ -357,6 +361,7 @@
         params.setNoPvr(noPvr);
         params.setNoAnn(noAnn);
         params.setNoVDoc(noVDoc);
+        params.setNoExt(noExt);
         params.setDebug(debug);
         params.setErrorListener(err);
         params.setRepackage(repackage);
@@ -402,6 +407,7 @@
         private boolean noPvr;
         private boolean noAnn;
         private boolean noVDoc;
+        private boolean noExt;
         private boolean debug;
         private boolean incrementalSrcGen;
         private String repackage;
@@ -601,6 +607,16 @@
             this.noVDoc = newNoVDoc;
         }
 
+        public boolean isNoExt()
+        {
+            return noExt;
+        }
+
+        public void setNoExt(boolean newNoExt)
+        {
+            this.noExt = newNoExt;
+        }
+
         public boolean isIncrementalSrcGen()
         {
             return incrementalSrcGen;
@@ -742,7 +758,7 @@
 
     private static SchemaTypeSystem loadTypeSystem(String name, File[] xsdFiles, File[] wsdlFiles,
URL[] urlFiles, File[] configFiles,
         File[] javaFiles, ResourceLoader cpResourceLoader,
-        boolean download, boolean noUpa, boolean noPvr, boolean noAnn, boolean noVDoc,
+        boolean download, boolean noUpa, boolean noPvr, boolean noAnn, boolean noVDoc, boolean
noExt,
         Set mdefNamespaces, File baseDir, Map sourcesToCopyMap,
         Collection outerErrorListener, File schemasDir, EntityResolver entResolver, File[]
classpath, String javasource)
     {
@@ -882,6 +898,9 @@
         ArrayList cdoclist = new ArrayList();
         if (configFiles != null)
         {
+            if (noExt)
+                System.out.println("Pre/Post and Interface extensions will be ignored.");
+            
             for (int i = 0; i < configFiles.length; i++)
             {
                 try
@@ -899,7 +918,15 @@
                     {
                         StscState.addInfo(errorListener, "Loading config file " + configFiles[i]);
                         if (configdoc.validate(new XmlOptions().setErrorListener(errorListener)))
-                            cdoclist.add(((ConfigDocument)configdoc).getConfig());
+                        {
+                            ConfigDocument.Config config = ((ConfigDocument)configdoc).getConfig();
+                            cdoclist.add(config);
+                            if (noExt)
+                            {
+                                //disable extensions
+                                config.setExtensionArray(new Extensionconfig[] {});
+                            }
+                        }
                     }
                 }
                 catch (XmlException e)
@@ -1023,6 +1050,7 @@
         boolean noPvr = params.isNoPvr();
         boolean noAnn = params.isNoAnn();
         boolean noVDoc = params.isNoVDoc();
+        boolean noExt = params.isNoExt();
         boolean incrSrcGen = params.isIncrementalSrcGen();
         Collection outerErrorListener = params.getErrorListener();
 
@@ -1070,7 +1098,7 @@
         // build the in-memory type system
         XmlErrorWatcher errorListener = new XmlErrorWatcher(outerErrorListener);
         SchemaTypeSystem system = loadTypeSystem(name, xsdFiles, wsdlFiles, urlFiles, configFiles,
-            javaFiles, cpResourceLoader, download, noUpa, noPvr, noAnn, noVDoc, mdefNamespaces,
+            javaFiles, cpResourceLoader, download, noUpa, noPvr, noAnn, noVDoc, noExt, mdefNamespaces,
             baseDir, sourcesToCopyMap, errorListener, schemasDir, cmdLineEntRes, classpath,
javasource);
         if (errorListener.hasError())
             result = false;

Modified: xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java?view=diff&rev=530930&r1=530929&r2=530930
==============================================================================
--- xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java (original)
+++ xmlbeans/trunk/src/xmlcomp/org/apache/xmlbeans/impl/tool/XMLBean.java Fri Apr 20 14:47:53
2007
@@ -69,6 +69,7 @@
                         nopvr,
                         noann,
                         novdoc,
+                        noext = false,
                         failonerror = true,
                         fork = true,
                         includeAntRuntime = true,
@@ -234,6 +235,7 @@
             params.setNoPvr(nopvr);
             params.setNoAnn(noann);
             params.setNoVDoc(novdoc);
+            params.setNoExt(noext);
             params.setJavaSource(javasource);
             success = SchemaCompiler.compile(params);
 
@@ -758,6 +760,20 @@
     public boolean isNoValidateDoc()
     {
         return novdoc;
+    }
+
+    /**
+     * Ignore extensions found in .xsdconfig files
+     * @param novdoc
+     */
+    public void setNoExt(boolean noext)
+    {
+        this.noext = noext;
+    }
+
+    public boolean isNoExt()
+    {
+        return noext;
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: commits-help@xmlbeans.apache.org


Mime
View raw message