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 02:29:37 UTC

svn commit: r1142350 [6/18] - in /incubator/airavata/donations/ogce-donation/modules/ws-messaging: broker/ broker/customLibs/ broker/customLibs/activeMQ/ broker/src/ broker/src/main/ broker/src/main/java/ broker/src/main/java/wsmg/ broker/src/main/java...

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/storage/WsmgStorage.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/storage/WsmgStorage.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/storage/WsmgStorage.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/storage/WsmgStorage.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.commons.storage;
+
+import java.util.List;
+
+import wsmg.broker.subscription.SubscriptionEntry;
+import wsmg.broker.subscription.SubscriptionState;
+
+public interface WsmgStorage {
+
+	public abstract List<SubscriptionEntry> getAllSubscription();
+
+	public abstract int insert(SubscriptionState subscription);
+
+	public abstract int delete(String subscriptionId);
+
+	public void enqueue(Object object, String trackId);
+
+	public Object blockingDequeue();
+
+	public int size();
+
+	public void flush();
+
+	public void cleanup();
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/util/OMElementComparator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/util/OMElementComparator.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/util/OMElementComparator.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/commons/util/OMElementComparator.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,204 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.commons.util;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.OMNode;
+import org.apache.log4j.Logger;
+
+import wsmg.commons.exceptions.XMLComparisonException;
+
+
+public class OMElementComparator {
+
+	private static Logger log = Logger
+			.getLogger(OMElementComparator.class);
+
+	private Vector<String> ignorableNamespaceList = new Vector<String>();
+
+	public void addIgnorableNamespace(String nsURI) {
+		ignorableNamespaceList.add(nsURI);
+	}
+
+	public void clearIgnorableNamespaces() {
+		ignorableNamespaceList.clear();
+	}
+
+	public boolean compare(OMElement elementOne, OMElement elementTwo)
+			throws XMLComparisonException {
+
+		// ignore if the elements belong to any of the ignorable namespaces list
+		if (isIgnorable(elementOne) || isIgnorable(elementTwo)) {
+			return true;
+		}
+
+		if (elementOne == null && elementTwo == null) {
+			log.info("Both Elements are null.");
+			return true;
+		}
+		if (elementOne == null && elementTwo != null) {
+			throw new XMLComparisonException(
+					"Element One is null and Element Two is not null");
+		}
+		if (elementOne != null && elementTwo == null) {
+			throw new XMLComparisonException(
+					"Element Two is null and Element One is not null");
+		}
+
+		compare("Elements names are not equal. ", elementOne.getLocalName(),
+				elementTwo.getLocalName());
+
+		compare("Element namespaces are not equal", elementOne.getNamespace(),
+				elementTwo.getNamespace());
+
+		compareAllAttributes(elementOne, elementTwo);
+
+		/*
+		 * Trimming the value of the XMLElement is not correct since this
+		 * compare method cannot be used to compare element contents with
+		 * trailing and leading whitespaces BUT for the practicalltiy of tests
+		 * and to get the current tests working we have to trim() the contents
+		 */
+		compare("Elements texts are not equal ", elementOne.getText().trim(),
+				elementTwo.getText().trim());
+
+		compareAllChildren(elementOne, elementTwo);
+
+		return true;
+	}
+
+	private void compareAllAttributes(OMElement elementOne, OMElement elementTwo)
+			throws XMLComparisonException {
+		compareAttibutes(elementOne, elementTwo);
+		compareAttibutes(elementTwo, elementOne);
+	}
+
+	private void compareAllChildren(OMElement elementOne, OMElement elementTwo)
+			throws XMLComparisonException {
+		compareChildren(elementOne, elementTwo);
+		compareChildren(elementTwo, elementOne);
+	}
+
+	private boolean isIgnorable(OMElement elt) {
+		if (elt != null) {
+			OMNamespace namespace = elt.getNamespace();
+			if (namespace != null) {
+				return ignorableNamespaceList.contains(namespace
+						.getNamespaceURI());
+			} else {
+				return false;
+			}
+		} else {
+			return false;
+		}
+	}
+
+	private void compareChildren(OMElement elementOne, OMElement elementTwo)
+			throws XMLComparisonException {
+		// ignore if the elements belong to any of the ignorable namespaces list
+		if (isIgnorable(elementOne) || isIgnorable(elementTwo)) {
+			return;
+		}
+		Iterator elementOneChildren = elementOne.getChildren();
+		while (elementOneChildren.hasNext()) {
+			OMNode omNode = (OMNode) elementOneChildren.next();
+			if (omNode instanceof OMElement) {
+				OMElement elementOneChild = (OMElement) omNode;
+				OMElement elementTwoChild = null;
+				// Do the comparison only if the element is not ignorable
+				if (!isIgnorable(elementOneChild)) {
+					elementTwoChild = elementTwo
+							.getFirstChildWithName(elementOneChild.getQName());
+					// Do the comparison only if the element is not ignorable
+					if (!isIgnorable(elementTwoChild)) {
+						if (elementTwoChild == null) {
+							throw new XMLComparisonException(" There is no "
+									+ elementOneChild.getLocalName()
+									+ " element under "
+									+ elementTwo.getLocalName());
+						}
+					}
+				}
+				compare(elementOneChild, elementTwoChild);
+			}
+		}
+	}
+
+	private void compareAttibutes(OMElement elementOne, OMElement elementTwo)
+			throws XMLComparisonException {
+		int elementOneAtribCount = 0;
+		int elementTwoAtribCount = 0;
+		Iterator attributes = elementOne.getAllAttributes();
+		while (attributes.hasNext()) {
+			OMAttribute omAttribute = (OMAttribute) attributes.next();
+			OMAttribute attr = elementTwo.getAttribute(omAttribute.getQName());
+			if (attr == null) {
+				throw new XMLComparisonException(
+						"Attributes are not the same in two elements. Attribute "
+								+ omAttribute.getLocalName() + " != ");
+			}
+			elementOneAtribCount++;
+		}
+
+		Iterator elementTwoIter = elementTwo.getAllAttributes();
+		while (elementTwoIter.hasNext()) {
+			elementTwoIter.next();
+			elementTwoAtribCount++;
+
+		}
+
+		if (elementOneAtribCount != elementTwoAtribCount) {
+			throw new XMLComparisonException(
+					"Attributes are not the same in two elements.");
+		}
+	}
+
+	private void compare(String failureNotice, String one, String two)
+			throws XMLComparisonException {
+		if (!one.equals(two)) {
+			throw new XMLComparisonException(failureNotice + one + " != " + two);
+		}
+	}
+
+	private void compare(String failureNotice, OMNamespace one, OMNamespace two)
+			throws XMLComparisonException {
+		if (one == null && two == null) {
+			return;
+		} else if (one != null && two == null) {
+			throw new XMLComparisonException(
+					"First Namespace is NOT null. But the second is null");
+		} else if (one == null && two != null) {
+			throw new XMLComparisonException(
+					"First Namespace is null. But the second is NOT null");
+		}
+
+		if (!one.getNamespaceURI().equals(two.getNamespaceURI())) {
+			throw new XMLComparisonException(failureNotice + one + " != " + two);
+		}
+
+		// Do we need to compare prefixes as well
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/Configuration.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/Configuration.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/Configuration.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/Configuration.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,557 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.config;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Vector;
+
+/**
+ * Configuration interface.
+ * 
+ */
+@Deprecated
+public interface Configuration {
+
+	/**
+	 * Create an Configuration object that is a subset of this one. The new
+	 * Configuration object contains every key from the current Configuration
+	 * that starts with prefix. The prefix is removed from the keys in the
+	 * subset.
+	 * 
+	 * @param prefix
+	 *            The prefix used to select the properties.
+	 */
+	Configuration subset(String prefix);
+
+	/**
+	 * Check if the configuration is empty.
+	 * 
+	 * @return true is the configuration contains no key/value pair, false
+	 *         otherwise
+	 */
+	boolean isEmpty();
+
+	/**
+	 * Check if the configuration contains the key.
+	 * 
+	 * @return true is the configuration contains a value for this key, false
+	 *         otherwise
+	 */
+	boolean containsKey(String key);
+
+	/**
+	 * Add a property to the configuration. If it already exists then the value
+	 * stated here will be added to the configuration entry. For example, if
+	 * 
+	 * resource.loader = file
+	 * 
+	 * is already present in the configuration and you
+	 * 
+	 * addProperty("resource.loader", "classpath")
+	 * 
+	 * Then you will end up with a Vector like the following:
+	 * 
+	 * ["file", "classpath"]
+	 * 
+	 * @param key
+	 *            The Key to add the property to.
+	 * @param token
+	 *            The Value to add.
+	 */
+	void addProperty(String key, Object value);
+
+	/**
+	 * Set a property, this will replace any previously set values. Set values
+	 * is implicitly a call to clearProperty(key), addProperty(key,value).
+	 * 
+	 * @param key
+	 *            The key of the property to change
+	 * @param value
+	 *            The new value
+	 */
+	void setProperty(String key, Object value);
+
+	/**
+	 * Clear a property in the configuration.
+	 * 
+	 * @param key
+	 *            the key to remove along with corresponding value.
+	 */
+	void clearProperty(String key);
+
+	/**
+	 * Gets a property from the configuration.
+	 * 
+	 * @param key
+	 *            property to retrieve
+	 * @return value as object. Will return user value if exists, if not then
+	 *         default value if exists, otherwise null
+	 */
+	String getProperty(String key);
+
+	/**
+	 * Get the list of the keys contained in the configuration repository that
+	 * match the specified prefix.
+	 * 
+	 * @param prefix
+	 *            The prefix to test against.
+	 * @return An Iterator of keys that match the prefix.
+	 */
+	Iterator getKeys(String prefix);
+
+	/**
+	 * Get the list of the keys contained in the configuration repository.
+	 * 
+	 * @return An Iterator.
+	 */
+	Iterator getKeys();
+
+	/**
+	 * Get a list of properties associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated properties if key is found.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                String/Vector.
+	 * @exception IllegalArgumentException
+	 *                if one of the tokens is malformed (does not contain an
+	 *                equals sign).
+	 */
+	Properties getProperties(String key);
+
+	/**
+	 * Get a boolean associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated boolean.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Boolean.
+	 */
+	boolean getBoolean(String key);
+
+	/**
+	 * Get a boolean associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated boolean.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Boolean.
+	 */
+	boolean getBoolean(String key, boolean defaultValue);
+
+	/**
+	 * Get a boolean associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated boolean if key is found and has valid format,
+	 *         default value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Boolean.
+	 */
+	Boolean getBoolean(String key, Boolean defaultValue);
+
+	/**
+	 * Get a byte associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated byte.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Byte.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	byte getByte(String key);
+
+	/**
+	 * Get a byte associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated byte.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Byte.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	byte getByte(String key, byte defaultValue);
+
+	/**
+	 * Get a byte associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated byte if key is found and has valid format, default
+	 *         value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Byte.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Byte getByte(String key, Byte defaultValue);
+
+	/**
+	 * Get a double associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated double.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Double.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	double getDouble(String key);
+
+	/**
+	 * Get a double associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated double.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Double.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	double getDouble(String key, double defaultValue);
+
+	/**
+	 * Get a double associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated double if key is found and has valid format,
+	 *         default value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Double.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Double getDouble(String key, Double defaultValue);
+
+	/**
+	 * Get a float associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated float.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Float.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	float getFloat(String key);
+
+	/**
+	 * Get a float associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated float.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Float.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	float getFloat(String key, float defaultValue);
+
+	/**
+	 * Get a float associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated float if key is found and has valid format,
+	 *         default value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Float.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Float getFloat(String key, Float defaultValue);
+
+	/**
+	 * Get a int associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated int.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Integer.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	int getInt(String key);
+
+	/**
+	 * Get a int associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated int.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Integer.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	int getInt(String key, int defaultValue);
+
+	/**
+	 * Get a int associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated int if key is found and has valid format, default
+	 *         value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Integer.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Integer getInteger(String key, Integer defaultValue);
+
+	/**
+	 * Get a long associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated long.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Long.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	long getLong(String key);
+
+	/**
+	 * Get a long associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated long.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Long.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	long getLong(String key, long defaultValue);
+
+	/**
+	 * Get a long associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated long if key is found and has valid format, default
+	 *         value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a Long.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Long getLong(String key, Long defaultValue);
+
+	/**
+	 * Get a short associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated short.
+	 * @exception NoSuchElementException
+	 *                is thrown if the key doesn't map to an existing object.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Short.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	short getShort(String key);
+
+	/**
+	 * Get a short associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated short.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Short.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	short getShort(String key, short defaultValue);
+
+	/**
+	 * Get a short associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated short if key is found and has valid format,
+	 *         default value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Short.
+	 * @exception NumberFormatException
+	 *                is thrown if the value mapped by the key has not a valid
+	 *                number format.
+	 */
+	Short getShort(String key, Short defaultValue);
+
+	/**
+	 * Get a string associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated string.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                String.
+	 */
+	String getString(String key);
+
+	/**
+	 * Get a string associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated string if key is found and has valid format,
+	 *         default value otherwise.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                String.
+	 */
+	String getString(String key, String defaultValue);
+
+	/**
+	 * Get an array of strings associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated string array if key is found.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                String/Vector of Strings.
+	 */
+	String[] getStringArray(String key);
+
+	/**
+	 * Get a Vector of strings associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @return The associated Vector.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Vector.
+	 */
+	Vector getVector(String key);
+
+	/**
+	 * Get a Vector of strings associated with the given configuration key.
+	 * 
+	 * @param key
+	 *            The configuration key.
+	 * @param defaultValue
+	 *            The default value.
+	 * @return The associated Vector.
+	 * @exception ClassCastException
+	 *                is thrown if the key maps to an object that is not a
+	 *                Vector.
+	 */
+	Vector getVector(String key, Vector defaultValue);
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationManager.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationManager.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationManager.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.config;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.apache.axis2.Constants;
+import org.apache.log4j.Logger;
+
+import wsmg.commons.WsmgCommonConstants;
+
+public class ConfigurationManager {
+
+	private Logger logger = Logger.getLogger(ConfigurationManager.class);
+
+	protected Properties configurations = new Properties();
+
+	public ConfigurationManager(String configFileName) {
+
+		try {
+
+			configurations.load(this.getClass().getClassLoader()
+					.getResourceAsStream(configFileName));
+
+		} catch (Exception e) {
+			throw new RuntimeException("unable to load configurations", e);
+		}
+
+	}
+
+	private void configureSystemProperties(Properties p) {
+		String axis2Repo = getConfig(WsmgCommonConstants.CONFIG_AXIS2_REPO,
+				null);
+
+		if (!dirExists(axis2Repo)) {
+
+			String axis2Home = System.getenv("AXIS2_HOME");
+
+			axis2Repo = axis2Home.endsWith(File.separator) ? axis2Home
+					+ axis2Repo : axis2Home + File.separator + axis2Repo;
+
+		}
+
+		if (axis2Repo != null) {
+
+			logger.info("axis2 repository :" + axis2Repo);
+			System.setProperty(Constants.AXIS2_REPO, axis2Repo);
+		}
+
+	}
+
+	public String getConfig(String configName) {
+
+		return configurations.getProperty(configName);
+	}
+
+	public String getConfig(String configName, String defaultVal) {
+		return configurations.getProperty(configName, defaultVal);
+	}
+
+	public int getConfig(String configName, int defaultVal) {
+
+		return Integer.parseInt(configurations.getProperty(configName, Integer
+				.toString(defaultVal)));
+
+	}
+
+	private boolean dirExists(String path) {
+		File f = new File(path);
+
+		return f.isDirectory();
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationParamsReader.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationParamsReader.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationParamsReader.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/ConfigurationParamsReader.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,946 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.config;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Responsible for loading the configuration parameters specified in a
+ * configuration file.
+ * 
+ * @author Shrideep Pallickara and Hongbin Liu $Revision: 1.3 $ $Date:
+ *         2005/09/01 21:22:54 $
+ */
+
+@Deprecated
+public class ConfigurationParamsReader implements Configuration {
+
+	static final Logger log = Logger.getLogger(ConfigurationParamsReader.class);
+	public final String FILE_SEPARATOR = "/";
+
+	public final String DELIMITER = ",";
+
+	private final int INITIAL_LIST_SIZE = 3;
+
+	private String basePath = null;
+
+	private ArrayList keysList = new ArrayList();
+
+	protected Configuration defaults = null;
+
+	protected Hashtable store = new Hashtable();
+
+	public ConfigurationParamsReader() {
+	}
+
+	public ConfigurationParamsReader(String file) {
+		try {
+			load(file);
+		} catch (IOException ioe) {
+			ioe.printStackTrace();
+			log.info(ioe.getMessage());
+		}
+	}
+
+	public ConfigurationParamsReader(Configuration defaults) {
+		this.defaults = defaults;
+	}
+
+	/**
+	 * Load the properties from the given file
+	 * 
+	 * @param file
+	 *            The properties file to load
+	 * @throws IOException
+	 */
+	public void load(String file) throws IOException {
+		load(this.getClass().getClassLoader().getResourceAsStream(file));
+	}
+
+	/**
+	 * Load the properties from the given input stream.
+	 * 
+	 * @param input
+	 *            An InputStream on the properties file
+	 * @throws IOException
+	 */
+	public void load(InputStream input) throws IOException {
+		load(input, null);
+	}
+
+	/**
+	 * Load the properties from the given input stream and using the specified
+	 * encoding.
+	 * 
+	 * @param input
+	 *            An InputStream.
+	 * @param enc
+	 *            An encoding.
+	 * @exception IOException
+	 */
+	public synchronized void load(InputStream input, String enc)
+			throws IOException {
+
+		LineNumberReader reader = null;
+
+		if (enc != null) {
+			try {
+				reader = new LineNumberReader(new InputStreamReader(input, enc));
+			} catch (UnsupportedEncodingException e) {
+				// Get one with the default encoding...
+			}
+		}
+		if (reader == null) {
+			reader = new LineNumberReader(new InputStreamReader(input));
+		}
+
+		StringBuffer sb = new StringBuffer();
+		while (true) {
+
+			String line = reader.readLine();
+			if (line == null) {
+				break; // EOF
+			}
+
+			line = line.trim();
+			if (line.startsWith("#")) {
+				continue;
+
+			} else if (line.equals("")) {
+				continue;
+
+			} else if (line.endsWith("\\")) {
+				sb.append(line.substring(0, line.length() - 1));
+				continue;
+
+			} else {
+				line = sb.append(line).toString();
+				sb = new StringBuffer();
+
+				int equalIndex = line.indexOf('=');
+				/**
+				 * fix commons.configuration bug
+				 * 
+				 * @see BasePropertiesConfiguration#load we not only make sure
+				 *      there is an equal sign, but also there is something
+				 *      after the equal sign
+				 */
+				if (equalIndex > 0 && (equalIndex + 1) < line.length()) {
+					String key = line.substring(0, equalIndex).trim();
+					String value = line.substring(equalIndex + 1).trim();
+
+					addProperty(key, value);
+
+				}
+			}
+		}
+	}
+
+	/**
+	 * @param The
+	 *            file name with which to get InputStream
+	 * @return An InputStream
+	 * @throws IOException
+	 */
+	public InputStream getPropertyStream(String resourceName)
+			throws IOException {
+
+		InputStream resource = null;
+		File file = null;
+
+		if (resourceName.startsWith(FILE_SEPARATOR)) {
+			// an absolute path
+			file = new File(resourceName);
+			log.info("configuration: load " + resourceName);
+		} else if (basePath == null || basePath.equals("")) {
+
+			file = new File(resourceName);
+			String canonName = file.getCanonicalPath();
+			file = new File(canonName);
+			log.info("configuration: load " + canonName);
+		} else {
+			StringBuffer fileName = new StringBuffer();
+
+			if (!basePath.endsWith(FILE_SEPARATOR)) {
+				basePath = basePath + FILE_SEPARATOR;
+			}
+			fileName.append(basePath).append(resourceName);
+			file = new File(fileName.toString());
+			String canonName = file.getCanonicalPath();
+			file = new File(canonName);
+			log.info("configuration: load " + canonName);
+		}
+
+		if (file == null || !file.exists()) {
+			throw new FileNotFoundException("File not exists " + resourceName);
+
+		} else if (!file.canRead()) {
+			throw new IOException("File " + resourceName
+					+ " exists but could not be read.");
+
+		} else {
+			resource = new FileInputStream(file);
+		}
+
+		return resource;
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public void addProperty(String key, Object token) {
+
+		List tokenAdd = null;
+
+		if (token instanceof String) {
+			tokenAdd = processString((String) token);
+
+		} else if (token instanceof Collection) {
+
+			for (Iterator it = ((Collection) token).iterator(); it.hasNext();) {
+				addProperty(key, it.next());
+			}
+			return;
+
+		} else {
+			tokenAdd = new Vector(1);
+			tokenAdd.add(token);
+		}
+
+		Object o = store.get(key);
+		if (o instanceof Vector) {
+			for (Iterator it = tokenAdd.iterator(); it.hasNext();) {
+				((Vector) o).add(it.next());
+			}
+
+		} else {
+			Vector v = new Vector();
+			if (o != null) {
+				v.add(o);
+			}
+			for (Iterator it = tokenAdd.iterator(); it.hasNext();) {
+				v.add(it.next());
+			}
+
+			if (o == null && v.size() == 1) {
+				addPropertyDirect(key, v.get(0));
+
+			} else {
+				addPropertyDirect(key, v);
+			}
+		}
+	}
+
+	/**
+	 * @param token
+	 *            A String token
+	 * @return A List of Strings
+	 */
+	protected List processString(String token) {
+		List l = new ArrayList(INITIAL_LIST_SIZE);
+
+		if (token.indexOf(DELIMITER) > 0) {
+			StringTokenizer tokenizer = new StringTokenizer(token, DELIMITER);
+
+			while (tokenizer.hasMoreTokens()) {
+				String value = tokenizer.nextToken();
+				/**
+				 * fix commons.configuration bug
+				 * 
+				 * @see PropertiesConfiguration#processString() more trim() call
+				 *      allows both comma "," AND whitespace between values
+				 */
+				l.add(value.trim());
+			}
+		} else {
+			l.add(token);
+		}
+
+		return l;
+	}
+
+	/**
+	 * @param key
+	 *            key to use for mapping
+	 * @param obj
+	 *            object to store
+	 */
+	protected void addPropertyDirect(String key, Object obj) {
+
+		if (!store.containsKey(key)) {
+			keysList.add(key);
+		}
+
+		store.put(key, obj);
+	}
+
+	/**
+	 * Map <code> true </code>, <code> on </code>, <code> yes </code> to true;
+	 * <code> false </code>, <code> off </code>, <code> no </code> to false.
+	 * 
+	 * @param value
+	 *            The value to test for boolean state.
+	 * @return String of true, false or null
+	 */
+	public String testBoolean(String value) {
+
+		String val = value.toLowerCase();
+
+		if (val.equals("true") || val.equals("on") || val.equals("yes")) {
+			return "true";
+
+		} else if (val.equals("false") || val.equals("off") || val.equals("no")) {
+			return "false";
+
+		} else {
+			return null;
+		}
+
+	}
+
+	/**
+	 * 
+	 * @see Configuration
+	 */
+	public Configuration subset(String prefix) {
+
+		Configuration pc = new ConfigurationParamsReader();
+		Iterator keys = this.getKeys();
+		boolean valid = false;
+
+		while (keys.hasNext()) {
+			Object key = keys.next();
+
+			if (key instanceof String && ((String) key).startsWith(prefix)) {
+				if (!valid) {
+					valid = true;
+				}
+
+				String newKey = null;
+				if (((String) key).length() == prefix.length()) {
+					newKey = prefix;
+
+				} else {
+					newKey = ((String) key).substring(prefix.length() + 1);
+				}
+
+				Object value = store.get(key);
+				((ConfigurationParamsReader) pc).addPropertyDirect(newKey,
+						value);
+
+			}
+		}
+
+		if (valid) {
+			return pc;
+		} else {
+			return null;
+		}
+
+	}
+
+	/**
+	 * @see Configuration#isEmpty
+	 */
+	public boolean isEmpty() {
+		return store.isEmpty();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public boolean containsKey(String key) {
+		return store.containsKey(key);
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public void setProperty(String key, Object value) {
+		clearProperty(key);
+		addProperty(key, value);
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public void clearProperty(String key) {
+
+		if (containsKey(key)) {
+			for (int i = 0; i < keysList.size(); i++) {
+				if (((String) keysList.get(i)).equals(key)) {
+					keysList.remove(i);
+					break;
+				}
+			}
+			store.remove(key);
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Iterator getKeys() {
+		return keysList.iterator();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Iterator getKeys(String prefix) {
+		Iterator keys = getKeys();
+		ArrayList matchingKeys = new ArrayList();
+
+		while (keys.hasNext()) {
+			Object key = keys.next();
+
+			if (key instanceof String && ((String) key).startsWith(prefix)) {
+				matchingKeys.add(key);
+			}
+		}
+		return matchingKeys.iterator();
+	}
+
+	/**
+	 * Returns all the properties that have been read from the specified
+	 * configuration file
+	 */
+	public Properties getProperties(Properties _defaults) {
+		Properties props = new Properties(_defaults);
+
+		Enumeration e = store.keys();
+		while (e.hasMoreElements()) {
+			String _key = (String) e.nextElement();
+			String _value = store.get(_key).toString();
+			props.setProperty(_key, _value);
+		}
+		return props;
+
+	}
+
+	/**
+	 * @see Configuration
+	 * @see #getProperties(String, Properties)
+	 */
+	public Properties getProperties(String key) {
+		return getProperties(key, null);
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Properties getProperties(String key, Properties defaults) {
+
+		String[] tokens = getStringArray(key);
+
+		/*
+		 * Each token is of the form 'key=value'.
+		 */
+		Properties props = (defaults == null ? new Properties()
+				: new Properties(defaults));
+
+		for (int i = 0; i < tokens.length; i++) {
+			String token = tokens[i];
+			int equalIndex = token.indexOf('=');
+			if (equalIndex > 0) {
+				String pkey = token.substring(0, equalIndex).trim();
+				String pvalue = token.substring(equalIndex + 1).trim();
+				props.put(pkey, pvalue);
+			} else if (tokens.length == 1 && token.equals("")) {
+				// Semantically equivalent to an empty Properties
+				// object.
+				break;
+			} else {
+				throw new IllegalArgumentException('\'' + token
+						+ "' does not contain an equals sign");
+			}
+		}
+		return props;
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public String getProperty(String key) {
+
+		Object o = store.get(key);
+
+		if (o == null) {
+			if (defaults != null) {
+				o = defaults.getProperty(key);
+			}
+		}
+		return o.toString();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public boolean getBoolean(String key) {
+		Boolean b = getBoolean(key, (Boolean) null);
+		if (b != null) {
+			return b.booleanValue();
+
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public boolean getBoolean(String key, boolean defaultValue) {
+		return getBoolean(key, new Boolean(defaultValue)).booleanValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Boolean getBoolean(String key, Boolean defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Boolean) {
+			return (Boolean) value;
+		} else if (value instanceof String) {
+			String s = testBoolean((String) value);
+			Boolean b = new Boolean(s);
+			return b;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getBoolean(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Boolean object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public byte getByte(String key) {
+		Byte b = getByte(key, null);
+		if (b != null) {
+			return b.byteValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ " doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public byte getByte(String key, byte defaultValue) {
+		return getByte(key, new Byte(defaultValue)).byteValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Byte getByte(String key, Byte defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Byte) {
+			return (Byte) value;
+		} else if (value instanceof String) {
+			Byte b = new Byte((String) value);
+			return b;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getByte(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Byte object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public double getDouble(String key) {
+		Double d = getDouble(key, null);
+		if (d != null) {
+			return d.doubleValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public double getDouble(String key, double defaultValue) {
+		return getDouble(key, new Double(defaultValue)).doubleValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Double getDouble(String key, Double defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Double) {
+			return (Double) value;
+		} else if (value instanceof String) {
+			Double d = new Double((String) value);
+			return d;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getDouble(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Double object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public float getFloat(String key) {
+		Float f = getFloat(key, null);
+		if (f != null) {
+			return f.floatValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public float getFloat(String key, float defaultValue) {
+		return getFloat(key, new Float(defaultValue)).floatValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Float getFloat(String key, Float defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Float) {
+			return (Float) value;
+		} else if (value instanceof String) {
+			Float f = new Float((String) value);
+			return f;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getFloat(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Float object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public int getInt(String key) {
+		Integer i = getInteger(key, null);
+		if (i != null) {
+			return i.intValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public int getInt(String key, int defaultValue) {
+		Integer i = getInteger(key, null);
+
+		if (i == null) {
+			return defaultValue;
+		}
+
+		return i.intValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Integer getInteger(String key, Integer defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Integer) {
+			return (Integer) value;
+		} else if (value instanceof String) {
+			Integer i = new Integer((String) value);
+			return i;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getInteger(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Integer object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public long getLong(String key) {
+		Long l = getLong(key, null);
+		if (l != null) {
+			return l.longValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public long getLong(String key, long defaultValue) {
+		return getLong(key, new Long(defaultValue)).longValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Long getLong(String key, Long defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Long) {
+			return (Long) value;
+		} else if (value instanceof String) {
+			Long l = new Long((String) value);
+			return l;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getLong(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Long object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public short getShort(String key) {
+		Short s = getShort(key, null);
+		if (s != null) {
+			return s.shortValue();
+		} else {
+			throw new NoSuchElementException('\'' + key
+					+ "' doesn't map to an existing object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public short getShort(String key, short defaultValue) {
+		return getShort(key, new Short(defaultValue)).shortValue();
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Short getShort(String key, Short defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof Short) {
+			return (Short) value;
+		} else if (value instanceof String) {
+			Short s = new Short((String) value);
+			return s;
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getShort(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Short object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public String getString(String key) {
+		return getString(key, null);
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public String getString(String key, String defaultValue) {
+		Object value = resolveVectorStore(key);
+
+		if (value instanceof String) {
+			return (String) value;
+
+		} else if (value == null) {
+			if (defaults != null) {
+				return defaults.getString(key, defaultValue);
+			} else {
+				return defaultValue;
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a String object");
+		}
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public String[] getStringArray(String key) {
+		Object value = store.get(key);
+
+		String[] tokens;
+
+		if (value instanceof String) {
+			tokens = new String[1];
+			tokens[0] = (String) value;
+
+		} else if (value instanceof Vector) {
+			tokens = new String[((Vector) value).size()];
+
+			for (int i = 0; i < tokens.length; i++) {
+
+				tokens[i] = (String) ((Vector) value).get(i);
+			}
+
+		} else if (value == null) {
+			if (defaults != null) {
+				tokens = defaults.getStringArray(key);
+			} else {
+				tokens = new String[0];
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a String/Vector object");
+		}
+		return tokens;
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Vector getVector(String key) {
+		return getVector(key, null);
+	}
+
+	/**
+	 * @see Configuration
+	 */
+	public Vector getVector(String key, Vector defaultValue) {
+		Object value = store.get(key);
+		Vector v = null;
+
+		if (value instanceof String) {
+			v = new Vector(1);
+			v.addElement((String) value);
+
+		} else if (value == null) {
+			if (defaults != null) {
+				v = defaults.getVector(key, defaultValue);
+			} else {
+				v = ((defaultValue == null) ? new Vector() : defaultValue);
+			}
+		} else {
+			throw new ClassCastException('\'' + key
+					+ "' doesn't map to a Vector object: " + value + ", a "
+					+ value.getClass().getName());
+		}
+		return v;
+	}
+
+	/**
+	 * 
+	 */
+	public String getBasePath() {
+		return this.basePath;
+	}
+
+	/**
+	 * 
+	 */
+	public void setBasePath(String path) {
+		this.basePath = path;
+	}
+
+	/**
+	 * Returns an object from the store described by the key. If the value is a
+	 * Vector object, replace it with the first object in the container
+	 * 
+	 * @param key
+	 *            The property key.
+	 * 
+	 * @return value Value, transparently resolving a possible Vector
+	 *         dependency.
+	 */
+	private Object resolveVectorStore(String key) {
+		Object value = store.get(key);
+		if (value != null && value instanceof Vector) {
+			value = ((Vector) value).get(0);
+		}
+		return value;
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WSMGParameter.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WSMGParameter.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WSMGParameter.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WSMGParameter.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.config;
+
+import wsmg.commons.storage.WsmgStorage;
+
+public class WSMGParameter {
+
+	// public static String TOPIC_BROKER="vm://localhost";
+	public static final String OUTGOING_QUEUE_BROKER = "vm://localhost";
+
+	public static final String INCOMING_QUEUE_BROKER = "vm://localhost";
+	// not used if you don't use activeMQ as message filter
+	public static final String TOPIC_BROKER = "failover:(tcp://hunk.extreme.indiana.edu:61616)?maximumRetries=10";
+
+	// public static String
+	// OUTGOING_QUEUE_BROKER="failover:(tcp://bleu.extreme.indiana.edu:61616)?maximumRetries=10";
+	// public static String
+	// INCOMING_QUEUE_BROKER="failover:(tcp://exodus.extreme.indiana.edu:61616)?maximumRetries=10";
+
+	// public static String
+	// OUTGOING_QUEUE_BROKER="tcp://hunk.extreme.indiana.edu:61616";
+	// public static String
+	// INCOMING_QUEUE_BROKER="tcp://hunk.extreme.indiana.edu:61616";
+	// public static String OUTGOING_QUEUE_BROKER="tcp://localhost:61616";
+	// public static String INCOMING_QUEUE_BROKER="tcp://localhost:61616";
+	//	
+	public static final boolean testOutGoingQueueMaxiumLength = false; // default=false
+	// Test deque rate without really delivering message over the network in
+	// deliveryThread
+	public static final boolean performRealDelivery = true; // default=true
+	// when performRealDelivery=false to test dequeue, also need to set
+	// testOutGoingQueueMaxiumLength = false;
+	// otherwise, it will blocked for enqueue to prevent messages being
+	// delivered out.
+
+	// set to true if use embeded activeMQ
+	public static final boolean useEmbeddedActiveMQ = false; // default=false
+
+	public static final boolean useIncomingQueue = false; // default=false
+
+	public static final boolean useOutGoingQueue = true; // default=true
+
+	// enable or disable the TimerThread that displays the message rate
+	public static final boolean measureMessageRate = false; // default=false
+
+	// used for gt4 interop test
+	public static final boolean gt4 = false; // default=false
+
+	// stress test publisher use WSE, false=>use WSNT
+	public static final boolean stressTestPublisherUseWSE = true; // default=true
+
+	// stress test subscriber use WSE,false=>use WSNT
+	public static final boolean stressTestSubscriberUseWSE = true; // default=true
+
+	public static final boolean stressTestPublisherCatchUpPublishingRate = false;
+
+	public static WsmgStorage OUT_GOING_QUEUE = null; // default=null
+
+	// set to false will make the broker unable to delivery messages (only put
+	// them in a queue) and depend on another thread
+	public static final boolean enableDeliveryThreadInStandAloneBroker = true; // default=true
+	public static final boolean enableDeliveryThreadInTomcatBroker = false; // default=false
+
+	public static final boolean enableAutoCleanSubscriptions = false; // default=true
+
+	public static final boolean useYFilter = false;
+	public static final boolean debugYFilter = false;
+
+	public static final boolean cleanQueueonStartUp = false; // default=true
+	public static final boolean requireSubscriptionRenew = true;
+	public static final long expirationTime = 1000 * 60 * 60 * 72; // 72 hours
+	public static final String DB_CONFIG_NAME = "db.config";
+
+	public static final String MESSAGEBOX_DB_CONFIG_NAME = "db.config";
+
+	public static final boolean showTrackId = false;
+	public static final String versionSetUpNote = "Added_Sub_Timeout";
+	public static final boolean enableMessengerStatucCheckPort = true; // default=false
+	public static final boolean allowSaveToLocalMsgBoxDB = false; // default=false
+	// Following configures are for testing/merging purpose. users of WSMG can
+	// ignore.
+	public static final boolean useYidistributedDB = false; // default true
+	public static final boolean measureInternalProcessingTime = false;
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WsmgConfigurationContext.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WsmgConfigurationContext.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WsmgConfigurationContext.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/config/WsmgConfigurationContext.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,134 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.config;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import wsmg.broker.NotificationProcessor;
+import wsmg.broker.subscription.SubscriptionManager;
+import wsmg.commons.storage.WsmgStorage;
+import wsmg.matching.AbstractMessageMatcher;
+import wsmg.matching.XPath.YFilterMessageMatcher;
+import wsmg.messenger.OutGoingQueue;
+
+public class WsmgConfigurationContext {
+
+	private OutGoingQueue outgoingQueue = null;
+
+	// private AbstractMessageMatcher messageMatcher;
+
+	private List<AbstractMessageMatcher> messageMatchers = new LinkedList<AbstractMessageMatcher>();
+
+	private Map<Object, Object> publisherRegistrationDB = new HashMap<Object, Object>();// TODO:
+
+	// parameterize
+	// the
+	// map
+
+	
+	private ReentrantReadWriteLock messegeMatchersLock = new ReentrantReadWriteLock();
+
+	private ConfigurationManager configurationManager;
+
+	private SubscriptionManager subscriptionMan;
+
+	private NotificationProcessor notificationProcessor;
+
+	private WsmgStorage storage;
+
+	/**
+	 * @return Returns the publisherRegistrationDB.
+	 */
+	public Map getPublisherRegistrationDB() {
+		return publisherRegistrationDB;
+	}
+
+	
+
+	/**
+	 * @return Returns the wsntAdapter.
+	 */
+
+	public List<AbstractMessageMatcher> getMessageMatchers() {
+		return messageMatchers;
+	}
+
+	public WsmgConfigurationContext() {
+
+		outgoingQueue = new OutGoingQueue();
+
+		setDirectFilter();
+	}
+
+	private void setDirectFilter() {
+
+		messageMatchers.add(new YFilterMessageMatcher(publisherRegistrationDB));
+		// messageMatchers.add(new DirectWsntMessageMatcher(subscriptions,
+		// publisherRegistrationDB));
+
+	}
+
+	public OutGoingQueue getOutgoingQueue() {
+		return outgoingQueue;
+	}
+
+	public ConfigurationManager getConfigurationManager() {
+		return configurationManager;
+	}
+
+	public SubscriptionManager getSubscriptionManager() {
+		return subscriptionMan;
+	}
+
+	public NotificationProcessor getNotificationProcessor() {
+		return notificationProcessor;
+	}
+
+	public void setConfigurationManager(ConfigurationManager configMan) {
+		this.configurationManager = configMan;
+	}
+
+	public void setSubscriptionManager(SubscriptionManager subMan) {
+		this.subscriptionMan = subMan;
+	}
+
+	public void setNotificationProcessor(NotificationProcessor processor) {
+		this.notificationProcessor = processor;
+	}
+
+	public WsmgStorage getStorage() {
+		return storage;
+	}
+
+	public void setStorage(WsmgStorage s) {
+		storage = s;
+	}
+
+	
+
+	public ReentrantReadWriteLock getMessegeMatcherLock() {
+		return messegeMatchersLock;
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewer.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewer.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewer.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewer.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.gui;
+
+import java.awt.Dimension;
+import java.awt.Toolkit;
+
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+
+public class NotificationViewer {
+
+	boolean packFrame = false;
+
+	/*
+	 * private static String getAxis2Repository(String[] cmdArgs) {
+	 * 
+	 * // if its in system properties get it.
+	 * 
+	 * if (System.getProperty(WsmgCommonConstants.CONFIG_AXIS2_REPO) != null) {
+	 * File repodir = new File(System
+	 * .getProperty(WsmgCommonConstants.CONFIG_AXIS2_REPO));
+	 * 
+	 * if (repodir.isDirectory()) { return repodir.getAbsolutePath(); }
+	 * 
+	 * throw new RuntimeException(
+	 * "axis2 repository given in system parameter is invalid: " +
+	 * repodir.getAbsolutePath());
+	 * 
+	 * }
+	 * 
+	 * if (cmdArgs.length > 1) {
+	 * 
+	 * if (cmdArgs[0].startsWith("-" + WsmgCommonConstants.CONFIG_AXIS2_REPO)) {
+	 * 
+	 * File repoDir = new File(cmdArgs[1]);
+	 * 
+	 * if (repoDir.isDirectory()) { return repoDir.getAbsolutePath(); }
+	 * 
+	 * throw new RuntimeException(
+	 * "axis2 repository given as a  command line argument is invalid: " +
+	 * repoDir.getAbsolutePath()); }
+	 * 
+	 * throw new RuntimeException("unknown commandline argument");
+	 * 
+	 * }
+	 * 
+	 * String axis2Home = System.getenv().get("AXIS2_HOME");
+	 * 
+	 * 
+	 * if (axis2Home != null) {
+	 * 
+	 * String repo = axis2Home.endsWith(File.pathSeparator) ? axis2Home +
+	 * "repository" : axis2Home + File.separator + "repository";
+	 * 
+	 * File repoDir = new File(repo);
+	 * 
+	 * if (repoDir.isDirectory()) {
+	 * 
+	 * 
+	 * return repoDir.getAbsolutePath(); } }
+	 * 
+	 * return null; }
+	 * 
+	 * private static void printHelp() {
+	 * System.out.println("unable to determine axis2 repository");
+	 * System.out.println("please provide the system property: " +
+	 * WsmgCommonConstants.CONFIG_AXIS2_REPO);
+	 * System.out.println("or set AXIS2_HOME envirnment variable"); }
+	 */
+
+	/**
+	 * Construct and show the application.
+	 */
+	public NotificationViewer() {
+		NotificationViewerFrame frame = new NotificationViewerFrame();
+		// Validate frames that have preset sizes
+		// Pack frames that have useful preferred size info, e.g. from their
+		// layout
+		if (packFrame) {
+			frame.pack();
+		} else {
+			frame.validate();
+		}
+
+		// Center the window
+		Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
+		Dimension frameSize = frame.getSize();
+		if (frameSize.height > screenSize.height) {
+			frameSize.height = screenSize.height;
+		}
+		if (frameSize.width > screenSize.width) {
+			frameSize.width = screenSize.width;
+		}
+
+		frame.setLocation((screenSize.width - frameSize.width) / 2,
+				(screenSize.height - frameSize.height) / 2);
+		frame.setVisible(true);
+	}
+
+	/**
+	 * Application entry point.
+	 * 
+	 * @param args
+	 *            String[]
+	 */
+	public static void main(String[] args) {
+
+		/*
+		 * final String axis2Repo = getAxis2Repository(args);
+		 * 
+		 * if (axis2Repo == null) { printHelp(); System.exit(1); }
+		 */
+
+		SwingUtilities.invokeLater(new Runnable() {
+			public void run() {
+				try {
+					UIManager.setLookAndFeel(UIManager
+							.getSystemLookAndFeelClassName());
+				} catch (Exception exception) {
+					exception.printStackTrace();
+				}
+
+				new NotificationViewer();
+			}
+		});
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewerFrame.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewerFrame.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewerFrame.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/NotificationViewerFrame.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,363 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import java.awt.Insets;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTabbedPane;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.border.Border;
+
+import org.apache.axis2.AxisFault;
+import org.apache.log4j.Logger;
+
+import wsmg.client.ConsumerServer;
+import wsmg.client.WsntMsgBrokerClient;
+
+public class NotificationViewerFrame extends JFrame {
+
+	private static final long serialVersionUID = -4924241323165353343L;
+
+	Logger logger = Logger.getLogger(NotificationViewerFrame.class);
+
+	JPanel contentPane;
+
+	BorderLayout borderLayout1 = new BorderLayout();
+
+	JPanel jPanel1 = new JPanel();
+
+	Border border1 = BorderFactory.createLineBorder(Color.gray, 2);
+
+	JLabel jLabel1 = new JLabel();
+
+	JButton jButtonStart = new JButton();
+
+	JLabel jLabel2 = new JLabel();
+
+	JTextField jTextBrokerUrl = new JTextField();
+
+	JLabel jLabel3 = new JLabel();
+
+	JTextField jTextPort = new JTextField();
+
+	JLabel jLabel4 = new JLabel();
+
+	JTextField jTextTopic = new JTextField();
+
+	JTabbedPane jTabbedPane1 = new JTabbedPane();
+
+	JScrollPane jScrollPane1 = new JScrollPane();
+
+	JTextArea jTextAreaBrief = new JTextArea();
+
+	JScrollPane jScrollPane2 = new JScrollPane();
+
+	JTextArea jTextAreaWhole = new JTextArea();
+
+	JButton jButtonClear = new JButton();
+
+	ConsumerServer consumerServer = null;
+
+	WsntMsgBrokerClient client;
+
+	String subId = null;
+
+	JButton jButtonStop = new JButton();
+
+	GridBagLayout gridBagLayout1 = new GridBagLayout();
+
+	public NotificationViewerFrame() {
+		try {
+			setDefaultCloseOperation(EXIT_ON_CLOSE);
+			jbInit();
+		} catch (Exception exception) {
+			exception.printStackTrace();
+		}
+
+		client = new WsntMsgBrokerClient();
+
+	}
+
+	/**
+	 * Component initialization.
+	 * 
+	 * @throws java.lang.Exception
+	 */
+	private void jbInit() throws Exception {
+		contentPane = (JPanel) getContentPane();
+		contentPane.setLayout(borderLayout1);
+		setSize(new Dimension(547, 429));
+		setTitle("WS-Notification Viewer");
+		jPanel1.setBackground(Color.white);
+		jPanel1.setBorder(border1);
+		jPanel1.setMaximumSize(new Dimension(180000, 180000));
+		jPanel1.setLayout(gridBagLayout1);
+		jLabel1
+				.setFont(new java.awt.Font("Serif", Font.BOLD | Font.ITALIC, 28));
+		jLabel1.setForeground(Color.blue);
+		jLabel1.setText("WS-Notification Listener");
+		jButtonStart
+				.setToolTipText("Subscribe to the topic and start listening");
+		jButtonStart.setText("Start");
+		jButtonStart
+				.addActionListener(new NotificationViewerFrame_jButton1_actionAdapter(
+						this));
+		jLabel2.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
+		jLabel2.setText("BrokerURL");
+		jTextBrokerUrl.setToolTipText("Enter Broker URL here.");
+		jTextBrokerUrl.setText("http://localhost:8080/axis2/services/NotificationService");
+		jLabel3.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
+		jLabel3.setText("Listening Port");
+		jTextPort
+				.setToolTipText("Enter the port this listener will be listening to.");
+		jTextPort.setText("19999");
+		jLabel4.setFont(new java.awt.Font("Dialog", Font.BOLD, 11));
+		jLabel4.setText("Topic");
+		jTextTopic.setToolTipText("Enter the topic to subscribe.");
+		jTextTopic.setText("topic");
+		jTextAreaBrief.setToolTipText("Summary of the messages received.");
+		jTextAreaBrief.setLineWrap(true);
+		// jTextAreaWhole.setMinimumSize(new Dimension(490, 17));
+		// jTextAreaWhole.setPreferredSize(new Dimension(490, 17));
+		jTextAreaWhole.setToolTipText("Full content of the SOAP messages.");
+		// jTextAreaWhole.setText("");
+		jButtonClear.setToolTipText("Clear messages in the two message panes.");
+		jButtonClear.setText("Clear Messages");
+		jButtonClear
+				.addActionListener(new NotificationViewerFrame_jButtonClear_actionAdapter(
+						this));
+		jButtonStop.setEnabled(false);
+		jButtonStop
+				.setToolTipText("Unsubscribe to the topic and stop listening.");
+		jButtonStop.setText("Stop");
+		jButtonStop
+				.addActionListener(new NotificationViewerFrame_jButtonStop_actionAdapter(
+						this));
+		jScrollPane1
+				.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+		jScrollPane1.setAutoscrolls(true);
+		jScrollPane1.setToolTipText("Summary of the messages received.");
+		jScrollPane2
+				.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
+		jScrollPane2.setAutoscrolls(true);
+		jScrollPane2.setToolTipText("Full content of the SOAP messages.");
+		jTabbedPane1.add(jScrollPane1, "Brief Messages");
+		jTabbedPane1.add(jScrollPane2, "Whole Messages");
+		jPanel1.add(jLabel1, new GridBagConstraints(1, 0, 2, 1, 0.0, 0.0,
+				GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(7,
+						10, 0, 107), 20, -5));
+		jPanel1.add(jButtonStop, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0,
+				GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
+						0, 48, 0, 80), 55, -4));
+		jPanel1.add(jLabel4, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0,
+				GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+						36, 0, 8), 43, 4));
+		jPanel1.add(jLabel3, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0,
+				GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,
+						36, 0, 0), 1, 4));
+		jPanel1.add(jTextPort, new GridBagConstraints(1, 3, 1, 1, 1.0, 0.0,
+				GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL,
+				new Insets(7, 0, 0, 0), 144, -1));
+		jPanel1.add(jButtonClear, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0,
+				GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
+						0, 46, 0, 78), 3, -4));
+		jPanel1.add(jTextTopic, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0,
+				GridBagConstraints.SOUTHWEST, GridBagConstraints.HORIZONTAL,
+				new Insets(0, 0, 0, 0), 149, -1));
+		jPanel1
+				.add(jTextBrokerUrl, new GridBagConstraints(1, 1, 1, 1, 1.0,
+						0.0, GridBagConstraints.NORTHWEST,
+						GridBagConstraints.HORIZONTAL, new Insets(6, -1, 5, 1),
+						10, -1));
+		jPanel1.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
+				GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
+				new Insets(6, 37, 5, 0), 21, 4));
+		jPanel1.add(jButtonStart, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
+				GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(
+						8, 47, 0, 79), 57, -4));
+		jScrollPane2.getViewport().add(jTextAreaWhole);
+		jScrollPane1.getViewport().add(jTextAreaBrief);
+
+		jPanel1.add(jTabbedPane1, new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0,
+				GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(
+						0, 18, 57, 30), 0, 206));
+		contentPane.add(jPanel1, java.awt.BorderLayout.CENTER);
+	}
+
+	public void jButtonStart_actionPerformed(ActionEvent event) {
+		// jLabel1.setForeground(new Color(255,0,0));
+		String brokerUrl = jTextBrokerUrl.getText().trim();
+		String topic = jTextTopic.getText();
+
+		String listeningPort = jTextPort.getText();
+
+		int port = -1;
+
+		try {
+			port = Integer.parseInt(listeningPort);
+		} catch (NumberFormatException nfe) {
+
+			JOptionPane.showMessageDialog(this, nfe, "invalid port specified",
+					JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+
+		client.init(brokerUrl);// important
+		// Create a handler to handle the notifications arrived
+		WsntViewerConsumerNotificationHandler handler = new WsntViewerConsumerNotificationHandler(
+				this);
+
+		String consumerUrl = null;
+
+		try {
+			String[] eprs = client.startConsumerService(port, handler);
+
+			if (eprs.length > 0) {
+				consumerUrl = eprs[0];
+			} else {
+				throw new AxisFault("no consumer url given by wse client api");
+			}
+
+		} catch (Exception e) {
+			JOptionPane.showMessageDialog(this, e,
+					"Unable to start consumer service",
+					JOptionPane.ERROR_MESSAGE);
+			return;
+		}
+
+		try {
+			subId = client.subscribe(consumerUrl, topic, null);
+		} catch (Exception e) {
+
+			JOptionPane.showMessageDialog(this, e,
+					"Unable to subscribe to topic", JOptionPane.ERROR_MESSAGE);
+
+			client.shutdownConsumerService();
+			return;
+		}
+
+		jButtonStart.setEnabled(false);
+		jTextBrokerUrl.setEnabled(false);
+		jTextTopic.setEnabled(false);
+		jTextPort.setEnabled(false);
+		jButtonStop.setEnabled(true);
+		jTextAreaBrief.append("Listener started...\n");
+		jTextAreaWhole.append("Listener started...\n");
+
+	}
+
+	public void jButtonStop_actionPerformed(ActionEvent e) {
+		if (subId != null) {
+			try {
+				client.init(jTextBrokerUrl.getText().trim());
+				client.unSubscribe(subId);
+			} catch (Exception e1) {
+				JOptionPane.showMessageDialog(this, e,
+						"Unable to unsubscribe from topic",
+						JOptionPane.ERROR_MESSAGE);
+			}// TODO: add with replyTo URL
+			subId = null;
+		}
+
+		client.shutdownConsumerService();
+
+		jButtonStop.setEnabled(false);
+		jButtonStart.setEnabled(true);
+		jTextBrokerUrl.setEnabled(true);
+		jTextTopic.setEnabled(true);
+		jTextPort.setEnabled(true);
+		jTextAreaBrief.append("Listener stoped.\n");
+		jTextAreaWhole.append("Listener stoped.\n");
+
+	}
+
+	public void addBriefMessage(String message) {
+		jTextAreaBrief.append(message + "\n");
+		jTextAreaBrief.selectAll();
+	}
+
+	public void addWholeMessage(String message) {
+		jTextAreaWhole.append(message + "\n");
+		jTextAreaWhole.selectAll();
+	}
+
+	public void jButtonClear_actionPerformed(ActionEvent e) {
+		jTextAreaBrief.setText("");
+		jTextAreaWhole.setText("");
+	}
+}
+
+class NotificationViewerFrame_jButtonStop_actionAdapter implements
+		ActionListener {
+	private NotificationViewerFrame adaptee;
+
+	NotificationViewerFrame_jButtonStop_actionAdapter(
+			NotificationViewerFrame adaptee) {
+		this.adaptee = adaptee;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		adaptee.jButtonStop_actionPerformed(e);
+	}
+}
+
+class NotificationViewerFrame_jButtonClear_actionAdapter implements
+		ActionListener {
+	private NotificationViewerFrame adaptee;
+
+	NotificationViewerFrame_jButtonClear_actionAdapter(
+			NotificationViewerFrame adaptee) {
+		this.adaptee = adaptee;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		adaptee.jButtonClear_actionPerformed(e);
+	}
+}
+
+class NotificationViewerFrame_jButton1_actionAdapter implements ActionListener {
+	private NotificationViewerFrame adaptee;
+
+	NotificationViewerFrame_jButton1_actionAdapter(
+			NotificationViewerFrame adaptee) {
+		this.adaptee = adaptee;
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		adaptee.jButtonStart_actionPerformed(e);
+
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/README.txt
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/README.txt?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/README.txt (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/README.txt Sun Jul  3 00:29:24 2011
@@ -0,0 +1,15 @@
+USING Notification Listener GUI.
+
+It is designed for LEAD project. The expected message XML schema is LEAD schema. It can also accept String messages.
+ 
+ 1, Use ant to compile the package. 
+  2, Then run
+source setenv.sh
+Or setenv.bat in Windows.
+ to setup CLASSPATH. It looks better in Windows.
+
+  3, Then run: 
+ java wsnt.wsntviewapp.NotificationViewer 
+ to start the GUI.
+
+You need to enter Broker URL, topic and listening port. 

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/WsntViewerConsumerNotificationHandler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/WsntViewerConsumerNotificationHandler.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/WsntViewerConsumerNotificationHandler.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/gui/WsntViewerConsumerNotificationHandler.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF 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 wsmg.gui;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.log4j.Logger;
+
+import wsmg.client.ConsumerNotificationHandler;
+import wsmg.commons.WsmgNameSpaceConstants;
+
+public class WsntViewerConsumerNotificationHandler implements
+		ConsumerNotificationHandler {
+	private final static Logger logger = Logger
+			.getLogger(WsntViewerConsumerNotificationHandler.class);
+
+	public NotificationViewerFrame frame = null;
+
+	public WsntViewerConsumerNotificationHandler() {
+	}
+
+	public WsntViewerConsumerNotificationHandler(NotificationViewerFrame f) {
+		this.frame = f;
+	}
+
+	public void handleNotification(SOAPEnvelope msgEnvelope) {
+		logger.debug("*******lead message handler Received message********");
+		logger.debug(msgEnvelope);
+		try {
+			addBriefMsg(msgEnvelope);
+			addWholeMsg(msgEnvelope);
+		} catch (XMLStreamException e) {
+			logger.error("invalid message received", e);
+			throw new RuntimeException("invalid message recieved", e);
+		}
+	}
+
+	private void addBriefMsg(SOAPEnvelope env) throws XMLStreamException {
+
+		QName notify = new QName(WsmgNameSpaceConstants.WSNT_NS
+				.getNamespaceURI(), "Notify", WsmgNameSpaceConstants.WSNT_NS
+				.getPrefix());
+
+		QName notifyMsg = new QName(WsmgNameSpaceConstants.WSNT_NS
+				.getNamespaceURI(), "NotificationMessage",
+				WsmgNameSpaceConstants.WSNT_NS.getPrefix());
+
+		QName msg = new QName(WsmgNameSpaceConstants.WSNT_NS.getNamespaceURI(),
+				"Message", WsmgNameSpaceConstants.WSNT_NS.getPrefix());
+
+		if (env.getBody() == null) {
+			throw new RuntimeException("invalid soap envelope - no soap body");
+		}
+
+		Iterator ite = env.getBody().getChildrenWithName(notify);
+
+		if (!ite.hasNext()) {
+			throw new RuntimeException(notify.getLocalPart()
+					+ " tag is not found");
+		}
+
+		OMElement ele = (OMElement) ite.next();
+		ite = ele.getChildrenWithName(notifyMsg);
+
+		if (!ite.hasNext()) {
+			throw new RuntimeException(notifyMsg.getLocalPart()
+					+ " tag is not found");
+		}
+
+		ele = (OMElement) ite.next();
+
+		ite = ele.getChildrenWithName(msg);
+
+		if (!ite.hasNext()) {
+			throw new RuntimeException(msg.getLocalPart()
+					+ " tags are not found");
+		}
+
+		while (ite.hasNext()) {
+			ele = (OMElement) ite.next();
+
+			if (ele.getFirstElement() != null) {
+				frame.addBriefMessage(ele.getFirstElement().toString());
+			} else {
+				throw new RuntimeException("raw message is not found");
+			}
+
+		}
+
+	}
+
+	private void addWholeMsg(SOAPEnvelope envelope) throws XMLStreamException {
+		frame.addWholeMessage(envelope.toStringWithConsume());
+
+	}
+
+}