[jboss-svn-commits] JBL Code SVN: r20224 - in labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4: images and 3 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 30 03:04:59 EDT 2008
Author: beve
Date: 2008-05-30 03:04:58 -0400 (Fri, 30 May 2008)
New Revision: 20224
Added:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/images/gear1.gif
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/lib/swing-layout-1.0.jar
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.form
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.java
Modified:
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/Priority_Rules.drl
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/build.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processdefinition.xml
labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processimage.jpg
Log:
Work for JBESB-1586 "Update bpm_orchestration4 quickstart"
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/Priority_Rules.drl
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/Priority_Rules.drl 2008-05-29 19:58:03 UTC (rev 20223)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/Priority_Rules.drl 2008-05-30 07:04:58 UTC (rev 20224)
@@ -12,24 +12,18 @@
rule "Logging"
+salience 10
when
order: OrderHeader()
customer: Customer()
then
System.out.println("Customer Status: " + customer.getStatus());
System.out.println("Order Total: " + order.getTotalAmount());
+ order.setOrderPriority(1);
end
-rule "Customer Platinum Status"
- when
- customer: Customer(status > 50)
- order: OrderHeader(totalAmount > 50)
- then
- System.out.println("Platinum Customer - High Priority");
- order.setOrderPriority(3);
-end
-
rule "Customer Gold Status"
+salience 20
when
customer: Customer(status > 10, status <= 50)
order: OrderHeader(totalAmount > 25)
@@ -38,6 +32,15 @@
order.setOrderPriority(2);
end
+rule "Customer Platinum Status"
+salience 20
+ when
+ customer: Customer(status > 50)
+ order: OrderHeader(totalAmount > 50)
+ then
+ System.out.println("Platinum Customer - High Priority");
+ order.setOrderPriority(3);
+end
\ No newline at end of file
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/build.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/build.xml 2008-05-29 19:58:03 UTC (rev 20223)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/build.xml 2008-05-30 07:04:58 UTC (rev 20224)
@@ -34,7 +34,7 @@
<taskdef name="deployToServer" classname="org.jbpm.ant.DeployProcessToServerTask">
<classpath refid="exec-classpath"/>
</taskdef>
- <deployToServer username="${jbpm.console.username}" password="${jbpm.console.password}" serverDeployer="${org.jboss.esb.jbpm.console.upload.url}">
+ <deployToServer>
<fileset dir="${basedir}/processDefinition" includes="*"/>
</deployToServer>
</target>
@@ -42,7 +42,7 @@
<target name="startProcess" depends="compile" description="Sends a message to start the process instance">
<echo>Sends a message to start the process instance</echo>
- <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendJMSMessageStart" failonerror="true">
+ <java fork="yes" classname="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.test.SendJMSMessageStart" failonerror="true">
<arg value="SampleOrder.xml"/>
<classpath refid="exec-classpath"/>
</java>
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/images/gear1.gif
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/images/gear1.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml 2008-05-29 19:58:03 UTC (rev 20223)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/jboss-esb.xml 2008-05-30 07:04:58 UTC (rev 20224)
@@ -5,10 +5,17 @@
<providers>
<jms-provider name="JBossMQ"
- connection-factory="ConnectionFactory">
+ connection-factory="ConnectionFactory"
+ jndi-URL="jnp://127.0.0.1:1099"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces">
+
<jms-bus busid="startGwChannel">
<jms-message-filter dest-type="QUEUE"
dest-name="queue/quickstart_bpm_orchestration4_start_gw" />
+ <!-- quickstart_bpm_orchestration4_start_gw -->
+ <!-- This queue is used for JPetstore's order -->
+ <!-- queue/quickstart_simple_cbr_Request -->
</jms-bus>
<jms-bus busid="startEsbChannel">
<jms-message-filter dest-type="QUEUE"
@@ -112,7 +119,7 @@
<action name="SetupMessage"
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.esb_actions.SetupMessage">
- <property name="status" value="60" />
+ <property name="status" value="40" />
<!-- status was not in order XML, this is just for demo purposes -->
</action>
@@ -237,7 +244,7 @@
busidref="conciergeServiceEsbChannel" maxThreads="1">
</jms-listener>
</listeners>
- <actions>
+ <actions mep="OneWay">
<action name="monitor" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.esb_actions.SimpleJMSNotifier">
<property name="ALERT_QUEUE_NAME" value="quickstart_bpm_orchestration4_monitor" />
<property name="PREPENDED_TEXT" value="Concierge:Highest Priority Customers/Orders" />
@@ -253,7 +260,7 @@
busidref="distributionServiceEsbChannel" maxThreads="1">
</jms-listener>
</listeners>
- <actions>
+ <actions mep="OneWay">
<action name="monitor" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.esb_actions.SimpleJMSNotifier">
<property name="ALERT_QUEUE_NAME" value="quickstart_bpm_orchestration4_monitor" />
<property name="PREPENDED_TEXT" value="Distribution Manager:Medium Priority Customers/Orders" />
@@ -268,7 +275,7 @@
busidref="basicShippingServiceEsbChannel" maxThreads="1">
</jms-listener>
</listeners>
- <actions>
+ <actions mep="OneWay">
<action name="monitor" class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration4.esb_actions.SimpleJMSNotifier">
<property name="ALERT_QUEUE_NAME" value="quickstart_bpm_orchestration4_monitor" />
<property name="PREPENDED_TEXT" value="Basic:Lowest Priority Customers/Orders" />
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/lib/swing-layout-1.0.jar
===================================================================
(Binary files differ)
Property changes on: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/lib/swing-layout-1.0.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processdefinition.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processdefinition.xml 2008-05-29 19:58:03 UTC (rev 20223)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processdefinition.xml 2008-05-30 07:04:58 UTC (rev 20224)
@@ -1,92 +1,100 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<process-definition
- name="bpm4_ESBOrderProcess">
- <start-state name="start">
- <transition name="" to="Intake Order"></transition>
- </start-state>
-
- <node name="Intake Order">
-
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration4</esbCategoryName>
- <esbServiceName>IntakeService</esbServiceName>
- <!-- async call of IntakeService -->
- <bpmToEsbVars>
- <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT" />
- </bpmToEsbVars>
- <esbToBpmVars>
- <mapping esb="body.entireOrderAsXML" bpm="entireOrderAsXML" />
- <mapping esb="body.orderHeader" bpm="entireOrderAsObject" />
- <mapping esb="body.customer" bpm="entireCustomerAsObject" />
- <mapping esb="body.order_orderId" bpm="order_orderid" />
- <mapping esb="body.order_totalAmount" bpm="order_totalamount" />
- <mapping esb="body.order_orderPriority" bpm="order_priority" />
- <mapping esb="body.customer_firstName" bpm="customer_firstName" />
- <mapping esb="body.customer_lastName" bpm="customer_lastName" />
- <mapping esb="body.customer_status" bpm="customer_status" />
- </esbToBpmVars>
- </action>
-
- <transition name="" to="Review Order"></transition>
- </node>
-
- <task-node name="Review Order">
- <task name="Order Review">
- <assignment actor-id="user"></assignment>
- <controller>
- <variable name="customer_firstName" access="read,write,required"></variable>
- <variable name="customer_lastName" access="read,write,required"></variable>
- <variable name="customer_status" access="read"></variable>
- <variable name="order_totalamount" access="read"></variable>
- <variable name="order_priority" access="read"></variable>
- <variable name="order_orderid" access="read"></variable>
- <variable name="order_discount" access="read"></variable>
- <variable name="entireOrderAsXML" access="read"></variable>
- </controller>
- </task>
- <transition name="" to="Calculate Discount"></transition>
- </task-node>
-
- <node name="Calculate Discount">
-
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
- <esbCategoryName>BPM_Orchestration4</esbCategoryName>
- <esbServiceName>DiscountService</esbServiceName>
- <bpmToEsbVars>
- <mapping bpm="entireCustomerAsObject" esb="customer" />
- <mapping bpm="entireOrderAsObject" esb="orderHeader" />
- <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT" />
- </bpmToEsbVars>
- <esbToBpmVars>
- <mapping bpm="entireOrderAsObject" esb="order" />
- <mapping esb="body.order_orderDiscount" bpm="order_discount" />
- </esbToBpmVars>
- </action>
-
- <transition name="" to="Review Discount"></transition>
- </node>
-
- <task-node name="Review Discount">
- <task name="Discount Review">
- <assignment actor-id="manager"></assignment>
- </task>
- <transition name="" to="Ship It"></transition>
- </task-node>
-
- <node name="Ship It">
- <transition name="" to="end">
- <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
- <esbCategoryName>BPM_Orchestration4</esbCategoryName>
- <esbServiceName>ShippingService</esbServiceName>
- <bpmToEsbVars><mapping bpm="entireCustomerAsObject" esb="customer" />
- <mapping bpm="entireOrderAsObject" esb="orderHeader" />
- <mapping bpm="entireOrderAsXML" esb="entireOrderAsXML" />
- </bpmToEsbVars>
- </action>
- </transition>
- </node>
-
- <end-state name="end"></end-state>
-
-</process-definition>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process-definition
+ name="bpm4_ESBOrderProcess">
+ <start-state name="start">
+ <transition name="" to="Intake Order"></transition>
+ </start-state>
+
+ <node name="Intake Order" async="true">
+
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration4</esbCategoryName>
+ <esbServiceName>IntakeService</esbServiceName>
+ <!-- async call of IntakeService -->
+ <bpmToEsbVars>
+ <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT" />
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping esb="body.entireOrderAsXML" bpm="entireOrderAsXML" />
+ <mapping esb="body.orderHeader" bpm="entireOrderAsObject" />
+ <mapping esb="body.customer" bpm="entireCustomerAsObject" />
+ <mapping esb="body.order_orderId" bpm="order_orderid" />
+ <mapping esb="body.order_totalAmount" bpm="order_totalamount" />
+ <mapping esb="body.order_orderPriority" bpm="order_priority" />
+ <mapping esb="body.customer_firstName" bpm="customer_firstName" />
+ <mapping esb="body.customer_lastName" bpm="customer_lastName" />
+ <mapping esb="body.customer_status" bpm="customer_status" />
+ </esbToBpmVars>
+ </action>
+
+ <transition name="" to="Review Order"></transition>
+ </node>
+
+ <task-node name="Review Order" async="true">
+ <task name="Order Review">
+ <assignment actor-id="user"></assignment>
+ <controller>
+ <variable name="customer_firstName" access="read,write,required"/>
+ <variable name="customer_lastName" access="read,write,required"/>
+ <variable name="customer_status" access="read,write"/>
+ <variable name="order_totalamount" access="read"/>
+ <variable name="order_priority" access="read"/>
+ <variable name="order_orderid" access="read"/>
+ <variable name="order_discount" access="read"/>
+ <variable name="entireOrderAsXML" access="read"/>
+ </controller>
+ </task>
+ <transition name="" to="Calculate Discount"/>
+ </task-node>
+
+ <node name="Calculate Discount" async="true">
+
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbActionHandler">
+ <esbCategoryName>BPM_Orchestration4</esbCategoryName>
+ <esbServiceName>DiscountService</esbServiceName>
+ <bpmToEsbVars>
+ <mapping bpm="entireCustomerAsObject" esb="body.customer" />
+ <mapping bpm="customer_firstName" esb="body.customer.firstName" />
+ <mapping bpm="customer_lastName" esb="body.customer.lastName" />
+ <mapping bpm="customer_status" esb="body.customer.status" />
+ <mapping bpm="entireOrderAsObject" esb="orderHeader" />
+ <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT" />
+ </bpmToEsbVars>
+ <esbToBpmVars>
+ <mapping bpm="entireOrderAsObject" esb="order" />
+ <mapping esb="body.order_orderDiscount" bpm="order_discount" />
+ <mapping esb="body.customer.firstName" bpm="customer_firstName" />
+ <mapping esb="body.customer.lastName" bpm="customer_lastName" />
+ <mapping esb="body.customer.status" bpm="customer_status" />
+ </esbToBpmVars>
+ </action>
+
+ <transition name="" to="Review Discount"></transition>
+ </node>
+
+ <task-node name="Review Discount" async="true">
+ <task name="Discount Review">
+ <assignment actor-id="manager"></assignment>
+ </task>
+ <transition name="" to="Ship It"></transition>
+ </task-node>
+
+ <node name="Ship It" async="true">
+ <transition name="" to="end">
+ <action name="esbAction" class="org.jboss.soa.esb.services.jbpm.actionhandlers.EsbNotifier">
+ <esbCategoryName>BPM_Orchestration4</esbCategoryName>
+ <esbServiceName>ShippingService</esbServiceName>
+ <bpmToEsbVars><mapping bpm="entireCustomerAsObject" esb="customer" />
+ <mapping bpm="customer_firstName" esb="body.customer.firstName" />
+ <mapping bpm="customer_lastName" esb="body.customer.lastName" />
+ <mapping bpm="entireOrderAsObject" esb="orderHeader" />
+ <mapping bpm="entireOrderAsXML" esb="entireOrderAsXML" />
+ </bpmToEsbVars>
+ </action>
+ </transition>
+ </node>
+
+ <end-state name="end"></end-state>
+
+</process-definition>
Modified: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/processDefinition/processimage.jpg
===================================================================
(Binary files differ)
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.form
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.form (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.form 2008-05-30 07:04:58 UTC (rev 20224)
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="3"/>
+ <Property name="title" type="java.lang.String" value="Service Alert Monitor"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <Events>
+ <EventHandler event="windowClosing" listener="java.awt.event.WindowListener" parameters="java.awt.event.WindowEvent" handler="formWindowClosing"/>
+ </Events>
+ <AuxValues>
+ <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0" pref="265" max="32767" attributes="0"/>
+ <Component id="jButton1" alignment="0" pref="265" max="32767" attributes="0"/>
+ <Component id="jLabel3" alignment="0" pref="265" max="32767" attributes="0"/>
+ <Component id="jLabel1" alignment="0" pref="265" max="32767" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel1" min="-2" pref="39" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jScrollPane1" min="-2" pref="98" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jLabel3" pref="84" max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jButton1" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel1">
+ <Properties>
+ <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+ <Font name="Tahoma" size="18" style="0"/>
+ </Property>
+ <Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
+ <Color blue="cc" green="0" red="0" type="rgb"/>
+ </Property>
+ <Property name="horizontalAlignment" type="int" value="0"/>
+ <Property name="text" type="java.lang.String" value="Service Alert Monitor"/>
+ </Properties>
+ </Component>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
+ </AuxValues>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="textAreaOrderQueue">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
+ <Font name="Arial" size="14" style="0"/>
+ </Property>
+ <Property name="rows" type="int" value="5"/>
+ <Property name="tabSize" type="int" value="2"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton" name="jButton1">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="Clear"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="jLabel3">
+ <Properties>
+ <Property name="horizontalAlignment" type="int" value="0"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+</Form>
Added: labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.java (rev 0)
+++ labs/jbossesb/branches/JBESB_4_2_1_GA_CP/product/samples/quickstarts/bpm_orchestration4/src/ServiceAlertMonitor.java 2008-05-30 07:04:58 UTC (rev 20224)
@@ -0,0 +1,192 @@
+/*
+ * ServiceAlertMonitor2.java
+ *
+ * Created on November 21, 2006, 12:10 AM
+ */
+import javax.swing.UIManager;
+import java.awt.Dimension;
+import java.awt.Toolkit;
+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.TextMessage;
+import javax.jms.Message;
+import javax.jms.QueueReceiver;
+import javax.jms.MessageListener;
+
+/**
+ *
+ * @author burr
+ */
+public class ServiceAlertMonitor extends javax.swing.JFrame implements MessageListener {
+ InitialContext iniCtx = null;
+ QueueConnectionFactory qcf = null;
+ QueueConnection conn = null;
+ QueueSession receiverSession = null;
+ Queue receiverQueue = null;
+ QueueReceiver queueReceiver = null;
+
+ String imageName = "images/javawork.gif";
+
+ /** Creates new form ServiceAlertMonitor */
+ public ServiceAlertMonitor(String serviceName, String queueName, String imageName) {
+ initComponents();
+ this.jLabel1.setText(serviceName);
+ try {
+ if (iniCtx == null) iniCtx = new InitialContext();
+ if (qcf == null) qcf = (QueueConnectionFactory) iniCtx.lookup("ConnectionFactory");
+ if (conn == null) {
+ conn = qcf.createQueueConnection();
+ conn.start();
+ }
+ String responseQueueName = "queue/" + queueName;
+ this.imageName = imageName;
+ receiverQueue = (Queue) iniCtx.lookup(responseQueueName);
+ receiverSession = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);
+ queueReceiver = receiverSession.createReceiver(receiverQueue);
+ queueReceiver.setMessageListener(this);
+ } catch (Exception e) {
+ System.out.println(e);
+ }
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
+ private void initComponents() {
+ jLabel1 = new javax.swing.JLabel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ textAreaOrderQueue = new javax.swing.JTextArea();
+ jButton1 = new javax.swing.JButton();
+ jLabel3 = new javax.swing.JLabel();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setTitle("Service Alert Monitor");
+ addWindowListener(new java.awt.event.WindowAdapter() {
+ public void windowClosing(java.awt.event.WindowEvent evt) {
+ formWindowClosing(evt);
+ }
+ });
+
+ jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
+ jLabel1.setForeground(new java.awt.Color(0, 0, 204));
+ jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ jLabel1.setText("Service Alert Monitor");
+
+ textAreaOrderQueue.setColumns(20);
+ textAreaOrderQueue.setFont(new java.awt.Font("Arial", 0, 14));
+ textAreaOrderQueue.setRows(5);
+ textAreaOrderQueue.setTabSize(2);
+ jScrollPane1.setViewportView(textAreaOrderQueue);
+
+ jButton1.setText("Clear");
+ jButton1.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ jButton1ActionPerformed(evt);
+ }
+ });
+
+ jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+
+ org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .addContainerGap()
+ .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
+ .add(jButton1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
+ .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE)
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 265, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
+ .add(layout.createSequentialGroup()
+ .add(jLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 39, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 98, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jLabel3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 84, Short.MAX_VALUE)
+ .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
+ .add(jButton1)
+ .addContainerGap())
+ );
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
+ try {
+ if (queueReceiver != null) queueReceiver.close();
+ if (receiverSession != null) receiverSession.close();
+
+ } catch (JMSException e) {
+ System.out.println(e);
+ }
+ }//GEN-LAST:event_formWindowClosing
+
+ boolean on = false;
+ private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
+ textAreaOrderQueue.setText("");
+ this.jLabel3.setIcon(null);
+ //this.jLabel3.setVisible(false);
+ }//GEN-LAST:event_jButton1ActionPerformed
+
+
+ public void onMessage(Message msg) {
+ try {
+ String textMessage = ((TextMessage)msg).getText();
+ textAreaOrderQueue.setText(textMessage);
+ java.io.File x = new java.io.File(imageName);
+ System.out.println(x.getAbsolutePath());
+ javax.swing.ImageIcon icon = new javax.swing.ImageIcon(x.getAbsolutePath()); // animated gif
+ this.jLabel3.setIcon(icon);
+ this.jLabel3.setVisible(true);
+ } catch (Exception e) {
+ System.err.println(e);
+ textAreaOrderQueue.setText("ERROR: " + e.getMessage());
+ }
+ }
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) throws Exception {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ System.out.println(args[0]);
+ final String tempServiceName = args[0];
+ System.out.println(args[1]);
+ final String tempQueueName = args[1];
+ System.out.println(args[2]);
+ final String tempImageName = args[2];
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ ServiceAlertMonitor frame = new ServiceAlertMonitor(tempServiceName,tempQueueName,tempImageName);
+
+ // center the window
+ Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
+ frame.setLocation(d.width/2 - frame.getWidth()/2,
+ d.height/2 - frame.getHeight()/2);
+ frame.setVisible(true);
+ }
+ });
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton jButton1;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel3;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea textAreaOrderQueue;
+ // End of variables declaration//GEN-END:variables
+
+}
More information about the jboss-svn-commits
mailing list