geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r431110 - in /geronimo/xbean/trunk: maven-xbean-plugin/src/main/java/org/apache/xbean/maven/ xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/
Date Sat, 12 Aug 2006 23:04:00 GMT
Author: gnodet
Date: Sat Aug 12 16:03:59 2006
New Revision: 431110

URL: http://svn.apache.org/viewvc?rev=431110&view=rev
Log:
XBEAN-43: The metadata generator should create the spring.schemas property file

Modified:
    geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
    geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java

Modified: geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java?rev=431110&r1=431109&r2=431110&view=diff
==============================================================================
--- geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
(original)
+++ geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
Sat Aug 12 16:03:59 2006
@@ -122,7 +122,7 @@
             }
             MappingLoader mappingLoader = new QdoxMappingLoader(namespace, new File[] { srcDir
}, excludedClasses);
             GeneratorPlugin[] plugins = new GeneratorPlugin[]{
-                new XmlMetadataGenerator(this, outputDir.getAbsolutePath()),
+                new XmlMetadataGenerator(this, outputDir.getAbsolutePath(), schema),
                 new DocumentationGenerator(this, schema),
                 new XsdGenerator(this, schema)
             };

Modified: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java?rev=431110&r1=431109&r2=431110&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
(original)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/MappingGeneratorTask.java
Sat Aug 12 16:03:59 2006
@@ -95,7 +95,7 @@
             MappingLoader mappingLoader = new QdoxMappingLoader(namespace, getFiles(srcDir),
excludedClasses);
 
             GeneratorPlugin[] plugins = new GeneratorPlugin[]{
-                new XmlMetadataGenerator(this, metaInfDir),
+                new XmlMetadataGenerator(this, metaInfDir, destFile),
                 new DocumentationGenerator(this, destFile),
                 new XsdGenerator(this, destFile)
             };

Modified: geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java?rev=431110&r1=431109&r2=431110&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
(original)
+++ geronimo/xbean/trunk/xbean-spring-common/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
Sat Aug 12 16:03:59 2006
@@ -20,6 +20,7 @@
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.net.URI;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -36,12 +37,14 @@
 public class XmlMetadataGenerator implements GeneratorPlugin {
     private final String metaInfDir;
     private final LogFacade log;
+    private final File schema;
     
     public static final String NAMESPACE_HANDLER = "org.apache.xbean.spring.context.v2.XBeanNamespaceHandler";
 
-    public XmlMetadataGenerator(LogFacade log, String metaInfDir) {
+    public XmlMetadataGenerator(LogFacade log, String metaInfDir, File schema) {
         this.metaInfDir = metaInfDir;
         this.log = log;
+        this.schema = schema;
     }
 
     public void generate(NamespaceMapping namespaceMapping) throws IOException {
@@ -68,6 +71,18 @@
             out.println(namespace.replaceAll(":", "\\\\:") + "=" + NAMESPACE_HANDLER);
         } finally {
             out.close();
+        }
+
+        if (schema != null) {
+            String cp = new File(metaInfDir).toURI().relativize(schema.toURI()).toString();
+            file = new File(metaInfDir, "META-INF/spring.schemas");
+            log.log("Generating Spring 2.0 schema mapping: " + file + " for namespace: "
+ namespace);
+            out = new PrintWriter(new FileWriter(file));
+            try {
+                out.println(namespace.replaceAll(":", "\\\\:") + "=" + cp);
+            } finally {
+                out.close();
+            }
         }
     }
 



Mime
View raw message