[overlord-commits] Overlord SVN: r130 - in cdl/trunk: runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions and 7 other directories.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Mon Jul 7 13:41:19 EDT 2008
Author: jeff.yuchang
Date: 2008-07-07 13:41:18 -0400 (Mon, 07 Jul 2008)
New Revision: 130
Added:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetMessageAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetQuotesListAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetRequestQuoteMessageAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckInvalidMessageAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckResponseMessageAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SetQuoteMessageAction.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SupplierMain.java
Removed:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/GetVariableAction.java
Modified:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/ScheduleItem.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/SessionManager.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ActionProperties.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/PerformAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ReceiveMessageAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SendMessageAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/WhileAction.java
cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/MVELUsageTest.java
cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/XMLUtilsTest.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Confirmation.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Quote.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Request4QuoteMain.java
cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Supplier.java
cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml
cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
cdl/trunk/samples/jbossesb/broker/src/main/resources/hibernate.cfg.xml
cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml
cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/jboss-esb.xml
Log:
* update broker example.
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/ScheduleItem.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/ScheduleItem.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/ScheduleItem.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -87,7 +87,12 @@
}
public String toString() {
- return (category+"/"+name);
+ StringBuffer sbuffer = new StringBuffer();
+ sbuffer.append("id=" + id +",");
+ sbuffer.append("category=" + category + ",");
+ sbuffer.append("name=" + name + ",");
+ sbuffer.append("session=" + session);
+ return sbuffer.toString();
}
public long getId() {
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/SessionManager.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/SessionManager.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/conversation/SessionManager.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -22,6 +22,7 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import org.apache.log4j.Logger;
import org.hibernate.Transaction;
@@ -29,6 +30,7 @@
import org.jboss.soa.overlord.jbossesb.actions.ConversationActionException;
import org.jboss.soa.overlord.jbossesb.actions.MessageProperties;
import org.jboss.soa.overlord.jbossesb.actions.Service;
+import org.mvel.MVEL;
/**
* This component is responsible for managing the persistence and retrieval
@@ -82,7 +84,7 @@
}
}
-
+ @SuppressWarnings("unchecked")
public static Session createSubSession(String sessionName, String sessionKey, Message message) throws Exception {
org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
@@ -93,10 +95,14 @@
Object businessState = pojoclass.newInstance();
transaction = hibernateSession.beginTransaction();
- //TODO: set variable here.
- //String bindExpression = (String) message.getProperties().getProperty(MessageProperties.BIND_VARIABLE);
- //Object value = message.getProperties().getProperty(MessageProperties.BIND_OBJECT);
+ Map<String, Object> boundVariables = (Map<String, Object>)message.getProperties().
+ getProperty(MessageProperties.BOUND_VARIABLE_KEY);
+ for(String key : boundVariables.keySet()) {
+ MVEL.setProperty(businessState, key, boundVariables.get(key));
+ logger.info("bound to " + key);
+ }
+
hibernateSession.save(businessState);
Session conversationSession = new Session();
@@ -109,6 +115,7 @@
}
conversationSession.setBusinessObject(businessState);
conversationSession.setParent(parentSession);
+ conversationSession.setServiceName(parentSession.getServiceName());
hibernateSession.save(conversationSession);
transaction.commit();
@@ -118,7 +125,7 @@
if (transaction != null) {
transaction.rollback();
}
- throw new Exception (e);
+ throw new ConversationActionException (e);
} finally {
hibernateSession.close();
}
@@ -132,15 +139,19 @@
if (sessionKey != null) {
org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
- Session session = (Session) hibernateSession.load(Session.class, Long.valueOf(sessionKey));
- Class<?> pojoClass = ClassLoaderUtil.loadClass(session.getPojoClass());
- Object pojo = hibernateSession.load(pojoClass, Long.valueOf(session.getPojoID()));
- session.setBusinessObject(pojo);
- session.getScheduleItems().size();
- session.getIdentities().size();
- session.getJoinStates().size();
- session.getEprWrappers().size();
- hibernateSession.close();
+ Session session = null;
+ try {
+ session = (Session) hibernateSession.load(Session.class, Long.valueOf(sessionKey));
+ Class<?> pojoClass = ClassLoaderUtil.loadClass(session.getPojoClass());
+ Object pojo = hibernateSession.load(pojoClass, Long.valueOf(session.getPojoID()));
+ session.setBusinessObject(pojo);
+ session.getScheduleItems().size();
+ session.getIdentities().size();
+ session.getJoinStates().size();
+ session.getEprWrappers().size();
+ } finally {
+ hibernateSession.close();
+ }
return session;
}
@@ -225,7 +236,7 @@
if (transaction != null) {
transaction.rollback();
}
- throw new ConversationActionException("Error in removeObject", e);
+ throw new ConversationActionException("Error in removeObject : " + obj, e);
} finally {
hibernateSession.close();
}
@@ -235,23 +246,27 @@
public static Session getSession(Identity id) {
org.hibernate.Session hibernateSession = HibernateUtil.getSessionFactory().openSession();
- String query = "select b from Identity b where b.type =:type and b.propertyValues =:propertyValues and b.serviceName =:serviceName";
- List<?> results = hibernateSession.createQuery(query)
- .setParameter("type", id.getType())
- .setParameter("propertyValues", id.getPropertyValues())
- .setParameter("serviceName", id.getServiceName())
- .list();
- if (results.size() < 1) {
- return null;
+ Session session = null;
+ try {
+ String query = "select b from Identity b where b.type =:type and b.propertyValues =:propertyValues and b.serviceName =:serviceName";
+ List<?> results = hibernateSession.createQuery(query)
+ .setParameter("type", id.getType())
+ .setParameter("propertyValues", id.getPropertyValues())
+ .setParameter("serviceName", id.getServiceName())
+ .list();
+ if (results.size() < 1) {
+ return null;
+ }
+
+ Identity theID = (Identity)results.get(0);
+ session = theID.getSession();
+ session.getScheduleItems().size();
+ session.getIdentities().size();
+ session.getJoinStates().size();
+ session.getEprWrappers().size();
+ } finally {
+ hibernateSession.close();
}
-
- Identity theID = (Identity)results.get(0);
- Session session = theID.getSession();
- session.getScheduleItems().size();
- session.getIdentities().size();
- session.getJoinStates().size();
- session.getEprWrappers().size();
- hibernateSession.close();
return session;
}
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ActionProperties.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ActionProperties.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ActionProperties.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -42,6 +42,10 @@
public static final String SERVICE_DESCRIPTION_NAME = "serviceDescriptionName";
public static final String RESPONSE_SERVICE_NAME="responseServiceName";
public static final String RESPONSE_SERVICE_CATEGORY="responseServiceCategory";
+
+ public static final String SERVICE_NAME_EXPRESSION = "serviceNameExpression";
+ public static final String SERVICE_CATEGORY_EXPRESSION = "serviceCategoryExpression";
+
public static final String IMMEDIATE="immediate";
public static final String IDENTITIES="identities";
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ConversationAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -167,6 +167,7 @@
Session session = getSession(message);
if (session != null && isFirstConversationAction(message)) {
unschedule(message);
+ logger.info("This is first conversation action to unschedule the item!");
}
return handle(message);
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/GetVariableAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/GetVariableAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/GetVariableAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., 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.
- *
- * (C) 2008,
- */
-package org.jboss.soa.overlord.jbossesb.actions;
-
-import org.jboss.soa.esb.helpers.ConfigTree;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.overlord.conversation.Session;
-
-/**
- * @author jeffyu
- *
- */
-public class GetVariableAction extends ConversationAction {
-
- public GetVariableAction(ConfigTree config) {
- super(config);
- }
-
-
- @Override
- public Message handle(Message message) throws Exception {
- String expression = getConfig().getAttribute("variable");
- Session session = getSession(message);
- Object obj = session.getBusinessObject();
- //TODO
- return message;
- }
-
-}
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/PerformAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/PerformAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/PerformAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -22,6 +22,7 @@
import java.util.HashMap;
import java.util.Map;
+import org.apache.log4j.Logger;
import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
@@ -34,6 +35,7 @@
*/
public class PerformAction extends ConversationAction {
+ private Logger logger = Logger.getLogger(PerformAction.class);
public PerformAction(ConfigTree config) {
super(config);
@@ -57,12 +59,14 @@
Object o = MVEL.eval(fromExpression, session.getBusinessObject());
bindingVal.put(toVariable, o);
+ logger.info("bind from :" + fromExpression + " to :" + toVariable);
}
}
message.getProperties().setProperty(MessageProperties.BOUND_VARIABLE_KEY, bindingVal);
- ServiceInvoker serviceInvoker = new ServiceInvoker(serviceCategory, serviceName);
- serviceInvoker.deliverAsync(message);
+ //ServiceInvoker serviceInvoker = new ServiceInvoker(serviceCategory, serviceName);
+ //serviceInvoker.deliverSync(message, 2000);
+ session.schedule(serviceCategory, serviceName, true, message);
return message;
}
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ReceiveMessageAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ReceiveMessageAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/ReceiveMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -35,7 +35,6 @@
}
public Message handle(Message message) throws Exception {
- String requiredOp=getConfig().getAttribute(ActionProperties.OPERATION);
String requiredMType=getConfig().getAttribute(ActionProperties.MESSAGE_TYPE);
String clientEPR=getConfig().getAttribute(ActionProperties.CLIENT_EPR);
String serviceName = getConfig().getAttribute(ActionProperties.SERVICE_DESCRIPTION_NAME);
@@ -44,9 +43,6 @@
throw new Exception("Message type not defined");
}
- // Check if operation and/or message type already associated with
- // the message
- String mesgOp=(String)message.getProperties().getProperty(MessageProperties.OPERATION);
String mesgMType=getMessageType(message);
// Check message type
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SendMessageAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SendMessageAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SendMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -19,6 +19,9 @@
*/
package org.jboss.soa.overlord.jbossesb.actions;
+import java.util.List;
+
+import org.apache.log4j.Logger;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
import org.jboss.soa.esb.client.ServiceInvoker;
@@ -31,6 +34,7 @@
import org.jboss.soa.overlord.conversation.Identity;
import org.jboss.soa.overlord.conversation.LogicalCourier;
import org.jboss.soa.overlord.conversation.Session;
+import org.mvel.MVEL;
/**
@@ -38,22 +42,19 @@
*/
public class SendMessageAction extends ConversationAction {
+ private Logger logger = Logger.getLogger(SendMessageAction.class);
+
public SendMessageAction(ConfigTree config) {
super(config);
}
public Message handle(Message message) throws Exception {
- String requiredOp=getConfig().getAttribute(ActionProperties.OPERATION);
String requiredMType=getConfig().getAttribute(ActionProperties.MESSAGE_TYPE);
if (requiredMType == null) {
- throw new Exception("Message type not defined");
+ throw new ConversationActionException("Message type is not defined");
}
- // Check if operation and/or message type already associated with
- // the message
- String mesgOp=(String)message.getProperties().getProperty(
- MessageProperties.OPERATION);
String mesgMType=getMessageType(message);
// Check message type
@@ -63,11 +64,12 @@
String respServiceName=getConfig().getAttribute(ActionProperties.RESPONSE_SERVICE_NAME);
String respServiceCategory=getConfig().getAttribute(ActionProperties.RESPONSE_SERVICE_CATEGORY);
String clientEPR=getConfig().getAttribute(ActionProperties.CLIENT_EPR);
+ String nameExpression = getConfig().getAttribute(ActionProperties.SERVICE_NAME_EXPRESSION);
+ String categoryExpression = getConfig().getAttribute(ActionProperties.SERVICE_CATEGORY_EXPRESSION);
+
+ Session session=getSession(message);
- Session session=getSession(message);
-
- // TODO: Need to deal with identity???
- java.util.List<Identity> ids=getIdentities(message, null);
+ List<Identity> ids=getIdentities(message, null);
session.assimulateIdentities(ids);
@@ -75,13 +77,12 @@
Message mesg = MessageFactory.getInstance().getMessage(MessageType.JBOSS_XML);
mesg.getBody().add(message.getBody().get());
- if (serviceCategory != null && serviceName != null) {
+ if ((serviceCategory != null && serviceName != null)
+ || (categoryExpression != null && nameExpression != null)) {
// Check if response details provided
if (respServiceName != null && respServiceCategory != null) {
- org.jboss.soa.esb.addressing.eprs.LogicalEPR lepr=
- new org.jboss.soa.esb.addressing.eprs.LogicalEPR(respServiceCategory,
- respServiceName);
+ LogicalEPR lepr= new LogicalEPR(respServiceCategory, respServiceName);
mesg.getHeader().getCall().setReplyTo(lepr);
@@ -90,11 +91,19 @@
message);
}
- logger.info("Sending message to '"+serviceCategory+"/"+serviceName+"'");
- ServiceInvoker invoker = new ServiceInvoker(serviceCategory, serviceName);
+ ServiceInvoker invoker = null;
+ if (serviceCategory != null && serviceName != null) {
+ invoker = new ServiceInvoker(serviceCategory, serviceName);
+ } else {
+ serviceCategory = (String) MVEL.eval(categoryExpression, session.getBusinessObject());
+ serviceName = (String) MVEL.eval(nameExpression, session.getBusinessObject());
+ invoker = new ServiceInvoker(serviceCategory, serviceName);
+ }
invoker.deliverAsync(mesg);
+ logger.info("Sending message to '"+serviceCategory+"/"+serviceName+"'");
+
} else if (clientEPR != null) {
EPR epr=null;
@@ -103,7 +112,7 @@
if (epr == null) {
logger.error("Client EPR '"+clientEPR+"' does not exist in session");
- throw new Exception("Client EPR '"+clientEPR+"' does not exist in session");
+ throw new ConversationActionException("Client EPR '"+clientEPR+"' does not exist in session");
}
Courier courier=null;
@@ -111,8 +120,7 @@
// Workaround, as CourierFactory currently does
// not support logical EPRs.
if (epr instanceof LogicalEPR) {
- courier = new LogicalCourier((LogicalEPR)
- epr);
+ courier = new LogicalCourier((LogicalEPR) epr);
} else {
courier = CourierFactory.getCourier(epr);
}
@@ -123,16 +131,14 @@
courier.cleanup();
} else {
- throw new Exception("Failed to send message");
+ throw new ConversationActionException("Failed to send message");
}
- logger.info("MESSAGE TYPE '"+mesgMType+"' SENT");
+ logger.info("MESSAGE TYPE '"+mesgMType+"' SENT.");
- } else {
-
- // Unexpected message
- throw new Exception("Unexpected message type="+mesgMType+
- ", but expecting type="+requiredMType);
+ } else {
+ throw new ConversationActionException("Unexpected message type="+mesgMType+
+ ", but expecting type="+requiredMType);
}
return(message);
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetMessageAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetMessageAction.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.jbossesb.actions;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.conversation.Session;
+import org.mvel.MVEL;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class SetMessageAction extends ConversationAction {
+
+ private Logger logger = Logger.getLogger(SetMessageAction.class);
+
+ public SetMessageAction(ConfigTree config) {
+ super(config);
+ }
+
+
+ @Override
+ public Message handle(Message message) throws Exception {
+ String expression = getConfig().getAttribute("stateExpression");
+ String headerProperty = getConfig().getAttribute("headerProperty");
+ Session session = getSession(message);
+ Object obj = MVEL.eval(expression, session.getBusinessObject());
+ if (headerProperty != null) {
+ message.getProperties().setProperty(headerProperty, obj);
+ logger.info("Set object of " + obj + " to header property of " + headerProperty);
+ }
+ return message;
+ }
+
+}
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/SetVariableAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -19,15 +19,23 @@
*/
package org.jboss.soa.overlord.jbossesb.actions;
+import org.apache.log4j.Logger;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.conversation.Session;
+import org.jboss.soa.overlord.conversation.SessionManager;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.mvel.MVEL;
+import org.w3c.dom.Element;
/**
* @author jeffyu
*
*/
public class SetVariableAction extends ConversationAction {
-
+
+ private Logger logger = Logger.getLogger(SetVariableAction.class);
+
public SetVariableAction(ConfigTree config) {
super(config);
}
@@ -35,8 +43,36 @@
@Override
public Message handle(Message message) throws Exception {
- //TODO
+ String variable = getConfig().getAttribute("variable");
+ String stateExpression = getConfig().getAttribute("stateExpression");
+ String messageExpression = getConfig().getAttribute("messageExpression");
+
+ Session session = getSession(message);
+ Object bstate = session.getBusinessObject();
+
+ logger.info("Set value to the variable of " + variable);
+
+ while (variable.startsWith("parent.")) {
+ variable = variable.substring(7);
+ session = session.getParent();
+ }
+
+ if (stateExpression != null) {
+ Object result = MVEL.eval(stateExpression, bstate);
+ MVEL.setProperty(bstate, variable, result);
+ logger.info("The Variable is: " + variable + "; stateExpression is: " + stateExpression);
+ } else if (messageExpression != null) {
+ String xmlBody = (String) message.getBody().get();
+ Element element = (Element) XMLUtils.getNode(xmlBody);
+ String result = XMLUtils.executeXpath(element, messageExpression);
+ MVEL.setProperty(bstate, variable, result);
+ logger.info("The Variable is: " + variable + "; messageExpression is: " + messageExpression);
+ }
+
+ SessionManager.updateObject(bstate);
+
return message;
}
+
}
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/WhileAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/WhileAction.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/overlord/jbossesb/actions/WhileAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -19,6 +19,8 @@
*/
package org.jboss.soa.overlord.jbossesb.actions;
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
import org.jboss.soa.overlord.conversation.Session;
@@ -30,7 +32,7 @@
*/
public class WhileAction extends ConversationAction {
- private int counter = 0;
+ private Logger logger = Logger.getLogger(WhileAction.class);
public WhileAction(ConfigTree config) {
super(config);
@@ -55,20 +57,24 @@
//TODO: Need to think about the expression.
String decisionMethod = whileConfig.getAttribute("decision-method");
-
+ logger.info("decision method is : " + decisionMethod);
if (decisionMethod != null) {
Object response = MVEL.eval(getMvelMethodName(decisionMethod), session.getBusinessObject());
- if (response instanceof Integer) {
- Integer value = (Integer) response;
- if (counter < value) {
+ if (response instanceof Boolean) {
+ Boolean flag = (Boolean) response;
+ logger.info("The result of decision method is: " + flag);
+ if (flag) {
String category = whileConfig.getAttribute(ActionProperties.SERVICE_CATEGORY);
String name = whileConfig.getAttribute(ActionProperties.SERVICE_NAME);
- session.schedule(category, name, true, message);
- counter ++;
+ session.schedule(category, name, false, message);
+ ServiceInvoker serviceInvoker = new ServiceInvoker(category, name);
+ serviceInvoker.deliverSync(message, 2000);
+ logger.info("Schedule items of " + category + "/" + name + "in WhileAction");
} else {
String category = exitConfig.getAttribute(ActionProperties.SERVICE_CATEGORY);
String name = exitConfig.getAttribute(ActionProperties.SERVICE_NAME);
session.schedule(category, name, true, message);
+ logger.info("Schedule items of " + category + "/" + name + "in WhileAction of exit branch");
}
} else {
throw new ConversationActionException("method return value is not an Integer.");
Modified: cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/MVELUsageTest.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/MVELUsageTest.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/MVELUsageTest.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -62,15 +62,33 @@
}
@Test
+ public void testIntegerInjection() throws Exception {
+ Integer i = new Integer(5);
+ MVEL.setProperty(example, "counter", i);
+ assertEquals(5, example.getCounter());
+ }
+
+ @Test
public void testGetProperty() throws Exception {
String property = "property";
assertEquals("exampleProperty", MVEL.getProperty(property, example));
}
-
+
+ @Test
+ public void testSetObject() throws Exception {
+ String property = "quote.value";
+ MVEL.setProperty(example, property, new Integer(5));
+ assertEquals(5, MVEL.getProperty(property, example));
+ }
+
public class Example {
private String property;
+
+ private int counter;
+
+ private Quote quote = new Quote();
public String getProperty() {
return property;
@@ -83,7 +101,41 @@
public boolean isInvoked() {
return true;
}
+
+ public int getCounter() {
+ return counter;
+ }
+
+ public void setCounter(int counter) {
+ this.counter = counter;
+ }
+
+ public Quote getQuote() {
+ return quote;
+ }
+
+ public void setQuote(Quote quote) {
+ this.quote = quote;
+ }
}
+
+ public class Quote {
+ private String name;
+ private int value;
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public int getValue() {
+ return value;
+ }
+ public void setValue(int value) {
+ this.value = value;
+ }
+
+ }
}
Modified: cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/XMLUtilsTest.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/XMLUtilsTest.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/soa/overlord/jbossesb/util/XMLUtilsTest.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -42,4 +42,24 @@
assertEquals("3", XMLUtils.executeXpath(element, expr));
}
+ @Test
+ public void testXpathAttribute() throws Exception {
+ String val = "<requestForQuote id=\"20\" supplierDesc=\"{http://www.jboss.org/overlord/loanBroker}Supplier1\" ></requestForQuote>";
+ String expr = "//@id";
+
+ Element element = (Element) XMLUtils.getNode(val);
+ assertEquals("20", XMLUtils.executeXpath(element, expr));
+ assertEquals("{http://www.jboss.org/overlord/loanBroker}Supplier1", XMLUtils.executeXpath(element, "//@supplierDesc"));
+
+ }
+
+ @Test
+ public void testXpathNode() throws Exception {
+ String val = "<quote id=\"20\" supplierDesc = \"{http://www.jboss.org/overlord/loanBroker}Supplier1\">10</quote>";
+ String expr = "/quote";
+
+ Element element = (Element) XMLUtils.getNode(val);
+ assertEquals("10", XMLUtils.executeXpath(element, expr));
+ }
+
}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/BrokerMain.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -19,15 +19,16 @@
*/
package org.jboss.soa.overlord.samples.jbossesb.loan.broker;
+import java.util.ArrayList;
import java.util.List;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
-import javax.persistence.OneToOne;
import javax.persistence.Table;
import org.jboss.soa.overlord.conversation.HibernateObject;
@@ -44,14 +45,23 @@
@Column(name="ID")
private long id;
- @OneToOne
- @JoinColumn(name="transaction_ID")
- private CompleteTransactionMain transaction;
+ @OneToMany(cascade={CascadeType.ALL})
+ @JoinColumn(name="broker_ID")
+ private List<Supplier> suppliers = new ArrayList<Supplier>();
@OneToMany
- @JoinColumn(name="supplier_ID")
- private List<Supplier> suppliers;
+ @JoinColumn(name="quote_ID")
+ private List<Quote> quotes = new ArrayList<Quote>();
+ @Column(name="supplier_index")
+ private int supplierIndex = 0;
+
+ @Column(name="selected_quote")
+ private int selected_quote = -1 ;
+
+ @Column(name="selected_supplier")
+ private int selected_supplier = -1;
+
public BrokerMain() {
initSuppliers();
}
@@ -64,14 +74,6 @@
this.id = id;
}
- public CompleteTransactionMain getTransaction() {
- return transaction;
- }
-
- public void setTransaction(CompleteTransactionMain transaction) {
- this.transaction = transaction;
- }
-
public List<Supplier> getSuppliers() {
return suppliers;
}
@@ -81,16 +83,67 @@
}
+ public boolean hasSuppliers() {
+ return (supplierIndex < suppliers.size());
+ }
+
+ public int nextSupplier() {
+ supplierIndex = supplierIndex + 1;
+ return supplierIndex;
+ }
+
+ public boolean receivedAllQuotes() {
+ return (this.quotes.size() == this.suppliers.size());
+ }
+
+ public Supplier getCurrentSupplier() {
+ return getSuppliers().get(supplierIndex);
+ }
+
protected void initSuppliers() {
- for(int i =1; i< 5; i++) {
+ for(int i =1; i< 2; i++) {
Supplier supplier = new Supplier();
supplier.setServiceCategory("ESBBroker.Suppliers");
- supplier.setServiceName("supplier" + i);
+ supplier.setServiceName("supplier" + i + ".main");
+ supplier.setServiceDescription("{http://www.jboss.org/overlord/loanBroker}Supplier" + i);
suppliers.add(supplier);
}
}
+
+ public int getSupplierIndex() {
+ return supplierIndex;
+ }
+
+ public void setSupplierIndex(int supplierIndex) {
+ this.supplierIndex = supplierIndex;
+ }
+
+ public List<Quote> getQuotes() {
+ return quotes;
+ }
+
+ public void setQuotes(List<Quote> quotes) {
+ this.quotes = quotes;
+ }
+
+ public int getSelected_quote() {
+ return selected_quote;
+ }
+
+ public void setSelected_quote(int selected_quote) {
+ this.selected_quote = selected_quote;
+ }
+
+ public int getSelected_supplier() {
+ return selected_supplier;
+ }
+
+ public void setSelected_supplier(int selected_supplier) {
+ this.selected_supplier = selected_supplier;
+ }
+ public void setQuote(Quote quote) {
+ this.quotes.add(quote);
+ }
-
-
}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Confirmation.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Confirmation.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Confirmation.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -34,7 +34,6 @@
@Entity
@Table(name="T_CONFIRMATION")
public class Confirmation implements HibernateObject {
-
private static final long serialVersionUID = 115L;
@@ -60,7 +59,5 @@
public void setDetail(String detail) {
this.detail = detail;
}
-
-
}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Quote.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Quote.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Quote.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -38,8 +38,11 @@
private long id;
@Column(name="VALUE")
- private int value;
+ private String value;
+ @Column(name="SERVICE_DESC")
+ private String serviceDescription;
+
public long getId() {
return this.id;
}
@@ -48,13 +51,20 @@
this.id = id;
}
- public int getValue() {
+ public String getServiceDescription() {
+ return serviceDescription;
+ }
+
+ public void setServiceDescription(String serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
+
+ public String getValue() {
return value;
}
- public void setValue(int value) {
+ public void setValue(String value) {
this.value = value;
}
-
}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Request4QuoteMain.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Request4QuoteMain.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Request4QuoteMain.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -19,14 +19,18 @@
*/
package org.jboss.soa.overlord.samples.jbossesb.loan.broker;
+import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
+import org.hibernate.annotations.Fetch;
+import org.hibernate.annotations.FetchMode;
import org.jboss.soa.overlord.conversation.HibernateObject;
/**
@@ -47,9 +51,9 @@
@JoinColumn(name="supplier_ID")
private Supplier supplier;
- @OneToOne
+ @OneToOne(fetch = FetchType.EAGER ,cascade={CascadeType.ALL})
@JoinColumn(name="quote_ID")
- private Quote quote;
+ private Quote quote = new Quote();
public long getId() {
return id;
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetQuotesListAction.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetQuotesListAction.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetQuotesListAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.broker;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.w3c.dom.Node;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class SetQuotesListAction extends AbstractActionLifecycle {
+
+ private Logger logger = Logger.getLogger(SetQuotesListAction.class);
+
+ private ConfigTree config;
+
+ public SetQuotesListAction(ConfigTree config) {
+ this.config = config;
+ }
+
+ public Message process(Message message) throws Exception {
+
+ List<Quote> quotes = (List<Quote>)message.getProperties().getProperty("quotes");
+
+ Node node = XMLUtils.getNode((String)message.getBody().get());
+ String idValue = node.getAttributes().getNamedItem("id").getNodeValue();
+
+ StringBuffer sbuffer = new StringBuffer();
+ sbuffer.append("<quoteList id=\"" + idValue + "\">");
+
+ for(Quote quote : quotes) {
+ sbuffer.append("<quote supplierDesc=\"" + quote.getServiceDescription() + "\">");
+ sbuffer.append(quote.getValue());
+ sbuffer.append("</quote>");
+ }
+
+ sbuffer.append("</quoteList>");
+
+ message.getBody().add(sbuffer.toString());
+
+ logger.info("set quote list message :" + sbuffer.toString());
+
+ return message;
+ }
+
+}
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetRequestQuoteMessageAction.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetRequestQuoteMessageAction.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/SetRequestQuoteMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.broker;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.w3c.dom.Node;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class SetRequestQuoteMessageAction extends AbstractActionLifecycle {
+
+ public static Logger logger = Logger.getLogger(SetRequestQuoteMessageAction.class);
+
+ private ConfigTree config;
+
+ public SetRequestQuoteMessageAction(ConfigTree config){
+ this.config = config;
+ }
+
+ public Message process(Message message) throws Exception {
+ Node node = XMLUtils.getNode((String)message.getBody().get());
+ String idValue = node.getAttributes().getNamedItem("id").getNodeValue();
+
+ String serviceDescription = (String)message.getProperties().getProperty("serviceDescriptionName");
+
+ message.getBody().add("<requestForQuote id=\"" + idValue +"\" supplierDesc=\"" + serviceDescription+ "\" ></requestForQuote>");
+
+ logger.info("Set 'requestForQuote' : "+message);
+
+ return message;
+ }
+
+}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Supplier.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Supplier.java 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/broker/Supplier.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -49,6 +49,9 @@
@Column(name="SERVICE_NAME")
private String serviceName;
+ @Column(name="SERVICE_DESCRIPTION")
+ private String serviceDescription;
+
@ManyToOne
@JoinColumn(name="BROKER_ID")
private BrokerMain broker;
@@ -84,7 +87,14 @@
public void setBroker(BrokerMain broker) {
this.broker = broker;
}
+
+ public String getServiceDescription() {
+ return serviceDescription;
+ }
+
+ public void setServiceDescription(String serviceDescription) {
+ this.serviceDescription = serviceDescription;
+ }
-
}
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckInvalidMessageAction.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckInvalidMessageAction.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckInvalidMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.creditAgency;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.w3c.dom.Node;
+
+public class SetCreditCheckInvalidMessageAction extends AbstractActionLifecycle {
+
+ private static Logger logger = Logger.getLogger(SetCreditCheckInvalidMessageAction.class);
+
+ private ConfigTree config;
+
+ public SetCreditCheckInvalidMessageAction(ConfigTree config) {
+ this.config = config;
+ }
+
+ public Message process(Message message) throws Exception{
+
+ Node node = XMLUtils.getNode((String)message.getBody().get());
+ String idValue = node.getAttributes().getNamedItem("id").getNodeValue();
+ message.getBody().add("<CreditCheckInvalid id=\"" + idValue +"\"></CreditCheckInvalid>");
+
+ logger.info("Updated credit message: "+message);
+
+ return(message);
+ }
+
+}
+
+
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckResponseMessageAction.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckResponseMessageAction.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/creditAgency/SetCreditCheckResponseMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.creditAgency;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.w3c.dom.Node;
+
+public class SetCreditCheckResponseMessageAction extends AbstractActionLifecycle {
+
+ private static Logger logger = Logger.getLogger(SetCreditCheckResponseMessageAction.class);
+
+ private ConfigTree config;
+
+ public SetCreditCheckResponseMessageAction(ConfigTree config) {
+ this.config = config;
+ }
+
+ public Message process(Message message) throws Exception{
+
+ Node node = XMLUtils.getNode((String)message.getBody().get());
+ String idValue = node.getAttributes().getNamedItem("id").getNodeValue();
+ message.getBody().add("<CreditCheckResponse id=\"" + idValue +"\"></CreditCheckResponse>");
+
+ logger.info("Updated credit message: "+message);
+
+ return(message);
+ }
+
+
+}
+
+
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SetQuoteMessageAction.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SetQuoteMessageAction.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SetQuoteMessageAction.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.supplier;
+
+import org.apache.log4j.Logger;
+import org.jboss.soa.esb.actions.AbstractActionLifecycle;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.overlord.jbossesb.util.XMLUtils;
+import org.w3c.dom.Node;
+
+/**
+ * @author jeffyu
+ *
+ */
+public class SetQuoteMessageAction extends AbstractActionLifecycle {
+
+ private Logger logger = Logger.getLogger(SetQuoteMessageAction.class);
+
+ private ConfigTree config;
+
+ public SetQuoteMessageAction(ConfigTree config) {
+ this.config = config;
+ }
+
+ public Message process(Message message) throws Exception {
+ Node node = XMLUtils.getNode((String)message.getBody().get());
+
+ String idValue = node.getAttributes().getNamedItem("id").getNodeValue();
+ String supplierDesc = "{http://www.jboss.org/overlord/loanBroker}Supplier1";
+
+ String body = "<quote id=\"" + idValue + "\" supplierDesc = \""
+ + supplierDesc+ "\">10</quote>";
+
+ message.getBody().add(body);
+
+ logger.info("set 'quote' of [" + body + "]");
+ return message;
+ }
+
+}
Added: cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SupplierMain.java
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SupplierMain.java (rev 0)
+++ cdl/trunk/samples/jbossesb/broker/src/main/java/org/jboss/soa/overlord/samples/jbossesb/loan/supplier/SupplierMain.java 2008-07-07 17:41:18 UTC (rev 130)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., 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.
+ *
+ * (C) 2008,
+ */
+package org.jboss.soa.overlord.samples.jbossesb.loan.supplier;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import org.jboss.soa.overlord.conversation.HibernateObject;
+import org.jboss.soa.overlord.jbossesb.actions.Service;
+
+/**
+ * @author jeffyu
+ *
+ */
+ at Service(name="{http://www.jboss.org/overlord/loanBroker}Supplier1", conversationType="Supplier", root=true)
+ at Entity
+ at Table(name="T_SUPPLIER1_MAIN")
+public class SupplierMain implements HibernateObject {
+
+
+ private static final long serialVersionUID = -3956749311779109550L;
+
+ @Id @GeneratedValue
+ @Column(name="ID")
+ private long id;
+
+ public long getId() {
+ return this.id;
+ }
+
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+}
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/deployment.xml 2008-07-07 17:41:18 UTC (rev 130)
@@ -1,19 +1,24 @@
<jbossesb-deployment>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker1</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker2</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker3</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker4</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker5</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker6</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker7</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker8</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker9</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker10</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker11</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker12</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker13</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker14</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker15</depends>
- <depends>jboss.esb.gen.destination:service=Queue,name=esb-loan-broker16</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker_reply</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker1</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker2</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker3</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker4</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker5</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker6</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker7</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker8</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker9</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker10</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker11</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker12</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker13</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker14</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker15</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker16</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency1</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency2</depends>
+ <depends>jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-supplier1</depends>
</jbossesb-deployment>
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/META-INF/jboss-esb.xml 2008-07-07 17:41:18 UTC (rev 130)
@@ -57,19 +57,7 @@
<jms-bus busid="BrokerService16">
<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-broker16"/>
</jms-bus>
- <jms-bus busid="CreditAgencyService">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency" />
- </jms-bus>
- <jms-bus busid="CreditAgencyService1">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency1" />
- </jms-bus>
- <jms-bus busid="CreditAgencyService2">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-creditAgency2" />
- </jms-bus>
- <jms-bus busid="Supplier">
- <jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-supplier" />
- </jms-bus>
- <jms-bus busid="Supplier1">
+ <jms-bus busid="SupplierService1">
<jms-message-filter dest-type="QUEUE" dest-name="queue/esb-loan-supplier1" />
</jms-bus>
</jms-provider>
@@ -84,16 +72,7 @@
busidref="BrokerService"
maxThreads="1"/>
</listeners>
- <actions mep="OneWay">
-
- <!-- This action routes incoming messages to the appropriate
- service descriptor for the state of the session. The message is
- only routed to the service descriptor if the session associated
- with the message's identity has the service descriptor on its
- schedule. The only exception to this is where the session does
- not yet exist, and the message being routed will initiate the
- session - not sure yet if this needs to be flagged specifically. -->
-
+ <actions mep="OneWay">
<action class="org.jboss.soa.overlord.jbossesb.actions.MessageRouterAction"
process="process" name="s0-1">
<property name="paths">
@@ -117,13 +96,6 @@
</action>
</actions>
</service>
-
- <!-- Link to service description is made by the 'serviceType' property in
- the CreateSessionAction. This could be associated with the session pojo,
- but means that pojo might then not be able to be shared in other sessions.
- This 'serviceType' property is only relevant for the 'root' choreography,
- so CreateSessionAction associated with a sub-choreography would not need
- to define this property. -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main" description="">
<listeners>
@@ -156,14 +128,6 @@
</actions>
</service>
- <!-- Possibly this following service descriptor does not need a RetrieveSessionAction
- as it is the target of a 'control link', and therefore could carry the session
- id (internal id used with hibernate) to retrieve the session in the first
- conversation based action. However we also need to be able to remove the
- service descriptor from the schedule. If there is a way for the action to
- know that it is the first 'conversation based' action in the pipeline, then
- possibly this fact could be used to remove the service descriptor (as
- long as it can get hold of its own service category and name -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.1" description="">
<listeners>
@@ -175,7 +139,7 @@
<action class="org.jboss.soa.overlord.jbossesb.actions.WhileAction"
process="process" name="s2-1">
<property name="paths">
- <while decision-method="sendAllRequests"
+ <while decision-method="hasSuppliers"
service-category="ESBBroker.BrokerParticipant"
service-name="ESBBrokerProcess.main.2"
immediate="true" />
@@ -186,10 +150,6 @@
</action>
</actions>
</service>
-
- <!-- This service descriptor represents the internal part of the while loop
- and due to only having one simple action, it ends with the state transition
- back to the service descriptor that contains the controlling 'WhileAction' -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.2" description="">
<listeners>
@@ -203,28 +163,22 @@
<property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
<property name="serviceName" value="RequestForQuote.main" />
<property name="bindDetails" >
-
- <!-- Not sure of the xpath expression syntax when accessing
- properties on a context object, but hopefully gets the
- purpose across. CDL uses custom XPath functions, but would
- be better if we could do without custom functions. -->
-
- <bind from-expression="/suppliers[/supplierIndex]"
+ <bind from-expression="getCurrentSupplier()"
to-variable="supplier" />
</property>
</action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction" name="s3-2">
+ <property name="variable" value="supplierIndex" />
+ <property name="stateExpression" value="nextSupplier()" />
+ </action>
<action class="org.jboss.soa.overlord.jbossesb.actions.ScheduleStateAction"
- process="process" name="s3-2">
+ process="process" name="s3-3">
<property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
<property name="serviceName" value="ESBBrokerProcess.main.1" />
<property name="immediate" value="true" />
</action>
</actions>
</service>
-
- <!-- Need to decide how to specify when expression and other properties. Should
- they be in a single property (same format as if, switch, etc) or should the
- information just be in separate properties? -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.3" description="">
<listeners>
@@ -236,7 +190,7 @@
<action class="org.jboss.soa.overlord.jbossesb.actions.WhenAction"
process="process" name="s4-1">
<property name="paths">
- <when expression="allQuotesReceived"
+ <when expression="receivedAllQuotes"
service-category="ESBBroker.BrokerParticipant"
service-name="ESBBrokerProcess.main.4" />
</property>
@@ -251,13 +205,17 @@
maxThreads="1"/>
</listeners>
<actions mep="OneWay">
- <action class="org.jboss.soa.overlord.jbossesb.actions.GetStateAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetMessageAction"
process="process" name="s4-1">
- <property name="session" value="org.jboss.soa.esb.samples.broker.BrokerMain" />
- <property name="variable" value="quotes" />
+ <property name="headerProperty" value="quotes" />
+ <property name="stateExpression" value="quotes" />
</action>
- <action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction"
+ <action class="org.jboss.soa.overlord.samples.jbossesb.loan.broker.SetQuotesListAction"
process="process" name="s4-2">
+
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction"
+ process="process" name="s4-3">
<property name="operation" value="makeEnquiry" />
<property name="messageType" value="quoteList" />
<property name="clientEPR" value="buyer" />
@@ -268,22 +226,13 @@
</property>
</action>
<action class="org.jboss.soa.overlord.jbossesb.actions.ScheduleStateAction"
- process="process" name="s4-3">
+ process="process" name="s4-4">
<property name="serviceCategory" value="ESBBroker.BrokerParticipant" />
<property name="serviceName" value="ESBBrokerProcess.main.5" />
<property name="immediate" value="false" />
</action>
</actions>
</service>
-
- <!-- RetrieveSessionAction put in here, as this is the target of a
- 'message link', and therefore will be triggered by the receipt of an
- external message. Depends whether client will actually invoke this service,
- or whether it would go through the 'behavioural gateway' - in which case
- the Retrieve may not be necessary, as the gateway could forward the relevant
- internal session id.
- The service name and category in the retrieve may be redundant if the
- action can determine the service descriptor it is container within. -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.5" description="">
<listeners>
@@ -318,12 +267,6 @@
</action>
</actions>
</service>
-
- <!-- Does not have a 'RetrieveSessionAction', as this is a 'control link'.
- Although even if message link, possible the ReceiveMessageAction could
- remove the service descriptor from the schedule, if it knows that it is the
- first conversation based action in the pipeline, and have access to the
- service descriptor information. -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.6" description="">
<listeners>
@@ -344,11 +287,6 @@
</action>
</actions>
</service>
-
- <!-- This and the following action are potentially redundant. Instead of performing
- a sub-session, it could just define the actions that are in that sub-session. The
- way it has been modelled here reflects the sub-choreos in the model, but this is not
- necessary to be able to check conformance. -->
<service category="ESBBroker.BrokerParticipant" name="ESBBrokerProcess.main.7" description="">
<listeners>
@@ -382,20 +320,12 @@
maxThreads="1"/>
</listeners>
<actions mep="OneWay">
- <!-- No actions - required to act as a join point for the performed sub-choreo
- to prevent the session from completing and prematurely terminating the child
- sessions.-->
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction" name="temporarily">
+
+ </action>
</actions>
</service>
- <!--
- REQUEST FOR QUOTE SUB-CHOREOGRAPHY
- -->
-
- <!-- GPB TODO: Think about identities - as there will be multiple concurrent
- RequestForQuote sub-sessions (one per supplier), then need to each have
- unique key, probably based on supplier id. -->
-
<service category="ESBBroker.BrokerParticipant" name="RequestForQuote.main" description="">
<listeners>
<jms-listener name="BrokerServiceListener10"
@@ -408,30 +338,34 @@
<property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.broker.Request4QuoteMain" />
</action>
- <!-- NOTE: the service being sent the message is obtained by
- xpath expression on the session's state. -->
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetMessageAction" name="s8-2">
+ <property name="headerProperty" value="serviceDescriptionName" />
+ <property name="stateExpression" value="supplier.serviceDescription" />
+ </action>
+ <action class="org.jboss.soa.overlord.samples.jbossesb.loan.broker.SetRequestQuoteMessageAction" name="s8-3">
+ </action>
+
<action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction"
- process="process" name="s8-2">
+ process="process" name="s8-4">
<property name="operation" value="getQuote" />
<property name="messageType" value="requestForQuote" />
- <property name="serviceName" value="/supplier/serviceName" />
- <property name="serviceCategory" value="/supplier/serviceCategory" />
+ <property name="serviceNameExpression" value="supplier.serviceName" />
+ <property name="serviceCategoryExpression" value="supplier.serviceCategory" />
<property name="responseServiceName" value="RequestForQuote.main.1" />
<property name="responseServiceCategory" value="ESBBroker.BrokerParticipant" />
<property name="identities" >
<identity type="primary" >
<token name="id" locator="//@id" />
+ <token name="supplierDesc" locator="//@supplierDesc" />
</identity>
</property>
</action>
</actions>
</service>
- <!-- message link - but possibly can deal with schedule and session
- retrieval as previously discussed -->
- <service category="ESBBroker.BrokerParticipant" name="RequestForQuote.main" description="">
+ <service category="ESBBroker.BrokerParticipant" name="RequestForQuote.main.1" description="">
<listeners>
<jms-listener name="BrokerServiceListener11"
busidref="BrokerService11"
@@ -442,19 +376,38 @@
process="process" name="s9-1">
<property name="operation" value="getQuote" />
<property name="messageType" value="quote" />
+ <property name="serviceDescriptionName" value="{http://www.jboss.org/overlord/loanBroker}Broker"/>
<property name="identities" >
<identity type="primary" >
<token name="id" locator="//@id" />
+ <token name="supplierDesc" locator="//@supplierDesc" />
</identity>
</property>
</action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ process="process" name="s9-2">
+ <property name="variable" value="quote.serviceDescription" />
+ <property name="messageExpression" value="//@supplierDesc" />
+ </action>
+
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ process="process" name="s9-3">
+ <property name="variable" value="quote.serviceDescription" />
+ <property name="messageExpression" value="//@supplierDesc" />
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ process="process" name="s9-4">
+ <property name="variable" value="quote.value" />
+ <property name="messageExpression" value="/quote" />
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetVariableAction"
+ process="process" name="s9-4">
+ <property name="variable" value="parent.quote" />
+ <property name="stateExpression" value="quote" />
+ </action>
</actions>
</service>
- <!--
- COMPLETE TRANSACTION SUB-CHOREOGRAPHY
- -->
-
<service category="ESBBroker.BrokerParticipant" name="CompleteTransaction.main" description="">
<listeners>
<jms-listener name="BrokerServiceListener12"
@@ -481,8 +434,8 @@
process="process" name="s10-3">
<property name="operation" value="checkCredit" />
<property name="messageType" value="creditInformation" />
- <property name="serviceName" value="CA.CompleteTransaction.main" />
- <property name="serviceCategory" value="ESBBroker.CreditAgencyParticipant" />
+ <property name="serviceName" value="CreditAgency.Main" />
+ <property name="serviceCategory" value="ESBBroker.CreditAgency" />
<property name="responseServiceName" value="CompleteTransaction.main.1" />
<property name="responseServiceCategory" value="ESBBroker.BrokerParticipant" />
<property name="identities" >
@@ -546,9 +499,8 @@
</property>
</action>
- <!-- Intermediate actions to construct confirmation -->
- <action class="org.jboss.soa.overlord.jbossesb.actions.GetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetMessageAction"
process="process" name="s12-2">
<property name="variable" value="confirmation" />
</action>
@@ -587,10 +539,8 @@
</property>
</action>
- <!-- Intermediate actions to store booking reference and then
- retrieve confirmation to be returned to the customer e.g. -->
- <action class="org.jboss.soa.overlord.jbossesb.actions.GetVariableAction"
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SetMessageAction"
process="process" name="s13-2">
<property name="variable" value="confirmation" />
</action>
@@ -626,9 +576,6 @@
</identity>
</property>
</action>
-
- <!-- Intermediate actions to build and return OrderRejected
- message and return it to the customer -->
<action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction"
process="process" name="s13-3">
@@ -644,7 +591,43 @@
</actions>
</service>
- <!-- CreditAgency participant -->
-
+ <service category="ESBBroker.Suppliers" name="Supplier1.main" description="">
+ <listeners>
+ <jms-listener name="SupplierServiceListener1"
+ busidref="SupplierService1"
+ maxThreads="1"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action class="org.jboss.soa.overlord.jbossesb.actions.CreateSessionAction"
+ process="process" name="su1">
+ <property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.supplier.SupplierMain" />
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.ReceiveMessageAction"
+ process="process" name="su2">
+ <property name="messageType" value="requestForQuote" />
+ <property name="clientEPR" value="broker" />
+ <property name="identities" >
+ <identity type="primary" >
+ <token name="id" locator="//@id" />
+ <token name="supplierDesc" locator="//@supplierDesc" />
+ </identity>
+ </property>
+ </action>
+ <action class="org.jboss.soa.overlord.samples.jbossesb.loan.supplier.SetQuoteMessageAction" name="su3">
+ </action>
+ <action class="org.jboss.soa.overlord.jbossesb.actions.SendMessageAction"
+ process="process" name="su4">
+ <property name="messageType" value="quote" />
+ <property name="clientEPR" value="broker" />
+ <property name="identities" >
+ <identity type="primary" >
+ <token name="id" locator="//@id" />
+ <token name="supplierDesc" locator="//@supplierDesc" />
+ </identity>
+ </property>
+ </action>
+ </actions>
+ </service>
+
</services>
</jbossesb>
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/hibernate.cfg.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/hibernate.cfg.xml 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/hibernate.cfg.xml 2008-07-07 17:41:18 UTC (rev 130)
@@ -61,6 +61,8 @@
<mapping class="org.jboss.soa.overlord.samples.jbossesb.loan.broker.Quote" />
<mapping class="org.jboss.soa.overlord.samples.jbossesb.loan.broker.Request4QuoteMain" />
+ <mapping class="org.jboss.soa.overlord.samples.jbossesb.loan.supplier.SupplierMain" />
+ <mapping class="org.jboss.soa.overlord.samples.jbossesb.loan.creditAgency.CreditAgency" />
</session-factory>
</hibernate-configuration>
Modified: cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml
===================================================================
--- cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/broker/src/main/resources/jbmq-queue-service.xml 2008-07-07 17:41:18 UTC (rev 130)
@@ -2,108 +2,137 @@
<server>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker1">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker_reply">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker2">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker1">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker2">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker3">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker3">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker4">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker4">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker5">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker5">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker6">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker6">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker7">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker7">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker8">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker8">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker9">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker9">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker10">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker10">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker11">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker11">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker12">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker12">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker13">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker13">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker14">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker14">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker15">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker15">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
<mbean code="org.jboss.mq.server.jmx.Queue"
- name="jboss.esb.gen.destination:service=Queue,name=esb-loan-broker16">
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-broker16">
<depends optional-attribute-name="DestinationManager">
jboss.mq:service=DestinationManager
</depends>
</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency1">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-creditAgency2">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
+<mbean code="org.jboss.mq.server.jmx.Queue"
+ name="jboss.esb.sample.broker.destination:service=Queue,name=esb-loan-supplier1">
+ <depends optional-attribute-name="DestinationManager">
+ jboss.mq:service=DestinationManager
+ </depends>
+</mbean>
-
</server>
Modified: cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/jboss-esb.xml
===================================================================
--- cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/jboss-esb.xml 2008-07-07 11:36:01 UTC (rev 129)
+++ cdl/trunk/samples/jbossesb/purchasing/src/main/resources/META-INF/jboss-esb.xml 2008-07-07 17:41:18 UTC (rev 130)
@@ -276,11 +276,11 @@
</listeners>
<actions mep="OneWay">
<action class="org.jboss.soa.overlord.jbossesb.actions.CreateSessionAction"
- process="process" name="c1">
- <property name="session" value="com.acme.services.creditAgency.CreditAgencyPurchase" />
+ process="process" name="su1">
+ <property name="session" value="org.jboss.soa.overlord.samples.jbossesb.loan.supplier.SupplierMain" />
</action>
<action class="org.jboss.soa.overlord.jbossesb.actions.ReceiveMessageAction"
- process="process" name="c2">
+ process="process" name="su2">
<property name="operation" value="checkCredit" />
<property name="messageType" value="CreditCheckRequest" />
<property name="clientEPR" value="broker" />
More information about the overlord-commits
mailing list