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 [7/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/matching/AbstractMessageMatcher.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/AbstractMessageMatcher.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/AbstractMessageMatcher.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/AbstractMessageMatcher.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,123 @@
+/*
+ * 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.matching;
+
+/**
+
+ * Title: WSNT Project
+ * </p>
+ * <p>
+ * Description:
+ * </p>
+ * <p>
+ * Copyright: Copyright (c) 2004
+ * </p>
+ * <p>
+ * Company:
+ * </p>
+ *
+ * @author Yi Huang
+ * @version 1.0
+ */
+/*
+ * import edu.indiana.extreme.rfx.types.base_types.addressing.
+ * EndpointReferenceType; import
+ * edu.indiana.extreme.rfx.types.base_types.notification.*;
+ */
+/*
+ * import xsul.types_wsnt.base.*; import xsul.types_wsnt.broker.*; import
+ * xsul.types_wsnt.topics.*; import xsul.types_wsrf.properties.*; import
+ * xsul.types_addressing.*;
+ */
+
+// import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.broker.subscription.SubscriptionState;
+import wsmg.transports.jms.MessageMatcherConnection;
+
+public abstract class AbstractMessageMatcher {
+
+ protected Map<String, String> currentMessageCache;
+
+ protected Map<Object, Object> publisherRegistrationDB; // TODO : Ramith,
+
+ private ReentrantReadWriteLock consumerListLock = new ReentrantReadWriteLock();
+
+ // infer types of
+ // key and value
+
+ public AbstractMessageMatcher(Map<Object, Object> publisherRegistrationDB) {
+
+ this.publisherRegistrationDB = publisherRegistrationDB;
+ this.currentMessageCache = new HashMap<String, String>();
+ }
+
+ public abstract void start(String carrierLocation);
+
+ // Message can be either String or XmlElement. Added XMLElement for
+ // performance consideration so that if not using queue,
+ // we don't need to serialize to String
+ // If we already serialized to String because of the uing queue, we don't
+ // have to change back to XMLElement until the delivery to consumers
+
+ public abstract void populateMatches(String wsntMessageConverterClassName,
+ AdditionalMessageContent additionalMessageContent, String message,
+ String topic, List<ConsumerInfo> matchedConsumers);
+
+ public abstract int handleUnsubscribe(String subscriptionId);
+
+ public abstract MessageMatcherConnection handleSubscribe(
+ SubscriptionState subscribeRequest, String subscriptionId);
+
+ public String handleGetCurrentMessage(String topic) {
+ String currentMessage = currentMessageCache.get(topic);
+ return currentMessage;
+ }
+
+ public void readLockUnlockConsumers(boolean lock) {
+ ReadLock readlock = consumerListLock.readLock();
+ lockUnlock(readlock, lock);
+ }
+
+ public void writeLockUnlockConsumers(boolean lock) {
+ WriteLock writeLock = consumerListLock.writeLock();
+ lockUnlock(writeLock, lock);
+ }
+
+ private void lockUnlock(Lock l, boolean lock) {
+
+ if (lock) {
+ l.lock();
+ } else {
+ l.unlock();
+ }
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/BitSetUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/BitSetUtil.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/BitSetUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/BitSetUtil.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,111 @@
+/*
+ * 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.matching.XPath;
+
+import java.util.BitSet;
+
+//Got code from "The Java Developers Almanac 1.4"
+
+public class BitSetUtil {
+ // Returns a bitset containing the values in bytes.
+ // The byte-ordering of bytes must be big-endian which means the most significant bit is in element 0.
+ public static BitSet fromByteArray(byte[] bytes) {
+ BitSet bits = new BitSet();
+ for (int i=0; i<bytes.length*8; i++) {
+ if ((bytes[bytes.length-i/8-1]&(1<<(i%8))) > 0) {
+ bits.set(i);
+ }
+ }
+ return bits;
+ }
+
+ // Returns a byte array of at least length 1.
+ // The most significant bit in the result is guaranteed not to be a 1
+ // (since BitSet does not support sign extension).
+ // The byte-ordering of the result is big-endian which means the most significant bit is in element 0.
+ // The bit at index 0 of the bit set is assumed to be the least significant bit.
+ public static byte[] toByteArray(BitSet bits) {
+ byte[] bytes = new byte[bits.length()/8+1];
+ for (int i=0; i<bits.length(); i++) {
+ if (bits.get(i)) {
+ bytes[bytes.length-i/8-1] |= 1<<(i%8);
+ }
+ }
+ return bytes;
+ }
+
+public static void main(String[] args){
+// Create the bitset
+ BitSet bits = new BitSet();
+
+ // Set a bit on
+ bits.set(2); // 100 = decimal 4
+ bits.set(127);
+ long start=System.nanoTime();
+ byte[] byteArray=toByteArray(bits);
+ long end0=System.nanoTime();
+ String base64=org.apache.axis2.util.Base64.encode(byteArray);
+ long end1=System.nanoTime();
+ byte[] byteArrayNew=org.apache.axis2.util.Base64.decode(base64);
+ BitSet bitsNew=fromByteArray(byteArrayNew);
+ long end2=System.nanoTime();
+ System.out.println("Base64String="+base64);
+ System.out.println("bitSet="+bitsNew.toString());
+ System.out.println("encodingTime="+(end1-start)+" decodingTime="+(end2-end1)+" encodingTime0="+(end0-start));
+ // Retrieving the value of a bit
+ boolean b = bits.get(0); // false
+ b = bits.get(2); // true
+
+ // Clear a bit
+ bits.clear(1);
+
+ // Setting a range of bits
+ BitSet bits2 = new BitSet();
+ bits2.set(1, 4); // 1110
+ bits2.set(127);
+
+ long start2=System.nanoTime();
+
+ // And'ing two bitsets
+ bits.and(bits2); // 0100
+ long end=System.nanoTime();
+ long total=(end-start2);
+ System.out.println("Total="+total);
+ // Xor'ing two bitsets
+ bits.xor(bits2); // 1010
+
+ // Flip all bits in the bitset
+ bits.flip(0, bits.length()); // 0101
+
+ // Andnot'ing two bitsets
+ bits.andNot(bits2); // 0001
+
+ // Or'ing two bitsets
+ bits.or(bits2); // 1111
+
+// byte[] byteArray=toByteArray(bits);
+// String base64=org.apache.axis2.util.Base64.encode(byteArray);
+// System.out.println("Base64String="+base64);
+
+
+}
+}
+
+
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterInfo.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterInfo.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterInfo.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterInfo.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,161 @@
+/*
+ * 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.matching.XPath;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+
+import wsmg.broker.ConsumerInfo;
+import wsmg.broker.ConsumerList;
+import wsmg.broker.ConsumerListManager;
+import wsmg.broker.subscription.SubscriptionState;
+import wsmg.config.WSMGParameter;
+import edu.berkeley.cs.db.yfilter.filter.EXfilterBasic;
+import edu.berkeley.cs.db.yfilter.filter.SystemGlobals;
+import edu.berkeley.cs.db.yfilterplus.queryparser.Query;
+import edu.berkeley.cs.db.yfilterplus.queryparser.XPQuery;
+import edu.berkeley.cs.db.yfilterplus.xmltree.XMLTree;
+
+public class YFilterInfo {
+ private EXfilterBasic yfilter = new EXfilterBasic();
+ private HashMap<Integer, String> yFilterIdToXPath = new HashMap<Integer, String>();
+ private HashMap<Integer, Query> yFilterIdToQuery = new HashMap<Integer, Query>();
+ private HashMap<String, Integer> xPathToYFilterId = new HashMap<String, Integer>();
+ private ConsumerListManager consumerListmanager = new ConsumerListManager();
+ private int index = 0;
+ private int counter = 0;
+
+ private Logger logger = Logger.getLogger(YFilterInfo.class);
+
+ public EXfilterBasic getYfilter() {
+ return yfilter;
+ }
+
+ public void setYfilter(EXfilterBasic yfilter) {
+ this.yfilter = yfilter;
+ }
+
+ public HashMap<Integer, String> getYFilterIdToXPath() {
+ return yFilterIdToXPath;
+ }
+
+ public void setYFilterIdToXPath(HashMap<Integer, String> filterIdToXPath) {
+ yFilterIdToXPath = filterIdToXPath;
+ }
+
+ public void addXPathQuery(String xpathExpression, String subscriptionId,
+ SubscriptionState subscribeRequest) throws RuntimeException {
+ index++;
+ counter++;
+ if (WSMGParameter.debugYFilter)
+ logger.debug("QueryExp=" + xpathExpression);
+
+ Integer yFilterIdObj = xPathToYFilterId.get(xpathExpression);
+ int yFilterId = -1;
+ if (yFilterIdObj != null) {
+ yFilterId = yFilterIdObj.intValue();
+ } else {
+ Query query = XPQuery.parseQuery(xpathExpression, index);
+ if (query == null) {
+ throw new RuntimeException("Invalid XPath expression:"
+ + xpathExpression);
+ }
+ if (WSMGParameter.debugYFilter)
+ logger.debug("addSubscription " + xpathExpression + " query :"
+ + query);
+ yFilterId = yfilter.addQuery(query);
+ if (WSMGParameter.debugYFilter)
+ yfilter.printQueryIndex();
+ xPathToYFilterId.put(xpathExpression, Integer.valueOf(yFilterId));
+ yFilterIdToXPath.put(new Integer(yFilterId), xpathExpression);
+ yFilterIdToQuery.put(yFilterId, query);
+ }
+ if (WSMGParameter.debugYFilter)
+ logger.debug("YFilterId=" + yFilterId);
+
+ consumerListmanager.addToConsumerList(xpathExpression,
+ subscribeRequest, subscriptionId);
+ }
+
+ public int removeSubscription(String subscriptionId) {
+
+ String xPath = consumerListmanager
+ .getTokenBySubscriptionId(subscriptionId);
+ int result = consumerListmanager.removeFromConsumerList(subscriptionId,
+ xPath);
+ if (result == 0) {
+ return 0;
+ }
+ int currentConsumerCount = consumerListmanager.getConsumerListByToken(
+ xPath).size();
+ if (currentConsumerCount == 0) {
+ Integer yFilterId = xPathToYFilterId.get(xPath);
+ Query q = yFilterIdToQuery.get(yFilterId);
+ yfilter.deleteQuery(q, q.getQueryId());
+ yFilterIdToQuery.remove(yFilterId);
+ }
+ counter--;
+ return result;
+ }
+
+ public List<ConsumerInfo> getMatchingConsumerList(String messageString) {
+ List<ConsumerInfo> matchingConsumerList = new LinkedList<ConsumerInfo>();
+ XMLTree tree = new XMLTree(new java.io.StringReader(messageString));
+ if (WSMGParameter.debugYFilter)
+ tree.print();
+ yfilter.setEventSequence(tree.getEvents());
+ yfilter.startParsing();
+
+ // print the matched queries //
+ if (SystemGlobals.hasQueries) {
+ if (WSMGParameter.debugYFilter)
+
+ yfilter.printQueryResults(System.out);
+ } else {
+ System.out.println("no match");
+ return matchingConsumerList;
+ }
+
+ Iterator<Integer> it = (Iterator<Integer>) yfilter.getMatchedQueries()
+ .iterator();
+ while (it.hasNext()) {
+ Integer qid = it.next();
+
+ String xpath = yFilterIdToXPath.get(qid);
+ ConsumerList consumerList = consumerListmanager
+ .getConsumerListByToken(xpath);
+
+ if (consumerList != null) {// has subscription to this topic
+ matchingConsumerList.addAll(consumerList.getConsumerList());
+ }
+ }
+ yfilter.clear();
+ return matchingConsumerList;
+ }
+
+ public int getCounter() {
+ return counter;
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterMessageMatcher.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterMessageMatcher.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterMessageMatcher.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/YFilterMessageMatcher.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,210 @@
+/*
+ * 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.
+ */
+
+/*
+ Some code adapted from apache pubscribe project's SubscriptionHome.java
+ */
+
+package wsmg.matching.XPath;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.broker.ConsumerList;
+import wsmg.broker.ConsumerListManager;
+import wsmg.broker.subscription.SubscriptionState;
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.config.WSMGParameter;
+import wsmg.matching.AbstractMessageMatcher;
+import wsmg.messenger.OutGoingQueue;
+import wsmg.transports.jms.MessageMatcherConnection;
+
+public class YFilterMessageMatcher extends AbstractMessageMatcher {
+
+ private OutGoingQueue outGoingQueue = null;
+
+ // private HashMap subIdToQuery=new HashMap();
+ // private HashMap yFilterIdToXPath=new HashMap();
+ private HashMap<String, YFilterInfo> topicToYFilterInfo = new HashMap<String, YFilterInfo>();
+ private HashMap<String, String> subIdToTopic = new HashMap<String, String>();
+ // private Map xpath2ConsumerListMap = new HashMap();
+
+ // used for topic only subscription, so that we don't have to create a
+ // YFilter object
+ private ConsumerListManager consumerListmanager = new ConsumerListManager();
+
+ // private String[] queries = new String[1000000];
+
+ private Logger logger = Logger.getLogger(YFilterMessageMatcher.class);
+
+ public YFilterMessageMatcher(Map<Object, Object> publisherRegistrationDB) {
+ super(publisherRegistrationDB);
+ // TODO Auto-generated constructor stub
+ }
+
+ public void start(String carrierLocation) {
+
+ currentMessageCache = new Hashtable<String, String>();
+ }
+
+ @Override
+ public void populateMatches(String wsntMessageConverterClassName,
+ AdditionalMessageContent additionalMessageContent, String message,
+ String topic, List<ConsumerInfo> matchedConsumers) {
+
+ assert (matchedConsumers != null);
+
+ if (WSMGParameter.debugYFilter)
+ logger.info("Message In YFilterAdapter=" + message);
+
+ // Important Get a Read Lock....
+ readLockUnlockConsumers(true);
+ try {
+
+ // 1, Topic only
+ ConsumerList topicConsumerList = consumerListmanager
+ .getConsumerListByToken(topic);
+ if (topicConsumerList != null) {// has subscription to this topic
+
+ ArrayList<ConsumerInfo> list = topicConsumerList
+ .getConsumerList();
+ matchedConsumers.addAll(list);
+ }
+ // 2, wild card topic only
+ ConsumerList wildcardConsumerList = consumerListmanager
+ .getConsumerListByToken(WsmgCommonConstants.WILDCARD_TOPIC);
+ if (wildcardConsumerList != null) {// has wildcard subscriptions
+ List<ConsumerInfo> wildCardConsumerInfoList = wildcardConsumerList
+ .getConsumerList();
+ if (wildCardConsumerInfoList != null) {
+ // System.out.println("ConsumerListSize2="+wildCardConsumerInfoList.size());
+ matchedConsumers.addAll(wildCardConsumerInfoList);
+ }
+ }
+ // 3, topic with Xpath
+ YFilterInfo yfilterInfo = topicToYFilterInfo.get(topic);
+ if (yfilterInfo != null) {
+ List<ConsumerInfo> topicAndXPathConsumerInfoList = yfilterInfo
+ .getMatchingConsumerList(message);
+ if (topicAndXPathConsumerInfoList != null) {
+ // System.out.println("ConsumerListSize3="+topicAndXPathConsumerInfoList.size());
+ matchedConsumers.addAll(topicAndXPathConsumerInfoList);
+ }
+ }
+ // 4, wild card topic with Xpath (XPath only)
+ yfilterInfo = topicToYFilterInfo
+ .get(WsmgCommonConstants.WILDCARD_TOPIC);
+ if (yfilterInfo != null) {
+ List<ConsumerInfo> wildcardTopicAndXPathConsumerInfoList = yfilterInfo
+ .getMatchingConsumerList(message);
+ if (wildcardTopicAndXPathConsumerInfoList != null) {
+ // System.out.println("ConsumerListSize4="+wildcardTopicAndXPathConsumerInfoList.size());
+ matchedConsumers
+ .addAll(wildcardTopicAndXPathConsumerInfoList);
+ }
+ }
+
+ } finally {
+
+ // Release the Read Lock...
+ readLockUnlockConsumers(false);
+ }
+
+ }
+
+ public int handleUnsubscribe(String subscriptionId) {
+
+ int ret = 1;
+
+ writeLockUnlockConsumers(true);
+ try {
+ String topicExpression = subIdToTopic.get(subscriptionId);
+ if (subscriptionId.startsWith("T")) { // Topic only
+ consumerListmanager.removeFromConsumerList(subscriptionId,
+ topicExpression);
+ } else {
+ YFilterInfo yfilterInfo = topicToYFilterInfo
+ .get(topicExpression);
+ if (yfilterInfo != null) {
+ yfilterInfo.removeSubscription(subscriptionId);
+ if (yfilterInfo.getCounter() == 0) {
+ yfilterInfo = null;
+ topicToYFilterInfo.remove(topicExpression);
+ }
+ } else {
+ System.out
+ .println("ERROR: Cannot find subscription with the subId="
+ + subscriptionId);
+ ret = 0;
+ }
+ }
+ } finally {
+ writeLockUnlockConsumers(false);
+ }
+
+ return ret;
+ }
+
+ public MessageMatcherConnection handleSubscribe(
+ SubscriptionState subscribeRequest, String subscriptionId) {
+
+ //Get the write lock
+ writeLockUnlockConsumers(true);
+ try {
+
+ String topicExpression = subscribeRequest.getLocalTopic();
+ subIdToTopic.put(subscriptionId, topicExpression);
+
+ String xpathExpression = subscribeRequest.getXpathString();
+ if (xpathExpression == null || xpathExpression.length() == 0) { // Topic
+ // only
+ consumerListmanager.addToConsumerList(topicExpression,
+ subscribeRequest, subscriptionId);
+ } else {
+ YFilterInfo yfilterInfo = topicToYFilterInfo
+ .get(topicExpression);
+ if (yfilterInfo == null) {
+ yfilterInfo = new YFilterInfo();
+ topicToYFilterInfo.put(topicExpression, yfilterInfo);
+ }
+ yfilterInfo.addXPathQuery(xpathExpression, subscriptionId,
+ subscribeRequest);
+ }
+
+ if (outGoingQueue == null) {
+ outGoingQueue = subscribeRequest.getOutGoingQueue();
+ }
+
+ } finally {
+ //release the write lock
+ writeLockUnlockConsumers(false);
+ }
+
+ return null;
+ }
+
+}
+
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/util/BitSetUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/util/BitSetUtil.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/util/BitSetUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/XPath/util/BitSetUtil.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,112 @@
+/*
+ * 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.matching.XPath.util;
+
+import java.util.BitSet;
+
+//Got code from "The Java Developers Almanac 1.4"
+
+public class BitSetUtil {
+ // Returns a bitset containing the values in bytes.
+ // The byte-ordering of bytes must be big-endian which means the most significant bit is in element 0.
+ public static BitSet fromByteArray(byte[] bytes) {
+ BitSet bits = new BitSet();
+ for (int i=0; i<bytes.length*8; i++) {
+ if ((bytes[bytes.length-i/8-1]&(1<<(i%8))) > 0) {
+ bits.set(i);
+ }
+ }
+ return bits;
+ }
+
+ // Returns a byte array of at least length 1.
+ // The most significant bit in the result is guaranteed not to be a 1
+ // (since BitSet does not support sign extension).
+ // The byte-ordering of the result is big-endian which means the most significant bit is in element 0.
+ // The bit at index 0 of the bit set is assumed to be the least significant bit.
+ public static byte[] toByteArray(BitSet bits) {
+ byte[] bytes = new byte[bits.length()/8+1];
+ for (int i=0; i<bits.length(); i++) {
+ if (bits.get(i)) {
+ bytes[bytes.length-i/8-1] |= 1<<(i%8);
+ }
+ }
+ return bytes;
+ }
+
+public static void main(String[] args){
+// Create the bitset
+ BitSet bits = new BitSet();
+
+ // Set a bit on
+ bits.set(2); // 100 = decimal 4
+ bits.set(127);
+ long start=System.nanoTime();
+ byte[] byteArray=toByteArray(bits);
+ long end0=System.nanoTime();
+ String base64=org.apache.axis2.util.Base64.encode(byteArray);
+ long end1=System.nanoTime();
+ byte[] byteArrayNew=org.apache.axis2.util.Base64.decode(base64);
+ BitSet bitsNew=fromByteArray(byteArrayNew);
+ long end2=System.nanoTime();
+ System.out.println("Base64String="+base64);
+ System.out.println("bitSet="+bitsNew.toString());
+ System.out.println("encodingTime="+(end1-start)+" decodingTime="+(end2-end1)+" encodingTime0="+(end0-start));
+ // Retrieving the value of a bit
+ boolean b = bits.get(0); // false
+ b = bits.get(2); // true
+
+ // Clear a bit
+ bits.clear(1);
+
+ // Setting a range of bits
+ BitSet bits2 = new BitSet();
+ bits2.set(1, 4); // 1110
+ bits2.set(127);
+
+ long start2=System.nanoTime();
+
+ // And'ing two bitsets
+ bits.and(bits2); // 0100
+ long end=System.nanoTime();
+ long total=(end-start2);
+ System.out.println("Total="+total);
+ // Xor'ing two bitsets
+ bits.xor(bits2); // 1010
+
+ // Flip all bits in the bitset
+ bits.flip(0, bits.length()); // 0101
+
+ // Andnot'ing two bitsets
+ bits.andNot(bits2); // 0001
+
+ // Or'ing two bitsets
+ bits.or(bits2); // 1111
+
+// byte[] byteArray=toByteArray(bits);
+// String base64=org.apache.axis2.util.Base64.encode(byteArray);
+// System.out.println("Base64String="+base64);
+
+
+}
+}
+
+
+
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,142 @@
+/*
+ * 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.matching.simpleTopic;
+
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.broker.ConsumerList;
+import wsmg.broker.ConsumerListManager;
+import wsmg.broker.subscription.SubscriptionState;
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.matching.AbstractMessageMatcher;
+import wsmg.messenger.OutGoingQueue;
+import wsmg.transports.jms.MessageMatcherConnection;
+
+public class DirectWsntMessageMatcher extends AbstractMessageMatcher {
+
+ private ConsumerListManager consumerListmanager = new ConsumerListManager();
+
+ private OutGoingQueue outGoingQueue = null;
+
+ // private Map topic2ConsumerListMap = new HashMap();
+
+ Logger logger = Logger.getLogger(DirectWsntMessageMatcher.class);
+
+ public DirectWsntMessageMatcher(
+
+ Map<Object, Object> publisherRegistrationDB) {
+ super(publisherRegistrationDB);
+ }
+
+ public DirectWsntMessageMatcher(
+ Map<String, SubscriptionState> subscriptionDB,
+ Map<Object, Object> publisherRegistrationDB, String carrier) {
+ super(publisherRegistrationDB);
+ }
+
+ public void start(String carrierLocation) {
+
+ currentMessageCache = new Hashtable<String, String>();
+ }
+
+ public MessageMatcherConnection handleSubscribe(
+ SubscriptionState subscribeRequest, String subscriptionId) {
+
+ String topicExpression = subscribeRequest.getLocalTopic();
+ if (topicExpression == null || topicExpression.length() == 0) {
+ logger.error("ERROR:WsntAdapterConnection creation failed.");
+ return null;
+ }
+
+ writeLockUnlockConsumers(true);
+
+ try {
+ consumerListmanager.addToConsumerList(topicExpression,
+ subscribeRequest, subscriptionId);
+ if (outGoingQueue == null) {
+ outGoingQueue = subscribeRequest.getOutGoingQueue();
+ }
+ } finally {
+ writeLockUnlockConsumers(false);
+ }
+
+ return null;
+
+ }
+
+ public int handleUnsubscribe(String subscriptionId) {
+
+ int ret = 0;
+
+ writeLockUnlockConsumers(true);
+ try {
+ ret = consumerListmanager.removeFromConsumerList(subscriptionId,
+ null);
+ } finally {
+ writeLockUnlockConsumers(false);
+ }
+
+ return ret;
+ }
+
+ @Override
+ public void populateMatches(String wsntMessageConverterClassName,
+ AdditionalMessageContent additionalMessageContent, String message,
+ String topic, List<ConsumerInfo> matchedConsumers) {
+
+ assert (matchedConsumers != null);
+
+ readLockUnlockConsumers(true);
+
+ try {
+
+ ConsumerList topicConsumerList = consumerListmanager
+ .getConsumerListByToken(topic);
+ ConsumerList wildcardConsumerList = consumerListmanager
+ .getConsumerListByToken(WsmgCommonConstants.WILDCARD_TOPIC);
+ if (topicConsumerList != null) {// has subscription to this topic
+
+ ArrayList<ConsumerInfo> list = topicConsumerList
+ .getConsumerList();
+
+ matchedConsumers.addAll(list);
+ }
+ if (wildcardConsumerList != null) {// has wildcard subscriptions
+ List<ConsumerInfo> wildCardConsumerInfoList = wildcardConsumerList
+ .getConsumerList();
+ if (wildCardConsumerInfoList != null) {
+ matchedConsumers.addAll(wildCardConsumerInfoList);
+ }
+ }
+
+ } finally {
+ readLockUnlockConsumers(false);
+ }
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/ConsumerUrlManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/ConsumerUrlManager.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/ConsumerUrlManager.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/ConsumerUrlManager.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,194 @@
+package wsmg.messenger;
+
+import java.net.NoRouteToHostException;
+import java.net.SocketTimeoutException;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.config.ConfigurationManager;
+import wsmg.util.RunTimeStatistics;
+
+public class ConsumerUrlManager {
+
+ private ConcurrentHashMap<String, FailedConsumerInfo> failedConsumerUrls = new ConcurrentHashMap<String, FailedConsumerInfo>(); // the
+
+ private final int defaultMaxRetry;
+
+ private long expireTimeGap; // milliseconds
+
+ private Logger logger = Logger.getLogger(ConsumerUrlManager.class);
+
+ private Timer cleanupTimer;
+
+ public ConsumerUrlManager(ConfigurationManager config) {
+
+ defaultMaxRetry = Integer.parseInt(config.getConfig(
+ WsmgCommonConstants.CONFIG_MAX_MESSAGE_DELIVER_RETRIES, "2"));
+
+ expireTimeGap = 1000 * 60 * Long.parseLong(config.getConfig(
+ WsmgCommonConstants.CONFIG_CONSUMER_URL_EXPIRATION_TIME_GAP,
+ "5")); // time is in milliseconds
+
+ // let minimum time to be 1 minute
+ long timerThreadInterval = Math.max(expireTimeGap / 5, 1000 * 60);
+
+ cleanupTimer = new Timer("Failed consumer url handler", true);
+ cleanupTimer.scheduleAtFixedRate(
+ new URLCleanUpTask(failedConsumerUrls), 0, timerThreadInterval);
+
+ }
+
+ public void onFailedDelivery(EndpointReference consumerEndpointReference,
+ long timeFinished, long timeTaken, AxisFault exception,
+ AdditionalMessageContent headers) {
+ String url = consumerEndpointReference.getAddress();
+
+ RunTimeStatistics.addNewFailedDeliverTime(timeTaken);
+ RunTimeStatistics.addFailedConsumerURL(url);
+
+ if (isEligibleToBlackList(exception)) {
+
+ FailedConsumerInfo info = failedConsumerUrls.get(url);
+ if (info == null) {
+ info = new FailedConsumerInfo();
+ failedConsumerUrls.put(url, info);
+ }
+
+ info.incrementNumberOfTimesTried(timeFinished + expireTimeGap);
+
+ } else {
+
+ String errorMsg = String.format(
+ "unable to deliver message: [%s] to consumer: [%s], "
+ + "reason: [%s]", headers.toString(), url,
+ exception.getMessage());
+
+ logger.error(errorMsg);
+ }
+ }
+
+ public void onSucessfullDelivery(
+ EndpointReference consumerEndpointReference, long timeTaken) {
+
+ RunTimeStatistics.addNewSuccessfulDeliverTime(timeTaken);
+
+ FailedConsumerInfo info = failedConsumerUrls
+ .remove(consumerEndpointReference.getAddress());
+
+ if (info != null) {
+ logger.debug(String.format("message was delivered to "
+ + "previously %d times failed url : %s", info
+ .getNumberOfTimesTried(), consumerEndpointReference
+ .getAddress()));
+ }
+ }
+
+ public boolean isUnavailable(String url) {
+
+ FailedConsumerInfo info = failedConsumerUrls.get(url);
+
+ return (info != null && info.isMaxRetryCountReached());
+ }
+
+ private boolean isEligibleToBlackList(AxisFault f) {
+
+ Throwable cause = f.getCause();
+
+ if (cause == null) {
+ logger.error("unknown error occured", cause);
+ return false;
+ }
+
+ /*
+ * if timeout because of the set timeout in this class In windows,
+ * timeout cause ConnectException with "Connection timed out" message
+ */
+ if (cause instanceof SocketTimeoutException
+ || cause.getMessage().indexOf("timed out") > 0
+ || cause instanceof NoRouteToHostException) {
+ return true;
+ }
+
+ return false;
+ }
+
+ class FailedConsumerInfo {
+
+ private int numberOfTimesTried;
+ private long expiryTime;
+
+ public FailedConsumerInfo() {
+ numberOfTimesTried = 0;
+ expiryTime = 0L;
+ }
+
+ public void incrementNumberOfTimesTried(long expireTime) {
+ numberOfTimesTried++;
+ expiryTime = expireTime;
+
+ }
+
+ public void decrementNumberOfTimeTried() {
+ numberOfTimesTried--;
+ }
+
+ public int getNumberOfTimesTried() {
+ return numberOfTimesTried;
+ }
+
+ public boolean isMaxRetryCountReached() {
+ return numberOfTimesTried >= defaultMaxRetry;
+ }
+
+ public long getLastAtteptExpiryTime() {
+ return expiryTime;
+ }
+
+ }
+
+ class URLCleanUpTask extends TimerTask {
+
+ ConcurrentHashMap<String, FailedConsumerInfo> failedConsumers;
+
+ public URLCleanUpTask(
+ ConcurrentHashMap<String, FailedConsumerInfo> failedUrls) {
+
+ failedConsumers = failedUrls;
+
+ }
+
+ @Override
+ public void run() {
+
+ logger.info("starting to clean up black listed consumer urls");
+ long currentTime = System.currentTimeMillis();
+
+ for (Entry<String, FailedConsumerInfo> entry : failedConsumers
+ .entrySet()) {
+ FailedConsumerInfo info = entry.getValue();
+
+ if (info.isMaxRetryCountReached()
+ && info.getLastAtteptExpiryTime() >= currentTime) {
+
+ info.decrementNumberOfTimeTried();
+ logger.info("decrementing number of times"
+ + " tried for consumer url: " + entry.getKey());
+
+ }
+
+ }
+
+ logger.info("finished cleaning black listed consumer urls");
+ }
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/OutGoingQueue.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/OutGoingQueue.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/OutGoingQueue.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/OutGoingQueue.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,71 @@
+/*
+ * 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.messenger;
+
+import org.apache.log4j.Logger;
+
+import wsmg.commons.OutGoingMessage;
+import wsmg.config.WSMGParameter;
+import wsmg.util.Counter;
+import wsmg.util.TimerThread;
+
+
+
+public class OutGoingQueue {
+
+ Logger logger = Logger.getLogger(OutGoingQueue.class);
+
+ private Counter storeToOutQueueCounter;
+
+ public OutGoingQueue() {
+
+ if (WSMGParameter.measureMessageRate) {
+ storeToOutQueueCounter = new Counter();
+ TimerThread timerThread = new TimerThread(storeToOutQueueCounter,
+ " StoreToOutQueueCounter");
+ new Thread(timerThread).start();
+ }
+
+ }
+
+ // need synchronized???
+ public void storeNotification(OutGoingMessage outGoingMessage,
+ long messageId) {
+
+ boolean loop = false;
+ do {
+
+ // this outgoing Que is created inside the messenger which is
+ // intended to send the notification message to the consumer.
+ WSMGParameter.OUT_GOING_QUEUE.enqueue(outGoingMessage,
+ outGoingMessage.getAdditionalMessageContent().getTrackId());
+
+ if (WSMGParameter.measureMessageRate) {
+ storeToOutQueueCounter.addCounter();
+ }
+
+ if (WSMGParameter.testOutGoingQueueMaxiumLength
+ && storeToOutQueueCounter.getCounterValue() < 1000000) {
+ loop = true;
+ }
+ } while (loop);
+
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/SenderUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/SenderUtils.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/SenderUtils.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/SenderUtils.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,158 @@
+package wsmg.messenger;
+
+import java.io.StringReader;
+import java.lang.reflect.Constructor;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.commons.CommonRoutines;
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.commons.WsmgNameSpaceConstants;
+import wsmg.config.ConfigurationManager;
+import wsmg.config.WSMGParameter;
+import wsmg.messenger.protocol.Axis2Protocol;
+import wsmg.messenger.protocol.DeliveryProtocol;
+import wsmg.messenger.protocol.SendingException;
+
+/*
+ * this class is not thread safe
+ * */
+
+public class SenderUtils {
+
+ Logger logger = Logger.getLogger(SenderUtils.class);
+
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+
+ ConsumerUrlManager urlManager;
+
+ DeliveryProtocol protocol;
+
+ public SenderUtils(ConsumerUrlManager urlMan, ConfigurationManager config) {
+ urlManager = urlMan;
+
+ /*
+ * Invoke factory and config
+ */
+ String protocolClass= config.getConfig(WsmgCommonConstants.DELIVERY_PROTOCOL, "wsmg.messenger.protocol.Axis2Protocol");
+ try {
+ Class cl = Class.forName(protocolClass);
+ Constructor<DeliveryProtocol> co = cl.getConstructor(null);
+ protocol = co.newInstance((Object[])null);
+
+ } catch (Exception e) {
+ //fallback to normal class
+ logger.error("Cannot initial protocol sender", e);
+ protocol = new Axis2Protocol();
+ }
+
+ protocol.setTimeout(Long.parseLong(config.getConfig(WsmgCommonConstants.CONFIG_SOCKET_TIME_OUT, "20000")));
+
+ }
+
+ public void send(ConsumerInfo consumerInfo, OMElement notificationMessageBodyEl, AdditionalMessageContent additionalMessageContent) {
+
+ if (consumerInfo.isPaused()) {
+ return;
+ }
+
+ if (notificationMessageBodyEl == null) {
+ logger.info("notification message is null, IGNORED");
+ return;
+ }
+
+ if (urlManager.isUnavailable(consumerInfo.getConsumerEprStr())) {
+ logger.info("consumer url is unavailable: " + consumerInfo.getConsumerEprStr());
+ return;
+ }
+
+ EndpointReference consumerReference = new EndpointReference(consumerInfo.getConsumerEprStr());
+
+ /*
+ * Extract message
+ */
+ OMElement message = null;
+ if (consumerInfo.getType().compareTo("wsnt") == 0) {
+ if (consumerInfo.isUseNotify()) {
+ message = wrapRawMessageToWsntWrappedFormat(notificationMessageBodyEl, additionalMessageContent);
+ } else {
+ message = notificationMessageBodyEl;
+ }
+ } else { // wse
+ message = notificationMessageBodyEl;
+ }
+
+ long timeElapsed = -1;
+ long startTime = -1;
+
+ startTime = System.currentTimeMillis();
+
+ try {
+
+ /*
+ * sending message out
+ */
+ protocol.deliver(consumerInfo, message, additionalMessageContent);
+
+ long finishTime = System.currentTimeMillis();
+ timeElapsed = finishTime - startTime;
+ if (WSMGParameter.showTrackId)
+ logger.info(String.format("track id = %s : delivered to: %s in %d ms", additionalMessageContent.getTrackId(), consumerReference.getAddress(), timeElapsed));
+
+ urlManager.onSucessfullDelivery(consumerReference, timeElapsed);
+ } catch (SendingException ex) {
+
+ long finishTime = System.currentTimeMillis();
+ timeElapsed = finishTime - startTime;
+
+ urlManager.onFailedDelivery(consumerReference, finishTime, timeElapsed, ex, additionalMessageContent);
+
+ }
+ }
+
+ public OMElement wrapRawMessageToWsntWrappedFormat(OMElement rawNotif, AdditionalMessageContent additionalMessageContent) {
+
+ OMElement fullNotif = factory.createOMElement("Notify", WsmgNameSpaceConstants.WSNT_NS);
+
+ OMElement notificationMessageEl = factory.createOMElement("NotificationMessage", WsmgNameSpaceConstants.WSNT_NS, fullNotif);
+
+ String topicElString = additionalMessageContent.getTopicElement();
+ if (topicElString != null) {
+ OMElement topicEl = null;
+ try {
+ topicEl = CommonRoutines.reader2OMElement(new StringReader(topicElString));
+ } catch (XMLStreamException e) {
+ // TODO add with throws
+ logger.fatal("XMLStreamreader exception when setting topicEl", e);
+ e.printStackTrace();
+ }
+ notificationMessageEl.addChild(topicEl);
+ }
+ String producerReferenceElString = additionalMessageContent.getProducerReference();
+ if (producerReferenceElString != null) {
+ OMElement producerReferenceEl = null;
+ try {
+ producerReferenceEl = CommonRoutines.reader2OMElement(new StringReader(producerReferenceElString));
+ } catch (XMLStreamException e) {
+ logger.fatal("XMLStreamException at " + "creating producerReferenceEl", e);
+ e.printStackTrace();
+ }
+ notificationMessageEl.addChild(producerReferenceEl);
+ }
+
+ OMElement messageEl = factory.createOMElement("Message", WsmgNameSpaceConstants.WSNT_NS, notificationMessageEl);
+ messageEl.addChild(rawNotif);
+
+ return fullNotif;
+
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/Axis2Protocol.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/Axis2Protocol.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/Axis2Protocol.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/Axis2Protocol.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,132 @@
+package wsmg.messenger.protocol;
+
+import java.io.StringReader;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.util.ElementHelper;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPHeaderBlock;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.commons.CommonRoutines;
+import wsmg.commons.WsmgNameSpaceConstants;
+
+public class Axis2Protocol implements DeliveryProtocol {
+
+ Logger logger = Logger.getLogger(Axis2Protocol.class);
+
+
+ SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
+
+ ServiceClient nonThreadLocalServiceClient = null;
+
+ long tcpConnectionTimeout = 0;
+
+ @Override
+ public void setTimeout(long timeout) {
+ this.tcpConnectionTimeout = timeout;
+ }
+
+ @Override
+ public void deliver(ConsumerInfo consumerInfo, OMElement message, AdditionalMessageContent additionalMessageContent) throws SendingException {
+ EndpointReference consumerReference = new EndpointReference(consumerInfo.getConsumerEprStr());
+
+ /*
+ * Extract information
+ */
+ String actionString = null;
+ List<OMElement> soapHeaders = new LinkedList<OMElement>();
+ if (consumerInfo.getType().compareTo("wsnt") == 0) {
+ actionString = WsmgNameSpaceConstants.WSNT_NS.getNamespaceURI() + "/Notify";
+ } else { // wse
+ actionString = additionalMessageContent.getAction();
+ String topicElString = additionalMessageContent.getTopicElement();
+ if (topicElString != null) {
+ OMElement topicEl = null;
+ try {
+ topicEl = CommonRoutines.reader2OMElement(new StringReader(topicElString));
+ soapHeaders.add(topicEl);
+ } catch (XMLStreamException e) {
+ logger.fatal("exception at topicEl xmlStreamException", e);
+ }
+ }
+ }
+
+ try {
+
+ ServiceClient client = configureServiceClient(actionString, consumerReference, additionalMessageContent.getMessageID(), soapHeaders);
+
+ client.sendRobust(message);
+ client.cleanupTransport();
+
+ } catch (AxisFault ex) {
+ throw new SendingException(ex.getCause());
+ }
+ }
+
+ private ServiceClient getServiceClient() throws AxisFault {
+
+ ServiceClient ret = nonThreadLocalServiceClient;
+ if (ret == null) {
+ ret = new ServiceClient();
+
+ nonThreadLocalServiceClient = ret;
+ }
+ ret.removeHeaders();
+ return ret;
+ }
+
+ private ServiceClient configureServiceClient(String action, EndpointReference consumerLocation, String msgId, List<OMElement> soapHeaders) throws AxisFault {
+
+ // not engaging addressing modules
+
+ ServiceClient client = getServiceClient();
+
+ SOAPHeaderBlock msgIdEl = soapfactory.createSOAPHeaderBlock("MessageID", WsmgNameSpaceConstants.WSA_NS);
+ msgIdEl.setText(msgId);
+ SOAPHeaderBlock actionEl = soapfactory.createSOAPHeaderBlock("Action", WsmgNameSpaceConstants.WSA_NS);
+ actionEl.setText(action);
+
+ SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", WsmgNameSpaceConstants.WSA_NS);
+ to.setText(consumerLocation.getAddress());
+
+ client.addHeader(actionEl);
+ client.addHeader(msgIdEl);
+ client.addHeader(to);
+
+ for (OMElement omHeader : soapHeaders) {
+
+ try {
+ SOAPHeaderBlock headerBlock = ElementHelper.toSOAPHeaderBlock(omHeader, soapfactory);
+
+ client.addHeader(headerBlock);
+ } catch (Exception e) {
+ throw AxisFault.makeFault(e);
+ }
+
+ }
+
+ Options opts = new Options();
+ opts.setTimeOutInMilliSeconds(tcpConnectionTimeout);
+ opts.setMessageId(msgId);
+ opts.setTo(consumerLocation);
+ opts.setAction(action);
+ opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
+
+ opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_PROTOCOL_VERSION, org.apache.axis2.transport.http.HTTPConstants.HEADER_PROTOCOL_10);
+ client.setOptions(opts);
+
+ return client;
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/DeliveryProtocol.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/DeliveryProtocol.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/DeliveryProtocol.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/DeliveryProtocol.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,12 @@
+package wsmg.messenger.protocol;
+
+import org.apache.axiom.om.OMElement;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+
+public interface DeliveryProtocol {
+
+ public void deliver(ConsumerInfo consumerInfo, OMElement message, AdditionalMessageContent additionalMessageContent) throws SendingException;
+ public void setTimeout(long timeout);
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/SendingException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/SendingException.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/SendingException.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/protocol/SendingException.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,16 @@
+package wsmg.messenger.protocol;
+
+import org.apache.axis2.AxisFault;
+
+public class SendingException extends AxisFault {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6250791562500752579L;
+
+ public SendingException(Throwable cause) {
+ super(cause);
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/SendingStrategy.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/SendingStrategy.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/SendingStrategy.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/SendingStrategy.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,8 @@
+package wsmg.messenger.strategy;
+
+
+public interface SendingStrategy {
+ public void start();
+
+ public void shutdown();
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/FixedParallelSender.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/FixedParallelSender.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/FixedParallelSender.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/FixedParallelSender.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,234 @@
+package wsmg.messenger.strategy.impl;
+
+import java.io.StringReader;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.LinkedBlockingQueue;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.ConsumerInfo;
+import wsmg.commons.CommonRoutines;
+import wsmg.commons.OutGoingMessage;
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.config.ConfigurationManager;
+import wsmg.config.WSMGParameter;
+import wsmg.messenger.ConsumerUrlManager;
+import wsmg.messenger.SenderUtils;
+import wsmg.messenger.strategy.SendingStrategy;
+
+public class FixedParallelSender extends Thread implements SendingStrategy {
+
+ private Logger log = Logger.getLogger(FixedParallelSender.class);
+
+ private ConcurrentHashMap<String, ConsumerHandler> activeConsumerHanders = new ConcurrentHashMap<String, ConsumerHandler>();
+
+ private ThreadCrew threadCrew = null;
+
+ private ConsumerUrlManager urlManager = null;
+ private ConfigurationManager configManager = null;
+
+ private long consumerHandlerIdCounter;
+
+ private boolean stopFlag = false;
+
+ public FixedParallelSender(ConfigurationManager config,
+ ConsumerUrlManager urlMan) {
+
+ int poolSize = config.getConfig(
+ WsmgCommonConstants.CONFIG_SENDING_THREAD_POOL_SIZE,
+ WsmgCommonConstants.DEFAULT_SENDING_THREAD_POOL_SIZE);
+
+ threadCrew = new ThreadCrew(poolSize);
+ urlManager = urlMan;
+ configManager = config;
+ }
+
+ public void shutdown() {
+ stopFlag = true;
+ }
+
+ public void run() {
+ int dequeuedMessageCounter = 0;
+
+ while (!stopFlag) {
+
+ try {
+
+ if (log.isDebugEnabled())
+ log.debug("before dequeue - delivery thread");
+
+ OutGoingMessage outGoingMessage = (OutGoingMessage) WSMGParameter.OUT_GOING_QUEUE
+ .blockingDequeue();
+
+ if (WSMGParameter.showTrackId)
+ log.debug(outGoingMessage.getAdditionalMessageContent()
+ .getTrackId()
+ + ": dequeued from outgoing queue");
+
+ distributeOverConsumerQueues(outGoingMessage);
+
+ } catch (Exception e) {
+
+ log.fatal("Unexpected_exception:", e);
+ }
+
+ dequeuedMessageCounter++;
+ }
+
+ threadCrew.stop();
+
+ }
+
+ public void distributeOverConsumerQueues(OutGoingMessage message) {
+ List<ConsumerInfo> consumerInfoList = message.getConsumerInfoList();
+
+ for (ConsumerInfo consumer : consumerInfoList) {
+
+ sendToConsumerHandler(consumer, message);
+
+ }
+
+ }
+
+ private ConsumerHandler sendToConsumerHandler(ConsumerInfo consumer,
+ OutGoingMessage message) {
+
+ String consumerUrl = consumer.getConsumerEprStr();
+
+ LightweightMsg lwm = new LightweightMsg(consumer, message
+ .getTextMessage(), message.getAdditionalMessageContent());
+
+ ConsumerHandler handler = activeConsumerHanders.get(consumerUrl);
+
+ if (handler == null) {
+ handler = new ConsumerHandler(getNextConsumerHandlerId(),
+ consumerUrl, configManager, urlManager);
+ activeConsumerHanders.put(consumerUrl, handler);
+ handler.submitMessage(lwm); // import to submit before execute.
+ threadCrew.submitTask(handler);
+ // (to remove a possible race
+ // condition)
+ } else {
+ handler.submitMessage(lwm);
+ }
+
+ return handler;
+
+ }
+
+ private long getNextConsumerHandlerId() {
+ return ++consumerHandlerIdCounter;
+ }
+
+ class ConsumerHandler implements RunnableEx {
+
+ LinkedBlockingQueue<LightweightMsg> queue = new LinkedBlockingQueue<LightweightMsg>();
+
+ final long id;
+ int batchSize;
+
+ ThreadLocal<SenderUtils> threadlocalSender = new ThreadLocal<SenderUtils>();
+
+ // SenderUtils sender = null;
+ String consumerUrl;
+
+ ConfigurationManager configMan;
+ ConsumerUrlManager consumerURLManager;
+
+ public ConsumerHandler(long handlerId, String url,
+ ConfigurationManager config, ConsumerUrlManager urlMan) {
+
+ configMan = config;
+ consumerURLManager = urlMan;
+ // sender = new SenderUtils(urlMan, config, true);
+ id = handlerId;
+ consumerUrl = url;
+
+ batchSize = config.getConfig(
+ WsmgCommonConstants.CONFIG_SENDING_BATCH_SIZE,
+ WsmgCommonConstants.DEFAULT_SENDING_BATCH_SIZE);
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getConsumerUrl() {
+ return consumerUrl;
+ }
+
+ private SenderUtils getSender() {
+
+ SenderUtils s = threadlocalSender.get();
+
+ if (s == null) {
+ s = new SenderUtils(consumerURLManager, configMan);
+ threadlocalSender.set(s);
+ }
+
+ return s;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+
+ if (o instanceof ConsumerHandler) {
+ ConsumerHandler h = (ConsumerHandler) o;
+ return h.getId() == id
+ && h.getConsumerUrl().equals(this.getConsumerUrl());
+ }
+
+ return false;
+ }
+
+ public void submitMessage(LightweightMsg msg) {
+ queue.add(msg);
+ }
+
+ public void run() {
+
+ if (log.isDebugEnabled())
+ log.debug(String.format(
+ "starting consumer handler: id :%d, url : %s", getId(),
+ getConsumerUrl()));
+
+ LinkedList<LightweightMsg> localList = new LinkedList<LightweightMsg>();
+
+ queue.drainTo(localList, batchSize);
+
+ send(localList);
+ localList.clear();
+
+ if (log.isDebugEnabled())
+ log.debug(String.format("calling on completion from : %d,",
+ getId()));
+
+ }
+
+ private void send(LinkedList<LightweightMsg> list) {
+
+ SenderUtils s = getSender();
+
+ while (!list.isEmpty()) {
+
+ LightweightMsg m = list.removeFirst();
+
+ try {
+ OMElement messgae2Send = CommonRoutines
+ .reader2OMElement(new StringReader(m.getPayLoad()));
+
+ s.send(m.getConsumerInfo(), messgae2Send, m.getHeader());
+
+ } catch (Exception e) {
+ log.fatal(e);
+ }
+
+ }
+
+ }
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/LightweightMsg.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/LightweightMsg.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/LightweightMsg.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/LightweightMsg.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,38 @@
+/**
+ *
+ */
+package wsmg.messenger.strategy.impl;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+
+class LightweightMsg {
+ private ConsumerInfo consumerInfo;
+ private String payload;
+ private AdditionalMessageContent header;
+
+ public LightweightMsg(ConsumerInfo c, String pld,
+ AdditionalMessageContent h) {
+ consumerInfo = c;
+ payload = pld;
+ header = h;
+ }
+
+ public String getPayLoad() {
+ return payload;
+ }
+
+ public ConsumerInfo getConsumerInfo() {
+ return consumerInfo;
+ }
+
+ public AdditionalMessageContent getHeader() {
+ return header;
+ }
+
+ public String toString() {
+ return String.format("header: %s, consumer: %s, pld: %s", header,
+ consumerInfo.getConsumerEprStr(), payload);
+ }
+
+}
\ No newline at end of file
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ParallelSender.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ParallelSender.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ParallelSender.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ParallelSender.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,291 @@
+package wsmg.messenger.strategy.impl;
+
+import java.io.StringReader;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.ConsumerInfo;
+import wsmg.commons.CommonRoutines;
+import wsmg.commons.OutGoingMessage;
+import wsmg.config.ConfigurationManager;
+import wsmg.config.WSMGParameter;
+import wsmg.messenger.ConsumerUrlManager;
+import wsmg.messenger.SenderUtils;
+import wsmg.messenger.strategy.SendingStrategy;
+
+public class ParallelSender extends Thread implements SendingStrategy {
+
+ private Logger log = Logger.getLogger(ParallelSender.class);
+
+ private ConcurrentHashMap<String, ConsumerHandler> activeConsumerHanders = new ConcurrentHashMap<String, ConsumerHandler>();
+
+ private final ExecutorService threadPool;
+ private long consumerHandlerIdCounter = 0L;
+ private boolean stopFlag = false;
+
+ private ConsumerUrlManager urlManager = null;
+ private ConfigurationManager configManager = null;
+
+ private ConsumerHandlerCompletionCallback consumerCallback = new ConsumerHandlerCompletionCallback() {
+
+ public void onCompletion(ConsumerHandler h) {
+
+ if (!activeConsumerHanders.remove(h.getConsumerUrl(), h)) {
+
+ if (log.isDebugEnabled())
+ log.debug(String.format("inactive consumer handler "
+ + "is already removed: id %d, url : %s", h.getId(),
+ h.getConsumerUrl()));
+ }
+
+ }
+ };
+
+ public ParallelSender(ConfigurationManager config, ConsumerUrlManager urlMan) {
+ urlManager = urlMan;
+ configManager = config;
+
+ threadPool = Executors.newCachedThreadPool();
+
+ }
+
+ public void shutdown() {
+ stopFlag = true;
+ }
+
+ public void run() {
+ int dequeuedMessageCounter = 0;
+
+ while (!stopFlag) {
+
+ try {
+
+ if (log.isDebugEnabled())
+ log.debug("before dequeue - delivery thread");
+
+ OutGoingMessage outGoingMessage = (OutGoingMessage) WSMGParameter.OUT_GOING_QUEUE
+ .blockingDequeue();
+
+ if (WSMGParameter.showTrackId)
+ log.debug(outGoingMessage.getAdditionalMessageContent()
+ .getTrackId()
+ + ": dequeued from outgoing queue");
+
+ distributeOverConsumerQueues(outGoingMessage);
+
+ } catch (Exception e) {
+
+ log.fatal("Unexpected_exception:", e);
+ }
+
+ dequeuedMessageCounter++;
+ }
+
+ threadPool.shutdown();
+
+ }
+
+ public void distributeOverConsumerQueues(OutGoingMessage message) {
+ List<ConsumerInfo> consumerInfoList = message.getConsumerInfoList();
+
+ for (ConsumerInfo consumer : consumerInfoList) {
+
+ sendToConsumerHandler(consumer, message);
+
+ }
+
+ }
+
+ private ConsumerHandler sendToConsumerHandler(ConsumerInfo consumer,
+ OutGoingMessage message) {
+
+ String consumerUrl = consumer.getConsumerEprStr();
+
+ LightweightMsg lwm = new LightweightMsg(consumer, message
+ .getTextMessage(), message.getAdditionalMessageContent());
+
+ ConsumerHandler handler = activeConsumerHanders.get(consumerUrl);
+
+ if (handler == null || (!handler.isActive())) {
+ handler = new ConsumerHandler(getNextConsumerHandlerId(),
+ consumerUrl, consumerCallback, configManager, urlManager);
+ activeConsumerHanders.put(consumerUrl, handler);
+ handler.submitMessage(lwm); // import to submit before execute.
+ // (to remove a possible race
+ // condition)
+ threadPool.execute(handler);
+ } else {
+ handler.submitMessage(lwm);
+ }
+
+ return handler;
+ }
+
+ private long getNextConsumerHandlerId() {
+ return ++consumerHandlerIdCounter;
+ }
+
+ interface ConsumerHandlerCompletionCallback {
+
+ public void onCompletion(ConsumerHandler h);
+
+ }
+
+ class ConsumerHandler implements Runnable {
+
+ LinkedBlockingQueue<LightweightMsg> queue = new LinkedBlockingQueue<LightweightMsg>();
+
+ ReadWriteLock activeLock = new ReentrantReadWriteLock();
+
+ final long id;
+ final int MAX_UNSUCCESSFULL_DRAINS = 3;
+ final int SLEEP_TIME_SECONDS = 1;
+ int numberOfUnsuccessfullDrainAttempts = 0;
+
+ boolean active = true;
+
+ ConsumerHandlerCompletionCallback callback = null;
+ SenderUtils sender = null;
+ String consumerUrl;
+
+ public ConsumerHandler(long handlerId, String url,
+ ConsumerHandlerCompletionCallback c,
+ ConfigurationManager config, ConsumerUrlManager urlMan) {
+ callback = c;
+ sender = new SenderUtils(urlMan, config);
+ id = handlerId;
+ consumerUrl = url;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public String getConsumerUrl() {
+ return consumerUrl;
+ }
+
+ public boolean isActive() {
+
+ boolean ret = false;
+
+ activeLock.readLock().lock();
+ try {
+ ret = active;
+ } finally {
+ activeLock.readLock().unlock();
+ }
+
+ return ret;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+
+ if (o instanceof ConsumerHandler) {
+ ConsumerHandler h = (ConsumerHandler) o;
+ return h.getId() == id
+ && h.getConsumerUrl().equals(this.getConsumerUrl());
+ }
+
+ return false;
+ }
+
+ public void submitMessage(LightweightMsg msg) {
+ queue.add(msg);
+ }
+
+ public void run() {
+
+ if (log.isDebugEnabled())
+ log.debug(String.format(
+ "starting consumer handler: id :%d, url : %s", getId(),
+ getConsumerUrl()));
+
+ LinkedList<LightweightMsg> localList = new LinkedList<LightweightMsg>();
+
+ while (active) {
+
+ int drainedMsgs = 0;
+ try {
+ activeLock.writeLock().lock();
+
+ drainedMsgs = queue.drainTo(localList);
+
+ if (drainedMsgs <= 0) {
+ numberOfUnsuccessfullDrainAttempts++;
+ } else {
+ numberOfUnsuccessfullDrainAttempts = 0;
+ }
+
+ if (numberOfUnsuccessfullDrainAttempts >= MAX_UNSUCCESSFULL_DRAINS) {
+
+ log.debug(String.format("inactivating, %d", getId()));
+
+ active = false;
+ numberOfUnsuccessfullDrainAttempts = 0;
+ }
+
+ } finally {
+ activeLock.writeLock().unlock();
+ }
+
+ send(localList);
+ localList.clear();
+
+ if (numberOfUnsuccessfullDrainAttempts > 0) {
+ waitForMessages();
+ }
+
+ }
+
+ if (log.isDebugEnabled())
+ log.debug(String.format("calling on completion from : %d,",
+ getId()));
+
+ callback.onCompletion(this);
+
+ }
+
+ private void send(LinkedList<LightweightMsg> list) {
+
+ while (!list.isEmpty()) {
+
+ LightweightMsg m = list.removeFirst();
+
+ try {
+ OMElement messgae2Send = CommonRoutines
+ .reader2OMElement(new StringReader(m.getPayLoad()));
+
+ sender.send(m.getConsumerInfo(), messgae2Send, m
+ .getHeader());
+
+ } catch (Exception e) {
+ log.fatal(e);
+ }
+
+ }
+
+ }
+
+ private void waitForMessages() {
+ try {
+
+ TimeUnit.SECONDS.sleep(SLEEP_TIME_SECONDS);
+ log.debug("finished - waiting for messages");
+ } catch (InterruptedException e) {
+ log.error("interrupted while waiting for messages", e);
+ }
+ }
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/SerialSender.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/SerialSender.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/SerialSender.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/SerialSender.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,99 @@
+package wsmg.messenger.strategy.impl;
+
+import java.io.StringReader;
+import java.util.List;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+import wsmg.commons.CommonRoutines;
+import wsmg.commons.OutGoingMessage;
+import wsmg.config.ConfigurationManager;
+import wsmg.config.WSMGParameter;
+import wsmg.messenger.ConsumerUrlManager;
+import wsmg.messenger.SenderUtils;
+import wsmg.messenger.strategy.SendingStrategy;
+
+public class SerialSender extends Thread implements SendingStrategy {
+
+ Logger log = Logger.getLogger(SerialSender.class);
+
+ private boolean stopFlag = false;
+
+ SenderUtils sender;
+
+ public SerialSender(ConfigurationManager config, ConsumerUrlManager urlman) {
+ sender = new SenderUtils(urlman, config);
+ }
+
+ public void shutdown() {
+ stopFlag = true;
+ log.info("delivery thread termination notificaiton recieved");
+ }
+
+ public void run() {
+
+ log.debug("run - delivery thread");
+
+
+ while (!stopFlag) {
+
+ try {
+
+ OutGoingMessage outGoingMessage = (OutGoingMessage) WSMGParameter.OUT_GOING_QUEUE
+ .blockingDequeue();
+
+ if (WSMGParameter.showTrackId)
+ log.debug(outGoingMessage.getAdditionalMessageContent()
+ .getTrackId()
+ + ": dequeued from outgoing queue");
+
+ sendNotification(outGoingMessage);
+
+ } catch (Exception e) {
+
+ log.fatal("Unexpected_exception:", e);
+ }
+ }
+ }
+
+ public synchronized void sendNotification(OutGoingMessage outGoingMessage) {
+
+ if (outGoingMessage == null) {
+ log.error("got a null outgoing message");
+ return;
+ }
+ String messageString = outGoingMessage.getTextMessage();
+
+ List<ConsumerInfo> consumerInfoList = outGoingMessage
+ .getConsumerInfoList();
+ AdditionalMessageContent soapHeader = outGoingMessage
+ .getAdditionalMessageContent();
+ deliverMessage(consumerInfoList, messageString, soapHeader);
+ }
+
+ private void deliverMessage(List<ConsumerInfo> consumerInfoList,
+ String messageString,
+ AdditionalMessageContent additionalMessageContent) {
+
+ try {
+ OMElement messgae2Send = CommonRoutines
+ .reader2OMElement(new StringReader(messageString));
+
+ for (ConsumerInfo obj : consumerInfoList) {
+
+ sender.send(obj, messgae2Send,
+ additionalMessageContent);
+
+ }
+
+ } catch (XMLStreamException e) {
+ log.fatal(e);
+ }
+
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ThreadCrew.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ThreadCrew.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ThreadCrew.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/messenger/strategy/impl/ThreadCrew.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,164 @@
+package wsmg.messenger.strategy.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.log4j.Logger;
+
+interface TaskCompletionCallback {
+ void onCompletion(ThreadCrew.WSMGRunnable r);
+}
+
+interface RunnableEx{
+ public void run();
+
+}
+
+
+public class ThreadCrew implements TaskCompletionCallback {
+
+ int nextIndex = 0;
+
+ Logger log = Logger.getLogger(ThreadCrew.class);
+
+ List<WSMGRunnable> wsmgRunnables = new ArrayList<WSMGRunnable>();
+
+ ExecutorService service;
+
+ public void onCompletion(WSMGRunnable r) {
+
+ synchronized (wsmgRunnables) {
+ log.error("error occued ..." );
+ List<RunnableEx> jobList = r.getJobList();
+ wsmgRunnables.remove(r);
+ WSMGRunnable newR = new WSMGRunnable(this, jobList);
+ wsmgRunnables.add(newR);
+ service.submit(newR);
+ }
+
+ }
+
+ public ThreadCrew(int poolSize) {
+
+ log.debug("pool size=" + poolSize);
+
+ service = Executors.newFixedThreadPool(poolSize);
+
+ for (int i = 0; i < poolSize; i++) {
+
+ WSMGRunnable r = new WSMGRunnable(this);
+ wsmgRunnables.add(r);
+ service.submit(r);
+ }
+
+
+ }
+
+ public void submitTask(RunnableEx task) {
+
+ WSMGRunnable r = null;
+
+ synchronized (wsmgRunnables) {
+
+ nextIndex++;
+ if (nextIndex >= wsmgRunnables.size())
+ nextIndex = 0;
+
+ r = wsmgRunnables.get(nextIndex);
+
+ }
+
+ r.submit(task);
+ }
+
+ public void stop() {
+
+ for (WSMGRunnable r : wsmgRunnables) {
+ r.shutdown();
+ }
+
+ service.shutdown();
+ }
+
+ class WSMGRunnable implements Runnable {
+
+ List<RunnableEx> jobs = new ArrayList<RunnableEx>();
+ TaskCompletionCallback completionCallback;
+ boolean runFlag = true;
+
+ public WSMGRunnable(TaskCompletionCallback c) {
+
+ this(c, new ArrayList<RunnableEx>());
+ System.out.println("wsmg created new");
+ }
+
+ public WSMGRunnable(TaskCompletionCallback c, List<RunnableEx> jl) {
+ completionCallback = c;
+ jobs = jl;
+ }
+
+ public void shutdown() {
+ runFlag = false;
+ }
+
+ public void run() {
+
+ try {
+
+ int i = 0;
+
+ while (runFlag) {
+
+ if (jobs.isEmpty()) {
+ waitForJobs();
+ continue;
+ }
+
+ RunnableEx runnable = jobs.get(i);
+ runnable.run();
+
+ i++;
+ if (i >= jobs.size()) {
+ i = 0;
+ }
+
+
+ }
+
+ } finally {
+
+ completionCallback.onCompletion(this);
+ }
+
+ }
+
+ public void submit(RunnableEx w) {
+
+ synchronized (jobs) {
+ jobs.add(w);
+ }
+
+ }
+
+ public List<RunnableEx> getJobList() {
+ return jobs;
+ }
+
+ final int SLEEP_TIME_SECONDS = 1;
+
+ private void waitForJobs() {
+ try {
+
+ TimeUnit.SECONDS.sleep(SLEEP_TIME_SECONDS);
+ if (log.isDebugEnabled())
+ log.debug("finished - waiting for messages");
+ } catch (InterruptedException e) {
+ log.error("interrupted while waiting for messages", e);
+ }
+ }
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/OutGoingMessage.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/OutGoingMessage.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/OutGoingMessage.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/OutGoingMessage.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,123 @@
+/*
+ * 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.processors;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+import wsmg.broker.AdditionalMessageContent;
+import wsmg.broker.ConsumerInfo;
+
+public class OutGoingMessage implements Serializable {
+ /**
+ *
+ */
+ private static final long serialVersionUID = -6999667921413261492L;
+
+ String textMessage;
+
+ AdditionalMessageContent additionalMessageContent;
+
+ List<ConsumerInfo> consumerInfoList = null;
+
+ // ConsumerInfo consumerInfo=null;
+
+ /**
+ *
+ */
+ public OutGoingMessage() {
+ // super();
+ // TODO Auto-generated constructor stub
+ // consumerInfo=new ConsumerInfo();
+ }
+
+ /**
+ * @param textMessage
+ * @param additionalMessageContent
+ * @param consumerInfoList
+ */
+ public OutGoingMessage(String textMessage,
+ AdditionalMessageContent additionalMessageContent, List<ConsumerInfo> consumerInfoList) {
+ super();
+ // TODO Auto-generated constructor stub
+ this.textMessage = textMessage;
+ this.additionalMessageContent = additionalMessageContent;
+ this.consumerInfoList = consumerInfoList;
+ }
+
+ /**
+ * @param consumerInfo
+ * The consumerInfo to set.
+ */
+ public void addConsumerInfo(ConsumerInfo consumerInfo) {
+ // this.consumerInfo = consumerInfo;
+ if (consumerInfoList == null) {
+ consumerInfoList = new ArrayList<ConsumerInfo>();
+ }
+ consumerInfoList.add(consumerInfo);
+ }
+
+ /**
+ * @return Returns the textMessage.
+ */
+ public String getTextMessage() {
+ return textMessage;
+ }
+
+ /**
+ * @param textMessage
+ * The textMessage to set.
+ */
+ public void setTextMessage(String textMessage) {
+ this.textMessage = textMessage;
+ }
+
+ /**
+ * @return Returns the consumerInfoList.
+ */
+ public List<ConsumerInfo> getConsumerInfoList() {
+ return consumerInfoList;
+ }
+
+ /**
+ * @param consumerInfoList
+ * The consumerInfoList to set.
+ */
+ public void setConsumerInfoList(List<ConsumerInfo> consumerInfoList) {
+ this.consumerInfoList = consumerInfoList;
+ }
+
+ /**
+ * @return Returns the soapHeader.
+ */
+ public AdditionalMessageContent getAdditionalMessageContent() {
+ return additionalMessageContent;
+ }
+
+ /**
+ * @param soapHeader
+ * The soapHeader to set.
+ */
+ public void setAdditionalMessageContent(AdditionalMessageContent soapHeader) {
+ this.additionalMessageContent = soapHeader;
+ }
+
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/PublisherRegistrationManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/PublisherRegistrationManager.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/PublisherRegistrationManager.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/PublisherRegistrationManager.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,80 @@
+/*
+ * 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.processors;
+
+import java.net.URI;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.context.ProcessingContext;
+import wsmg.commons.WsmgNameSpaceConstants;
+
+
+public class PublisherRegistrationManager {
+ int counter = 1;
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ URI serviceLocation = null;
+ static org.apache.log4j.Logger logger = Logger
+ .getLogger(PublisherRegistrationManager.class);
+
+ public PublisherRegistrationManager(URI serviceLocation) {
+ this.serviceLocation = serviceLocation;
+ }
+
+ public void registerPublisher(ProcessingContext ctx) {
+
+ OMElement eprEl = ctx.getSoapBody().getFirstChildWithName(
+ new QName(WsmgNameSpaceConstants.WSBR_NS.getNamespaceURI(),
+ "PublisherReference"));
+ EndpointReference publisherRef = new EndpointReference(eprEl.getText());
+ // SubscriptionState state = new SubscriptionState(publisherRef);
+ // String key = "sub"+(counter++)+"@"+PREFIX;
+ // subscriptions.put(key, state);
+ EndpointReference publisherRegistrationRef = new EndpointReference(
+ serviceLocation.toASCIIString());
+ publisherRegistrationRef.addReferenceParameter(new QName(
+ WsmgNameSpaceConstants.WIDGET_NS.getNamespaceURI(),
+ WsmgNameSpaceConstants.RESOURCE_ID), "pub" + (counter++));
+
+ OMElement publisherRegistrationReferenceOMElement;
+ try {
+ publisherRegistrationReferenceOMElement = EndpointReferenceHelper
+ .toOM(factory, publisherRegistrationRef, new QName(
+ WsmgNameSpaceConstants.WSBR_NS.getNamespaceURI(),
+ "SubscriptionManager"),
+ WsmgNameSpaceConstants.WSA_NS.getNamespaceURI());
+
+ ctx.getRespMessage().addChild(
+ publisherRegistrationReferenceOMElement);
+ } catch (AxisFault e) {
+ // TODO add with throws clause
+ logger.fatal("axis fault found at publisher registrationgmanager",
+ e);
+ e.printStackTrace();
+ }
+ }
+}
Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/ReceivedMessage.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/ReceivedMessage.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/ReceivedMessage.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/broker/src/main/java/wsmg/processors/ReceivedMessage.java Sun Jul 3 00:29:24 2011
@@ -0,0 +1,117 @@
+/*
+ * 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.processors;
+
+import java.io.Serializable;
+
+import wsmg.broker.AdditionalMessageContent;
+
+public class ReceivedMessage implements Serializable {
+
+ private static final long serialVersionUID = 7908767667077753895L;
+
+ String topicLocalString = null;
+
+ // String soapHeader = null;
+ AdditionalMessageContent soapHeader;
+
+ String notificationMessage = null;
+
+ String wsntMessageConverterClassName;
+
+ /**
+ * @param topicLocalString
+ * @param producerReference
+ * @param notificationMessageEl
+ * @param wsntMessageConverterClassName
+ */
+ public ReceivedMessage(String topicLocalString,
+ AdditionalMessageContent soapHeader, String notificationMessageEl,
+ String wsntMessageConverterClassName) {
+ super();
+ // TODO Auto-generated constructor stub
+ this.topicLocalString = topicLocalString;
+ this.soapHeader = soapHeader;
+ this.notificationMessage = notificationMessageEl;
+ this.wsntMessageConverterClassName = wsntMessageConverterClassName;
+ }
+
+ /**
+ * @return Returns the soapHeader.
+ */
+ public AdditionalMessageContent getSoapHeader() {
+ return soapHeader;
+ }
+
+ /**
+ * @param soapHeader
+ * The soapHeader to set.
+ */
+ public void setSoapHeader(AdditionalMessageContent soapHeader) {
+ this.soapHeader = soapHeader;
+ }
+
+ /**
+ * @return Returns the notificationMessage.
+ */
+ public String getNotificationMessage() {
+ return notificationMessage;
+ }
+
+ /**
+ * @param notificationMessage
+ * The notificationMessage to set.
+ */
+ public void setNotificationMessage(String notificationMessage) {
+ this.notificationMessage = notificationMessage;
+ }
+
+ /**
+ * @return Returns the topicLocalString.
+ */
+ public String getTopicLocalString() {
+ return topicLocalString;
+ }
+
+ /**
+ * @param topicLocalString
+ * The topicLocalString to set.
+ */
+ public void setTopicLocalString(String topicLocalString) {
+ this.topicLocalString = topicLocalString;
+ }
+
+ /**
+ * @return Returns the wsntMessageConverterClassName.
+ */
+ public String getWsntMessageConverterClassName() {
+ return wsntMessageConverterClassName;
+ }
+
+ /**
+ * @param wsntMessageConverterClassName
+ * The wsntMessageConverterClassName to set.
+ */
+ public void setWsntMessageConverterClassName(
+ String wsntMessageConverterClassName) {
+ this.wsntMessageConverterClassName = wsntMessageConverterClassName;
+ }
+
+}