[overlord-commits] Overlord SVN: r480 - cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Fri Feb 6 14:12:16 EST 2009


Author: objectiser
Date: 2009-02-06 14:12:16 -0500 (Fri, 06 Feb 2009)
New Revision: 480

Removed:
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ConversationBasedGenerator.java
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ModelBasedGenerator.java
Modified:
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/AntBuildSystem.java
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/BuildSystem.java
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
   cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/MavenBuildSystem.java
Log:
Changes to remove aspects copied from jbossesb action generation, to make more appropriate for bpel.

Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/AntBuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/AntBuildSystem.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/AntBuildSystem.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -24,11 +24,7 @@
 
 	private static final String BUILD_FILE = "build.xml";
 	private static final String ANT = "Ant";
-	private static final String ESB_CONFIG_PATH = "src/conf/jboss-esb.xml";
-	private static final String DEPLOYMENT_PATH = "src/conf/deployment.xml";
-	private static final String JBMQ_CONFIG_PATH = "src/conf/jbmq-queue-service.xml";
-	private static final String JAVA_SOURCE_PATH = "src/java";
-	private static final String LIBRARY_PATH = "src/lib";
+	private static final String BPEL_PATH = "bpel";
 
 	/**
 	 * This method represents the name of the build
@@ -51,51 +47,13 @@
 	}
 		
 	/**
-	 * This method returns the ESB configuration file
+	 * This method returns the BPEL file
 	 * path.
 	 * 
-	 * @return The ESB configuration file path
+	 * @return The BPEL file path
 	 */
-	public String getESBConfigFilePath() {
-		return(ESB_CONFIG_PATH);
+	public String getBPELFilePath() {
+		return(BPEL_PATH);
 	}
 	
-	/**
-	 * This method returns the deployment file
-	 * path.
-	 * 
-	 * @return The deployment file path
-	 */
-	public String getDeploymentFilePath() {
-		return(DEPLOYMENT_PATH);
-	}
-	
-	/**
-	 * This method returns the JBMQ configuration file
-	 * path.
-	 * 
-	 * @return The JBMQ configuration file path
-	 */
-	public String getJBMQConfigFilePath() {
-		return(JBMQ_CONFIG_PATH);
-	}
-	
-	/**
-	 * This method returns the Java source path.
-	 * 
-	 * @return The Java source path
-	 */
-	public String getJavaSourcePath() {
-		return(JAVA_SOURCE_PATH);
-	}
-	
-	/**
-	 * This method returns the library path.
-	 * 
-	 * @return The library path
-	 */
-	public String getLibraryPath() {
-		return(LIBRARY_PATH);
-	}
-		
 }

Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/BuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/BuildSystem.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/BuildSystem.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -49,41 +49,10 @@
 	public String getBuildFileContents(String projectName);
 	
 	/**
-	 * This method returns the ESB configuration file
-	 * path.
+	 * This method returns the BPEL file path.
 	 * 
-	 * @return The ESB configuration file path
+	 * @return The BPEL file path
 	 */
-	public String getESBConfigFilePath();
-	
-	/**
-	 * This method returns the deployment file
-	 * path.
-	 * 
-	 * @return The deployment file path
-	 */
-	public String getDeploymentFilePath();
-	
-	/**
-	 * This method returns the JBMQ configuration file
-	 * path.
-	 * 
-	 * @return The JBMQ configuration file path
-	 */
-	public String getJBMQConfigFilePath();
-	
-	/**
-	 * This method returns the Java source path.
-	 * 
-	 * @return The Java source path
-	 */
-	public String getJavaSourcePath();
-	
-	/**
-	 * This method returns the library path.
-	 * 
-	 * @return The library path, or null if not required
-	 */
-	public String getLibraryPath();
-	
+	public String getBPELFilePath();
+		
 }

Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ConversationBasedGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ConversationBasedGenerator.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ConversationBasedGenerator.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.generator;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.scribble.conversation.model.Conversation;
-
-/**
- * This interface represents a module that generates artefacts
- * based on a specific conversation.
- */
-public interface ConversationBasedGenerator {
-
-	/**
-	 * This method generates the relevant artefacts based on
-	 * the supplied conversation, within the specified Java project.
-	 * 
-	 * @param jproj The Java project
-	 * @param conversation The conversation
-	 * @param buildSystem The build system to use
-	 * @throws GeneratorException Failed to generate
-	 */
-	public void generate(IJavaProject jproj,
-			Conversation conversation, BuildSystem buildSystem)
-					throws GeneratorException;
-	
-}

Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/Generator.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -46,9 +46,6 @@
  */
 public class Generator {
 
-	private static final String CLASSPATH_FILENAME = ".classpath";
-	private static final String OUTPUT_LOCATION = "classes";
-	
 	/**
 	 * This is the constructor for the generator.
 	 * 
@@ -68,13 +65,6 @@
 	 */
 	protected void initialize(IFile res) {
 		
-		// Initialize the artefact generators
-		//m_conversationBasedGen.add(new BusinessObjectTypeGenerator());
-		
-		//m_modelBasedGen.add(new BuildConfigurationGenerator());
-		//m_modelBasedGen.add(new JBMQConfigurationGenerator());
-		//m_modelBasedGen.add(new DeploymentFileGenerator());
-		
 		// Initialize the model
 		ModelReference ref=
 			org.scribble.osgi.model.admin.OSGIModelRepository.createReference(res);
@@ -170,144 +160,44 @@
 	}
 	
 	protected void generateRoleProject(String projectName,
-			org.w3c.dom.Element esbConfig, ConversationModel localcm,
+			org.w3c.dom.Element bpel, ConversationModel localcm,
 			BPELLanguageModel model)	throws Exception {
 		
-		final IJavaProject jproj=createJavaProject(projectName);
+		final IProject proj=createProject(projectName);
 		
-		if (jproj != null && esbConfig != null) {
-			// Generate business object types for
-			// local conversation model
-			localcm.visit(new Visitor() {
+		if (proj != null && bpel != null) {
 
-				public boolean visit(ModelObject obj) {
-					
-					if (obj instanceof Conversation) {
-						for (int i=0; i < m_conversationBasedGen.size(); i++) {
-							try {
-								m_conversationBasedGen.get(i).generate(jproj,
-									(Conversation)obj, getBuildSystem());
-							} catch(GeneratorException e) {
-								logger.log(java.util.logging.Level.SEVERE,
-										"Failed to generate conversation based artefact",
-										e);
-							}
-						}
-					}
-					
-					return true;
-				}	
-			});
+			// Store BPEL configuration
+			IPath bpelPath=proj.getFullPath().append(
+					new Path(getBuildSystem().getBPELFilePath())).
+						append(localcm.getModelName().getName()+"_"+
+							localcm.getModelName().getLocatedRole().getName()+".bpel");
 			
-			// Store ESB configuration
-			IPath esbConfigPath=jproj.getPath().append(
-					new Path(getBuildSystem().getESBConfigFilePath()));
-			
-			IFile esbConfigFile=jproj.getProject().getWorkspace().getRoot().getFile(esbConfigPath);
-			GeneratorUtil.createParentFolder(esbConfigFile);
-			esbConfigFile.create(null, true,
+			IFile bpelFile=proj.getProject().getWorkspace().getRoot().getFile(bpelPath);
+			GeneratorUtil.createParentFolder(bpelFile);
+			bpelFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
 			
-			String config=getText(esbConfig);
+			String bpelText=getText(bpel);
 			
-			if (config != null) {
-				esbConfigFile.setContents(new java.io.ByteArrayInputStream(
-						config.getBytes()), true, false,
+			if (bpelText != null) {
+				bpelFile.setContents(new java.io.ByteArrayInputStream(
+						bpelText.getBytes()), true, false,
 						new org.eclipse.core.runtime.NullProgressMonitor());
 			}
-			
-			for (int i=0; i < m_modelBasedGen.size(); i++) {
-				try {
-					m_modelBasedGen.get(i).generate(jproj, model,
-							getBuildSystem());
-				} catch(GeneratorException e) {
-					logger.log(java.util.logging.Level.SEVERE,
-							"Failed to generate model based artefact",
-							e);
-				}
-			}
 		}
 	}
 			
-	protected IJavaProject createJavaProject(String projectName)
+	protected IProject createProject(String projectName)
 							throws Exception {
 		
 		// Create project
 		IProject project=m_file.getWorkspace().getRoot().getProject(projectName);
 		project.create(new org.eclipse.core.runtime.NullProgressMonitor());
 
-		IJavaProject jproj=JavaCore.create(project);
-		
 		project.open(new org.eclipse.core.runtime.NullProgressMonitor());
 		
-		IProjectDescription description = jproj.getProject().getDescription();
-		
-		// Update the project natures to include Java Nature
-		String[] prevNatures= description.getNatureIds();
-		String[] newNatures= new String[prevNatures.length + 1];
-		System.arraycopy(prevNatures, 0, newNatures, 0, prevNatures.length);
-		newNatures[prevNatures.length]= JavaCore.NATURE_ID;
-		description.setNatureIds(newNatures);
-		
-		// Setup project reference to CDM project
-		IProject[] prevProjects=description.getReferencedProjects();
-		IProject[] newProjects=new IProject[prevProjects.length+1];
-		System.arraycopy(prevProjects, 0, newProjects, 0, prevProjects.length);
-		newProjects[prevProjects.length] = m_file.getProject();
-		description.setReferencedProjects(newProjects);
-		
-		// Set the description
-		jproj.getProject().setDescription(description,
-				new org.eclipse.core.runtime.NullProgressMonitor());
-		
-		IPath outputLocation=jproj.getPath().append(new Path(OUTPUT_LOCATION));
-		IPath classpathLocation=jproj.getPath().append(new Path(CLASSPATH_FILENAME));
-		IPath sourceLocation=jproj.getPath().append(
-				new Path(getBuildSystem().getJavaSourcePath()));
-		IPath libLocation=null;
-		
-		if (getBuildSystem().getLibraryPath() != null) {
-			libLocation=jproj.getPath().append(new Path(getBuildSystem().getLibraryPath()));
-		}
-		
-		// create and set the output and source paths first
-		IFolder outputFolder= jproj.getProject().getWorkspace().getRoot().getFolder(outputLocation);
-		GeneratorUtil.createParentFolder(outputFolder);
-		outputFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
-		outputFolder.setDerived(true);		
-		
-		IFolder sourceFolder= jproj.getProject().getWorkspace().getRoot().getFolder(sourceLocation);
-		GeneratorUtil.createParentFolder(sourceFolder);
-		sourceFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
-		sourceFolder.setDerived(true);		
-		
-		if (libLocation != null) {
-			IFolder libFolder= jproj.getProject().getWorkspace().getRoot().getFolder(libLocation);
-			GeneratorUtil.createParentFolder(libFolder);
-			libFolder.create(true, true, new org.eclipse.core.runtime.NullProgressMonitor());
-			libFolder.setDerived(true);		
-		}
-		
-		IFile file=jproj.getProject().getWorkspace().getRoot().getFile(classpathLocation);
-		file.create(null, true, new org.eclipse.core.runtime.NullProgressMonitor());
-		file.setDerived(true);
-		
-		// Write empty contents, to overcome 'Resource '..' is not local' exception
-		String classpath="<classpath/>";
-		file.setContents(new java.io.ByteArrayInputStream(classpath.getBytes()), true,
-				false, new org.eclipse.core.runtime.NullProgressMonitor());
-			
-		IClasspathEntry[] classpaths=new IClasspathEntry[2];
-		
-		classpaths[0] = JavaCore.newContainerEntry(
-				new Path("org.eclipse.jdt.launching.JRE_CONTAINER"));
-					
-		classpaths[1] = JavaCore.newSourceEntry(sourceLocation);
-					
-		jproj.setRawClasspath(classpaths, outputLocation,
-				new org.eclipse.core.runtime.NullProgressMonitor());
-		
-		return(jproj);
+		return(project);
 	}
 
 	/**
@@ -454,8 +344,4 @@
 	private java.util.List<Role> m_roles=null;
 	private ConversationModel m_conversationModel=null;
 	private BuildSystem m_buildSystem=null;
-	private java.util.List<ConversationBasedGenerator> m_conversationBasedGen=
-		new java.util.Vector<ConversationBasedGenerator>();
-	private java.util.List<ModelBasedGenerator> m_modelBasedGen=
-		new java.util.Vector<ModelBasedGenerator>();
 }

Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/MavenBuildSystem.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/MavenBuildSystem.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/MavenBuildSystem.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -24,11 +24,7 @@
 
 	private static final String BUILD_FILE = "pom.xml";
 	private static final String MAVEN = "Maven";
-	private static final String ESB_CONFIG_PATH = "src/main/resources/META-INF/jboss-esb.xml";
-	private static final String DEPLOYMENT_PATH = "src/main/resources/META-INF/deployment.xml";
-	private static final String JBMQ_CONFIG_PATH = "src/main/resources/jbmq-queue-service.xml";
-	private static final String JAVA_SOURCE_PATH = "src/main/java";
-	private static final String LIBRARY_PATH = null;
+	private static final String BPEL_PATH = "src/main/resources/bpel";
 
 	/**
 	 * This method represents the name of the build
@@ -51,51 +47,13 @@
 	}
 	
 	/**
-	 * This method returns the ESB configuration file
+	 * This method returns the BPEL file
 	 * path.
 	 * 
-	 * @return The ESB configuration file path
+	 * @return The BPEL file path
 	 */
-	public String getESBConfigFilePath() {
-		return(ESB_CONFIG_PATH);
+	public String getBPELFilePath() {
+		return(BPEL_PATH);
 	}
-	
-	/**
-	 * This method returns the deployment file
-	 * path.
-	 * 
-	 * @return The deployment file path
-	 */
-	public String getDeploymentFilePath() {
-		return(DEPLOYMENT_PATH);
-	}
-	
-	/**
-	 * This method returns the JBMQ configuration file
-	 * path.
-	 * 
-	 * @return The JBMQ configuration file path
-	 */
-	public String getJBMQConfigFilePath() {
-		return(JBMQ_CONFIG_PATH);
-	}
-	
-	/**
-	 * This method returns the Java source path.
-	 * 
-	 * @return The Java source path
-	 */
-	public String getJavaSourcePath() {
-		return(JAVA_SOURCE_PATH);
-	}
-	
-	/**
-	 * This method returns the library path.
-	 * 
-	 * @return The library path
-	 */
-	public String getLibraryPath() {
-		return(LIBRARY_PATH);
-	}
 		
 }

Deleted: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ModelBasedGenerator.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ModelBasedGenerator.java	2009-02-06 12:18:23 UTC (rev 479)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/generator/ModelBasedGenerator.java	2009-02-06 19:12:16 UTC (rev 480)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- */
-package org.jboss.tools.overlord.cdl.bpel.generator;
-
-import org.eclipse.jdt.core.IJavaProject;
-import org.jboss.tools.overlord.cdl.bpel.model.*;
-
-/**
- * This interface represents a module that generates artefacts
- * based on the complete model.
- */
-public interface ModelBasedGenerator {
-
-	/**
-	 * This method generates the relevant artefacts based on
-	 * the supplied model, within the specified Java project.
-	 * 
-	 * @param jproj The Java project
-	 * @param model The model
-	 * @param buildSystem The build system to use
-	 * @throws GeneratorException Failed to generate
-	 */
-	public void generate(IJavaProject jproj,
-			BPELLanguageModel model, BuildSystem buildSystem)
-					throws GeneratorException;
-	
-}




More information about the overlord-commits mailing list