xmlbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r220227 - in /xmlbeans/trunk: ./ maven-plugin/ maven-plugin/src/ maven-plugin/src/java/ maven-plugin/src/java/org/ maven-plugin/src/java/org/apache/ maven-plugin/src/java/org/apache/xmlbeans/ maven-plugin/src/java/org/apache/xmlbeans/maven/
Date Fri, 22 Jul 2005 01:23:16 GMT
Author: radup
Date: Thu Jul 21 18:23:14 2005
New Revision: 220227

URL: http://svn.apache.org/viewcvs?rev=220227&view=rev
Log:
Adding the maven plugin into the xmlbeans svn tree.
Contributed by David Jencks.

Added:
    xmlbeans/trunk/maven-plugin/
    xmlbeans/trunk/maven-plugin/INSTRUCTIONS.txt
    xmlbeans/trunk/maven-plugin/LICENSE.txt
    xmlbeans/trunk/maven-plugin/NOTICE.txt
    xmlbeans/trunk/maven-plugin/plugin.jelly
    xmlbeans/trunk/maven-plugin/plugin.properties
    xmlbeans/trunk/maven-plugin/project.properties
    xmlbeans/trunk/maven-plugin/project.xml
    xmlbeans/trunk/maven-plugin/src/
    xmlbeans/trunk/maven-plugin/src/java/
    xmlbeans/trunk/maven-plugin/src/java/org/
    xmlbeans/trunk/maven-plugin/src/java/org/apache/
    xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/
    xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/
    xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
Modified:
    xmlbeans/trunk/KEYS

Modified: xmlbeans/trunk/KEYS
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/KEYS?rev=220227&r1=220226&r2=220227&view=diff
==============================================================================
--- xmlbeans/trunk/KEYS (original)
+++ xmlbeans/trunk/KEYS Thu Jul 21 18:23:14 2005
@@ -126,6 +126,7 @@
      Key fingerprint = A004 7A3C 02DA 01B5 7974  1890 6899 C8E2 3926 D7DD
 sig 3       3926D7DD 2005-06-27   Radu Preotiuc <radup@apache.org>
 sig         4159EADB 2005-07-10   Cliff Schmidt <cliffs@apache.org>
+sig         46914992 2005-07-13   Cezar Cristian Andrei <cezar@apache.org>
 sub  1024g/408A5399 2005-06-27
 sig         3926D7DD 2005-06-27   Radu Preotiuc <radup@apache.org>
 

Added: xmlbeans/trunk/maven-plugin/INSTRUCTIONS.txt
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/INSTRUCTIONS.txt?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/INSTRUCTIONS.txt (added)
+++ xmlbeans/trunk/maven-plugin/INSTRUCTIONS.txt Thu Jul 21 18:23:14 2005
@@ -0,0 +1,68 @@
+Some brief instructions for using the maven xmlbeans2 plugin
+
+1. Include something like this in your maven.xml:
+namespace declaration:
+
+    xmlns:xmlbeans="xmlbeans:maven"
+
+    <preGoal name="java:compile">
+        <xmlbeans:schema2java
+            sourcedir="${basedir}/src"
+            sourceschema="j2ee_1_4schema/application_1_4.xsd,j2ee_1_4schema/j2ee_jaxrpc_mapping_1_1.xsd,j2ee_1_3schema/connector_1_0.xsd"
+            xmlconfigs="${basedir}/src/conf/xmlconfig.xml"
+            targetdir="${basedir}/target/xmlbeans"
+            cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
+    </preGoal>
+
+where 
+
+sourcedir is a base directory for the list in sourceschema
+sourceschema is a comma-delimited list of all the schemas you want to compile
+xmlconfigs points to your xmlconfig.xml file
+targetdir is where you want generated java source to appear
+cataloglocation is the location of an entity resolver catalog to use for resolving namespace
to schema locations.
+
+The generated binary files, both .xsd and the TypeHolder class, will end up in the target/classes
directory.
+
+In addition, you can add precompiled schemas to the "schema classpath" by including them
as
+dependencies in project.xml with a properties tag like this:
+
+        <dependency>
+            <groupId>geronimo</groupId>
+            <artifactId>geronimo-naming-builder</artifactId>
+            <version>${pom.currentVersion}</version>
+            <properties>
+                <xmlbeans>true</xmlbeans>
+            </properties>
+        </dependency>
+
+You will probably also want to add a dependency on the plugin to your project.xml file and
the other dependencies if you use xmlbeans in unit tests:
+
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xmlbeans-maven-plugin</artifactId>
+            <version>2.0-beta1</version>
+            <type>plugin</type>
+        </dependency>
+
+        <!-- needed for xmlbeans runtime-->
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+            <version>${xmlbeans_version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax</artifactId>
+            <version>${stax_version}</version>
+        </dependency>
+    
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>${stax_api_version}</version>
+        </dependency>
+    
+
+

Added: xmlbeans/trunk/maven-plugin/LICENSE.txt
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/LICENSE.txt?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/LICENSE.txt (added)
+++ xmlbeans/trunk/maven-plugin/LICENSE.txt Thu Jul 21 18:23:14 2005
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   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.
+

Added: xmlbeans/trunk/maven-plugin/NOTICE.txt
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/NOTICE.txt?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/NOTICE.txt (added)
+++ xmlbeans/trunk/maven-plugin/NOTICE.txt Thu Jul 21 18:23:14 2005
@@ -0,0 +1,3 @@
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).
+

Added: xmlbeans/trunk/maven-plugin/plugin.jelly
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/plugin.jelly?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/plugin.jelly (added)
+++ xmlbeans/trunk/maven-plugin/plugin.jelly Thu Jul 21 18:23:14 2005
@@ -0,0 +1,104 @@
+<?xml version="1.0"?>
+<!--
+
+    Copyright 2004-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.
+-->
+
+<!-- ================================================================== -->
+<!-- xmlbeans v2 maven plugin                                           -->
+<!-- ================================================================== -->
+<project xmlns:j="jelly:core"
+    xmlns:u="jelly:util"
+    xmlns:ant="jelly:ant"
+    xmlns:maven="jelly:maven"
+    xmlns:define="jelly:define"
+    xmlns:xmlbeans="xmlbeans2:maven"
+    >
+
+    <define:taglib uri="xmlbeans2:maven">
+        <define:jellybean
+            name="SchemaCompilerWrapper"
+            className="org.apache.xmlbeans.maven.SchemaCompilerWrapper"
+            method="compileSchemas"/>
+
+
+        <define:tag name="schema2java" xmlns="jelly:ant">
+
+            <j:if test="${context.getVariable('maven.xmlbeans2.targetdir') == null}">
+                <fail>Missing required attribute: maven.xmlbeans2.targetdir</fail>
+            </j:if>
+            <j:if test="${context.getVariable('maven.xmlbeans2.sourcedir') == null}">
+                <fail>Missing required attribute: maven.xmlbeans2.sourcedir</fail>
+            </j:if>
+            <j:if test="${context.getVariable('maven.xmlbeans2.sourceschema') == null}">
+                <fail>Missing required attribute: maven.xmlbeans2.sourceschema</fail>
+            </j:if>
+            <j:if test="${context.getVariable('maven.xmlbeans2.xmlconfigs') == null}">
+                <fail>Missing required attribute: maven.xmlbeans2.xmlconfigs</fail>
+            </j:if>
+            <!-- set up classpath for already-compiled schemas -->
+            <j:forEach var="artifact" items="${pom.artifacts}">
+                <j:set var="dependency" value="${artifact.dependency}"/>
+                <j:if test="${dependency.getProperty('xmlbeans') == 'true'}">
+                    <j:set var="xmlbeans.classpath" value="${xmlbeans.classpath},${artifact.path}"/>
+                </j:if>
+            </j:forEach>
+
+            <j:jelly xmlns="jelly:ant">
+
+                <j:set var="uptodatePropName" value="xmlbeans.uptodate"/>
+                <j:expr value="${context.setVariable(uptodatePropName, null)}"/>
+                <j:set var="uptodateFile" value="${maven.xmlbeans2.targetdir}/tstamp"/>
+
+                <uptodate property="${uptodatePropName}"
+                    targetfile="${uptodateFile}">
+                    <srcfiles dir="${maven.xmlbeans2.sourcedir}"
+                        includes="${maven.xmlbeans2.sourceschema}"/>
+                </uptodate>
+
+
+                <xmlbeans:SchemaCompilerWrapper
+                    sourceDir="${maven.xmlbeans2.sourcedir}"
+                    sourceSchemas="${maven.xmlbeans2.sourceschema}"
+                    xmlConfigs="${maven.xmlbeans2.xmlconfigs}"
+                    javaTargetDir="${maven.xmlbeans2.targetdir}"
+                    classTargetDir="${maven.build.dest}"
+                    catalogLocation="${maven.xmlbeans2.cataloglocation}"
+                    classPath="${xmlbeans.classpath}"
+                    resources="${pom.build.resources}"
+                    buildSchemas="${context.getVariable(uptodatePropName) == null}"
+                    baseSchemaLocation="${maven.xmlbeans2.baseSchemaLocation}"
+                    />
+                <j:if test="${context.getVariable(uptodatePropName) == null}">
+                    <touch file="${uptodateFile}"/>
+                </j:if>
+
+                <path id="maven.xmlbeans.compile.src.set"
+                    location="${maven.xmlbeans2.targetdir}"/>
+                <j:if test="${context.antProject.getReference('maven.compile.src.set')
!= null}">
+                    <maven:addPath id="maven.compile.src.set"
+                        refid="maven.xmlbeans.compile.src.set"/>
+                </j:if>
+                <j:if test="${context.antProject.getReference('maven.compile.src.set')
== null}">
+                    <echo message="Maven cannot find the generated sources unless you
provide a dummy source directory in project.xml"/>
+                </j:if>
+
+            </j:jelly>
+        </define:tag>
+
+
+    </define:taglib>
+
+</project>
\ No newline at end of file

Added: xmlbeans/trunk/maven-plugin/plugin.properties
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/plugin.properties?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/plugin.properties (added)
+++ xmlbeans/trunk/maven-plugin/plugin.properties Thu Jul 21 18:23:14 2005
@@ -0,0 +1,50 @@
+#    Copyright 2003-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.
+
+#These properties can be set in a project.properties file or in an invocation in maven.xml
+#dependencies marked with the property <xmlbeans>true</xmlbeans> will get included
in the xmlbeans classpath
+#so you can reuse your xmlbeans generated classes.
+
+#a typical invocation looks like:
+#<project default="default"
+#    xmlns:xmlbeans="xmlbeans2:maven">
+#
+#    <preGoal name="java:compile">
+#        <xmlbeans:schema2java
+#            maven.xmlbeans2.sourceschema="application_1_4.xsd,j2ee_jaxrpc_mapping_1_1.xsd"
+#            maven.xmlbeans2.cataloglocation="${basedir}/src/catalog/resolver-catalog.xml"/>
+#    </preGoal>
+
+
+#base location for schemas to compile
+maven.xmlbeans2.sourcedir=${basedir}/src/schema
+
+#comma separated list of schemas to compile, relative to sourcedir above. You must specify
this explicitly
+maven.xmlbeans2.sourceschema=
+
+#location of the xmlbeans configuration file
+maven.xmlbeans2.xmlconfigs=${basedir}/src/schema/xmlconfig.xml
+
+#location of an xml catalog. If you use one, you must specify the location yourself.
+maven.xmlbeans2.cataloglocation=
+
+#target directory for generated java code.  Binary artifacts are place directly into target/classes.
+maven.xmlbeans2.targetdir=${basedir}/target/xmlbeans
+
+#default base location where schemas will be copied. Unlike the ant task,
+#they will include the path of the schema listed in the sourceSchemas parameter.
+maven.xmlbeans2.baseSchemaLocation=schemaorg_apache_xmlbeans/src
+
+
+

Added: xmlbeans/trunk/maven-plugin/project.properties
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/project.properties?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/project.properties (added)
+++ xmlbeans/trunk/maven-plugin/project.properties Thu Jul 21 18:23:14 2005
@@ -0,0 +1,28 @@
+#    Copyright 2003-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.
+
+maven.multiproject.type=plugin
+
+maven.repo.central=apache.org
+maven.repo.central.directory=/www/cvs.apache.org/repository
+
+maven.remote.group=apcvs
+
+maven.compile.source=1.4
+maven.compile.target=1.4
+#maven.compile.deprecation=true
+maven.compile.debug=true
+maven.compile.optimize=true
+
+

Added: xmlbeans/trunk/maven-plugin/project.xml
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/project.xml?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/project.xml (added)
+++ xmlbeans/trunk/maven-plugin/project.xml Thu Jul 21 18:23:14 2005
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    Copyright 2004 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>
+    <pomVersion>3</pomVersion>
+
+    <groupId>xmlbeans</groupId>
+    <id>xmlbeans-maven-plugin</id>
+    <currentVersion>2.0.0-beta1</currentVersion>
+    <name>xmlbeans maven plugin</name>
+    <organization>
+        <name>Apache Software Foundation</name>
+        <url>http://www.apache.org/</url>
+        <logo></logo>
+    </organization>
+    <inceptionYear>2004</inceptionYear>
+    <package>org.apache.xmlbeans.maven</package>
+    <logo></logo>
+
+    <dependencies>
+        <dependency>
+            <groupId>xml-resolver</groupId>
+            <artifactId>xml-resolver</artifactId>
+            <version>1.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>xmlbeans</groupId>
+            <artifactId>xbean</artifactId>
+            <version>2.0.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>stax</groupId>
+            <artifactId>stax-api</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>maven</groupId>
+            <artifactId>maven</artifactId>
+            <version>1.0.2</version>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <sourceDirectory>src/java</sourceDirectory>
+        <unitTestSourceDirectory>src/test</unitTestSourceDirectory>
+
+        <unitTest>
+            <includes>
+                <include>**/*Test.java</include>
+            </includes>
+        </unitTest>
+
+        <resources>
+            <resource>
+                <directory>src/plugin-resources</directory>
+                <targetPath>plugin-resources</targetPath>
+            </resource>
+            <resource>
+                <directory>.</directory>
+                <includes>
+                    <include>plugin.jelly</include>
+                    <include>plugin.properties</include>
+                    <include>project.properties</include>
+                    <include>project.xml</include>
+                </includes>
+            </resource>
+        </resources>
+    </build>
+</project>

Added: xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
URL: http://svn.apache.org/viewcvs/xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java?rev=220227&view=auto
==============================================================================
--- xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
(added)
+++ xmlbeans/trunk/maven-plugin/src/java/org/apache/xmlbeans/maven/SchemaCompilerWrapper.java
Thu Jul 21 18:23:14 2005
@@ -0,0 +1,270 @@
+/**
+ *
+ * Copyright 2003-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.
+ */
+
+package org.apache.xmlbeans.maven;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.apache.maven.project.Resource;
+import org.apache.xml.resolver.CatalogManager;
+import org.apache.xml.resolver.tools.CatalogResolver;
+import org.apache.xmlbeans.impl.tool.SchemaCompiler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+
+/**
+ *
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
+ *
+ * */
+public class SchemaCompilerWrapper {
+
+    private String sourceDir;
+    private String sourceSchemas;
+    private String xmlConfigs;
+    private String javaTargetDir;
+    private String classTargetDir;
+    private String catalogLocation;
+    private String classPath;
+    private List resources;
+    private boolean buildSchemas;
+    //this copy should not end in /
+    private String baseSchemaLocation = "schemaorg_apache_xmlbeans/src";
+
+    public String getSourceDir() {
+        return sourceDir;
+    }
+
+    public void setSourceDir(String sourceDir) {
+        this.sourceDir = sourceDir;
+    }
+
+    public String getSourceSchemas() {
+        return sourceSchemas;
+    }
+
+    public void setSourceSchemas(String sourceSchemas) {
+        this.sourceSchemas = sourceSchemas;
+    }
+
+    public String getXmlConfigs() {
+        return xmlConfigs;
+    }
+
+    public void setXmlConfigs(String xmlConfigs) {
+        this.xmlConfigs = xmlConfigs;
+    }
+
+    public String getJavaTargetDir() {
+        return javaTargetDir;
+    }
+
+    public void setJavaTargetDir(String javaTargetDir) {
+        this.javaTargetDir = javaTargetDir;
+    }
+
+    public String getClassTargetDir() {
+        return classTargetDir;
+    }
+
+    public void setClassTargetDir(String classTargetDir) {
+        this.classTargetDir = classTargetDir;
+    }
+
+    public String getCatalogLocation() {
+        return catalogLocation;
+    }
+
+    public void setCatalogLocation(String catalogLocation) {
+        this.catalogLocation = catalogLocation;
+    }
+
+    public String getClassPath() {
+        return classPath;
+    }
+
+    public void setClassPath(String classPath) {
+        this.classPath = classPath;
+    }
+
+    public List getResources() {
+        return resources;
+    }
+
+    public void setResources(List resources) {
+        this.resources = resources;
+    }
+
+    public boolean isBuildSchemas() {
+        return buildSchemas;
+    }
+
+    public void setBuildSchemas(boolean buildSchemas) {
+        this.buildSchemas = buildSchemas;
+    }
+
+    public String getBaseSchemaLocation() {
+        return baseSchemaLocation;
+    }
+
+    public void setBaseSchemaLocation(String baseSchemaLocation) {
+        if (baseSchemaLocation != null && !(baseSchemaLocation.length() == 0)) {
+            this.baseSchemaLocation = baseSchemaLocation;
+        }
+    }
+
+    public void compileSchemas() throws Exception {
+        List schemas = new ArrayList();
+        File base = new File(sourceDir);
+        Resource resource = new Resource();
+        resource.setDirectory(sourceDir);
+        resource.setTargetPath(baseSchemaLocation);
+        for (StringTokenizer st = new StringTokenizer(sourceSchemas, ","); st.hasMoreTokens();)
{
+            String schemaName = st.nextToken();
+            schemas.add(new File(base, schemaName));
+            resource.addInclude(schemaName);
+        }
+        resources.add(resource);
+        if (buildSchemas) {
+            List configs = new ArrayList();
+
+            if (xmlConfigs != null) {
+                for (StringTokenizer st = new StringTokenizer(xmlConfigs, ","); st.hasMoreTokens();)
{
+                    String configName = st.nextToken();
+                    configs.add(new File(configName));
+                }
+            }
+            List classPathList = new ArrayList();
+            List urls = new ArrayList();
+            if (classPath != null) {
+                for (StringTokenizer st = new StringTokenizer(classPath, ","); st.hasMoreTokens();)
{
+                    String classpathElement = st.nextToken();
+                    File file = new File(classpathElement);
+                    classPathList.add(file);
+                    urls.add(file.toURL());
+                    System.out.println("Adding to classpath: " + file);
+                }
+            }
+            ClassLoader cl = new URLClassLoader((URL[]) urls.toArray(new URL[] {}));
+            EntityResolver entityResolver = null;
+            if (catalogLocation != null) {
+                CatalogManager catalogManager = CatalogManager.getStaticManager();
+                catalogManager.setCatalogFiles(catalogLocation);
+                entityResolver = new CatalogResolver();
+            }
+            URI sourceDirURI = new File(sourceDir).toURI();
+            entityResolver = new PassThroughResolver(cl, entityResolver, sourceDirURI, baseSchemaLocation);
+
+            SchemaCompiler.Parameters params = new SchemaCompiler.Parameters();
+            params.setBaseDir(null);
+            params.setXsdFiles((File[])schemas.toArray(new File[] {}));
+            params.setWsdlFiles(new File[] {});
+            params.setJavaFiles(new File[] {});
+            params.setConfigFiles((File[])configs.toArray(new File[] {}));
+            params.setClasspath((File[])classPathList.toArray(new File[] {}));
+            params.setOutputJar(null);
+            params.setName(null);
+            params.setSrcDir(new File(javaTargetDir));
+            params.setClassesDir(new File(classTargetDir));
+            params.setCompiler(null);
+            params.setMemoryInitialSize(null);
+            params.setMemoryMaximumSize(null);
+            params.setNojavac(true);
+            params.setQuiet(false);
+            params.setVerbose(true);
+            params.setDownload(false);
+            params.setNoUpa(false);
+            params.setNoPvr(false);
+            params.setDebug(true);
+            params.setErrorListener(new ArrayList());
+            params.setRepackage(null);
+            params.setExtensions(null);
+            params.setMdefNamespaces(null);
+            params.setEntityResolver(entityResolver);
+
+            boolean result = SchemaCompiler.compile(params);
+            if (!result) {
+                Collection errors = params.getErrorListener();
+                for (Iterator iterator = errors.iterator(); iterator.hasNext();) {
+                    Object o = (Object) iterator.next();
+                    System.out.println("xmlbeans error: " + o);
+                }
+                throw new Exception("Schema compilation failed");
+            }
+        }
+
+    }
+
+    private static class PassThroughResolver implements EntityResolver {
+        private final ClassLoader cl;
+        private final EntityResolver delegate;
+        private final URI sourceDir;
+        //this copy has an / appended
+        private final String baseSchemaLocation;
+
+        public PassThroughResolver(ClassLoader cl, EntityResolver delegate, URI sourceDir,
String baseSchemaLocation) {
+            this.cl = cl;
+            this.delegate = delegate;
+            this.sourceDir = sourceDir;
+            this.baseSchemaLocation = baseSchemaLocation + "/";
+        }
+        public InputSource resolveEntity(String publicId,
+                                         String systemId)
+                throws SAXException, IOException {
+            if (delegate != null) {
+                InputSource is = delegate.resolveEntity(publicId, systemId);
+                if (is != null) {
+                    return is;
+                }
+            }
+            System.out.println("Could not resolve publicId: " + publicId + ", systemId: "
+ systemId + " from catalog");
+            String localSystemId;
+            try {
+                 localSystemId = sourceDir.relativize(new URI(systemId)).toString();
+            } catch (URISyntaxException e) {
+                throw (IOException)new IOException("Could not relativeize systemId").initCause(e);
+            }
+            InputStream in = cl.getResourceAsStream(localSystemId);
+            if (in != null) {
+                System.out.println("found in classpath at: " + localSystemId);
+                return new InputSource(in);
+            }
+            in = cl.getResourceAsStream(baseSchemaLocation + localSystemId);
+            if (in != null) {
+                System.out.println("found in classpath at: META-INF/" + localSystemId);
+                return new InputSource(in);
+            }
+            System.out.println("Not found in classpath, looking in current directory: " +
systemId);
+            return new InputSource(systemId);
+        }
+
+    }
+}



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


Mime
View raw message