You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by sm...@apache.org on 2011/07/03 17:51:46 UTC

svn commit: r1142453 [10/12] - in /incubator/airavata/ws-messaging/trunk/messagebroker: ./ .settings/ customLibs/ customLibs/activeMQ/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/airavata/ src/mai...

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Consumer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Consumer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Consumer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,148 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Consumer extends Thread {
+
+	class NotificationMsgReciever implements ConsumerNotificationHandler {
+
+		private BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+		public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+			queue.add(msgEnvelope);
+		}
+
+		public BlockingQueue<SOAPEnvelope> getQueue() {
+			return queue;
+		}
+
+	}
+
+	private Properties configurations;
+	private int consumerPort;
+
+	public Consumer(String consumerName, int port, Properties config) {
+		super(consumerName);
+		consumerPort = port;
+		configurations = config;
+	}
+
+	public void run() {
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String xpathExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_XPATH);
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+
+		System.out.println("subscribing with xpath expression: "
+				+ xpathExpression);
+
+		NotificationMsgReciever msgReciever = new NotificationMsgReciever();
+
+		String[] consumerEprs = null;
+
+		String subscriptionId = null;
+
+		try {
+			consumerEprs = client.startConsumerService(consumerPort,
+					msgReciever);
+
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out.println("unable to start consumer service, exiting");
+			return;
+		}
+
+		try {
+
+			subscriptionId = client.subscribe(consumerEprs[0], null,
+					xpathExpression);
+			System.out.println(getName() + "got the subscription id :"
+					+ subscriptionId);
+
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out
+					.println("unable to subscribe for the xpath consumer exiting");
+			return;
+		}
+
+		try {
+
+			do {
+
+				SOAPEnvelope env = msgReciever.getQueue().take();
+
+				String msg;
+				try {
+					msg = env.getBody().getFirstElement().toStringWithConsume();
+					System.out.println(String.format(
+							"consumer [%s] recieved: %s", getName(), msg));
+
+				} catch (Exception e) {
+					System.err.print("invalid msg recieved");
+				}
+
+			} while (true);
+
+		} catch (InterruptedException ie) {
+
+			try {
+				// unsubscribe from the topic.
+				client.unSubscribe(subscriptionId);
+			} catch (MsgBrokerClientException e) {
+
+				e.printStackTrace();
+				System.out.println("unable to unsubscribe, ignoring");
+			}
+
+			// shutdown the consumer service.
+			client.shutdownConsumerService();
+
+			System.out.println("interrupted");
+
+		}
+
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/MultipleProducersConsumers.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/MultipleProducersConsumers.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/MultipleProducersConsumers.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/MultipleProducersConsumers.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,95 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class MultipleProducersConsumers {
+
+	private static Properties getDefaults() {
+
+		Properties defaults = new Properties();
+		defaults.setProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR,
+				"http://localhost:8080/axis2/services/EventingService");
+		defaults.setProperty(ConfigKeys.TOPIC_XPATH, "/msg/src");
+		defaults.setProperty(ConfigKeys.CONSUMER_PORT_OFFSET, "2222");
+
+		defaults.setProperty(ConfigKeys.PUBLISH_TIME_INTERVAL, "5");
+		defaults.setProperty(ConfigKeys.PRODUCER_COUNT, "2");
+		defaults.setProperty(ConfigKeys.CONSUMER_COUNT, "3");
+
+		return defaults;
+	}
+
+	public static void main(String[] args) throws InterruptedException {
+
+		Properties configurations = new Properties(getDefaults());
+		try {
+
+			URL url = ClassLoader
+					.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+			if (url == null) {
+				throw new IOException("configuration file not found");
+			}
+			configurations.load(url.openStream());
+
+		} catch (IOException ioe) {
+
+			System.out
+					.println("unable to load configuration file, default settings will be used");
+		}
+
+		int numberOfProducers = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.PRODUCER_COUNT));
+
+		int numberOfConsumers = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.CONSUMER_COUNT));
+
+		Consumer[] consumers = new Consumer[numberOfConsumers];
+		int portOffset = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.CONSUMER_PORT_OFFSET));
+		for (int i = 0; i < consumers.length; i++) {
+			consumers[i] = new Consumer("consumer_" + i, portOffset + i,
+					configurations);
+			consumers[i].start();
+		}
+
+		Producer[] producers = new Producer[numberOfProducers];
+		for (int i = 0; i < producers.length; i++) {
+			producers[i] = new Producer("producer_" + i, configurations);
+			producers[i].start();
+		}
+
+		for (Consumer c : consumers) {
+			c.join();
+		}
+
+		for (Producer p : producers) {
+			p.join();
+		}
+
+	}
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Producer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Producer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Producer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers-xpath/src/wsmg/samples/wse/Producer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.StringReader;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Producer extends Thread {
+
+	private Properties configurations;
+
+	private XMLInputFactory xmlFactory = XMLInputFactory.newInstance();
+
+	public Producer(String producerId, Properties config) {
+		super(producerId);
+		configurations = config;
+	}
+
+	private OMElement buildMsg(String msg) {
+
+		XMLStreamReader inflow = null;
+		try {
+			inflow = xmlFactory.createXMLStreamReader(new StringReader(msg));
+		} catch (XMLStreamException e) {
+			throw new RuntimeException(e);
+		}
+
+		StAXOMBuilder builder = new StAXOMBuilder(inflow);
+		OMElement omElement = builder.getDocumentElement();
+		return omElement;
+	}
+
+	public void run() {
+
+		System.out.println(String
+				.format("producer [%s] starting...", getName()));
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String topicExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_SIMPLE);
+
+		int timeInterval = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.PUBLISH_TIME_INTERVAL));
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+
+		String msgFormat = "<msg><seq>%d</seq><src>%s</src><uuid>%s</uuid></msg>";
+
+		try {
+
+			int count = 0;
+			while (true) {
+				UUID uuid = UUID.randomUUID();
+				count++;
+				String msg = String.format(msgFormat, count, getName(), uuid
+						.toString());
+				System.out.println(String.format(
+						"producer [%s] sending msg: %s", getName(), msg));
+				client.publish(topicExpression, buildMsg(msg));
+				TimeUnit.SECONDS.sleep(timeInterval);
+			}
+
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			System.out.println("interruped");
+		} catch (MsgBrokerClientException f) {
+			f.printStackTrace();
+			System.out
+					.println("unable to publish messages - producer will stop.");
+
+		}
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/README.txt?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/README.txt (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/README.txt Sun Jul  3 15:51:36 2011
@@ -0,0 +1,25 @@
+OGCE-WS messenger Quick Start Guide- Sample 1 
+=================================
+
+This sample demonstrates a scenarios where multiple producers publish messages under a topic, while multiple consumers receive them.
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+
+1) configure and run ws-messenger in any mode. please refer ws-messenger user guide to know how to run the ws-messenger.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) set configurations in './conf/configuration.properties' file.
+
+4) run following command:
+      ant run

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,23 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+
+axis2.home=

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.xml?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.xml (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/build.xml Sun Jul  3 15:51:36 2011
@@ -0,0 +1,87 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<?xml version="1.0"?>
+
+
+<project name="wsmgsamples" default="run" basedir=".">
+
+	<property file="build.properties" />
+	<property name="lib.path" value="../../" />
+	<property name="dest.dir" value="bin" />
+	<property name="src.dir" value="src" />
+	<property name="conf.dir" location="conf" />
+
+	<path id="broker.libs.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+
+	<path id="broker.class.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+		
+		<path location="${conf.dir}" />
+		
+		<pathelement location="${dest.dir}" />
+	</path>
+
+	<target name="clean">
+		<delete dir="${dest.dir}" />
+	</target>
+
+	<target name="build" depends="makeDest">
+		<antcall target="compile" />
+	</target>
+
+	<target name="makeDest">
+		<mkdir dir="${dest.dir}" />
+	</target>
+
+
+	<target name="compile" depends="makeDest">
+		<javac debug="true" srcdir="${src.dir}" destdir="${dest.dir}">
+			<classpath refid="broker.libs.path" />
+		</javac>
+	</target>
+
+
+	<target name="run" depends="build">
+
+		<java classname="org.apache.airavata.wsmg.samples.wse.MultipleProducersConsumers" fork="true">
+			<classpath refid="broker.class.path" />
+		</java>
+
+	</target>
+
+
+</project>

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/conf/configurations.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/conf/configurations.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/conf/configurations.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/conf/configurations.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,28 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+broker.eventing.service.epr=http://localhost:8080/axis2/services/EventingService
+broker.notification.service.epr=http://localhost:8080/axis2/services/NotificationService
+consumer.port=6060
+topic.xpath=/msg/src
+publish.time.interval=5
+producer.count=2
+consumer.count=3

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/util/ConfigKeys.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/util/ConfigKeys.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/util/ConfigKeys.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,39 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.util;
+
+public interface ConfigKeys {
+
+	String CONFIG_FILE_NAME = "configurations.properties";
+
+	String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
+	String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
+
+	String CONSUMER_EPR = "consumer.location";
+	String CONSUMER_PORT_OFFSET = "consumer.port";
+	String TOPIC_SIMPLE = "topic.simple";
+	String TOPIC_XPATH = "topic.xpath";
+	String AXIS2_REPO = "axis2.repo";
+	String PUBLISH_TIME_INTERVAL = "publish.time.interval";
+	String PRODUCER_COUNT = "producer.count";
+	String CONSUMER_COUNT = "consumer.count";
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Consumer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Consumer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Consumer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,147 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.AxisFault;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Consumer extends Thread {
+
+	class NotificationMsgReciever implements ConsumerNotificationHandler {
+
+		private BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+		public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+			queue.add(msgEnvelope);
+		}
+
+		public BlockingQueue<SOAPEnvelope> getQueue() {
+			return queue;
+		}
+
+	}
+
+	private Properties configurations;
+	private int consumerPort;
+
+	public Consumer(String consumerName, int port, Properties config) {
+		super(consumerName);
+		consumerPort = port;
+		configurations = config;
+	}
+
+	public void run() {
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String xpathExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_XPATH);
+
+		System.out.println("subscribing with xpath expression: "
+				+ xpathExpression);
+
+		NotificationMsgReciever msgReciever = new NotificationMsgReciever();
+
+		String[] consumerEprs = null;
+
+		String subscriptionId = null;
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+		try {
+			consumerEprs = client.startConsumerService(consumerPort,
+					msgReciever);
+
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out.println("unable to start consumer service, exiting");
+			return;
+		}
+
+		try {
+
+			subscriptionId = client.subscribe(consumerEprs[0], null,
+					xpathExpression);
+			System.out.println(getName() + "got the subscription id :"
+					+ subscriptionId);
+
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out
+					.println("unable to subscribe for the xpath consumer exiting");
+			return;
+		}
+
+		try {
+
+			do {
+
+				SOAPEnvelope env = msgReciever.getQueue().take();
+
+				String msg;
+				try {
+					msg = env.getBody().getFirstElement().toStringWithConsume();
+					System.out.println(String.format(
+							"consumer [%s] recieved: %s", getName(), msg));
+
+				} catch (Exception e) {
+					System.err.print("invalid msg recieved");
+				}
+
+			} while (true);
+
+		} catch (InterruptedException ie) {
+
+			try {
+				// unsubscribe from the topic.
+				client.unSubscribe(subscriptionId);
+				
+			} catch (MsgBrokerClientException e) {
+
+				e.printStackTrace();
+				System.out.println("unable to unsubscribe, ignoring");
+			}
+
+			// shutdown the consumer service.
+			client.shutdownConsumerService();
+
+			System.out.println("interrupted");
+
+		}
+
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/MultipleProducersConsumers.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/MultipleProducersConsumers.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/MultipleProducersConsumers.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/MultipleProducersConsumers.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,95 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class MultipleProducersConsumers {
+
+	private static Properties getDefaults() {
+
+		Properties defaults = new Properties();
+		defaults.setProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR,
+				"http://localhost:8080/axis2/services/EventingService");
+		defaults.setProperty(ConfigKeys.TOPIC_XPATH, "/msg/src");
+		defaults.setProperty(ConfigKeys.CONSUMER_PORT_OFFSET, "2222");
+
+		defaults.setProperty(ConfigKeys.PUBLISH_TIME_INTERVAL, "5");
+		defaults.setProperty(ConfigKeys.PRODUCER_COUNT, "2");
+		defaults.setProperty(ConfigKeys.CONSUMER_COUNT, "3");
+
+		return defaults;
+	}
+
+	public static void main(String[] args) throws IOException,
+			InterruptedException {
+
+		Properties configurations = new Properties(getDefaults());
+		try {
+
+			URL url = ClassLoader
+					.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+			if (url == null) {
+				throw new IOException("configuration file not found");
+			}
+			configurations.load(url.openStream());
+			
+		} catch (IOException ioe) {
+			
+			System.out.println("unable to load configuration file, default settings will be used");
+		}
+
+		int numberOfProducers = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.PRODUCER_COUNT));
+
+		int numberOfConsumers = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.CONSUMER_COUNT));
+
+		Consumer[] consumers = new Consumer[numberOfConsumers];
+		int portOffset = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.CONSUMER_PORT_OFFSET));
+		for (int i = 0; i < consumers.length; i++) {
+			consumers[i] = new Consumer("consumer_" + i, portOffset + i,
+					configurations);
+			consumers[i].start();
+		}
+
+		Producer[] producers = new Producer[numberOfProducers];
+		for (int i = 0; i < producers.length; i++) {
+			producers[i] = new Producer("producer_" + i, configurations);
+			producers[i].start();
+		}
+
+		for (Consumer c : consumers) {
+			c.join();
+		}
+
+		for (Producer p : producers) {
+			p.join();
+		}
+
+	}
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Producer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Producer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Producer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-multiple-producers-consumers/src/wsmg/samples/wse/Producer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,108 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Producer extends Thread {
+
+	private Properties configurations;
+
+	public Producer(String producerId, Properties config) {
+		super(producerId);
+		configurations = config;
+	}
+
+	private OMElement createMsg(int seq, String src, String uuid) {
+
+		// "<msg><seq>%d</seq><src>%s</src><uuid>%s</uuid></msg>"
+
+		OMFactory factory = OMAbstractFactory.getOMFactory();
+
+		OMElement omMsg = factory.createOMElement("msg", null);
+
+		OMElement omSeq = factory.createOMElement("seq", null, omMsg);
+		omSeq.setText("" + seq);
+
+		OMElement omSrc = factory.createOMElement("src", null, omMsg);
+		omSrc.setText(src);
+
+		OMElement omUUID = factory.createOMElement("uuid", null, omMsg);
+		omUUID.setText(uuid);
+
+		return omMsg;
+	}
+
+	public void run() {
+
+		System.out.println(String
+				.format("producer [%s] starting...", getName()));
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String topicExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_SIMPLE);
+
+		int timeInterval = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.PUBLISH_TIME_INTERVAL));
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+
+		try {
+
+			int count = 0;
+			while (true) {
+				UUID uuid = UUID.randomUUID();
+				count++;
+				OMElement omMsg = createMsg(count, getName(), uuid.toString());
+				System.out.println(String.format(
+						"producer [%s] sending msg: %s", getName(), omMsg
+								.toString()));
+
+				client.publish(topicExpression, omMsg);
+
+				TimeUnit.SECONDS.sleep(timeInterval);
+			}
+
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			System.out.println("interruped");
+		} catch (MsgBrokerClientException f) {
+			f.printStackTrace();
+			System.out
+					.println("unable to publish messages - producer will stop.");
+
+		}
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/README.txt?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/README.txt (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/README.txt Sun Jul  3 15:51:36 2011
@@ -0,0 +1,26 @@
+OGCE-WS messenger Quick Start Guide- Sample 1 
+=================================
+
+This sample demonstrate how publish messages under a given topic and how to receive them.
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+
+1) configure and run ws-messenger in any mode. please refer ws-messenger user guide to know how to run the ws-messenger.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) set configurations in './conf/configuration.properties' file.
+
+4) run following command:
+      ant run
+      

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+
+
+axis2.home=

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.xml?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.xml (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/build.xml Sun Jul  3 15:51:36 2011
@@ -0,0 +1,88 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<?xml version="1.0"?>
+
+
+<project name="wsmgsamples" default="run" basedir=".">
+
+	<property file="build.properties" />
+	<property name="lib.path" value="../../" />
+	<property name="dest.dir" value="bin" />
+	<property name="src.dir" value="src" />
+	<property name="conf.dir" location="conf" />
+
+	<path id="broker.libs.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+
+	<path id="broker.class.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+		<path location="${conf.dir}" />
+		
+		<pathelement location="${dest.dir}" />
+	</path>
+
+	<target name="clean">
+		<delete dir="${dest.dir}" />
+	</target>
+
+	<target name="build" depends="makeDest">
+		<antcall target="compile" />
+	</target>
+
+	<target name="makeDest">
+		<mkdir dir="${dest.dir}" />
+	</target>
+
+
+	<target name="compile" depends="makeDest">
+		<javac debug="true" srcdir="${src.dir}" destdir="${dest.dir}">
+			<classpath refid="broker.libs.path" />
+		</javac>
+	</target>
+
+
+	<target name="run" depends="build">
+
+		<echo message="broker.class.path" />
+
+		<java classname="org.apache.airavata.wsmg.samples.wse.WSERoundTrip" fork="true">
+			<classpath refid="broker.class.path" />
+		</java>
+
+	</target>
+
+
+</project>

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/conf/configurations.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/conf/configurations.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/conf/configurations.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/conf/configurations.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,27 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+broker.eventing.service.epr=http://localhost:8080/axis2/services/EventingService
+broker.notification.service.epr=http://localhost:8080/axis2/services/NotificationService
+consumer.port=6060
+topic.simple=SampleSimpleTopic
+topic.xpath=/c/b/a
+publish.time.interval=5

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/util/ConfigKeys.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/util/ConfigKeys.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/util/ConfigKeys.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,38 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.util;
+
+public interface ConfigKeys {
+
+	String CONFIG_FILE_NAME = "configurations.properties";
+	
+	String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
+	String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
+
+	String CONSUMER_EPR = "consumer.location";
+	String CONSUMER_PORT = "consumer.port";
+	String TOPIC_SIMPLE = "topic.simple";
+	String TOPIC_XPATH = "topic.xpath";
+	String AXIS2_REPO = "axis2.repo";
+	String PUBLISH_TIME_INTERVAL = "publish.time.interval";
+	
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Consumer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Consumer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Consumer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Consumer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,143 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.util.Properties;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+
+import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Consumer extends Thread {
+
+	class NotificationMsgReciever implements ConsumerNotificationHandler {
+
+		private BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
+
+		public void handleNotification(SOAPEnvelope msgEnvelope) {
+
+			queue.add(msgEnvelope);
+		}
+
+		public BlockingQueue<SOAPEnvelope> getQueue() {
+			return queue;
+		}
+
+	}
+
+	private Properties configurations;
+	private int consumerPort;
+
+	public Consumer(String consumerName, int port, Properties config) {
+		super(consumerName);
+		consumerPort = port;
+		configurations = config;
+	}
+
+	public void run() {
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String topicExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_SIMPLE);
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+
+		System.out.println("subscribing with topic expression: "
+				+ topicExpression);
+
+		NotificationMsgReciever msgReciever = new NotificationMsgReciever();
+
+		String[] consumerEprs = null;
+
+		String subscriptionId = null;
+
+		try {
+			consumerEprs = client.startConsumerService(consumerPort,
+					msgReciever);
+
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out.println("unable to start consumer service, exiting");
+			return;
+		}
+
+		try {
+
+			subscriptionId = client.subscribe(consumerEprs[0], topicExpression,
+					null);
+		} catch (MsgBrokerClientException e) {
+
+			e.printStackTrace();
+
+			System.out
+					.println("unable to subscribe for the topic consumer exiting");
+			return;
+		}
+
+		try {
+
+			do {
+
+				SOAPEnvelope env = msgReciever.getQueue().take();
+
+				String msg;
+				try {
+					msg = env.getBody().getFirstElement().toStringWithConsume();
+					System.out.println(String.format(
+							"consumer [%s] recieved: %s", getName(), msg));
+
+				} catch (Exception e) {
+					System.err.print("invalid msg recieved");
+				}
+
+			} while (true);
+
+		} catch (InterruptedException ie) {
+
+			try {
+				// unsubscribe from the topic.
+				client.unSubscribe(subscriptionId);
+			} catch (MsgBrokerClientException e) {
+
+				e.printStackTrace();
+				System.out.println("unable to unsubscribe, ignoring");
+			}
+
+			// shutdown the consumer service.
+			client.shutdownConsumerService();
+
+			System.out.println("interrupted");
+
+		}
+
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Producer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Producer.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Producer.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/Producer.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,87 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class Producer extends Thread {
+
+	private Properties configurations;
+
+	public Producer(String producerId, Properties config) {
+		super(producerId);
+		configurations = config;
+	}
+
+	public void run() {
+
+		System.out.println(String
+				.format("producer [%s] starting...", getName()));
+
+		String brokerLocation = configurations
+				.getProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR);
+		String topicExpression = configurations
+				.getProperty(ConfigKeys.TOPIC_SIMPLE);
+
+		int timeInterval = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.PUBLISH_TIME_INTERVAL));
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+
+		OMElement omMsg = OMAbstractFactory.getOMFactory().createOMElement(
+				"msg", null);
+		int sequence = 1;
+
+		try {
+
+			while (true) {
+
+				omMsg.setText("" + (sequence++));
+
+				System.out.println(String.format(
+						"producer [%s] sending msg: %s", getName(), omMsg
+								.toString()));
+				client.publish(topicExpression, omMsg);
+				TimeUnit.SECONDS.sleep(timeInterval);
+			}
+
+		} catch (InterruptedException e) {
+			e.printStackTrace();
+			System.out.println("interruped");
+		} catch (MsgBrokerClientException f) {
+			f.printStackTrace();
+			System.out
+					.println("unable to publish messages - producer will stop.");
+
+		}
+	}
+
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/WSERoundTrip.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/WSERoundTrip.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/WSERoundTrip.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-round-trip/src/wsmg/samples/wse/WSERoundTrip.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,75 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class WSERoundTrip {
+
+	private static Properties getDefaults() {
+
+		Properties defaults = new Properties();
+		defaults.setProperty(ConfigKeys.BROKER_EVENTING_SERVICE_EPR,
+				"http://localhost:8080/axis2/services/EventingService");
+		defaults.setProperty(ConfigKeys.TOPIC_SIMPLE, "simpleSampleTopic");
+		defaults.setProperty(ConfigKeys.CONSUMER_PORT, "2222");
+		defaults.setProperty(ConfigKeys.PUBLISH_TIME_INTERVAL, "5");
+		return defaults;
+	}
+
+	public static void main(String[] args) throws InterruptedException {
+
+		Properties configurations = new Properties(getDefaults());
+		try {
+
+			URL url = ClassLoader
+					.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+			if (url == null) {
+				throw new IOException("configuration file not found");
+			}
+			configurations.load(url.openStream());
+
+		} catch (IOException ioe) {
+
+			System.out
+					.println("unable to load configuration file, default will be used.");
+		}
+
+		Producer producer = new Producer("simple topic", configurations);
+
+		int consumerPort = Integer.parseInt(configurations
+				.getProperty(ConfigKeys.CONSUMER_PORT));
+		Consumer consumer = new Consumer("topic consumer", consumerPort,
+				configurations);
+
+		consumer.start();
+		producer.start();
+
+		consumer.join();
+		producer.join();
+
+	}
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/README.txt?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/README.txt (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/README.txt Sun Jul  3 15:51:36 2011
@@ -0,0 +1,25 @@
+OGCE-WS messenger Quick Start Guide- Sample 1 
+=================================
+
+This sample demonstrate how to subscribe to a topic using ws eventing protocol.
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+
+1) configure and run ws-messenger in any mode. please refer ws-messenger user guide to know how to run the ws-messenger.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) set configurations in './conf/configuration.properties' file.
+
+4) run following command:
+      ant run

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+
+
+axis2.home=

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.xml?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.xml (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/build.xml Sun Jul  3 15:51:36 2011
@@ -0,0 +1,87 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<?xml version="1.0"?>
+
+
+<project name="wsmgsamples" default="run" basedir=".">
+
+	<property file="build.properties" />
+	<property name="lib.path" value="../../" />
+	<property name="dest.dir" value="bin" />
+	<property name="src.dir" value="src" />
+	<property name="conf.dir" location="conf" />
+
+	<path id="broker.libs.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+
+	<path id="broker.class.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+
+		<path location="${conf.dir}" />
+
+		<pathelement location="${dest.dir}" />
+	</path>
+
+	<target name="clean">
+		<delete dir="${dest.dir}" />
+	</target>
+
+	<target name="build" depends="makeDest">
+		<antcall target="compile" />
+	</target>
+
+	<target name="makeDest">
+		<mkdir dir="${dest.dir}" />
+	</target>
+
+
+	<target name="compile" depends="makeDest">
+		<javac debug="true" srcdir="${src.dir}" destdir="${dest.dir}">
+			<classpath refid="broker.libs.path" />
+		</javac>
+	</target>
+
+
+	<target name="run" depends="build">
+
+		<java classname="org.apache.airavata.wsmg.samples.wse.TopicSubscribe" fork="true">
+			<classpath refid="broker.class.path" />
+		</java>
+
+	</target>
+
+
+</project>

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/conf/configurations.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/conf/configurations.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/conf/configurations.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/conf/configurations.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,28 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+broker.eventing.service.epr=http://localhost:8080/axis2/services/EventingService
+broker.notification.service.epr=http://localhost:8080/axis2/services/NotificationService
+consumer.location=http://localhost:6060/axis2/services/ConsumerService
+consumer.port=6060
+topic.simple=SampleSimpleTopic
+topic.xpath=
+

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/util/ConfigKeys.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/util/ConfigKeys.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/util/ConfigKeys.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.util;
+
+public interface ConfigKeys {
+
+	String CONFIG_FILE_NAME = "configurations.properties";
+	
+	String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
+	String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
+
+	String CONSUMER_EPR = "consumer.location";
+	String CONSUMER_PORT = "consumer.port";
+	String TOPIC_SIME = "topic.simple";
+	String TOPIC_XPATH = "topic.xpath";
+	String AXIS2_REPO = "axis2.repo";
+	
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/wse/TopicSubscribe.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/wse/TopicSubscribe.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/wse/TopicSubscribe.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-topic-subscription/src/wsmg/samples/wse/TopicSubscribe.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,71 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseClientAPI;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class TopicSubscribe {
+
+	public static void main(String[] args) throws MsgBrokerClientException {
+
+		Properties configurations = new Properties();
+
+		try {
+
+			URL url = ClassLoader
+					.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+			if (url == null) {
+				throw new IOException("configuration file not found");
+			}
+			configurations.load(url.openStream());
+
+		} catch (IOException ioe) {
+
+			System.out
+					.println("unable to load configuration file, default will be used.");
+		}
+
+		String brokerLocation = configurations.getProperty(
+				ConfigKeys.BROKER_EVENTING_SERVICE_EPR,
+				"http://localhost:8080/axis2/services/EventingService");
+		String topicExpression = configurations.getProperty(
+				ConfigKeys.TOPIC_SIME, "SampleSimpleTopic");
+		String consumerLocation = configurations.getProperty(
+				ConfigKeys.CONSUMER_EPR,
+				"http://localhost:2222/axis2/services/ConsumerService");
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+		// create a topic subscription.
+		String subscriptionId = client.subscribe(consumerLocation,
+				topicExpression, null);
+
+		System.out.println("subscription id : " + subscriptionId);
+	}
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/README.txt?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/README.txt (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/README.txt Sun Jul  3 15:51:36 2011
@@ -0,0 +1,24 @@
+OGCE-WS messenger Quick Start Guide- Sample 1 
+=================================
+
+This sample demonstrate how to subscribe using ws eventing protocol with a Xpath expression.
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+1) configure and run ws-messenger in any mode. please refer ws-messenger user guide to know how to run the ws-messenger.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) set configurations in './conf/configuration.properties' file.
+
+4) run following command:
+      ant run

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+
+
+axis2.home=

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.xml?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.xml (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/build.xml Sun Jul  3 15:51:36 2011
@@ -0,0 +1,87 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<?xml version="1.0"?>
+
+
+<project name="wsmgsamples" default="run" basedir=".">
+
+	<property file="build.properties" />
+	<property name="lib.path" value="../../" />
+	<property name="dest.dir" value="bin" />
+	<property name="src.dir" value="src" />
+	<property name="conf.dir" location="conf" />
+
+	<path id="broker.libs.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+	</path>
+
+
+	<path id="broker.class.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+
+		<path location="${conf.dir}" />
+
+		<pathelement location="${dest.dir}" />
+	</path>
+
+	<target name="clean">
+		<delete dir="${dest.dir}" />
+	</target>
+
+	<target name="build" depends="makeDest">
+		<antcall target="compile" />
+	</target>
+
+	<target name="makeDest">
+		<mkdir dir="${dest.dir}" />
+	</target>
+
+
+	<target name="compile" depends="makeDest">
+		<javac debug="true" srcdir="${src.dir}" destdir="${dest.dir}">
+			<classpath refid="broker.libs.path" />
+		</javac>
+	</target>
+
+
+	<target name="run" depends="build">
+
+		<java classname="org.apache.airavata.wsmg.samples.wse.XpathSubscribe" fork="true">
+			<classpath refid="broker.class.path" />
+		</java>
+
+	</target>
+
+
+</project>

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/conf/configurations.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/conf/configurations.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/conf/configurations.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/conf/configurations.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,28 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+broker.eventing.service.epr=http://localhost:8080/axis2/services/EventingService
+broker.notification.service.epr=http://localhost:8080/axis2/services/NotificationService
+consumer.location=http://localhost:6060/axis2/services/ConsumerService
+consumer.port=6060
+topic.simple=SampleSimpleTopic
+topic.xpath=/c/b/a
+

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/util/ConfigKeys.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/util/ConfigKeys.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/util/ConfigKeys.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/util/ConfigKeys.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.util;
+
+public interface ConfigKeys {
+
+	String CONFIG_FILE_NAME = "configurations.properties";
+	
+	String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
+	String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
+
+	String CONSUMER_EPR = "consumer.location";
+	String CONSUMER_PORT = "consumer.port";
+	String TOPIC_SIMPLE = "topic.simple";
+	String TOPIC_XPATH = "topic.xpath";
+	String AXIS2_REPO = "axis2.repo";
+	
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/wse/XpathSubscribe.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/wse/XpathSubscribe.java?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/wse/XpathSubscribe.java (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wse-xpath-subscription/src/wsmg/samples/wse/XpathSubscribe.java Sun Jul  3 15:51:36 2011
@@ -0,0 +1,73 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+package org.apache.airavata.wsmg.samples.wse;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Properties;
+
+import org.apache.airavata.wsmg.client.MsgBrokerClientException;
+import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
+import org.apache.airavata.wsmg.samples.util.ConfigKeys;
+
+public class XpathSubscribe {
+
+	public static void main(String[] args) throws MsgBrokerClientException{
+
+		Properties configurations = new Properties();
+
+		try {
+
+			URL url = ClassLoader
+					.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
+			if (url == null) {
+				throw new IOException("configuration file not found");
+			}
+			configurations.load(url.openStream());
+
+		} catch (IOException ioe) {
+
+			System.out
+					.println("unable to load configuration file, default will be used.");
+		}
+
+		String brokerLocation = configurations.getProperty(
+				ConfigKeys.BROKER_EVENTING_SERVICE_EPR,
+				"http://localhost:8080/axis2/services/EventingService");
+		String xpathExpression = configurations.getProperty(
+				ConfigKeys.TOPIC_XPATH, "/c/b/a");
+		String consumerLocation = configurations.getProperty(
+				ConfigKeys.CONSUMER_EPR,
+				"http://localhost:2222/axis2/services/ConsumerService");
+
+		WseMsgBrokerClient client = new WseMsgBrokerClient();
+		client.init(brokerLocation);
+		System.out.println("subscribing with xpath expression: "
+				+ xpathExpression);
+
+		// create a topic subscription.
+		String subscriptionId = client.subscribe(consumerLocation, null,
+				xpathExpression);
+
+		System.out.println("xpath subscription id : " + subscriptionId);
+	}
+}

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/README.txt?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/README.txt (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/README.txt Sun Jul  3 15:51:36 2011
@@ -0,0 +1,22 @@
+OGCE-WS messenger Quick Start Guide- Sample 1 
+=================================
+
+This sample demonstrate how to run ws-notification listener.
+
+
+Pre-Requisites
+==============
+
+Apache Ant 1.7.1 or later
+Apache Axis2 1.5 or later
+
+
+
+Steps:
+======
+1) configure and run ws-messenger in any mode. please refer ws-messenger user guide to know how to run the ws-messenger.
+
+2) configure 'build.properties' located in the sample directory.
+
+3) run following command:
+      ant run

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.properties
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.properties?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.properties (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.properties Sun Jul  3 15:51:36 2011
@@ -0,0 +1,24 @@
+#
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+
+
+
+axis2.home=

Added: incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.xml?rev=1142453&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.xml (added)
+++ incubator/airavata/ws-messaging/trunk/messagebroker/src/samples/wsmg-gui/build.xml Sun Jul  3 15:51:36 2011
@@ -0,0 +1,51 @@
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<?xml version="1.0"?>
+
+
+<project name="wsmgsamples" default="run" basedir=".">
+
+	<property file="build.properties" />
+	<property name="lib.path" value="../../" />
+	<path id="broker.class.path">
+		<fileset dir="${lib.path}">
+			<include name="*.jar" />
+		</fileset>
+
+		<fileset dir="${axis2.home}/lib">
+			<include name="*.jar" />
+		</fileset>
+
+		<path location="${conf.dir}" />
+
+		<pathelement location="${dest.dir}" />
+	</path>
+
+	<target name="run">
+
+		<java classname="org.apache.airavata.wsmg.gui.NotificationViewer" fork="true">
+			<classpath refid="broker.class.path" />
+		</java>
+
+	</target>
+
+</project>