camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r823255 - in /camel/branches/camel-1.x: components/camel-spring/ components/camel-spring/src/main/java/org/apache/camel/spring/handler/ components/camel-spring/src/main/resources/META-INF/ parent/
Date Thu, 08 Oct 2009 18:21:07 GMT
Author: gnodet
Date: Thu Oct  8 18:21:06 2009
New Revision: 823255

URL: http://svn.apache.org/viewvc?rev=823255&view=rev
Log:
CAMEL-2021: schema versioning for camel-spring schema

Modified:
    camel/branches/camel-1.x/components/camel-spring/pom.xml
    camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
    camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.handlers
    camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.schemas
    camel/branches/camel-1.x/parent/pom.xml

Modified: camel/branches/camel-1.x/components/camel-spring/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/pom.xml?rev=823255&r1=823254&r2=823255&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-spring/pom.xml (original)
+++ camel/branches/camel-1.x/components/camel-spring/pom.xml Thu Oct  8 18:21:06 2009
@@ -186,33 +186,6 @@
         <artifactId>maven-antrun-plugin</artifactId>
         <executions>
           <execution>
-            <id>process-sources</id>
-            <phase>process-sources</phase>
-            <configuration>
-              <tasks>
-                <echo>Copying to code together for the XSD generation</echo>
-
-                <mkdir dir="${project.build.directory}/schema-src" />
-                <copy todir="${project.build.directory}/schema-src">
-                  <fileset dir="${basedir}/src/main/java">
-                    <include name="org/apache/camel/spring/Camel*.java" />
-                    <include name="org/apache/camel/spring/Endpoint*.java" />
-                    <include name="org/apache/camel/spring/package-info.java" />
-                  </fileset>
-                  <fileset dir="${basedir}/../../camel-core/src/main/java">
-                    <include name="org/apache/camel/model/**/*.java" />
-                    <include name="org/apache/camel/ExchangePattern.java" />
-                    <include name="org/apache/camel/package-info.java" />
-                  </fileset>
-                </copy>
-              </tasks>
-            </configuration>
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-
-          <execution>
             <id>package</id>
             <phase>package</phase>
             <configuration>
@@ -286,26 +259,6 @@
     <pluginManagement>
       <plugins>
           <plugin>
-            <groupId>com.sun.tools.jxc.maven2</groupId>
-            <artifactId>maven-jaxb-schemagen-plugin</artifactId>
-            <executions>
-              <execution>
-                <phase>process-sources</phase>
-                <configuration>
-                  <destdir>${project.build.directory}/schema</destdir>
-                  <srcdir>${project.build.directory}/schema-src</srcdir>
-                  <schemas>
-                    <schema>
-                      <namespace>http://activemq.apache.org/camel/schema/spring</namespace>
-                      <file>camel-spring.xsd</file>
-                    </schema>
-                  </schemas>
-                  <!--<verbose>false</verbose>-->
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>  
-          <plugin>
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-dependency-plugin</artifactId>  
             <configuration>
@@ -317,7 +270,7 @@
                   <type>jar</type>
                   <overWrite>false</overWrite>
                   <outputDirectory>${project.build.directory}/schema</outputDirectory>
-                  <includes>camel-spring.xsd</includes>
+                  <includes>*.xsd</includes>
                 </artifactItem>
               </artifactItems>
             </configuration>
@@ -370,13 +323,46 @@
       <build>
         <plugins>
           <plugin>
-            <groupId>com.sun.tools.jxc.maven2</groupId>
-            <artifactId>maven-jaxb-schemagen-plugin</artifactId>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-antrun-plugin</artifactId>
             <executions>
               <execution>
+                <id>process-sources</id>
                 <phase>process-sources</phase>
+                      <configuration>
+                          <tasks>
+                              <taskdef name="schemagen" classname="com.sun.tools.jxc.SchemaGenTask"
classpathref="maven.plugin.classpath"/>
+
+                              <echo>Copying to code together for the XSD generation</echo>
+                              <mkdir dir="${project.build.directory}/schema-src" />
+                              <copy todir="${project.build.directory}/schema-src">
+                                <fileset dir="${basedir}/src/main/java">
+                                  <include name="org/apache/camel/spring/Camel*.java"
/>
+                                  <include name="org/apache/camel/spring/Endpoint*.java"
/>
+                                  <include name="org/apache/camel/spring/package-info.java"
/>
+                                </fileset>
+                                <fileset dir="${basedir}/../../camel-core/src/main/java">
+                                  <include name="org/apache/camel/model/**/*.java" />
+                                  <include name="org/apache/camel/ExchangePattern.java"
/>
+                                  <include name="org/apache/camel/package-info.java" />
+                                </fileset>
+                              </copy>
+
+                              <echo>Generating XSD schema</echo>
+                              <mkdir dir="${project.build.directory}/schema" />
+                              <schemagen srcdir="${project.build.directory}/schema-src"
destdir="${project.build.directory}/schema">
+                                  <schema namespace="http://activemq.apache.org/camel/schema/spring"
file="camel-spring.xsd"/>
+                                  <classpath refid="maven.compile.classpath"/>
+                              </schemagen>
+                              <copy file="${project.build.directory}/schema/camel-spring.xsd"
+                                    tofile="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"/>
+                              <replace file="${project.build.directory}/schema/camel-spring-v${camel.schema.version}.xsd"
+                                       token="http://activemq.apache.org/camel/schema/spring"
value="http://activemq.apache.org/camel/schema/spring/v${camel.schema.version}"/>
+
+                          </tasks>
+                      </configuration>
                 <goals>
-                  <goal>generate</goal>
+                  <goal>run</goal>
                 </goals>
               </execution>
             </executions>
@@ -407,10 +393,6 @@
               </execution>
             </executions>
           </plugin>                  
-          <plugin>
-            <groupId>com.sun.tools.jxc.maven2</groupId>
-            <artifactId>maven-jaxb-schemagen-plugin</artifactId>
-          </plugin>
         </plugins>
       </build>
     </profile>    
@@ -437,10 +419,6 @@
               </execution>
             </executions>
           </plugin>                          
-          <plugin>
-            <groupId>com.sun.tools.jxc.maven2</groupId>
-            <artifactId>maven-jaxb-schemagen-plugin</artifactId>
-          </plugin>
         </plugins>
       </build>
     </profile>      

Modified: camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java?rev=823255&r1=823254&r2=823255&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
(original)
+++ camel/branches/camel-1.x/components/camel-spring/src/main/java/org/apache/camel/spring/handler/CamelNamespaceHandler.java
Thu Oct  8 18:21:06 2009
@@ -27,6 +27,7 @@
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
 
+import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -59,12 +60,27 @@
 public class CamelNamespaceHandler extends NamespaceHandlerSupport {
 
     private static final transient Log LOG = LogFactory.getLog(CamelNamespaceHandler.class);
+    private static final String SPRING_NS = "http://activemq.apache.org/camel/schema/spring";
+
     protected BeanDefinitionParser endpointParser = new BeanDefinitionParser(EndpointFactoryBean.class);
     protected BeanDefinitionParser beanPostProcessorParser = new BeanDefinitionParser(CamelBeanPostProcessor.class);
     protected Set<String> parserElementNames = new HashSet<String>();
     private JAXBContext jaxbContext;
     private Map<String, BeanDefinitionParser> parserMap = new HashMap<String, BeanDefinitionParser>();
 
+    public static void renameNamespaceRecursive(Node node) {
+        if (node.getNodeType() == Node.ELEMENT_NODE) {
+            Document doc = node.getOwnerDocument();
+            if (((Element) node).getNamespaceURI().startsWith(SPRING_NS + "/v")) {
+                doc.renameNode(node, SPRING_NS, node.getNodeName());
+            }
+        }
+        NodeList list = node.getChildNodes();
+        for (int i = 0; i < list.getLength(); ++i) {
+            renameNamespaceRecursive(list.item(i));
+        }
+    }
+
     public ModelFileGenerator createModelFileGenerator() throws JAXBException {
         return new ModelFileGenerator(getJaxbContext());
     }
@@ -183,6 +199,7 @@
 
         @Override
         protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder
builder) {
+            renameNamespaceRecursive(element);
             super.doParse(element, parserContext, builder);
 
             String contextId = element.getAttribute("id");

Modified: camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.handlers
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.handlers?rev=823255&r1=823254&r2=823255&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.handlers
(original)
+++ camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.handlers
Thu Oct  8 18:21:06 2009
@@ -16,3 +16,4 @@
 #
 
 http\://activemq.apache.org/camel/schema/spring=org.apache.camel.spring.handler.CamelNamespaceHandler
+http\://activemq.apache.org/camel/schema/spring/v${camel.schema.version}=org.apache.camel.spring.handler.CamelNamespaceHandler

Modified: camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.schemas
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.schemas?rev=823255&r1=823254&r2=823255&view=diff
==============================================================================
--- camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.schemas
(original)
+++ camel/branches/camel-1.x/components/camel-spring/src/main/resources/META-INF/spring.schemas
Thu Oct  8 18:21:06 2009
@@ -16,6 +16,8 @@
 #
 
 http\://activemq.apache.org/camel/schema/spring/camel-spring.xsd=camel-spring.xsd
+http\://activemq.apache.org/camel/schema/spring=camel-spring.xsd
+http\://activemq.apache.org/camel/schema/spring/v${camel.schema.version}=camel-spring-v${camel.schema.version}.xsd
 
 http\://activemq.apache.org/camel/schema/spring/camel-spring-1.0.0.xsd=camel-spring.xsd
 http\://activemq.apache.org/camel/schema/spring/camel-spring-1.1.0.xsd=camel-spring.xsd

Modified: camel/branches/camel-1.x/parent/pom.xml
URL: http://svn.apache.org/viewvc/camel/branches/camel-1.x/parent/pom.xml?rev=823255&r1=823254&r2=823255&view=diff
==============================================================================
--- camel/branches/camel-1.x/parent/pom.xml (original)
+++ camel/branches/camel-1.x/parent/pom.xml Thu Oct  8 18:21:06 2009
@@ -959,9 +959,11 @@
                                <propertyregex property="ov.p3a" input="${ov.p3}" regexp="(\..+)"
replace="\1" defaultValue=".0"/>
                                <propertyregex property="ov.p4a" input="${ov.p4}" regexp="(\..+)"
replace="\1" defaultValue=""/>
                                <property name="ov" value="${ov.p1a}${ov.p2a}${ov.p3a}${ov.p4a}"/>
+                               <property name="os" value="${ov.p1a}${ov.p2a}"/>
                                <echo message="OSGi version:    ${ov}" />
                                <mkdir dir="target"/>
-                               <echo message="camel.osgi.version.clean = ${ov}" file="target/camel.osgi.version.txt"/>
+                               <echo message="camel.osgi.version.clean = ${ov}${line.separator}"
file="target/camel.osgi.version.txt"/>
+                               <echo message="camel.schema.version = ${os}${line.separator}"
file="target/camel.osgi.version.txt" append="true"/>
                            </tasks>
                        </configuration>
                        <goals>



Mime
View raw message