geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sppa...@apache.org
Subject svn commit: r382837 - in /geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin: LaunchOSGIMojo.java XSDImporterMojo.java
Date Fri, 03 Mar 2006 14:29:10 GMT
Author: sppatel
Date: Fri Mar  3 06:29:10 2006
New Revision: 382837

URL: http://svn.apache.org/viewcvs?rev=382837&view=rev
Log:
process args for xsd2java

Modified:
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/LaunchOSGIMojo.java
    geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/XSDImporterMojo.java

Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/LaunchOSGIMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/LaunchOSGIMojo.java?rev=382837&r1=382836&r2=382837&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/LaunchOSGIMojo.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/LaunchOSGIMojo.java
Fri Mar  3 06:29:10 2006
@@ -24,6 +24,7 @@
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
 import org.eclipse.core.runtime.adaptor.EclipseStarter;
 
 abstract public class LaunchOSGIMojo extends AbstractMojo {
@@ -32,6 +33,11 @@
 	 * @parameter expression="${settings.localRepository}/eclipse/eclipse"
 	 */
 	protected File eclipseHome;
+	
+	/**
+	 * @parameter expression="${project}"
+	 */
+	protected MavenProject project;
 
 	/*
 	 * (non-Javadoc)

Modified: geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/XSDImporterMojo.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/XSDImporterMojo.java?rev=382837&r1=382836&r2=382837&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/XSDImporterMojo.java
(original)
+++ geronimo/devtools/eclipse-plugin/trunk/maven-plugins/maven-emf-plugin/src/main/java/org/apache/emf/plugin/XSDImporterMojo.java
Fri Mar  3 06:29:10 2006
@@ -16,7 +16,10 @@
  *  limitations under the License.
  */
 import java.io.File;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
 
 /**
  * @goal xsd2java
@@ -28,46 +31,55 @@
 	/**
 	 * @parameter
 	 */
-	protected Map packageMap;
+	protected Map packagemap;
 
 	/**
 	 * @parameter
-	 * 
 	 */
-	protected File schema;
+	protected String[] packages;
 
 	/**
 	 * @parameter
-	 * 
+	 * @required
 	 */
-	protected File genModel;
+	protected File schema;
 
 	/**
 	 * @parameter
-	 * 
+	 * @required
 	 */
-	protected File project;
+	protected File genmodel;
 
 	/**
 	 * @parameter
-	 * 
+	 * @required
 	 */
+	protected String type;
+
 	protected String projectId;
 
-	/**
-	 * @parameter
-	 * 
-	 */
-	protected String type;
+	public static final String SPACE = " ";
 
-	/* (non-Javadoc)
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.emf.plugin.LaunchOSGIMojo#getArguments()
 	 */
 	protected String[] getArguments() {
-		return null;
+		String params = processParameters().toString();
+		getLog().info(params.toString());
+		StringTokenizer st = new StringTokenizer(params);
+		String[] args = new String[st.countTokens()];
+		int i = 0;
+		while (st.hasMoreTokens()) {
+			args[i++] = st.nextToken();
+		}
+		return args;
 	}
-	
-	/* (non-Javadoc)
+
+	/*
+	 * (non-Javadoc)
+	 * 
 	 * @see org.apache.emf.plugin.LaunchOSGIMojo#getApplicationID()
 	 */
 	protected String getApplicationID() {
@@ -76,7 +88,43 @@
 
 	protected StringBuffer processParameters() {
 		StringBuffer buffer = new StringBuffer();
+		buffer.append(schema.getAbsolutePath() + SPACE);
+		buffer.append(genmodel.getAbsolutePath() + SPACE);
+		if ("model".equals(type)) {
+			buffer.append("-modelProject");
+		} else if ("edit".equals(type)) {
+			buffer.append("-editProject");
+		} else if ("editor".equals(type)) {
+			buffer.append("-editorProject");
+		}
+		buffer.append(SPACE);
+		buffer.append(project.getBasedir() + SPACE);
+		buffer.append(getRelativeSrcDir() + SPACE);
+		if (packages != null) {
+			buffer.append("-packages" + SPACE);
+			for (int i = 0; i < packages.length; i++) {
+				buffer.append(packages[i] + SPACE);
+			}
+		}
+
+		if (packagemap != null) {
+			buffer.append("-packagemap" + SPACE);
+			Set keys = packagemap.keySet();
+			for (Iterator i = keys.iterator(); i.hasNext();) {
+				String pkg = (String) i.next();
+				String mapping = (String) packagemap.get(pkg);
+				buffer.append(pkg + SPACE + mapping + SPACE);
+			}
+		}
 		return buffer;
+	}
+	
+	private String getRelativeSrcDir() {
+		String src = project.getBuild().getSourceDirectory();
+		src = src.split(project.getBasedir().getAbsolutePath())[1];
+		if(src.startsWith(File.separator))
+			src = src.substring(1);
+		return src;
 	}
 
 }



Mime
View raw message