[jboss-svn-commits] JBL Code SVN: r20631 - in labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent: src/org/jboss/soa/esb/samples/quickstart and 3 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 19 01:35:52 EDT 2008


Author: beve
Date: 2008-06-19 01:35:52 -0400 (Thu, 19 Jun 2008)
New Revision: 20631

Added:
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java
Removed:
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/businessrules/
Modified:
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml
   labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml
Log:
added the 'ruleagent' package name as this conflicted with the busines_ruleservice_statful quickstart.


Modified: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml	2008-06-19 04:58:42 UTC (rev 20630)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/build.xml	2008-06-19 05:35:52 UTC (rev 20631)
@@ -23,7 +23,7 @@
   <target name="runtest" depends="compile"
 	description="will receive JMS message to trigger the actions in the ESB">
      <echo>Runs Test JMS Sender</echo>
-     <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.businessrules.test.SendJMSMessage" failonerror="true">
+     <java fork="yes" classname="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.test.SendJMSMessage" failonerror="true">
 		<classpath refid="exec-classpath" />
      </java>
   </target>  

Modified: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml	2008-06-19 04:58:42 UTC (rev 20630)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/deployment.xml	2008-06-19 05:35:52 UTC (rev 20631)
@@ -2,7 +2,7 @@
 <jbossesb-deployment>
   <depends>jboss.esb:deployment=jbrules.esb</depends>
   <depends>jboss.esb:deployment=smooks.esb</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW</depends>
-  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB</depends>
-<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW</depends>
+  <depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB</depends>
+<depends>jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify</depends>
 </jbossesb-deployment>

Modified: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml	2008-06-19 04:58:42 UTC (rev 20630)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbm-queue-service.xml	2008-06-19 05:35:52 UTC (rev 20631)
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <server>
   <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW"
     xmbean-dd="xmdesc/Queue-xmbean.xml">
     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>
   </mbean>
   <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB"
     xmbean-dd="xmdesc/Queue-xmbean.xml">
     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>
   </mbean>
   <mbean code="org.jboss.jms.server.destination.QueueService"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify"
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify"
     xmbean-dd="xmdesc/Queue-xmbean.xml">
     <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
 	<depends>jboss.messaging:service=PostOffice</depends>

Modified: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml	2008-06-19 04:58:42 UTC (rev 20630)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jbmq-queue-service.xml	2008-06-19 05:35:52 UTC (rev 20631)
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <server>
   <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_GW">
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_GW">
     <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
     </depends>
   </mbean>
   <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Request_ESB">
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Request_ESB">
     <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
     </depends>
   </mbean>
   <mbean code="org.jboss.mq.server.jmx.Queue"
-    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_Notify">
+    name="jboss.esb.quickstart.destination:service=Queue,name=quickstart_Business_Rules_RuleAgent_Notify">
     <depends optional-attribute-name="DestinationManager">
       jboss.mq:service=DestinationManager
     </depends>

Modified: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml	2008-06-19 04:58:42 UTC (rev 20630)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/jboss-esb.xml	2008-06-19 05:35:52 UTC (rev 20631)
@@ -9,11 +9,11 @@
 			jndi-URL="localhost">
 			<jms-bus busid="quickstartGwChannel">
 				<jms-message-filter dest-type="QUEUE"
-					dest-name="queue/quickstart_Business_Rules_Request_GW" />
+					dest-name="queue/quickstart_Business_Rules_RuleAgent_Request_GW" />
 			</jms-bus>
 			<jms-bus busid="quickstartEsbChannel">
 				<jms-message-filter dest-type="QUEUE"
-					dest-name="queue/quickstart_Business_Rules_Request_ESB" />
+					dest-name="queue/quickstart_Business_Rules_RuleAgent_Request_ESB" />
 			</jms-bus>
 		</jms-provider>
 	</providers>
@@ -43,15 +43,14 @@
 				</action>
 
 				<action name="fixUpMessage"
-					class="org.jboss.soa.esb.samples.quickstart.businessrules.SetupMessage">
+					class="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.SetupMessage">
 				</action>
 								
 				<!--  Use the BRP to calculate the policy price -->
 				<action
-					class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
-					name="PolicyPricing">
-					<property name="ruleSet"
-						value="ruleAgent/brmsdeployedrules.properties" />
+					class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
+ name="PolicyPricing">
+					<property name="ruleAgentProperties" value="ruleAgent/brmsdeployedrules.properties" />
 					<property name="object-paths">
 						<object-path esb="body.Driver" />
 						<object-path esb="body.Policy" />
@@ -59,7 +58,7 @@
 				</action>
 			
 			  	<action name="reviewMessage"
-					class="org.jboss.soa.esb.samples.quickstart.businessrules.ReviewMessage">
+					class="org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.ReviewMessage">
 					<property name="stuff" value="Sent notification: "/>
 			     </action>
 			</actions>

Added: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/ReviewMessage.java	2008-06-19 05:35:52 UTC (rev 20631)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.Driver;
+import org.jboss.soa.esb.services.rules.Policy;
+
+public class ReviewMessage extends AbstractActionPipelineProcessor {
+	private String input = "Sent Notification to:";
+	
+	public Message process(Message message) throws ActionProcessingException {
+		
+		Driver driver = (Driver) message.getBody().get("Driver");
+		Policy policy = (Policy) message.getBody().get("Policy");	
+		System.out.println("{ ================ " + input);		
+		System.out.println("Name: " + driver.getName());
+		System.out.println("Policy Price: " + policy.getBasePrice());
+		System.out.println("} ================ " + input);
+		
+	
+		return message;
+	}
+	
+	public ReviewMessage(ConfigTree configTree) {
+		input = configTree.getAttribute("stuff");
+	}
+	
+}

Added: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/SetupMessage.java	2008-06-19 05:35:52 UTC (rev 20631)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules;
+
+import java.util.HashMap;
+import org.jboss.soa.esb.actions.AbstractActionPipelineProcessor;
+import org.jboss.soa.esb.actions.ActionProcessingException;
+import org.jboss.soa.esb.helpers.ConfigTree;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.services.rules.Driver;
+import org.jboss.soa.esb.services.rules.Policy;
+import org.apache.log4j.Logger;
+
+public class SetupMessage extends AbstractActionPipelineProcessor {
+	private Logger logger = Logger.getLogger(SetupMessage.class);
+	
+	public Message process(Message message) throws ActionProcessingException {
+		HashMap transformedBeans = (HashMap) message.getBody().get("EXTRACTED_BEANS_HASH");
+		if(transformedBeans != null) {
+			Driver driver = (Driver) transformedBeans.get("Driver");
+			Policy policy = (Policy) transformedBeans.get("Policy");	
+			message.getBody().add("Driver", driver);
+			message.getBody().add("Policy", policy);			
+			logger.info("Moved the transformed driver and policy");
+		}
+		return message;
+	}
+	
+	public SetupMessage(ConfigTree configTree) {
+		
+	}
+	
+}

Added: labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java
===================================================================
--- labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java	                        (rev 0)
+++ labs/jbossesb/workspace/dbevenius/ruleservice/product/samples/quickstarts/business_ruleservice_ruleAgent/src/org/jboss/soa/esb/samples/quickstart/ruleagent/businessrules/test/SendJMSMessage.java	2008-06-19 05:35:52 UTC (rev 20631)
@@ -0,0 +1,110 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author JBoss Inc.
+ */
+package org.jboss.soa.esb.samples.quickstart.ruleagent.businessrules.test;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.jms.JMSException;
+import javax.jms.QueueConnectionFactory;
+import javax.jms.Queue;
+import javax.jms.QueueConnection;
+import javax.jms.QueueSession;
+import javax.jms.QueueSender;
+import javax.jms.ObjectMessage;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+public class SendJMSMessage {
+    QueueConnection conn;
+    QueueSession session;
+    Queue que;
+    
+    
+    public void setupConnection() throws JMSException, NamingException
+    {
+    	InitialContext iniCtx = new InitialContext();
+    	Object tmp = iniCtx.lookup("ConnectionFactory");
+    	QueueConnectionFactory qcf = (QueueConnectionFactory) tmp;
+    	conn = qcf.createQueueConnection();
+    	que = (Queue) iniCtx.lookup("queue/quickstart_Business_Rules_RuleAgent_Request_GW");
+    	session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+    	conn.start();
+    	System.out.println("Connection Started");
+    }
+    
+    public void stop() throws JMSException 
+    { 
+        conn.stop();
+        session.close();
+        conn.close();
+    }
+    
+    public void sendAMessage(String msg) throws JMSException {
+    	
+        QueueSender send = session.createSender(que);        
+        ObjectMessage tm = session.createObjectMessage(msg);        
+        send.send(tm);        
+        send.close();
+    }
+    public String readAsciiFile(String fileName) throws IOException {
+		  FileReader fr = null;
+		  char[] thechars = null;
+
+		  try {
+			  File thefile = new File( fileName );
+			  fr = new FileReader( thefile );
+			  int size = (int) thefile.length();
+			  thechars = new char[size];
+		
+			  int count, index = 0;
+		
+			  // 	read in the bytes from the input stream
+			  while( ( count = fr.read( thechars, index, size ) ) > 0 ) {
+				  size -= count;
+				  index += count;
+			  }
+			} catch(Exception e) {	
+				System.out.println(e);
+			}
+			finally {
+				if( fr != null )
+		        fr.close();
+			}
+			return new String(thechars);
+
+    } // readAsciiFile
+    
+    public static void main(String args[]) throws Exception
+    {        	    	
+    	SendJMSMessage sm = new SendJMSMessage();
+    	sm.setupConnection();
+    	String fileContent = sm.readAsciiFile("SampleDriver.xml");
+    	System.out.println("---------------------------------------------");
+    	System.out.println(fileContent);
+    	System.out.println("---------------------------------------------");
+    	sm.sendAMessage(fileContent); 
+    	sm.stop();
+    	
+    }
+    
+}




More information about the jboss-svn-commits mailing list