[savara-commits] savara SVN: r513 - in branches/experimental/2.0.x: bundles/org.savara.bpel/src/main/java/org/savara/bpel and 26 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Dec 22 17:50:24 EST 2010


Author: objectiser
Date: 2010-12-22 17:50:23 -0500 (Wed, 22 Dec 2010)
New Revision: 513

Added:
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/ProtocolToBPELModelGenerator.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.classpath
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.project
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/META-INF/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/META-INF/MANIFEST.MF
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/build.properties
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/pom.xml
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/ScribbleServices.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/osgi/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/osgi/Activator.java
Removed:
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
   branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java
   branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/protocol/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/editor/
Modified:
   branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseifGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/FlowGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/IfGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/InvokeGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/OnMessageGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/PickGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProcessGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProtocolGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReceiveGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReplyGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ScopeGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/SequenceGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/WhileGenerationRule.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java
   branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tap.eclipse/
   branches/experimental/2.0.x/tools/plugins/org.savara.tap.model/
   branches/experimental/2.0.x/tools/plugins/org.savara.tap.validation/
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/META-INF/MANIFEST.MF
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/actions/GenerateAction.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/dialogs/GenerateDialog.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
   branches/experimental/2.0.x/tools/plugins/org.savara.tools.validator/
Log:
Intermediate save - still refactoring.

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/META-INF/MANIFEST.MF	2010-12-22 22:50:23 UTC (rev 513)
@@ -26,5 +26,8 @@
   org.savara.bpel.model.change.RunModelChangeRule,
   org.savara.bpel.model.change.SpawnModelChangeRule,
   org.savara.bpel.model.change.ConversationInteractionModelChangeRule
-Export-Package: org.savara.bpel.model.change;x-friends:="org.savara.tools.bpel.tests",
- org.savara.bpel.model.generator.protocol;x-friends:="org.savara.tools.bpel.tests"
+Export-Package: org.savara.bpel.generator,
+ org.savara.bpel.model,
+ org.savara.bpel.model.change;x-friends:="org.savara.tools.bpel.tests",
+ org.savara.bpel.parser,
+ org.savara.bpel.util

Copied: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/ProtocolToBPELModelGenerator.java (from rev 511, branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java)
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/ProtocolToBPELModelGenerator.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/ProtocolToBPELModelGenerator.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2005-8 Pi4 Technologies Ltd
+ *
+ * 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.
+ *
+ *
+ * Change History:
+ * 24 Jul 2008 : Initial version created by gary
+ */
+package org.savara.bpel.generator;
+
+import org.savara.bpel.BPELDefinitions;
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.change.BPELModelChangeContext;
+import org.savara.model.generator.ModelGenerator;
+import org.scribble.common.resource.ResourceLocator;
+import org.scribble.common.logging.Journal;
+import org.scribble.protocol.ProtocolDefinitions;
+import org.scribble.protocol.model.*;
+
+/**
+ * This class represents the Protocol to BPEL implementation of the model
+ * generator interface.
+ */
+public class ProtocolToBPELModelGenerator implements ModelGenerator {
+
+	public boolean isSupported(String sourceType, String targetType) {
+		return(sourceType.equals(ProtocolDefinitions.PROTOCOL_TYPE) &&
+							targetType.equals(BPELDefinitions.BPEL_TYPE));
+	}
+
+	public Object generate(Object source, Journal journal, ResourceLocator locator) {
+		BPELModelChangeContext context=
+			new BPELModelChangeContext();
+		ProtocolModel pm=(ProtocolModel)source;
+		
+		// Create BPEL model
+		TProcess bpel=new TProcess();
+		
+		context.setParent(bpel);
+		
+		ProtocolModel bpelModel=new ProtocolModel();
+		bpelModel.getProperties().put(BPELDefinitions.BPEL_MODEL_PROPERTY, bpel);
+		
+		context.insert(bpelModel, pm, null);
+		
+		return(bpel);
+	}
+	
+}

Copied: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol (from rev 508, branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol)

Deleted: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -1,101 +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.savara.bpel.model.generator.protocol;
-
-import org.savara.bpel.model.TProcess;
-import org.savara.bpel.model.TScope;
-import org.savara.bpel.model.TVariable;
-import org.savara.util.ResourceLocator;
-import org.scribble.protocol.model.Activity;
-
-public interface ConversionContext {
-
-	/**
-	 * This method applies the conversion process to the supplied component.
-	 * 
-	 * @param component The domain component
-	 * @param activities The list of protocol activities to place the conversion results
-	 */
-	public void convert(Object component, java.util.List<Activity> activities);
-	
-	/**
-	 * This method returns a reference to the resource locator.
-	 * 
-	 * @return The resource locator
-	 */
-	public ResourceLocator getResourceLocator();
-	
-	/**
-	 * This method returns the process.
-	 * 
-	 * @return The process
-	 */
-	public TProcess getProcess();
-	
-	/**
-	 * This method returns the role associated with the
-	 * endpoint being converted.
-	 * 
-	 *@return The role
-	 */
-	public String getRole();
-
-	/**
-	 * This method returns the variable associated with the
-	 * supplied name.
-	 * 
-	 * @param name The name
-	 * @return The variable, or null if not found
-	 */
-	public TVariable getVariable(String name);
-	
-	/**
-	 * This method adds a variable to the context.
-	 * 
-	 * @param var The variable
-	 */
-	public void addVariable(TVariable var);
-
-	/**
-	 * This method removes a variable from the context.
-	 * 
-	 * @param var The variable
-	 */
-	public void removeVariable(TVariable var);
-
-	/**
-	 * This method pushes the supplied scope on the stack.
-	 * 
-	 * @param scope The scope
-	 */
-	public void pushScope(TScope scope);
-	
-	/**
-	 * This method pops the top scope from the stack.
-	 * 
-	 */
-	public void popScope();
-	
-	/**
-	 * This method returns the current scope.
-	 * 
-	 * @return The scope, or null if not within a scope
-	 */
-	public TScope getScope();
-	
-}

Copied: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java (from rev 511, branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ConversionContext.java)
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ConversionContext.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,101 @@
+/*
+ * 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.savara.bpel.generator.protocol;
+
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TVariable;
+import org.scribble.common.resource.ResourceLocator;
+import org.scribble.protocol.model.Activity;
+
+public interface ConversionContext {
+
+	/**
+	 * This method applies the conversion process to the supplied component.
+	 * 
+	 * @param component The domain component
+	 * @param activities The list of protocol activities to place the conversion results
+	 */
+	public void convert(Object component, java.util.List<Activity> activities);
+	
+	/**
+	 * This method returns a reference to the resource locator.
+	 * 
+	 * @return The resource locator
+	 */
+	public ResourceLocator getResourceLocator();
+	
+	/**
+	 * This method returns the process.
+	 * 
+	 * @return The process
+	 */
+	public TProcess getProcess();
+	
+	/**
+	 * This method returns the role associated with the
+	 * endpoint being converted.
+	 * 
+	 *@return The role
+	 */
+	public String getRole();
+
+	/**
+	 * This method returns the variable associated with the
+	 * supplied name.
+	 * 
+	 * @param name The name
+	 * @return The variable, or null if not found
+	 */
+	public TVariable getVariable(String name);
+	
+	/**
+	 * This method adds a variable to the context.
+	 * 
+	 * @param var The variable
+	 */
+	public void addVariable(TVariable var);
+
+	/**
+	 * This method removes a variable from the context.
+	 * 
+	 * @param var The variable
+	 */
+	public void removeVariable(TVariable var);
+
+	/**
+	 * This method pushes the supplied scope on the stack.
+	 * 
+	 * @param scope The scope
+	 */
+	public void pushScope(TScope scope);
+	
+	/**
+	 * This method pops the top scope from the stack.
+	 * 
+	 */
+	public void popScope();
+	
+	/**
+	 * This method returns the current scope.
+	 * 
+	 * @return The scope, or null if not within a scope
+	 */
+	public TScope getScope();
+	
+}

Deleted: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -1,174 +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.savara.bpel.model.generator.protocol;
-
-import org.savara.bpel.model.TProcess;
-import org.savara.bpel.model.TScope;
-import org.savara.bpel.model.TVariable;
-import org.savara.util.ResourceLocator;
-import org.scribble.protocol.model.Activity;
-
-/**
- * This class provides a default implementation of the conversation
- * context.
- */
-public class DefaultConversionContext implements ConversionContext {
-	
-	private String m_role=null;
-	private TProcess m_process=null;
-	private ResourceLocator m_resourceLocator=null;
-	private java.util.Map<String,TVariable> m_variables=
-					new java.util.HashMap<String,TVariable>();
-	private java.util.Stack<TScope> m_scopeStack=new java.util.Stack<TScope>();
-	
-	private static java.util.List<ProtocolGenerationRule> m_rules=
-					new java.util.Vector<ProtocolGenerationRule>();
-	
-	static {
-		m_rules.add(new ElseGenerationRule());
-		m_rules.add(new ElseifGenerationRule());
-		m_rules.add(new FlowGenerationRule());
-		m_rules.add(new IfGenerationRule());
-		m_rules.add(new InvokeGenerationRule());
-		m_rules.add(new OnMessageGenerationRule());
-		m_rules.add(new PickGenerationRule());
-		m_rules.add(new ProcessGenerationRule());
-		m_rules.add(new ReceiveGenerationRule());
-		m_rules.add(new ReplyGenerationRule());
-		m_rules.add(new ScopeGenerationRule());
-		m_rules.add(new SequenceGenerationRule());
-		m_rules.add(new WhileGenerationRule());
-	}
-
-	/**
-	 * This is the constructor for the conversion context, initialised
-	 * with the role being played by the converted BPEL process.
-	 * 
-	 * @param role The role
-	 * @param proc The process
-	 * @param locator The resource locator
-	 */
-	public DefaultConversionContext(String role, TProcess proc, ResourceLocator locator) {
-		m_role = role;
-		m_process = proc;
-		m_resourceLocator = locator;
-	}
-	
-	/**
-	 * This method applies the conversion process to the supplied component.
-	 * 
-	 * @param component The domain component
-	 * @param activities The list of protocol activities to place the conversion results
-	 */
-	public void convert(Object component, java.util.List<Activity> activities) {
-		ProtocolGenerationRule rule=null;
-		
-		for (int i=0; rule == null && i < m_rules.size(); i++) {
-			if (m_rules.get(i).isSupported(component)) {
-				rule = m_rules.get(i);
-			}
-		}
-		
-		if (rule != null) {
-			rule.convert(this, component, activities);
-		}
-	}
-	
-	/**
-	 * This method returns a reference to the environment context.
-	 * 
-	 * @return The environment context
-	 */
-	public ResourceLocator getResourceLocator() {
-		return(m_resourceLocator);
-	}
-	
-	/**
-	 * This method returns the process.
-	 * 
-	 * @return The process
-	 */
-	public TProcess getProcess() {
-		return(m_process);
-	}
-	
-	/**
-	 * This method returns the role associated with the
-	 * endpoint being converted.
-	 * 
-	 *@return The role
-	 */
-	public String getRole() {
-		return(m_role);
-	}
-	
-	/**
-	 * This method returns the variable associated with the
-	 * supplied name.
-	 * 
-	 * @param name The name
-	 * @return The variable, or null if not found
-	 */
-	public TVariable getVariable(String name) {
-		return(m_variables.get(name));
-	}
-	
-	/**
-	 * This method adds a variable to the context.
-	 * 
-	 * @param var The variable
-	 */
-	public void addVariable(TVariable var) {
-		m_variables.put(var.getName(), var);
-	}
-	
-	/**
-	 * This method removes a variable from the context.
-	 * 
-	 * @param var The variable
-	 */
-	public void removeVariable(TVariable var) {
-		m_variables.remove(var.getName());
-	}
-	
-	/**
-	 * This method pushes the supplied scope on the stack.
-	 * 
-	 * @param scope The scope
-	 */
-	public void pushScope(TScope scope) {
-		m_scopeStack.push(scope);
-	}
-	
-	/**
-	 * This method pops the top scope from the stack.
-	 * 
-	 */
-	public void popScope() {
-		m_scopeStack.pop();
-	}
-	
-	/**
-	 * This method returns the current scope.
-	 * 
-	 * @return The scope, or null if not within a scope
-	 */
-	public TScope getScope() {
-		return(m_scopeStack.peek());
-	}
-}

Copied: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java (from rev 511, branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/DefaultConversionContext.java)
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java	                        (rev 0)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/DefaultConversionContext.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,174 @@
+/*
+ * 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.savara.bpel.generator.protocol;
+
+import org.savara.bpel.model.TProcess;
+import org.savara.bpel.model.TScope;
+import org.savara.bpel.model.TVariable;
+import org.scribble.common.resource.ResourceLocator;
+import org.scribble.protocol.model.Activity;
+
+/**
+ * This class provides a default implementation of the conversation
+ * context.
+ */
+public class DefaultConversionContext implements ConversionContext {
+	
+	private String m_role=null;
+	private TProcess m_process=null;
+	private ResourceLocator m_resourceLocator=null;
+	private java.util.Map<String,TVariable> m_variables=
+					new java.util.HashMap<String,TVariable>();
+	private java.util.Stack<TScope> m_scopeStack=new java.util.Stack<TScope>();
+	
+	private static java.util.List<ProtocolGenerationRule> m_rules=
+					new java.util.Vector<ProtocolGenerationRule>();
+	
+	static {
+		m_rules.add(new ElseGenerationRule());
+		m_rules.add(new ElseifGenerationRule());
+		m_rules.add(new FlowGenerationRule());
+		m_rules.add(new IfGenerationRule());
+		m_rules.add(new InvokeGenerationRule());
+		m_rules.add(new OnMessageGenerationRule());
+		m_rules.add(new PickGenerationRule());
+		m_rules.add(new ProcessGenerationRule());
+		m_rules.add(new ReceiveGenerationRule());
+		m_rules.add(new ReplyGenerationRule());
+		m_rules.add(new ScopeGenerationRule());
+		m_rules.add(new SequenceGenerationRule());
+		m_rules.add(new WhileGenerationRule());
+	}
+
+	/**
+	 * This is the constructor for the conversion context, initialised
+	 * with the role being played by the converted BPEL process.
+	 * 
+	 * @param role The role
+	 * @param proc The process
+	 * @param locator The resource locator
+	 */
+	public DefaultConversionContext(String role, TProcess proc, ResourceLocator locator) {
+		m_role = role;
+		m_process = proc;
+		m_resourceLocator = locator;
+	}
+	
+	/**
+	 * This method applies the conversion process to the supplied component.
+	 * 
+	 * @param component The domain component
+	 * @param activities The list of protocol activities to place the conversion results
+	 */
+	public void convert(Object component, java.util.List<Activity> activities) {
+		ProtocolGenerationRule rule=null;
+		
+		for (int i=0; rule == null && i < m_rules.size(); i++) {
+			if (m_rules.get(i).isSupported(component)) {
+				rule = m_rules.get(i);
+			}
+		}
+		
+		if (rule != null) {
+			rule.convert(this, component, activities);
+		}
+	}
+	
+	/**
+	 * This method returns a reference to the environment context.
+	 * 
+	 * @return The environment context
+	 */
+	public ResourceLocator getResourceLocator() {
+		return(m_resourceLocator);
+	}
+	
+	/**
+	 * This method returns the process.
+	 * 
+	 * @return The process
+	 */
+	public TProcess getProcess() {
+		return(m_process);
+	}
+	
+	/**
+	 * This method returns the role associated with the
+	 * endpoint being converted.
+	 * 
+	 *@return The role
+	 */
+	public String getRole() {
+		return(m_role);
+	}
+	
+	/**
+	 * This method returns the variable associated with the
+	 * supplied name.
+	 * 
+	 * @param name The name
+	 * @return The variable, or null if not found
+	 */
+	public TVariable getVariable(String name) {
+		return(m_variables.get(name));
+	}
+	
+	/**
+	 * This method adds a variable to the context.
+	 * 
+	 * @param var The variable
+	 */
+	public void addVariable(TVariable var) {
+		m_variables.put(var.getName(), var);
+	}
+	
+	/**
+	 * This method removes a variable from the context.
+	 * 
+	 * @param var The variable
+	 */
+	public void removeVariable(TVariable var) {
+		m_variables.remove(var.getName());
+	}
+	
+	/**
+	 * This method pushes the supplied scope on the stack.
+	 * 
+	 * @param scope The scope
+	 */
+	public void pushScope(TScope scope) {
+		m_scopeStack.push(scope);
+	}
+	
+	/**
+	 * This method pops the top scope from the stack.
+	 * 
+	 */
+	public void popScope() {
+		m_scopeStack.pop();
+	}
+	
+	/**
+	 * This method returns the current scope.
+	 * 
+	 * @return The scope, or null if not within a scope
+	 */
+	public TScope getScope() {
+		return(m_scopeStack.peek());
+	}
+}

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseifGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ElseifGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ElseifGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/FlowGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/FlowGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/FlowGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/IfGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/IfGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/IfGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/InvokeGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/InvokeGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/InvokeGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/OnMessageGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/OnMessageGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/OnMessageGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/PickGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/PickGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/PickGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProcessGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProcessGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProcessGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProtocolGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ProtocolGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ProtocolGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import org.scribble.protocol.model.Activity;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReceiveGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReceiveGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReceiveGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReplyGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ReplyGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ReplyGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ScopeGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/ScopeGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/ScopeGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/SequenceGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/SequenceGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/SequenceGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/WhileGenerationRule.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/protocol/WhileGenerationRule.java	2010-12-20 17:43:34 UTC (rev 508)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/generator/protocol/WhileGenerationRule.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -15,7 +15,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  * MA  02110-1301, USA.
  */
-package org.savara.bpel.model.generator.protocol;
+package org.savara.bpel.generator.protocol;
 
 import java.util.List;
 

Deleted: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/model/generator/ProtocolToBPELModelGenerator.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -1,60 +0,0 @@
-/*
- * Copyright 2005-8 Pi4 Technologies Ltd
- *
- * 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.
- *
- *
- * Change History:
- * 24 Jul 2008 : Initial version created by gary
- */
-package org.savara.bpel.model.generator;
-
-import org.savara.bpel.BPELDefinitions;
-import org.savara.bpel.model.TProcess;
-import org.savara.bpel.model.change.BPELModelChangeContext;
-import org.savara.model.ProtocolDefinitions;
-import org.savara.model.generator.ModelGenerator;
-import org.scribble.common.resource.ResourceLocator;
-import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.*;
-
-/**
- * This class represents the Protocol to BPEL implementation of the model
- * generator interface.
- */
-public class ProtocolToBPELModelGenerator implements ModelGenerator {
-
-	public boolean isSupported(String sourceType, String targetType) {
-		return(sourceType.equals(ProtocolDefinitions.PROTOCOL_TYPE) &&
-							targetType.equals(BPELDefinitions.BPEL_TYPE));
-	}
-
-	public Object generate(Object source, Journal journal, ResourceLocator locator) {
-		BPELModelChangeContext context=
-			new BPELModelChangeContext();
-		ProtocolModel pm=(ProtocolModel)source;
-		
-		// Create BPEL model
-		TProcess bpel=new TProcess();
-		
-		context.setParent(bpel);
-		
-		ProtocolModel bpelModel=new ProtocolModel();
-		bpelModel.getProperties().put(BPELDefinitions.BPEL_MODEL_PROPERTY, bpel);
-		
-		context.insert(bpelModel, pm, null);
-		
-		return(bpel);
-	}
-	
-}

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/parser/BPELProtocolParser.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -20,8 +20,8 @@
 package org.savara.bpel.parser;
 
 import org.savara.bpel.BPELDefinitions;
+import org.savara.bpel.generator.protocol.DefaultConversionContext;
 import org.savara.bpel.model.TProcess;
-import org.savara.bpel.model.generator.protocol.DefaultConversionContext;
 import org.savara.bpel.util.BPELModelUtil;
 import org.scribble.common.resource.ResourceLocator;
 import org.scribble.common.logging.Journal;

Modified: branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/bundles/org.savara.bpel/src/main/java/org/savara/bpel/util/TypeReferenceUtil.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -19,7 +19,7 @@
 
 import javax.xml.namespace.QName;
 
-import org.savara.bpel.model.generator.protocol.ConversionContext;
+import org.savara.bpel.generator.protocol.ConversionContext;
 import org.scribble.protocol.model.TypeReference;
 
 public class TypeReferenceUtil {

Deleted: branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java
===================================================================
--- branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/bundles/org.savara.core/src/main/java/org/savara/model/ProtocolDefinitions.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -1,24 +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.savara.model;
-
-public class ProtocolDefinitions {
-
-	public static final String PROTOCOL_TYPE="spr";
-	
-}


Property changes on: branches/experimental/2.0.x/tools/plugins/org.savara.tap.eclipse
___________________________________________________________________
Name: svn:ignore
   + bin



Property changes on: branches/experimental/2.0.x/tools/plugins/org.savara.tap.model
___________________________________________________________________
Name: svn:ignore
   + bin



Property changes on: branches/experimental/2.0.x/tools/plugins/org.savara.tap.validation
___________________________________________________________________
Name: svn:ignore
   + bin


Modified: branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/META-INF/MANIFEST.MF	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/META-INF/MANIFEST.MF	2010-12-22 22:50:23 UTC (rev 513)
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: SAVARA Tools BPEL Plug-in
 Bundle-SymbolicName: org.savara.tools.bpel;singleton:=true
-Bundle-Version: 1.2.0.qualifier
+Bundle-Version: 2.0.0.qualifier
 Bundle-Activator: org.savara.tools.bpel.osgi.Activator
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
@@ -22,7 +22,8 @@
  org.eclipse.wst.common.project.facet.core,
  org.savara.wsdl,
  org.savara.bpel,
- org.savara.core
+ org.savara.core,
+ org.savara.tools.core
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Bundle-Vendor: www.savara.org

Modified: branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/actions/GenerateAction.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/actions/GenerateAction.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/actions/GenerateAction.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -29,7 +29,6 @@
 import org.eclipse.ui.IWorkbenchPart;
 
 import org.savara.tools.bpel.dialogs.*;
-import org.scribble.eclipse.util.*;
 
 
 /**
@@ -38,8 +37,6 @@
  */
 public class GenerateAction implements IObjectActionDelegate {
 
-	private static final String CANNOT_GENERATE = "Choreography has errors, so cannot generate";
-
 	public GenerateAction() {
 	}
 
@@ -56,18 +53,14 @@
 			
 			if (res instanceof IFile) {
 				
-				if (ResourceUtil.hasErrors(res) == false) {
-					GenerateDialog dialog=
-						new GenerateDialog(m_targetPart.getSite().getShell(),
-									(IFile)res);
-					
-					try {
-						dialog.open();
-					} catch(Throwable e) {
-						logger.error("Failed to open generate dialog", e);
-					}
-				} else {
-					warn(CANNOT_GENERATE);
+				GenerateDialog dialog=
+					new GenerateDialog(m_targetPart.getSite().getShell(),
+								(IFile)res);
+				
+				try {
+					dialog.open();
+				} catch(Throwable e) {
+					logger.error("Failed to open generate dialog", e);
 				}
 			}
 		}

Modified: branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/dialogs/GenerateDialog.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/dialogs/GenerateDialog.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/dialogs/GenerateDialog.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -24,12 +24,11 @@
 import org.eclipse.swt.events.*;
 import org.eclipse.swt.layout.*;
 import org.eclipse.swt.widgets.*;
+import org.savara.core.eclipse.ScribbleServices;
 import org.savara.tools.bpel.generator.*;
-import org.scribble.conversation.model.ConversationModel;
-import org.scribble.extensions.RegistryFactory;
+import org.scribble.common.logging.CachedJournal;
+import org.scribble.common.logging.Journal;
 import org.scribble.protocol.model.*;
-import org.scribble.model.admin.DefaultModelListener;
-import org.scribble.model.admin.ModelRepository;
 
 /**
  * This class provides the dialog for generating BPEL
@@ -57,30 +56,18 @@
 	 * @param res The file
 	 */
 	protected void initialize(IFile res) {
-		ModelReference ref=
-			org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
+		Journal journal=new CachedJournal();
 		
-		if (ref != null) {
-			ModelRepository mrep=(ModelRepository)
-					RegistryFactory.getRegistry().getExtension(
-						ModelRepository.class, null);
-
-			if (mrep != null) {
-				Model model=mrep.getModel(ref,
-						new DefaultModelListener());
-		
-				if (model instanceof ConversationModel) {
-					m_conversationModel = (ConversationModel)model;
-						
-					m_localModelRefs = m_conversationModel.getLocalModels(ref);
-				}
+		try {
+			m_protocolModel = ScribbleServices.getParserManager().parse(res.getFileExtension(),
+								res.getContents(), journal, null);
+			
+			if (m_protocolModel == null) {
+				logger.error("Unable to load model used to generate the BPEL process");
 			}
+		} catch(Exception e) {
+			logger.error("Failed to generate BPEL process", e);
 		}
-		
-		if (m_conversationModel == null) {
-			error("Unable to load model used to generate " +
-					"the BPEL artefacts", null);
-		}
 	}
 	
 	/**
@@ -129,12 +116,13 @@
 		gd.widthHint = 300;
 		label.setLayoutData(gd);
 
-		if (m_conversationModel != null) {
+		if (m_protocolModel != null) {
+			java.util.List<Role> roles=m_protocolModel.getProtocol().getRoles();
 
-			for (int i=0; i < m_localModelRefs.size(); i++) {
+			for (int i=0; i < roles.size(); i++) {
 				
 				Button button=new Button(group, SWT.CHECK);
-				button.setText(m_localModelRefs.get(i).getLocatedRole());
+				button.setText(roles.get(i).getName());
 				button.setSelection(true);
 				
 				gd = new GridData();
@@ -156,10 +144,10 @@
 				
 				Text projectName=new Text(group, SWT.NONE);
 				
-				String prjName=m_localModelRefs.get(i).getLocatedRole();
+				String prjName=roles.get(i).getName();
 				
-				if (m_conversationModel.getModelName() != null) {
-					prjName = m_conversationModel.getModelName().getName()+"-"+prjName;
+				if (m_protocolModel.getProtocol() != null) {
+					prjName = m_protocolModel.getProtocol().getName()+"-"+prjName;
 				}
 				
 				projectName.setText(prjName);
@@ -302,10 +290,12 @@
 		try {
 			Generator generator=new Generator(m_file);
 			
-			for (int i=0; i < m_localModelRefs.size(); i++) {
+			java.util.List<Role> roles=m_protocolModel.getProtocol().getRoles();
+			
+			for (int i=0; i < roles.size(); i++) {
 				
 				if (m_roleButtons.get(i).getSelection()) {
-					generator.generateRole(m_localModelRefs.get(i),
+					generator.generateRole(roles.get(i),
 							m_projectNames.get(i).getText(), m_file);
 				}
 			}
@@ -337,8 +327,7 @@
 	private static Log logger = LogFactory.getLog(GenerateDialog.class);
 
 	private IFile m_file=null;
-	private ConversationModel m_conversationModel=null;
-	private java.util.List<ModelReference> m_localModelRefs=null;
+	private ProtocolModel m_protocolModel=null;
 	private java.util.List<Button> m_roleButtons=new java.util.Vector<Button>();
 	private java.util.List<Text> m_projectNames=new java.util.Vector<Text>();
 }

Modified: branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java	2010-12-20 20:25:50 UTC (rev 512)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -17,6 +17,8 @@
  */
 package org.savara.tools.bpel.generator;
 
+import java.io.ByteArrayOutputStream;
+
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.transform.Transformer;
@@ -30,20 +32,19 @@
 import org.eclipse.core.resources.IProject;
 import org.eclipse.core.resources.IProjectDescription;
 import org.eclipse.core.resources.IResource;
+import org.savara.bpel.generator.ProtocolToBPELModelGenerator;
 import org.savara.bpel.model.*;
-import org.savara.bpel.model.component.PartnerLink;
+import org.savara.bpel.util.BPELModelUtil;
 import org.savara.contract.model.Contract;
 import org.savara.contract.model.Interface;
 import org.savara.contract.model.Namespace;
+import org.savara.core.eclipse.ScribbleServices;
 import org.savara.util.XMLUtils;
 import org.savara.wsdl.generator.WSDLGeneratorFactory;
 import org.savara.wsdl.generator.soap.SOAPDocLitWSDLBinding;
-import org.scribble.conversation.model.*;
-import org.scribble.extensions.RegistryFactory;
+import org.scribble.common.logging.CachedJournal;
+import org.scribble.common.logging.Journal;
 import org.scribble.protocol.model.*;
-import org.scribble.model.admin.DefaultModelListener;
-import org.scribble.model.admin.ModelRepository;
-import org.scribble.model.change.ModelGenerator;
 import org.eclipse.core.runtime.*;
 import org.eclipse.jst.common.project.facet.WtpUtils;
 import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -58,55 +59,36 @@
 public class Generator {
 
 	private static final String SCHEMA_LOCATION_ATTR = "schemaLocation";
-
 	private static final String INCLUDE_ELEMENT = "include";
-
 	private static final String XML_SCHEMA = "http://www.w3.org/2001/XMLSchema";
-
 	private static final String WSDL_IMPORT = "wsdl:import";
-
 	private static final String BPEL_DEPLOY_DESCRIPTOR_FILENAME = "bpel-deploy.xml";
-
 	private static final String XMLNS_PREFIX = "xmlns:";
-
 	private static final String SERVICE_LABEL = "service";
-
 	private static final String PROVIDE_LABEL = "provide";
-
 	private static final String PARTNER_LINK_LABEL = "partnerLink";
-
 	private static final String INVOKE_LABEL = "invoke";
-
 	private static final String ACTIVE_LABEL = "active";
-
 	private static final String PROCESS_LABEL = "process";
-
 	private static final String DEPLOY_LABEL = "deploy";
-
 	private static final String APACHE_ODE_NAMESPACE = "http://www.apache.org/ode/schemas/dd/2007/03";
-
 	private static final String PORT_TYPE_LABEL = "portType";
-
 	private static final String TARGET_NAMESPACE_LABEL = "targetNamespace";
-
 	private static final String PLNK_ROLE = "plnk:role";
-
 	private static final String NAME_LABEL = "name";
-
 	private static final String PLNK_PARTNER_LINK_TYPE = "plnk:partnerLinkType";
-
 	private static final String WSDL_DEFINITIONS = "wsdl:definitions";
-
 	private static final String WSDL_NS = "http://schemas.xmlsoap.org/wsdl/";
-
 	private static final String PLNKTYPE_NS = "http://docs.oasis-open.org/wsbpel/2.0/plnktype";
-
 	private static final String XMLNS_WSDL = "xmlns:wsdl";
-
-	private static final String XMLNS_PLNK = "xmlns:plnk";
-	
+	private static final String XMLNS_PLNK = "xmlns:plnk";	
 	private static final String BPEL_PATH = "bpelContent";
 
+	private static Log logger = LogFactory.getLog(Generator.class);
+
+	private IFile m_file=null;
+	private ProtocolModel m_protocolModel=null;
+
 	/**
 	 * This is the constructor for the generator.
 	 * 
@@ -126,6 +108,7 @@
 	protected void initialize(IFile res) {
 		
 		// Initialize the model
+		/*
 		ModelReference ref=
 			org.scribble.eclipse.model.admin.OSGIModelRepository.createReference(res);
 		
@@ -138,74 +121,76 @@
 				Model model=mrep.getModel(ref,
 						new DefaultModelListener());
 		
-				if (model instanceof ConversationModel) {
-					m_conversationModel = (ConversationModel)model;
+				if (model instanceof ProtocolModel) {
+					m_protocolModel = (ProtocolModel)model;
 						
-					m_localModelRefs = m_conversationModel.getLocalModels(ref);
+					m_localModelRefs = m_protocolModel.getLocalModels(ref);
 				}
 			}
 		}
+		*/
 		
-		if (m_conversationModel == null) {
-			logger.error("Unable to load model used to generate " +
-					"the ESB artefacts");
+		// Obtain protocol model
+		// TODO: Need to configure Eclipse based journal for reporting errors?
+		Journal journal=new CachedJournal();
+		
+		try {
+			m_protocolModel = ScribbleServices.getParserManager().parse(res.getFileExtension(),
+								res.getContents(), journal, null);
+			
+			if (m_protocolModel == null) {
+				logger.error("Unable to load model used to generate the BPEL process");
+			}
+		} catch(Exception e) {
+			logger.error("Failed to generate BPEL process", e);
 		}
 	}
 	
 	/**
-	 * This method returns the local model references that
-	 * can be generated.
-	 * 
-	 * @return The local model references
-	 */
-	public java.util.List<ModelReference> getLocalModels() {
-		return(m_localModelRefs);
-	}
-	
-	/**
 	 * This method generates the project associated with the
 	 * supplied role (and optional sub-definition path) contained
 	 * in the local model reference.
 	 * 
-	 * @param localModelRef The local model reference
+	 * @param localRole The local model reference
 	 * @param projectName The project name
 	 * @param cdmResource The original choreography file
 	 * @throws Exception Failed to generate role
 	 */
-	public void generateRole(ModelReference localModelRef, String projectName, IFile cdmResource)
+	public void generateRole(Role localRole, String projectName, IFile cdmResource)
 						throws Exception {
 		
 		if (logger.isDebugEnabled()) {
-			logger.debug("Generate local model '"+localModelRef+"' for: "+
-						m_conversationModel);
+			logger.debug("Generate local model '"+localRole+"' for: "+
+						m_protocolModel);
 		}
 		
+		/*
 		// Project to role
-		org.scribble.projector.Projector projector=
+		org.scribble.projector.ProtocolProjector projector=
 			(org.scribble.projector.Projector)
 			RegistryFactory.getRegistry().getExtension(
 					org.scribble.projector.Projector.class, null);
 
 		if (projector != null) {
-			Role role=new Role(localModelRef.getLocatedRole());
+			Role role=new Role(localRole.getLocatedRole());
 			
 			// Transfer contract details (if defined) from local model
 			// reference to role
-			if (localModelRef.getAnnotations().containsKey(org.savara.contract.model.Contract.class.getName())) {
-				role.getAnnotations().put(org.savara.contract.model.Contract.class.getName(),
-								localModelRef.getAnnotations().get(org.savara.contract.model.Contract.class.getName()));
+			if (localRole.getProperties().containsKey(org.savara.contract.model.Contract.class.getName())) {
+				role.getProperties().put(org.savara.contract.model.Contract.class.getName(),
+								localRole.getProperties().get(org.savara.contract.model.Contract.class.getName()));
 			}
 			
 			ModelReference srcRef=
 				new ModelReference(ConversationNotation.NOTATION_CODE);
 			
-			Model localModel=projector.project(srcRef, m_conversationModel,
-					localModelRef.getSubDefinitionPath(), role,
+			Model localModel=projector.project(srcRef, m_protocolModel,
+					localRole.getSubDefinitionPath(), role,
 					new DefaultModelListener());
 			
-			if (localModel instanceof ConversationModel &&
-					((ConversationModel)localModel).getConversation() != null) {
-				ConversationModel lcm=(ConversationModel)localModel;
+			if (localModel instanceof ProtocolModel &&
+					((ProtocolModel)localModel).getProtocol() != null) {
+				ProtocolModel lcm=(ProtocolModel)localModel;
 				
 				ModelReference targetRef=
 					new ModelReference(BPELNotation.NOTATION_CODE);
@@ -228,11 +213,28 @@
 				}
 			}
 		}
+		*/
+		
+		CachedJournal journal=new CachedJournal();
+		
+		ProtocolModel local=ScribbleServices.getProtocolProjector().project(m_protocolModel,
+								localRole, journal);
+		
+		if (local != null) {
+			// TODO: Obtain model generator from manager class (SAVARA-156)
+			ProtocolToBPELModelGenerator generator=new ProtocolToBPELModelGenerator();
+			
+			Object target=generator.generate(local, journal, null);
+			
+			if (target instanceof TProcess) {
+				generateRoleProject(projectName, localRole, (TProcess)target, local, cdmResource);
+			}
+		}
 	}
 	
 	protected void generateRoleProject(String projectName, Role role,
-			org.savara.bpel.model.component.Process bpelProcess, ConversationModel localcm,
-			BPELLanguageModel model, IFile cdmResource) throws Exception {
+			TProcess bpelProcess, ProtocolModel localcm,
+					IFile cdmResource) throws Exception {
 		
 		final IProject proj=createProject(projectName);
 		
@@ -241,8 +243,8 @@
 			// Store BPEL configuration
 			IPath bpelPath=proj.getFullPath().append(
 					new Path(BPEL_PATH)).
-						append(localcm.getModelName().getName()+"_"+
-							localcm.getModelName().getRole().getName()+".bpel");
+						append(localcm.getProtocol().getName()+"_"+
+							localcm.getProtocol().getRole().getName()+".bpel");
 			
 			IFile bpelFile=proj.getProject().getWorkspace().getRoot().getFile(bpelPath);
 			createFolder(bpelFile);
@@ -250,18 +252,20 @@
 			bpelFile.create(null, true,
 					new org.eclipse.core.runtime.NullProgressMonitor());
 			
-			String bpelText=XMLUtils.toText(bpelProcess.getDOMElement());
+			//String bpelText=XMLUtils.toText(bpelProcess.getDOMElement());
+			ByteArrayOutputStream os=new ByteArrayOutputStream();
+			BPELModelUtil.serialize(bpelProcess, os);
 			
-			if (bpelText != null) {
-				bpelFile.setContents(new java.io.ByteArrayInputStream(
-						bpelText.getBytes()), true, false,
+			os.close();
+			
+			bpelFile.setContents(new java.io.ByteArrayInputStream(
+						os.toByteArray()), true, false,
 						new org.eclipse.core.runtime.NullProgressMonitor());
-			}
 			
 			// Write the WSDL files
 			generateWSDL(role, proj, localcm, cdmResource);		
 			
-			java.util.List<Role> roles=localcm.getConversation().getRoles();
+			java.util.List<Role> roles=localcm.getProtocol().getRoles();
 			
 			for (int i=0; i < roles.size(); i++) {
 				generateWSDL(roles.get(i), proj, localcm, cdmResource);
@@ -275,15 +279,15 @@
 		}
 	}
 	
-	protected void generateWSDL(Role role, IProject proj, ConversationModel localcm,
+	protected void generateWSDL(Role role, IProject proj, ProtocolModel localcm,
 						IFile cdmResource) throws Exception {		
 		
-		if (role.getAnnotations().containsKey(Contract.class.getName())) {
+		if (role.getProperties().containsKey(Contract.class.getName())) {
 			javax.wsdl.xml.WSDLWriter writer=
 				javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
 			org.savara.wsdl.generator.WSDLGenerator generator=
 						WSDLGeneratorFactory.getWSDLGenerator();
-			Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
+			Contract contract=(Contract)role.getProperties().get(Contract.class.getName());
 
 			// Generate BPEL folder
 			IPath bpelFolderPath=proj.getFullPath().append(
@@ -318,7 +322,7 @@
 						num += i;
 					}
 
-					String filename=getWSDLFileName(role, localcm.getModelName().getName(), num);
+					String filename=getWSDLFileName(role, localcm.getProtocol().getName(), num);
 					byte[] b=null;
 					
 					if (i > 0) {
@@ -481,8 +485,8 @@
 		}
 	}
 	
-	protected void generatePartnerLinkTypes(Role role, IProject proj, ConversationModel localcm,
-			org.savara.bpel.model.component.Process bpelProcess) throws Exception {	
+	protected void generatePartnerLinkTypes(Role role, IProject proj, ProtocolModel localcm,
+			TProcess bpelProcess) throws Exception {	
 		
 		org.w3c.dom.Document doc=javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();;
 		
@@ -495,7 +499,7 @@
 		defn.setAttribute(TARGET_NAMESPACE_LABEL, bpelProcess.getTargetNamespace());
 		
 		// Add import to associated wsdl
-		String wsdlName=getWSDLFileName(role, localcm.getModelName().getName(), "");
+		String wsdlName=getWSDLFileName(role, localcm.getProtocol().getName(), "");
 
 		org.w3c.dom.Element imp=doc.createElement(WSDL_IMPORT);
 		
@@ -505,13 +509,13 @@
 		defn.appendChild(imp);					
 
 		// Add imports for associated roles
-		java.util.ListIterator<Role> roles=localcm.getConversation().getRoles().listIterator();
+		java.util.ListIterator<Role> roles=localcm.getProtocol().getRoles().listIterator();
 		
 		while (roles.hasNext()) {
 			Role r=roles.next();
 			
-			if (r != null && r.getAnnotations().containsKey(Contract.class.getName())) {
-				Contract contract=(Contract)r.getAnnotations().get(Contract.class.getName());
+			if (r != null && r.getProperties().containsKey(Contract.class.getName())) {
+				Contract contract=(Contract)r.getProperties().get(Contract.class.getName());
 				
 				boolean gen=false;
 				
@@ -526,7 +530,7 @@
 				}
 				
 				if (gen) {
-					wsdlName = getWSDLFileName(r, localcm.getModelName().getName(), "");
+					wsdlName = getWSDLFileName(r, localcm.getProtocol().getName(), "");
 		
 					imp = doc.createElement(WSDL_IMPORT);
 					
@@ -541,10 +545,10 @@
 		// Create partner link types
 		java.util.Map<String, String> nsMap=new java.util.HashMap<String, String>();
 		
-		for (PartnerLink pl : bpelProcess.getPartnerLinks()) {
+		for (TPartnerLink pl : bpelProcess.getPartnerLinks().getPartnerLink()) {
 			org.w3c.dom.Element plt=doc.createElement(PLNK_PARTNER_LINK_TYPE);
 			
-			plt.setAttribute(NAME_LABEL, XMLUtils.getLocalname(pl.getPartnerLinkType()));
+			plt.setAttribute(NAME_LABEL, pl.getPartnerLinkType().getLocalPart());
 			
 			if (pl.getPartnerRole() != null && pl.getPartnerRole().trim().length() > 0) {
 				org.w3c.dom.Element plRole=doc.createElement(PLNK_ROLE);
@@ -556,15 +560,15 @@
 				Role useRole=null;
 				
 				for (int i=0; useRole == null &&
-							i < localcm.getConversation().getRoles().size(); i++) {
-					if (pl.getPartnerRole().startsWith(localcm.getConversation().getRoles().get(i).getName())) {
-						useRole = localcm.getConversation().getRoles().get(i);
+							i < localcm.getProtocol().getRoles().size(); i++) {
+					if (pl.getPartnerRole().startsWith(localcm.getProtocol().getRoles().get(i).getName())) {
+						useRole = localcm.getProtocol().getRoles().get(i);
 					}
 				}
 				
 				if (useRole != null && 
-							useRole.getAnnotations().containsKey(Contract.class.getName())) {
-					Contract contract=(Contract)useRole.getAnnotations().get(Contract.class.getName());
+							useRole.getProperties().containsKey(Contract.class.getName())) {
+					Contract contract=(Contract)useRole.getProperties().get(Contract.class.getName());
 					Interface intf=null;
 					
 					if (pl.getMyRole() != null) {
@@ -597,8 +601,8 @@
 				
 				plRole.setAttribute(NAME_LABEL, pl.getMyRole());
 				
-				if (role.getAnnotations().containsKey(Contract.class.getName())) {
-					Contract contract=(Contract)role.getAnnotations().get(Contract.class.getName());
+				if (role.getProperties().containsKey(Contract.class.getName())) {
+					Contract contract=(Contract)role.getProperties().get(Contract.class.getName());
 					Interface intf=null;
 					
 					if (pl.getMyRole() != null) {
@@ -637,7 +641,7 @@
 		}
 		
 		// Write partner link types to file
-		String filename=getWSDLFileName(role, localcm.getModelName().getName(), "Artifacts");
+		String filename=getWSDLFileName(role, localcm.getProtocol().getName(), "Artifacts");
 		
 		IPath wsdlPath=proj.getFullPath().append(
 				new Path(BPEL_PATH)).
@@ -671,8 +675,8 @@
 	}
 	
 	
-	protected void generateBPELDeploy(Role role, IProject proj, ConversationModel localcm,
-			org.savara.bpel.model.component.Process bpelProcess) throws Exception {	
+	protected void generateBPELDeploy(Role role, IProject proj, ProtocolModel localcm,
+							TProcess bpelProcess) throws Exception {	
 		
 		org.w3c.dom.Document doc=javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();;
 		
@@ -709,7 +713,7 @@
 		// not handle.
 		
 		// Work through partner links for now
-		for (PartnerLink pl : bpelProcess.getPartnerLinks()) {
+		for (TPartnerLink pl : bpelProcess.getPartnerLinks().getPartnerLink()) {
 			if (pl.getPartnerRole() != null && pl.getPartnerRole().trim().length() > 0) {
 				org.w3c.dom.Element invoke=doc.createElement(INVOKE_LABEL);
 				
@@ -849,17 +853,4 @@
 			createFolder(res.getParent());
 		}
 	}
-
-	/*
-	public BuildSystem getBuildSystem() {
-		return(m_buildSystem);
-	}
-	*/
-
-	private static Log logger = LogFactory.getLog(Generator.class);
-
-	private IFile m_file=null;
-	private java.util.List<ModelReference> m_localModelRefs=null;
-	private ConversationModel m_conversationModel=null;
-	//private BuildSystem m_buildSystem=null;
 }

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.classpath
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.classpath	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.classpath	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src/java"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.project
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.project	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/.project	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.savara.tools.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/META-INF/MANIFEST.MF
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/META-INF/MANIFEST.MF	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/META-INF/MANIFEST.MF	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: SAVARA Tools Core
+Bundle-SymbolicName: org.savara.tools.core;singleton:=true
+Bundle-Version: 2.0.0.qualifier
+Bundle-Activator: org.savara.core.eclipse.osgi.Activator
+Bundle-Vendor: www.savara.org
+Service-Component: OSGI-INF/eclipse-resource-loader.xml
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.scribble.common,
+ org.scribble.protocol,
+ org.scribble.protocol.monitor,
+ org.scribble.protocol.parser
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.savara.core.eclipse

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/build.properties
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/build.properties	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/build.properties	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,16 @@
+source.. = src/java/
+output.. = bin/
+bin.includes = plugin.xml,\
+               META-INF/,\
+               .,\
+               OSGI-INF/,\
+               build.properties,\
+               pom.xml
+src.includes = .project,\
+               .classpath,\
+               META-INF/,\
+               OSGI-INF/,\
+               build.properties,\
+               plugin.xml,\
+               pom.xml,\
+               src/

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/pom.xml
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/pom.xml	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/pom.xml	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,24 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.savara.tools</groupId>
+	<artifactId>org.savara.tools.core</artifactId> 
+	<version>2.0.0-SNAPSHOT</version>
+	<packaging>eclipse-plugin</packaging>
+	<name>Savara::Tools::Plugins::ToolsCore</name>
+
+	<parent>
+		<groupId>org.savara.tools</groupId>
+		<artifactId>plugins</artifactId>
+		<version>2.0.0-SNAPSHOT</version>
+	</parent>
+  
+   	<dependencies>
+ 		<dependency>
+ 			<groupId>org.scribble.bundles</groupId>
+			<artifactId>org.scribble.common</artifactId> 
+			<version>${scribble.version}</version>
+ 		</dependency>
+ 	</dependencies>
+  
+</project>

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/ScribbleServices.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/ScribbleServices.java	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/ScribbleServices.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2009 www.scribble.org
+ * 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.savara.core.eclipse;
+
+import org.scribble.protocol.export.ProtocolExportManager;
+import org.scribble.protocol.monitor.ProtocolMonitor;
+import org.scribble.protocol.parser.ProtocolParserManager;
+import org.scribble.protocol.projection.ProtocolProjector;
+import org.scribble.protocol.validation.ProtocolValidationManager;
+
+/**
+ * This class provides a manager for accessing services used
+ * by the designer.
+ *
+ */
+public class ScribbleServices {
+	
+	private static ProtocolValidationManager m_validationManager=null;
+	private static ProtocolParserManager m_parserManager=null;
+	private static ProtocolProjector m_protocolProjector=null;
+	private static ProtocolMonitor m_protocolMonitor=null;
+	private static ProtocolExportManager m_protocolExportManager=null;
+
+	public static ProtocolValidationManager getValidationManager() {
+		return(m_validationManager);
+	}
+	
+	public static void setValidationManager(ProtocolValidationManager vm) {
+		m_validationManager = vm;
+	}
+	
+	public static ProtocolParserManager getParserManager() {
+		return(m_parserManager);
+	}
+	
+	public static void setParserManager(ProtocolParserManager pm) {
+		m_parserManager = pm;
+	}
+	
+	public static ProtocolMonitor getProtocolMonitor() {
+		return(m_protocolMonitor);
+	}
+	
+	public static void setProtocolMonitor(ProtocolMonitor parser) {
+		m_protocolMonitor = parser;
+	}
+	
+	public static ProtocolProjector getProtocolProjector() {
+		return(m_protocolProjector);
+	}
+	
+	public static void setProtocolProjector(ProtocolProjector projector) {
+		m_protocolProjector = projector;
+	}	
+	
+	public static ProtocolExportManager getProtocolExportManager() {
+		return(m_protocolExportManager);
+	}
+	
+	public static void setProtocolExportManager(ProtocolExportManager pem) {
+		m_protocolExportManager = pem;
+	}	
+}
\ No newline at end of file

Added: branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/osgi/Activator.java
===================================================================
--- branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/osgi/Activator.java	                        (rev 0)
+++ branches/experimental/2.0.x/tools/plugins/org.savara.tools.core/src/java/org/savara/core/eclipse/osgi/Activator.java	2010-12-22 22:50:23 UTC (rev 513)
@@ -0,0 +1,103 @@
+/*
+ * 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.savara.core.eclipse.osgi;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.savara.core.eclipse.ScribbleServices;
+import org.scribble.protocol.parser.ProtocolParserManager;
+
+import java.util.logging.*;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+	
+	private static Logger logger = Logger.getLogger(Activator.class.getName());
+
+	// The plug-in ID
+	public static final String PLUGIN_ID = "org.savara.core.eclipse";
+
+	// The shared instance
+	private static Activator plugin;
+	
+	/**
+	 * The constructor
+	 */
+	public Activator() {
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+	 */
+	public void start(final BundleContext context) throws Exception {
+		super.start(context);
+		plugin = this;
+
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+	 */
+	public void stop(BundleContext context) throws Exception {
+		plugin = null;
+		super.stop(context);
+		
+		// Initialize the protocol parser manager
+		ServiceReference sref=context.getServiceReference(ProtocolParserManager.class.getName());
+		
+		ProtocolParserManager ppm=(ProtocolParserManager)context.getService(sref);
+		
+		ScribbleServices.setParserManager(ppm);
+	}
+
+	/**
+	 * Returns the shared instance
+	 *
+	 * @return the shared instance
+	 */
+	public static Activator getDefault() {
+		return plugin;
+	}
+
+	/**
+	 * This method logs an error against the plugin.
+	 * 
+	 * @param mesg The error message
+	 * @param t The optional exception
+	 */
+	public static void logError(String mesg, Throwable t) {
+		
+		if (getDefault() != null) {
+			Status status=new Status(IStatus.ERROR,
+					PLUGIN_ID, 0, mesg, t);
+			
+			getDefault().getLog().log(status);
+		}
+		
+		logger.severe("LOG ERROR: "+mesg+
+				(t == null ? "" : ": "+t));
+	}
+}


Property changes on: branches/experimental/2.0.x/tools/plugins/org.savara.tools.validator
___________________________________________________________________
Name: svn:ignore
   + bin




More information about the savara-commits mailing list