[overlord-commits] Overlord SVN: r75 - trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions.

overlord-commits at lists.jboss.org overlord-commits at lists.jboss.org
Fri Jun 27 11:47:46 EDT 2008


Author: objectiser
Date: 2008-06-27 11:47:46 -0400 (Fri, 27 Jun 2008)
New Revision: 75

Added:
   trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java
Modified:
   trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties
   trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateAction.java
Log:
Support PerformAction.

Modified: trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties
===================================================================
--- trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties	2008-06-26 17:39:18 UTC (rev 74)
+++ trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/Messages.properties	2008-06-27 15:47:46 UTC (rev 75)
@@ -17,5 +17,6 @@
 #  */
 
 _NOT_FOUND_BUSINESS_OBJECT_TYPE=Business object type '{0}' could not be found
+_NOT_FOUND_PERFORM_CREATE_SESSION=Perform action can only invoke a service descriptor that starts with a CreateSessionAction
 _NOT_FOUND_SERVICE_DESCRIPTOR=Service descriptor for category '{0}' and name '{1}' not found
 _MUST_BE_FIRST_ACTION='{0}' action must be first in the service descriptor
\ No newline at end of file

Added: trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java
===================================================================
--- trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java	                        (rev 0)
+++ trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/PerformAction.java	2008-06-27 15:47:46 UTC (rev 75)
@@ -0,0 +1,128 @@
+/*
+ * 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.jbossesb.model.actions;
+
+import org.jboss.tools.overlord.jbossesb.model.ConversionContext;
+import org.jboss.tools.overlord.jbossesb.model.ESBAction;
+import org.jboss.tools.overlord.jbossesb.model.ESBLink;
+import org.jboss.tools.overlord.jbossesb.model.ESBService;
+import org.scribble.model.*;
+import org.scribble.conversation.model.*;
+
+/**
+ * The model component for the 'WhenAction'.
+ *  
+ * @author gary
+ */
+public class PerformAction extends ESBAction {
+
+	private static final String SERVICE_NAME = "serviceName";
+	private static final String SERVICE_CATEGORY = "serviceCategory";
+	private static final String JOIN_SERVICE_NAME = "joinServiceName";
+	private static final String JOIN_SERVICE_CATEGORY = "joinServiceCategory";
+
+	/**
+	 * This method initializes the links with the ESB service descriptors
+	 * identified in each path of the action.
+	 */
+	@Override
+	protected void initializeLinks() {
+		super.initializeLinks();
+		
+		m_category=getPropertyValue(SERVICE_CATEGORY);
+		m_name=getPropertyValue(SERVICE_NAME);
+		
+		m_service=getService().getModel().getService(m_category, m_name);
+		
+		getLinks().add(new ESBLink(m_category, m_name, m_service, true));
+
+		m_joinCategory=getPropertyValue(JOIN_SERVICE_CATEGORY);
+		m_joinName=getPropertyValue(JOIN_SERVICE_NAME);
+		
+		if (m_joinCategory != null && m_joinName != null) {
+			m_joinService=getService().getModel().getService(m_joinCategory, m_joinName);
+			
+			getLinks().add(new ESBLink(m_joinCategory, m_joinName, m_joinService, true));
+		}
+	}
+	
+	/**
+	 * This method validates the ESB action and reports warnings or
+	 * errors to the supplied model listener.
+	 * 
+	 * @param l The model listener
+	 */
+	@Override
+	public void validate(ModelListener l) {
+		super.validate(l);
+		
+		// Check if performed state starts with a create session action
+		if (m_service != null) {
+			
+			if (m_service.getActions().size() == 0 ||
+					m_service.getActions().get(0).getActionClass().
+					endsWith("CreateSessionAction") == false) {
+				l.error(this, org.scribble.util.MessageUtil.format(
+						java.util.PropertyResourceBundle.getBundle(
+						"org.jboss.tools.overlord.jbossesb.model.actions.Messages"),
+							"_NOT_FOUND_PERFORM_CREATE_SESSION",
+							new String[]{}), null);				
+			}
+		}
+	}
+
+	/**
+	 * This method converts the ESB action into an equivalent
+	 * behavioural description for conformance checking.
+	 * 
+	 * @param activities The list of activities that will contain
+	 * 				the converted action(s)
+	 * @param context The conversion context
+	 */
+	@Override
+	public void convert(java.util.List<Activity> activities,
+			ConversionContext context) {
+		
+		Run elem=new Run();
+		activities.add(elem);
+		
+		elem.derivedFrom(this);
+
+		Conversation definition=new Conversation();
+		
+		elem.setInlineDefinition(definition);
+		
+		if (m_service != null) {
+			// TODO: May need to be separate definition, in case the
+			// same state is called from a number of different
+			// places
+			m_service.convert(definition.getBlock().getContents(), context);
+		}
+		
+		if (m_joinService != null) {
+			m_joinService.convert(activities, context);
+		}
+	}
+
+	private String m_category=null;
+	private String m_name=null;
+	private ESBService m_service=null;
+	private String m_joinCategory=null;
+	private String m_joinName=null;
+	private ESBService m_joinService=null;
+}

Modified: trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateAction.java
===================================================================
--- trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateAction.java	2008-06-26 17:39:18 UTC (rev 74)
+++ trunk/cdl/tools/plugins/org.jboss.tools.overlord.jbossesb/src/java/org/jboss/tools/overlord/jbossesb/model/actions/ScheduleStateAction.java	2008-06-27 15:47:46 UTC (rev 75)
@@ -30,6 +30,10 @@
  */
 public class ScheduleStateAction extends ESBAction {
 
+	private static final String IMMEDIATE = "immediate";
+	private static final String SERVICE_NAME = "serviceName";
+	private static final String SERVICE_CATEGORY = "serviceCategory";
+
 	/**
 	 * This method initializes the links with the ESB service descriptors
 	 * identified in each path of the action.
@@ -38,9 +42,9 @@
 	protected void initializeLinks() {
 		super.initializeLinks();
 		
-		String serviceCategory=getPropertyValue("serviceCategory");
-		String serviceName=getPropertyValue("serviceName");
-		String immediate=getPropertyValue("immediate");
+		String serviceCategory=getPropertyValue(SERVICE_CATEGORY);
+		String serviceName=getPropertyValue(SERVICE_NAME);
+		String immediate=getPropertyValue(IMMEDIATE);
 		
 		m_service=getService().getModel().getService(serviceCategory, serviceName);
 		




More information about the overlord-commits mailing list