You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/01/03 23:57:38 UTC

svn commit: r365762 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/wsdl/codegen/extension/ codegen/src/org/apache/axis2/wsdl/template/general/ integration/ security/

Author: dims
Date: Tue Jan  3 14:57:34 2006
New Revision: 365762

URL: http://svn.apache.org/viewcvs?rev=365762&view=rev
Log:
- Cleanup build.xml's a bit more
- Stop generating unused files/directories
- added a target for "clean"
- Remove unused targets

TODO:
- Add a classpath built from axis2.home property
- Add a target to create the .aar file
- Maybe add targets for compiling and running the test case.


Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl
    webservices/axis2/trunk/java/modules/integration/build.xml
    webservices/axis2/trunk/java/modules/security/maven.xml

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/XMLBeansExtension.java Tue Jan  3 14:57:34 2006
@@ -76,7 +76,8 @@
     public static final String MAPPER_FILE_NAME = "mapper";
     public static final String SCHEMA_PATH = "/org/apache/axis2/wsdl/codegen/schema/";
 
-
+    boolean debug = false;
+    
     public void engage() {
 
         //test the databinding type. If not just fall through
@@ -125,25 +126,29 @@
 
 
                     Stack importedSchemaStack = schema.getImportedSchemaStack();
-                    File schemaFolder = new File(configuration.getOutputLocation(), SCHEMA_FOLDER);
-                    schemaFolder.mkdir();
+                    File schemaFolder = null;
+                    if(debug) {
+                        schemaFolder = new File(configuration.getOutputLocation(), SCHEMA_FOLDER);
+                        schemaFolder.mkdir();
+                    }
                     //compile these schemas
                     while (!importedSchemaStack.isEmpty()) {
                         Element element = (Element) importedSchemaStack.pop();
                         String tagetNamespace = element.getAttribute("targetNamespace");
                         if (!processedSchemas.contains(tagetNamespace)) {
 
-                            // we are not using DOM toString method here, as it seems it depends on the
-                            // JDK version that is being used.
-                            String s = DOM2Writer.nodeToString(element);
-
-                            //write the schema to a file
-                            File tempFile = File.createTempFile("temp", ".xsd", schemaFolder);
-                            FileWriter writer = new FileWriter(tempFile);
-                            writer.write(s);
-                            writer.flush();
-                            writer.close();
-
+                            if(debug) {
+                                // we are not using DOM toString method here, as it seems it depends on the
+                                // JDK version that is being used.
+                                String s = DOM2Writer.nodeToString(element);
+    
+                                //write the schema to a file
+                                File tempFile = File.createTempFile("temp", ".xsd", schemaFolder);
+                                FileWriter writer = new FileWriter(tempFile);
+                                writer.write(s);
+                                writer.flush();
+                                writer.close();
+                            }
 
                             xmlObjectsVector.add(
                                     XmlObject.Factory.parse(
@@ -157,7 +162,7 @@
             }
 
             // add the third party schemas
-            //todo pehaps checking the namespaces would be a good idea to
+            //todo perhaps checking the namespaces would be a good idea to
             //make the generated code work efficiently
             for (int i = 0; i < additionalSchemas.length; i++) {
                 xmlObjectsVector.add(XmlObject.Factory.parse(
@@ -190,8 +195,10 @@
             //set the type mapper to the config
             configuration.setTypeMapper(mapper);
 
-            // write the mapper to a file for later retriival
-            writeMappingsToFile(mapper.getAllMappedNames());
+            if(debug) {
+                // write the mapper to a file for later retriival
+                writeMappingsToFile(mapper.getAllMappedNames());
+            }
 
         } catch (Exception e) {
             throw new RuntimeException(e);
@@ -354,7 +361,11 @@
 
         public OutputStream createBinaryFile(String typename)
                 throws IOException {
-            File file = new File(configuration.getOutputLocation(), typename);
+            File resourcesDirectory = new File(configuration.getOutputLocation(), "resources");
+            if(!resourcesDirectory.exists()) {
+                resourcesDirectory.mkdirs();
+            }
+            File file = new File(resourcesDirectory, typename);
             file.getParentFile().mkdirs();
             file.createNewFile();
             return new FileOutputStream(file);

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/adbAntBuildTemplate.xsl Tue Jan  3 14:57:34 2006
@@ -8,74 +8,34 @@
             <property name="src">
                 <xsl:attribute name="value">${basedir}\src</xsl:attribute>
             </property>
-            <property name="classes">
-                <xsl:attribute name="value">${basedir}\classes</xsl:attribute>
+            <property name="test">
+                <xsl:attribute name="value">${basedir}\test</xsl:attribute>
+            </property>
+            <property name="build">
+                <xsl:attribute name="value">${basedir}\build</xsl:attribute>
             </property>
-            <property name="bin">
-                <xsl:attribute name="value">${basedir}\bin</xsl:attribute>
+            <property name="classes">
+                <xsl:attribute name="value">${build}\classes</xsl:attribute>
             </property>
-            <property name="other">
-                <xsl:attribute name="value">${basedir}\other</xsl:attribute>
+            <property name="lib">
+                <xsl:attribute name="value">${build}\lib</xsl:attribute>
             </property>
 
-            <!--<property name="xbeans.available" value=""></property>
-            <property name="stax.available" value=""></property>
-            <property name="axis2.available" value=""></property>-->
             <property name="jars.ok" value=""></property>
-            <property name="mappings.folder.name" value="Mapping"></property>
-            <property name="schemas.folder.name" value="schemas"></property>
-
-
-            <target name="move.files" depends="init">
-                <xsl:comment>first move the generated packages</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${src}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes"><xsl:value-of select="$package"></xsl:value-of>\**\</xsl:attribute>
-                    </fileset>
-
-                </move>
-                <xsl:comment>move the adb stuff to the src too</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${src}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">adb\**\</xsl:attribute>
-                    </fileset>
-                </move>
-                <xsl:comment>move the rest of the stuff to the other folder</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${mappings.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${schemas.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-
-            </target>
 
             <target name="init">
                 <mkdir>
-                    <xsl:attribute name="dir">${src}</xsl:attribute>
+                    <xsl:attribute name="dir">${build}</xsl:attribute>
                 </mkdir>
                 <mkdir>
                     <xsl:attribute name="dir">${classes}</xsl:attribute>
                 </mkdir>
                 <mkdir>
-                    <xsl:attribute name="dir">${bin}</xsl:attribute>
+                    <xsl:attribute name="dir">${lib}</xsl:attribute>
                 </mkdir>
-
             </target>
 
-            <target name="pre.compile.test" depends="move.files">
+            <target name="pre.compile.test" depends="init">
                 <xsl:comment>Test the classpath for the availability of necesary classes</xsl:comment>
 
                 <available classname="javax.xml.stream.XMLStreamReader" property="stax.available"/>
@@ -103,9 +63,6 @@
                     <xsl:attribute name="destdir">${classes}</xsl:attribute>
                     <xsl:attribute name="srcdir">${src}</xsl:attribute>
                     <classpath>
-                        <xsl:attribute name="location">${bin}\${xbeans.packaged.jar.name}</xsl:attribute>
-                    </classpath>
-                    <classpath>
                         <xsl:attribute name="location">${java.class.path}</xsl:attribute>
                     </classpath>
                 </javac>
@@ -124,8 +81,13 @@
                 <xsl:attribute name="if">jars.ok</xsl:attribute>
                 <jar>
                     <xsl:attribute name="basedir">${classes}</xsl:attribute>
-                    <xsl:attribute name="destfile">${bin}\service.jar</xsl:attribute>
+                    <xsl:attribute name="destfile">${lib}\service.jar</xsl:attribute>
                 </jar>
+            </target>
+            <target name="clean">
+              <delete>
+                <xsl:attribute name="dir">${build}</xsl:attribute>
+              </delete>
             </target>
         </project>
     </xsl:template>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/defaultAntBuildTemplate.xsl Tue Jan  3 14:57:34 2006
@@ -8,66 +8,34 @@
             <property name="src">
                 <xsl:attribute name="value">${basedir}\src</xsl:attribute>
             </property>
-            <property name="classes">
-                <xsl:attribute name="value">${basedir}\classes</xsl:attribute>
+            <property name="test">
+                <xsl:attribute name="value">${basedir}\test</xsl:attribute>
+            </property>
+            <property name="build">
+                <xsl:attribute name="value">${basedir}\build</xsl:attribute>
             </property>
-            <property name="bin">
-                <xsl:attribute name="value">${basedir}\bin</xsl:attribute>
+            <property name="classes">
+                <xsl:attribute name="value">${build}\classes</xsl:attribute>
             </property>
-            <property name="other">
-                <xsl:attribute name="value">${basedir}\other</xsl:attribute>
+            <property name="lib">
+                <xsl:attribute name="value">${build}\lib</xsl:attribute>
             </property>
 
-            <!--<property name="xbeans.available" value=""></property>
-            <property name="stax.available" value=""></property>
-            <property name="axis2.available" value=""></property>-->
             <property name="jars.ok" value=""></property>
-            <property name="mappings.folder.name" value="Mapping"></property>
-            <property name="schemas.folder.name" value="schemas"></property>
-
-
-            <target name="move.files" depends="init">
-                <xsl:comment>first move the generated packages</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${src}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes"><xsl:value-of select="$package"></xsl:value-of>\**\</xsl:attribute>
-                    </fileset>
-
-                </move>
-                <xsl:comment>move the rest of the stuff to the other folder</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${mappings.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${schemas.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-
-            </target>
 
             <target name="init">
                 <mkdir>
-                    <xsl:attribute name="dir">${src}</xsl:attribute>
+                    <xsl:attribute name="dir">${build}</xsl:attribute>
                 </mkdir>
                 <mkdir>
                     <xsl:attribute name="dir">${classes}</xsl:attribute>
                 </mkdir>
                 <mkdir>
-                    <xsl:attribute name="dir">${bin}</xsl:attribute>
+                    <xsl:attribute name="dir">${lib}</xsl:attribute>
                 </mkdir>
-
             </target>
 
-            <target name="pre.compile.test" depends="move.files">
+            <target name="pre.compile.test" depends="init">
                 <xsl:comment>Test the classpath for the availability of necesary classes</xsl:comment>
 
                 <available classname="javax.xml.stream.XMLStreamReader" property="stax.available"/>

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/xmlbeansAntBuildTemplate.xsl Tue Jan  3 14:57:34 2006
@@ -8,87 +8,47 @@
             <property name="src">
                 <xsl:attribute name="value">${basedir}\src</xsl:attribute>
             </property>
-            <property name="classes">
-                <xsl:attribute name="value">${basedir}\classes</xsl:attribute>
+            <property name="test">
+                <xsl:attribute name="value">${basedir}\test</xsl:attribute>
+            </property>
+            <property name="resources">
+                <xsl:attribute name="value">${basedir}\resources</xsl:attribute>
             </property>
-            <property name="bin">
-                <xsl:attribute name="value">${basedir}\bin</xsl:attribute>
+            <property name="build">
+                <xsl:attribute name="value">${basedir}\build</xsl:attribute>
             </property>
-            <property name="other">
-                <xsl:attribute name="value">${basedir}\other</xsl:attribute>
+            <property name="classes">
+                <xsl:attribute name="value">${build}\classes</xsl:attribute>
             </property>
-            <property name="temp">
-                <xsl:attribute name="value">${basedir}\temp</xsl:attribute>
+            <property name="lib">
+                <xsl:attribute name="value">${build}\lib</xsl:attribute>
             </property>
+
             <property name="xbeans.packaged.jar.name" value="XBeans-packaged.jar"></property>
-            <!--<property name="xbeans.available" value=""></property>
-            <property name="stax.available" value=""></property>
-            <property name="axis2.available" value=""></property>-->
             <property name="jars.ok" value=""></property>
-            <property name="mappings.folder.name" value="Mapping"></property>
-            <property name="schemas.folder.name" value="schemas"></property>
-
-
-            <target name="move.files" depends="init">
-                <xsl:comment>first move the generated packages</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${src}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes"><xsl:value-of select="$package"></xsl:value-of>\**\</xsl:attribute>
-                    </fileset>
-
-                </move>
-                <xsl:comment>move the XBeans stuff to the temp</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${temp}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">schemaorg_apache_xmlbeans\**\</xsl:attribute>
-                    </fileset>
-                </move>
-                <xsl:comment>move the rest of the stuff to the other folder</xsl:comment>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${mappings.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-                <move>
-                    <xsl:attribute name="todir">${other}</xsl:attribute>
-                    <fileset>
-                        <xsl:attribute name="dir">${basedir}</xsl:attribute>
-                        <xsl:attribute name="includes">${schemas.folder.name}\**\</xsl:attribute>
-                    </fileset>
-                </move>
-
-            </target>
 
             <target name="init">
                 <mkdir>
-                    <xsl:attribute name="dir">${src}</xsl:attribute>
+                    <xsl:attribute name="dir">${build}</xsl:attribute>
                 </mkdir>
                 <mkdir>
                     <xsl:attribute name="dir">${classes}</xsl:attribute>
                 </mkdir>
                 <mkdir>
-                    <xsl:attribute name="dir">${bin}</xsl:attribute>
-                </mkdir>
-                <mkdir>
-                    <xsl:attribute name="dir">${temp}</xsl:attribute>
+                    <xsl:attribute name="dir">${lib}</xsl:attribute>
                 </mkdir>
             </target>
 
-            <target name="jar.xbeans" depends="move.files">
-                <!-- jar the  XMLbeans stuff to the bin folder-->
+            <target name="jar.xbeans">
+                <!-- jar the  XMLbeans stuff to the lib folder-->
                 <jar>
-                    <xsl:attribute name="basedir">${temp}</xsl:attribute>
-                    <xsl:attribute name="destfile">${bin}\${xbeans.packaged.jar.name}</xsl:attribute>
+                    <xsl:attribute name="basedir">${resources}</xsl:attribute>
+                    <xsl:attribute name="destfile">${lib}\${xbeans.packaged.jar.name}</xsl:attribute>
+                    <xsl:attribute name="excludes">**/services.xml</xsl:attribute>
                 </jar>
             </target>
 
-            <target name="pre.compile.test" depends="jar.xbeans">
+            <target name="pre.compile.test" depends="init, jar.xbeans">
                 <xsl:comment>Test the classpath for the availability of necesary classes</xsl:comment>
                 <available classname="org.apache.xmlbeans.XmlObject" property="xbeans.available"/>
                 <available classname="javax.xml.stream.XMLStreamReader" property="stax.available"/>
@@ -120,7 +80,7 @@
                     <xsl:attribute name="destdir">${classes}</xsl:attribute>
                     <xsl:attribute name="srcdir">${src}</xsl:attribute>
                     <classpath>
-                        <xsl:attribute name="location">${bin}\${xbeans.packaged.jar.name}</xsl:attribute>
+                        <xsl:attribute name="location">${lib}\${xbeans.packaged.jar.name}</xsl:attribute>
                     </classpath>
                     <classpath>
                         <xsl:attribute name="location">${java.class.path}</xsl:attribute>
@@ -141,8 +101,13 @@
                 <xsl:attribute name="if">jars.ok</xsl:attribute>
                 <jar>
                     <xsl:attribute name="basedir">${classes}</xsl:attribute>
-                    <xsl:attribute name="destfile">${bin}\service.jar</xsl:attribute>
+                    <xsl:attribute name="destfile">${lib}\service.jar</xsl:attribute>
                 </jar>
+            </target>
+            <target name="clean">
+              <delete>
+                <xsl:attribute name="dir">${build}</xsl:attribute>
+              </delete>
             </target>
         </project>
     </xsl:template>

Modified: webservices/axis2/trunk/java/modules/integration/build.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/integration/build.xml?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/build.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/build.xml Tue Jan  3 14:57:34 2006
@@ -91,6 +91,8 @@
         <move todir="${dir.classes}">
             <fileset dir="${dir.src}">
                 <include name="**/schema**/**/*.class"/>
+            </fileset>
+            <fileset dir="${dir.src}/resources">
                 <include name="**/schema**/**/*.xsb"/>
             </fileset>
         </move>

Modified: webservices/axis2/trunk/java/modules/security/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/security/maven.xml?rev=365762&r1=365761&r2=365762&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/security/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/security/maven.xml Tue Jan  3 14:57:34 2006
@@ -68,9 +68,9 @@
 
 		<!-- move/copy schema stuff into class.dir -->
     	<ant:move todir="${class.dir}">
-		    <ant:fileset dir="${work.dir}">
-                <ant:include name="**/schema*/**/*.class"/>
+            <ant:fileset dir="${work.dir}/resources">
                 <ant:include name="**/schema*/**/*.xsb"/>
+                <ant:include name="**/schema*/**/*.class"/>
             </ant:fileset>
 	    </ant:move>