geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r385573 - in /geronimo/devtools/eclipse-plugin/trunk: geronimo-emf-common/ maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/
Date Mon, 13 Mar 2006 15:39:26 GMT
Author: sppatel
Date: Mon Mar 13 07:39:24 2006
New Revision: 385573

URL: http://svn.apache.org/viewcvs?rev=385573&view=rev
Log:
m2 mojos plugin configuration

Added:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
  (with props)
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
  (with props)
Modified:
    geronimo/devtools/eclipse-plugin/trunk/geronimo-emf-common/pom.xml

Modified: geronimo/devtools/eclipse-plugin/trunk/geronimo-emf-common/pom.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/geronimo-emf-common/pom.xml?rev=385573&r1=385572&r2=385573&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/geronimo-emf-common/pom.xml (original)
+++ geronimo/devtools/eclipse-plugin/trunk/geronimo-emf-common/pom.xml Mon Mar 13 07:39:24
2006
@@ -44,9 +44,16 @@
             <org.apache.geronimo.xml.ns.deployment>http://geronimo.apache.org/xml/ns/deployment-1.0</org.apache.geronimo.xml.ns.deployment>
             <org.apache.geronimo.xml.ns.j2ee.application>http://geronimo.apache.org/xml/ns/j2ee/application-1.0</org.apache.geronimo.xml.ns.j2ee.application>
             <org.apache.geronimo.xml.ns.j2ee.web>http://geronimo.apache.org/xml/ns/j2ee/web-1.0</org.apache.geronimo.xml.ns.j2ee.web>
     
+            <org.apache.geronimo.xml.ns.j2ee.connector>http://geronimo.apache.org/xml/ns/j2ee/connector-1.0</org.apache.geronimo.xml.ns.j2ee.connector>
             <org.openejb.xml.ns.openejb.jar>http://www.openejb.org/xml/ns/openejb-jar-2.0</org.openejb.xml.ns.openejb.jar>
  
             <org.openejb.xml.ns.pkgen>http://www.openejb.org/xml/ns/pkgen-2.0</org.openejb.xml.ns.pkgen>
+            <org.apache.geronimo.xml.ns.j2ee.application.client>http://geronimo.apache.org/xml/ns/j2ee/application-client-1.0</org.apache.geronimo.xml.ns.j2ee.application.client>
           </packagemap>
+          <attributes>
+            <modelPluginClass>org.apache.geronimo.deployment.model.GeronimoEMFModelPlugin</modelPluginClass>
+            <editPluginClass>org.apache.geronimo.deployment.model.edit.GeronimoEMFEditPlugin</editPluginClass>
+            <updateClasspath>false</updateClasspath>
+          </attributes>
         </configuration>
         <executions>
           <execution>
@@ -54,6 +61,7 @@
             <phase>generate-resources</phase>
             <goals>
               <goal>xsd2genmodel</goal>
+              <goal>setattributes</goal>
             </goals>
             <configuration>
               <schemas>
@@ -73,6 +81,7 @@
             <phase>generate-resources</phase>
             <goals>
               <goal>xsd2genmodel</goal>
+              <goal>setattributes</goal>
             </goals>
             <configuration>
               <schemas>
@@ -89,6 +98,7 @@
             <phase>generate-resources</phase>
             <goals>
               <goal>xsd2genmodel</goal>
+              <goal>setattributes</goal>
             </goals>
             <configuration>
               <schemas>
@@ -106,6 +116,7 @@
             <phase>generate-resources</phase>
             <goals>
               <goal>xsd2genmodel</goal>
+              <goal>setattributes</goal>
             </goals>
             <configuration>
               <schemas>
@@ -122,6 +133,7 @@
             <phase>generate-resources</phase>
             <goals>
               <goal>xsd2genmodel</goal>
+              <goal>setattributes</goal>
             </goals>
             <configuration>
               <schemas>

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java?rev=385573&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
Mon Mar 13 07:39:24 2006
@@ -0,0 +1,87 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  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.emf.plugin;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Utility mojo that sets attributes in the generated .genmodel that are not
+ * configurable via headless eclipse
+ * 
+ * @goal setattributes
+ */
+public class GenModelModifierMojo extends AbstractMojo {
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File genmodel;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private Map attributes;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.maven.plugin.Mojo#execute()
+	 */
+	public void execute() throws MojoExecutionException, MojoFailureException {
+		DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+		TransformerFactory transformerFactory = TransformerFactory.newInstance();
+		try {
+			DocumentBuilder builder = docBuilderFactory.newDocumentBuilder();
+			Transformer transformer = transformerFactory.newTransformer();
+			Document doc = builder.parse(genmodel);
+			Element root = doc.getDocumentElement();
+			Iterator j = attributes.keySet().iterator();
+			while (j.hasNext()) {
+				String attribute = (String) j.next();
+				String value = (String) attributes.get(attribute);
+				root.setAttribute(attribute, value);
+				getLog().info("Attribute " + attribute + " : " + value);
+			}
+			Source src = new DOMSource(doc);
+			Result result = new StreamResult(new FileOutputStream(genmodel));
+			transformer.transform(src, result);
+		} catch (Exception e) {
+			e.printStackTrace();
+			throw new MojoFailureException(e.getMessage());
+		}
+
+	}
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GenModelModifierMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java?rev=385573&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
(added)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
Mon Mar 13 07:39:24 2006
@@ -0,0 +1,86 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ *  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.emf.plugin;
+
+import java.io.File;
+
+import org.apache.maven.plugin.MojoFailureException;
+
+/**
+ * @goal generate
+ */
+public class GeneratorMojo extends LaunchOSGIMojo {
+
+	public static final String APPLICATION_ID = "org.eclipse.emf.codegen.ecore.Generator";
+
+	/**
+	 * @parameter
+	 */
+	private File projectRootDirectory;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private File genModel;
+
+	/**
+	 * @parameter
+	 * @required
+	 */
+	private String type;
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.emf.plugin.LaunchOSGIMojo#getApplicationID()
+	 */
+	protected String getApplicationID() {
+		return APPLICATION_ID;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.apache.emf.plugin.LaunchOSGIMojo#getArguments()
+	 */
+	protected String[] getArguments() {
+		return getArguments(processParameters());
+	}
+
+	protected StringBuffer processParameters() {
+		StringBuffer buffer = new StringBuffer();
+		if (projectRootDirectory != null) {
+			buffer.append("-projects").append(projectRootDirectory.getAbsolutePath()).append(SPACE);
+		}
+
+		buffer.append("-").append("type").append(SPACE);
+		buffer.append(genModel.getAbsolutePath());
+
+		return buffer;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.emf.plugin.LaunchOSGIMojo#validate()
+	 */
+	protected void validate() throws MojoFailureException {
+		if (!"model".equalsIgnoreCase(type) || !"edit".equalsIgnoreCase(type)
+				|| !"editor".equalsIgnoreCase(type)) {
+			throw new MojoFailureException("<type> must be set to either 'model', 'edit', or
'editor'");
+		}
+	}
+
+}

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
------------------------------------------------------------------------------
    svn:keywords = Date Rev

Propchange: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/GeneratorMojo.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message