geronimo-xbean-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r573629 - in /geronimo/xbean/trunk: maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java xbean-spring/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
Date Fri, 07 Sep 2007 16:40:28 GMT
Author: chirino
Date: Fri Sep  7 09:40:27 2007
New Revision: 573629

URL: http://svn.apache.org/viewvc?rev=573629&view=rev
Log:
Added some configuration options to the xbean maven plugin so that you can disable it from
generating the spring.schema and spring.handler files.  Some projects might want to futher
customize these files and don't want the xbean generated versions.


Modified:
    geronimo/xbean/trunk/maven-xbean-plugin/src/main/java/org/apache/xbean/maven/XBeanMojo.java
    geronimo/xbean/trunk/xbean-spring/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=573629&r1=573628&r2=573629&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
Fri Sep  7 09:40:27 2007
@@ -109,8 +109,18 @@
      * @parameter schemaAsArtifact
      */
     private boolean schemaAsArtifact = true;
+    
+    /**
+     * @parameter 
+     */
+    private boolean generateSpringSchemasFile = true;
 
     /**
+     * @parameter 
+     */
+    private boolean generateSpringHandlersFile = true;
+    
+    /**
      * A list of additional GeneratorPlugins that should get used executed
      * when generating output.
      *
@@ -127,7 +137,9 @@
         getLog().debug( "outputDir[" + outputDir + "]" );
         getLog().debug( "propertyEditorPaths[" + propertyEditorPaths + "]" );
         getLog().debug( "schemaAsArtifact[" + schemaAsArtifact + "]");
-
+        getLog().debug( "generateSpringSchemasFile[" + generateSpringSchemasFile + "]");
+        getLog().debug( "generateSpringHandlersFile[" + generateSpringHandlersFile + "]");
+        
         if (schema == null) {
             schema = new File(outputDir, project.getArtifactId() + ".xsd");
         }
@@ -162,7 +174,7 @@
             File[] srcJars = sourceJars.toArray(new File[sourceJars.size()]);
             MappingLoader mappingLoader = new QdoxMappingLoader(namespace, srcJars, excludedClasses);
             GeneratorPlugin[] plugins = new GeneratorPlugin[]{
-                new XmlMetadataGenerator(outputDir.getAbsolutePath(), schema),
+                new XmlMetadataGenerator(outputDir.getAbsolutePath(), schema, generateSpringSchemasFile,
generateSpringHandlersFile),
                 new DocumentationGenerator(schema),
                 new XsdGenerator(schema),
                 new WikiDocumentationGenerator(schema),

Modified: geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java?rev=573629&r1=573628&r2=573629&view=diff
==============================================================================
--- geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
(original)
+++ geronimo/xbean/trunk/xbean-spring/src/main/java/org/apache/xbean/spring/generator/XmlMetadataGenerator.java
Fri Sep  7 09:40:27 2007
@@ -39,10 +39,18 @@
     private final File schema;
 
     public static final String NAMESPACE_HANDLER = "org.apache.xbean.spring.context.v2.XBeanNamespaceHandler";
+	private final boolean generateSpringSchemasFile;
+	private final boolean generateSpringHandlersFile;
 
     public XmlMetadataGenerator(String metaInfDir, File schema) {
+    	this(metaInfDir, schema, true, true);
+    }
+    
+    public XmlMetadataGenerator(String metaInfDir, File schema, boolean generateSpringSchemasFile,
boolean generateSpringHandlersFile) {
         this.metaInfDir = metaInfDir;
         this.schema = schema;
+		this.generateSpringSchemasFile = generateSpringSchemasFile;
+		this.generateSpringHandlersFile = generateSpringHandlersFile;
     }
 
     public void generate(NamespaceMapping namespaceMapping) throws IOException {
@@ -61,17 +69,20 @@
             out.close();
         }
         
-        // Generate spring 2.0 mapping
-        file = new File(metaInfDir, "META-INF/spring.handlers");
-        log.log("Generating Spring 2.0 handler mapping: " + file + " for namespace: " + namespace);
-        out = new PrintWriter(new FileWriter(file));
-        try {
-            out.println(namespace.replaceAll(":", "\\\\:") + "=" + NAMESPACE_HANDLER);
-        } finally {
-            out.close();
+        if( generateSpringHandlersFile ) {
+        	
+            // Generate spring 2.0 mapping
+	        file = new File(metaInfDir, "META-INF/spring.handlers");
+	        log.log("Generating Spring 2.0 handler mapping: " + file + " for namespace: " +
namespace);
+	        out = new PrintWriter(new FileWriter(file));
+	        try {
+	            out.println(namespace.replaceAll(":", "\\\\:") + "=" + NAMESPACE_HANDLER);
+	        } finally {
+	            out.close();
+	        }
         }
 
-        if (schema != null) {
+        if (schema != null && generateSpringSchemasFile ) {
             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);



Mime
View raw message