web-services-spring-globalxsds: global project for sharing autogenerated java classes...
authorGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 31 May 2015 23:04:48 +0000 (01:04 +0200)
committerGustavo Martin Morcuende <gu.martinm@gmail.com>
Sun, 31 May 2015 23:35:21 +0000 (01:35 +0200)
web-services-spring-client/src/main/build-resources/catalog.cat [new file with mode: 0644]
web-services-spring-globalxsds/pom.xml [new file with mode: 0644]
web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb [new file with mode: 0644]
web-services-spring-globalxsds/src/main/resources/parent.xsd [new file with mode: 0644]

diff --git a/web-services-spring-client/src/main/build-resources/catalog.cat b/web-services-spring-client/src/main/build-resources/catalog.cat
new file mode 100644 (file)
index 0000000..82fe4bb
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE catalog
+  PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+         "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
+         prefer="public">
+
+<!-- prefer="uri" -->
+
+    <rewriteURI uriStartString="http://gumartinm.name/spring-ws/parent/"
+                rewritePrefix="classpath:/"/>
+
+    <rewriteSystem systemIdStartString="http://gumartinm.name/spring-ws/parent/" rewritePrefix="classpath:/"/>
+</catalog>
diff --git a/web-services-spring-globalxsds/pom.xml b/web-services-spring-globalxsds/pom.xml
new file mode 100644 (file)
index 0000000..89451b9
--- /dev/null
@@ -0,0 +1,101 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <artifactId>web-services-spring</artifactId>
+    <groupId>de.spring.webservices</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+  <artifactId>web-services-spring-globalxsds</artifactId>
+  <name>web-services-spring-globalxsds</name>
+  <url>http://gumartinm.name</url>
+
+  <properties>
+    <project.xsd.schemas.source.path>src/main/resources</project.xsd.schemas.source.path>
+    <project.xsd.schemas.target.path>${basedir}/target/generated-sources/src/main/java</project.xsd.schemas.target.path>
+    <project.xsd.schemas.package.name>de.spring.webservices.auto</project.xsd.schemas.package.name>
+    <project.bindings.path>src/main/build-resources/bindings</project.bindings.path>
+  </properties>
+
+  <dependencies>
+
+    <!-- Unitary and integration tests -->
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <finalName>${project.artifactId}</finalName>
+    <resources>
+        <resource>
+            <directory>${basedir}/src/main/resources</directory>
+            <includes>
+                <include>**/*.*</include>
+            </includes>
+        </resource>
+    </resources>
+    <plugins>
+        <!-- Generate code from xsd files:
+             We could use maven-jaxb2-plugin in order to generate Java classes from XSD files but
+             this plugin seems more useful so, I keep using it. Besides, it is based on Apache CXF which
+             as well, uses jaxb.
+
+             See: http://cxf.apache.org/cxf-xjc-plugin.html
+        -->
+        <plugin>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-xjc-plugin</artifactId>
+            <version>3.0.3</version>
+            <configuration>
+                <fork>true</fork>
+                <extensions>
+                    <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:3.0.3</extension>
+                </extensions>
+            </configuration>
+            <executions>
+                <execution>
+                    <id>generate-sources-from-xsd</id>
+                    <phase>generate-sources</phase>
+                    <goals>
+                        <goal>xsdtojava</goal>
+                    </goals>
+                    <configuration>
+                        <sourceRoot>${project.xsd.schemas.target.path}</sourceRoot>
+                        <xsdOptions>
+                            <xsdOption>
+                                <extension>true</extension>
+                                <xsd>${project.xsd.schemas.source.path}/parent.xsd</xsd>
+                                <bindingFile>${project.bindings.path}/custombinding.xjb</bindingFile>
+                                <packagename>${project.xsd.schemas.package.name}</packagename>
+                            </xsdOption>
+                        </xsdOptions>
+                    </configuration>
+                </execution>
+            </executions>
+         </plugin>
+        <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>build-helper-maven-plugin</artifactId>
+                <version>1.9.1</version>
+                <executions>
+                    <execution>
+                        <id>add-source</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>add-source</goal>
+                        </goals>
+                        <configuration>
+                            <sources>
+                                <source>${project.xsd.schemas.target.path}</source>
+                            </sources>
+                        </configuration>
+                    </execution>
+                </executions>
+          </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb b/web-services-spring-globalxsds/src/main/build-resources/bindings/custombinding.xjb
new file mode 100644 (file)
index 0000000..8b4a110
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
+    jaxb:version="2.1"
+    jaxb:extensionBindingPrefixes="">
+    
+</jaxb:bindings>
diff --git a/web-services-spring-globalxsds/src/main/resources/parent.xsd b/web-services-spring-globalxsds/src/main/resources/parent.xsd
new file mode 100644 (file)
index 0000000..0ce508e
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified"
+    targetNamespace="http://gumartinm.name/spring-ws/parent">
+       
+    <xs:simpleType name="parentEnumType">
+        <xs:restriction base="xs:token">
+            <xs:enumeration value="FIRST"/>
+            <xs:enumeration value="SECOND"/>
+            <xs:enumeration value="THIRD"/>
+            <xs:enumeration value="FOURTH"/>
+            <xs:enumeration value="FIVETH"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>