You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/01/27 16:26:55 UTC
[01/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Repository: airavata
Updated Branches:
refs/heads/master 0b70b6936 -> cab157157
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
deleted file mode 100644
index 29fdbdf..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/TestUtilServer.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.BrokerServiceLifeCycle;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.engine.ServiceLifeCycle;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.nio.channels.ServerSocketChannel;
-
-public class TestUtilServer {
- private static int count = 0;
-
- private static SimpleHTTPServer receiver;
-
- public static int TESTING_PORT = 5555;
-
- public static final String FAILURE_MESSAGE = "Intentional Failure";
-
- public static synchronized void deployService(AxisService service) throws AxisFault {
- receiver.getConfigurationContext().getAxisConfiguration().addService(service);
- }
-
- public static synchronized void unDeployService(QName service) throws AxisFault {
- receiver.getConfigurationContext().getAxisConfiguration().removeService(service.getLocalPart());
- }
-
- public static synchronized void unDeployClientService() throws AxisFault {
- if (receiver.getConfigurationContext().getAxisConfiguration() != null) {
- receiver.getConfigurationContext().getAxisConfiguration().removeService("AnonymousService");
- }
- }
-
- public static synchronized void start(String repository, String axis2xml) throws Exception {
- if (count == 0) {
- ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
- TESTING_PORT = getAvailablePort();
- receiver = new SimpleHTTPServer(er, TESTING_PORT);
-
- try {
- receiver.start();
- System.out.print("Server started on port " + TESTING_PORT + ".....");
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
-
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e1) {
- throw new AxisFault("Thread interuptted", e1);
- }
- startBroker();
- }
- count++;
- }
-
- public static void startBroker() throws Exception {
-
- ServiceLifeCycle brokerLifeCycle = new BrokerServiceLifeCycle();
-
- final String configFileParam = "configuration.file.name";
- final String configFileValue = "airavata-server.properties";
-
- AxisService notificationService = getNotificationService();
- notificationService.addParameter(configFileParam, configFileValue);
- notificationService.setServiceLifeCycle(brokerLifeCycle);
- TestUtilServer.deployService(notificationService);
- brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), notificationService);
-
- AxisService eventingService = getEventingService();
- eventingService.addParameter(configFileParam, configFileValue);
- eventingService.setServiceLifeCycle(brokerLifeCycle);
- TestUtilServer.deployService(eventingService);
- brokerLifeCycle.startUp(TestUtilServer.getConfigurationContext(), eventingService);
-
- }
-
- public static AxisService getEventingService() {
-
- AxisService eventingService = new AxisService("EventingService");
-
- createOperation(eventingService, "renew",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew",
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse");
- createOperation(eventingService, "getStatus",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus",
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse");
-
- createOperation(eventingService, "subscriptionEnd",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd", null);
-
- createOperation(eventingService, "subscribe",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe",
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse");
- createOperation(eventingService, "unsubscribe",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver(),
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe",
- "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse");
- createOperation(eventingService, "publish",
- new org.apache.airavata.wsmg.broker.wseventing.WSEventingPublishMsgReceiver(),
- "http://org.apache.airavata/WseNotification", null);
-
- return eventingService;
- }
-
- public static AxisService getNotificationService() {
-
- AxisService notificationService = new AxisService("NotificationService");
-
- createOperation(notificationService, "notify",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/Notify",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/NotifyResponse");
-
- createOperation(notificationService, "subscribe",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequest",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequestResponse");
-
- createOperation(notificationService, "getCurrentMessage",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageRequest",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageResponse");
-
- createOperation(notificationService, "pauseSubscription",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubsriptionRequest",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubscriptionResponse");
-
- createOperation(notificationService, "resumeSubscription",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubsriptionRequest",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubscriptionResponse");
-
- createOperation(notificationService, "unsubscribe",
- new org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver(),
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubsribeRequest",
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubscribeResponse");
-
- return notificationService;
-
- }
-
- public static void createOperation(AxisService axisService, String name, MessageReceiver messageReceiver,
- String inputAction, String outputAction) {
- InOutAxisOperation operation1 = new InOutAxisOperation(new QName(name));
- operation1.setMessageReceiver(messageReceiver);
- operation1.setOutputAction(outputAction);
- axisService.addOperation(operation1);
- if (inputAction != null) {
- axisService.mapActionToOperation(inputAction, operation1);
- }
- }
-
- public static ConfigurationContext getNewConfigurationContext(String repository, String axis2xml) throws Exception {
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, axis2xml);
- }
-
- public static synchronized void stop() throws AxisFault {
- if (count == 1) {
- receiver.stop();
- while (receiver.isRunning()) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- // nothing to do here
- }
- }
- count = 0;
- // tp.doStop();
- System.out.print("Server stopped .....");
- } else {
- count--;
- }
- receiver.getConfigurationContext().terminate();
- }
-
- public static ConfigurationContext getConfigurationContext() {
- return receiver.getConfigurationContext();
- }
-
- public static int getAvailablePort(){
- ServerSocket serverSocket = null;
- try {
- serverSocket = new ServerSocket(0);
- serverSocket.close();
- } catch (IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- return serverSocket.getLocalPort();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties b/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
deleted file mode 100644
index 33b6161..0000000
--- a/modules/ws-messenger/messagebroker/src/test/resources/unit_tests.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#
-#
-consumer.port=2222
-consumer.location=http://localhost:2222
-topic.simple=MySimpleTestTopic
-topic.xpath=MyXpathTextTopic
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/pom.xml b/modules/ws-messenger/pom.xml
deleted file mode 100644
index d994c89..0000000
--- a/modules/ws-messenger/pom.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata</artifactId>
- <version>0.15-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-ws-messenger</artifactId>
- <packaging>pom</packaging>
- <name>Airavata WS Messenger</name>
- <url>http://airavata.apache.org/</url>
-
- <dependencyManagement>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.7</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-api</artifactId>
- <version>1.2.8</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.ws.commons.axiom</groupId>
- <artifactId>axiom-impl</artifactId>
- <type>jar</type>
- <version>1.2.8</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2</artifactId>
- <version>${axis2.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>${mysql.connector.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-local</artifactId>
- <version>${axis2.version}</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- <version>${axis2.version}</version>
- <scope>compile</scope>
- </dependency>
-
- </dependencies>
- </dependencyManagement>
-
- <profiles>
- <profile>
- <id>profile-messenger-client</id>
- <activation>
- <property>
- <name>module</name>
- <value>client</value>
- </property>
- </activation>
- <modules>
- <module>commons</module>
- <module>client</module>
- </modules>
- </profile>
- <profile>
- <id>profile-messagebox</id>
- <activation>
- <property>
- <name>module</name>
- <value>messagebox</value>
- </property>
- </activation>
- <modules>
- <module>commons</module>
- <module>messagebox</module>
- </modules>
- </profile>
- <profile>
- <id>profile-messagebroker</id>
- <activation>
- <property>
- <name>module</name>
- <value>messagebroker</value>
- </property>
- </activation>
- <modules>
- <module>commons</module>
- <module>messagebroker</module>
- </modules>
- </profile>
- <profile>
- <id>profile-messenger</id>
- <activation>
- <property>
- <name>module</name>
- <value>messenger</value>
- </property>
- </activation>
- <modules>
- <module>messenger</module>
- </modules>
- </profile>
- <profile>
- <id>default</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <modules>
- <module>commons</module>
- <module>client</module>
- <module>message-monitor</module>
- </modules>
- </profile>
- </profiles>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <slf4j.version>1.6.1</slf4j.version>
- <release.version>1.1.1</release.version>
- <axis2.version>1.5.1</axis2.version>
- <derby.version>10.7.1.1</derby.version>
- </properties>
-
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/NotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/NotificationSender.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/NotificationSender.java
index f478e18..9b26fee 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/NotificationSender.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/NotificationSender.java
@@ -1,289 +1,289 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.jython.lib;
-
-import java.net.URI;
-import java.util.Properties;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.WorkflowNotifier;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.axis2.addressing.EndpointReference;
-import org.python.core.PyObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-public class NotificationSender implements WorkflowNotifiable {
-
- protected static final Logger logger = LoggerFactory.getLogger(NotificationSender.class);
-
- protected WorkflowNotifier notifier;
-
- protected String brokerURL;
-
- protected String topic;
-
- protected URI workflowID;
-
- protected InvocationEntity initiator;
-
- protected InvocationEntity receiver;
-
- protected InvocationContext invocationContext;
-
- protected EndpointReference eventSink;
-
- protected WorkflowTrackingContext context;
-
- /**
- * Constructs a NotificationSender.
- *
- * @param brokerURL
- * @param topic
- */
- public NotificationSender(URI brokerURL, String topic) {
- this(brokerURL.toString(), topic);
- }
-
- /**
- * Creates a NotificationSender.
- *
- * @param brokerURL
- * The location of notification brokerUrl.
- * @param topic
- * The notification topic.
- */
- public NotificationSender(String brokerURL, String topic) {
- logger.debug("brokerURL:" + brokerURL + "topic:" + topic);
- this.topic = topic;
- this.brokerURL = brokerURL;
- this.workflowID = URI.create(StringUtil.convertToJavaIdentifier(this.topic));
- this.eventSink = new EndpointReference(this.brokerURL);
- Properties props = new Properties();
-
- this.notifier = NotifierFactory.createNotifier();
- URI initiatorWorkflowID = null;
- URI initiatorServiceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
- String initiatorWorkflowNodeID = null;
- Integer initiatorWorkflowTimeStep = null;
- this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID, initiatorServiceID,
- initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
- this.context.setTopic(topic);
- this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
- initiatorWorkflowTimeStep);
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = this.workflowID;
- String receiverWorkflowNodeID = null;
- Integer receiverWorkflowTimeStep = null;
- this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- receiverWorkflowTimeStep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#getEventSink()
- */
- @Override
- public EndpointReference getEventSink() {
- return this.eventSink;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowStarted(org.python.core.PyObject[],
- * java.lang.String[])
- */
- @Override
- public void workflowStarted(PyObject[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowStarted(java.lang.Object[],
- * java.lang.String[])
- */
- @Override
- public void workflowStarted(Object[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFinished(java.lang.Object[],
- * java.lang.String[])
- */
- @Override
- public void workflowFinished(Object[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.notifier.sendingResult(context, this.invocationContext, message);
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#sendingPartialResults(java.lang.Object[],
- * java.lang.String[])
- */
- @Override
- public void sendingPartialResults(Object[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.notifier.sendingResult(context, this.invocationContext, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFinished(org.python.core.PyObject[],
- * java.lang.String[])
- */
- @Override
- public void workflowFinished(PyObject[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.notifier.sendingResult(context, this.invocationContext, message);
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow Execution Finished.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowTerminated()
- */
- @Override
- public void workflowTerminated() {
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow Execution Finished.");
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.String)
- */
- @Override
- public void workflowFailed(String message) {
- workflowFailed(message, null);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.Throwable)
- */
- @Override
- public void workflowFailed(Throwable e) {
- workflowFailed(null, e);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.String,
- * java.lang.Throwable)
- */
- @Override
- public void workflowFailed(String message, Throwable e) {
- if(e != null)
- logger.error(e.getMessage(), e);
- if (message == null || "".equals(message)) {
- message = "Error";
- }
- if (e != null) {
- message += ": " + e.toString();
- }
- if (e != null) {
- String stackTrace = StringUtil.getStackTraceInString(e);
- XmlElement stackTraceElement = XMLUtil.BUILDER.newFragment("stackTrace");
- stackTraceElement.addChild(stackTrace);
- this.notifier.sendingFault(context, this.invocationContext, message,
- XMLUtil.xmlElementToString(stackTraceElement));
- } else {
- this.notifier.sendingFault(context, this.invocationContext, message);
- }
- }
-
- public void info(String message) {
- this.notifier.info(context, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#createServiceNotificationSender(java.lang.String)
- */
- @Override
- public ServiceNotifiable createServiceNotificationSender(String nodeID) {
- return new ServiceNotificationSender(this.notifier, this.eventSink, this.initiator, this.workflowID, nodeID,
- this.context,this.invocationContext);
- }
-
- @Override
- public void cleanup(){
- this.notifier.delete();
- }
-
- public String getTopic() {
- return topic;
- }
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+// */
+//
+//package org.apache.airavata.xbaya.jython.lib;
+//
+//import java.net.URI;
+//import java.util.Properties;
+//
+//import org.apache.airavata.common.utils.StringUtil;
+//import org.apache.airavata.common.utils.XMLUtil;
+//import org.apache.airavata.workflow.tracking.NotifierFactory;
+//import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+//import org.apache.airavata.workflow.tracking.common.InvocationContext;
+//import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+//import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+//import org.apache.axis2.addressing.EndpointReference;
+//import org.python.core.PyObject;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.xmlpull.infoset.XmlElement;
+//
+//public class NotificationSender implements WorkflowNotifiable {
+//
+// protected static final Logger logger = LoggerFactory.getLogger(NotificationSender.class);
+//
+// protected WorkflowNotifier notifier;
+//
+// protected String brokerURL;
+//
+// protected String topic;
+//
+// protected URI workflowID;
+//
+// protected InvocationEntity initiator;
+//
+// protected InvocationEntity receiver;
+//
+// protected InvocationContext invocationContext;
+//
+// protected EndpointReference eventSink;
+//
+// protected WorkflowTrackingContext context;
+//
+// /**
+// * Constructs a NotificationSender.
+// *
+// * @param brokerURL
+// * @param topic
+// */
+// public NotificationSender(URI brokerURL, String topic) {
+// this(brokerURL.toString(), topic);
+// }
+//
+// /**
+// * Creates a NotificationSender.
+// *
+// * @param brokerURL
+// * The location of notification brokerUrl.
+// * @param topic
+// * The notification topic.
+// */
+// public NotificationSender(String brokerURL, String topic) {
+// logger.debug("brokerURL:" + brokerURL + "topic:" + topic);
+// this.topic = topic;
+// this.brokerURL = brokerURL;
+// this.workflowID = URI.create(StringUtil.convertToJavaIdentifier(this.topic));
+// this.eventSink = new EndpointReference(this.brokerURL);
+// Properties props = new Properties();
+//
+// this.notifier = NotifierFactory.createNotifier();
+// URI initiatorWorkflowID = null;
+// URI initiatorServiceID = URI.create(StringUtil.convertToJavaIdentifier(topic));
+// String initiatorWorkflowNodeID = null;
+// Integer initiatorWorkflowTimeStep = null;
+// this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID, initiatorServiceID,
+// initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+// this.context.setTopic(topic);
+// this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+// initiatorWorkflowTimeStep);
+//
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = this.workflowID;
+// String receiverWorkflowNodeID = null;
+// Integer receiverWorkflowTimeStep = null;
+// this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// receiverWorkflowTimeStep);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#getEventSink()
+// */
+// @Override
+// public EndpointReference getEventSink() {
+// return this.eventSink;
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowStarted(org.python.core.PyObject[],
+// * java.lang.String[])
+// */
+// @Override
+// public void workflowStarted(PyObject[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowStarted(java.lang.Object[],
+// * java.lang.String[])
+// */
+// @Override
+// public void workflowStarted(Object[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFinished(java.lang.Object[],
+// * java.lang.String[])
+// */
+// @Override
+// public void workflowFinished(Object[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#sendingPartialResults(java.lang.Object[],
+// * java.lang.String[])
+// */
+// @Override
+// public void sendingPartialResults(Object[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFinished(org.python.core.PyObject[],
+// * java.lang.String[])
+// */
+// @Override
+// public void workflowFinished(PyObject[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow Execution Finished.");
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowTerminated()
+// */
+// @Override
+// public void workflowTerminated() {
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow Execution Finished.");
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.String)
+// */
+// @Override
+// public void workflowFailed(String message) {
+// workflowFailed(message, null);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.Throwable)
+// */
+// @Override
+// public void workflowFailed(Throwable e) {
+// workflowFailed(null, e);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#workflowFailed(java.lang.String,
+// * java.lang.Throwable)
+// */
+// @Override
+// public void workflowFailed(String message, Throwable e) {
+// if(e != null)
+// logger.error(e.getMessage(), e);
+// if (message == null || "".equals(message)) {
+// message = "Error";
+// }
+// if (e != null) {
+// message += ": " + e.toString();
+// }
+// if (e != null) {
+// String stackTrace = StringUtil.getStackTraceInString(e);
+// XmlElement stackTraceElement = XMLUtil.BUILDER.newFragment("stackTrace");
+// stackTraceElement.addChild(stackTrace);
+// this.notifier.sendingFault(context, this.invocationContext, message,
+// XMLUtil.xmlElementToString(stackTraceElement));
+// } else {
+// this.notifier.sendingFault(context, this.invocationContext, message);
+// }
+// }
+//
+// public void info(String message) {
+// this.notifier.info(context, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.WorkflowNotifiable#createServiceNotificationSender(java.lang.String)
+// */
+// @Override
+// public ServiceNotifiable createServiceNotificationSender(String nodeID) {
+// return new ServiceNotificationSender(this.notifier, this.eventSink, this.initiator, this.workflowID, nodeID,
+// this.context,this.invocationContext);
+// }
+//
+// @Override
+// public void cleanup(){
+// this.notifier.delete();
+// }
+//
+// public String getTopic() {
+// return topic;
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/ServiceNotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/ServiceNotificationSender.java b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/ServiceNotificationSender.java
index 36b79bf..1c44c33 100644
--- a/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/ServiceNotificationSender.java
+++ b/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/jython/lib/ServiceNotificationSender.java
@@ -1,293 +1,293 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.xbaya.jython.lib;
-
-import java.net.URI;
-import java.util.Iterator;
-
-import org.apache.airavata.common.utils.StringUtil;
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.tracking.WorkflowNotifier;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.impl.state.InvocationContextImpl;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-import xsul.wsif.WSIFMessage;
-
-public class ServiceNotificationSender implements ServiceNotifiable {
-
- private static final Logger logger = LoggerFactory.getLogger(ServiceNotificationSender.class);
-
- private WorkflowNotifier notifier;
-
- private URI workflowID;
-
- private String nodeID;
-
- private String serviceID;
-
- private InvocationEntity receiver;
-
- private InvocationEntity initiator;
-
- private InvocationContext invocationContext;
-
- private WorkflowTrackingContext context;
-
- private EndpointReference eventSink;
-
- /**
- * Constructs a ServiceNotificationSender.
- *
- * @param notifier
- * @param eventSink
- * @param initiator
- * @param workflowID
- * @param nodeID
- */
- protected ServiceNotificationSender(WorkflowNotifier notifier, EndpointReference eventSink,
- InvocationEntity initiator, URI workflowID, String nodeID, WorkflowTrackingContext context, InvocationContext invocationContext) {
- this.notifier = notifier;
- this.eventSink = eventSink;
- this.initiator = initiator;
- this.workflowID = workflowID;
- this.nodeID = nodeID;
- this.context = context;
- // In case of creating a service on the fly, there is no serviceID at
- // the beginning.
- this.serviceID = "";
- this.invocationContext = invocationContext;
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = URI.create(this.serviceID);
- String receiverWorkflowNodeID = this.nodeID;
- Integer workflowTimeStep = new Integer(0);
- this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- workflowTimeStep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#setServiceID(java.lang.String)
- */
- @Override
- public void setServiceID(String serviceID) {
- logger.debug("SerivceID:" + serviceID);
- this.serviceID = serviceID;
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = URI.create(this.serviceID);
- String receiverWorkflowNodeID = this.nodeID;
- Integer workflowTimeStep = new Integer(0);
- this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- workflowTimeStep);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#getEventSink()
- */
- @Override
- public EndpointReference getEventSink() {
- return this.eventSink;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#getWorkflowID()
- */
- @Override
- public URI getWorkflowID() {
- return this.workflowID;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#invokingService(xsul.wsif.WSIFMessage)
- */
- @Override
- public void invokingService(WSIFMessage inputs) {
- String message = "";
- Iterator partIt = inputs.partNames().iterator();
- boolean first = true;
- while (partIt.hasNext()) {
- if (first) {
- first = false;
- } else {
- message += ", ";
- }
-
- String name = (String) partIt.next();
- Object value = inputs.getObjectPart(name);
- if(value instanceof org.xmlpull.v1.builder.XmlElement){
- message += name + "=";
- Iterator children = ((org.xmlpull.v1.builder.XmlElement) value).children();
- while (children.hasNext()){
- message += children.next();
- }
- }else{
- message += name + "=" + value;
- }
- }
- XmlObject header = null;
- XmlObject body;
- try {
- body = XmlObject.Factory.parse(inputs.toString());
- } catch (XmlException e) {
- logger.warn("Failed to parse " + inputs.toString(), e);
- body = null; // Send notification anyway.
- }
- this.invocationContext = this.notifier.invokingService(this.context, this.receiver, header, body, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#serviceFinished(xsul.wsif.WSIFMessage)
- */
- @Override
- public void serviceFinished(WSIFMessage outputs) {
- String message = "";
- Iterator partIt = outputs.partNames().iterator();
- boolean first = true;
- while (partIt.hasNext()) {
- if (first) {
- first = false;
- } else {
- message += ", ";
- }
- String name = (String) partIt.next();
- Object value = outputs.getObjectPart(name);
- if(value instanceof org.xmlpull.v1.builder.XmlElement){
- message += name + "=";
- Iterator children = ((org.xmlpull.v1.builder.XmlElement) value).children();
- while (children.hasNext()){
- message += children.next();
- }
- }else{
- message += name + "=" + value;
- }
- }
- XmlObject header = null;
- XmlObject body;
- try {
- body = XmlObject.Factory.parse(outputs.toString());
- } catch (XmlException e) {
- logger.warn("Failed to parse " + outputs.toString(), e);
- body = null; // Send notification anyway.
- }
- this.notifier.receivedResult(this.context, this.invocationContext, header, body, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#invocationFailed(java.lang.String,
- * java.lang.Throwable)
- */
- @Override
- public void invocationFailed(String message, Throwable e) {
-
- // TODO there are two types of error messages.
- // The first one is while creating a service. (No API)
- // The second is while invoking a service.
- // e.g. notifier.invokingServiceFailed().
-
- // XXX If error occurs before invoking a service, create a fake
- // invocation context.
- if (this.invocationContext == null) {
- this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
- }
-
- logger.error(e.getMessage(), e);
- if (message == null || "".equals(message)) {
- message = "Error";
- }
- if (e != null) {
- message += ": " + e.toString();
- }
- if (e != null) {
- String stackTrace = StringUtil.getStackTraceInString(e);
- XmlElement stackTraceElement = XMLUtil.BUILDER.newFragment("stackTrace");
- stackTraceElement.addChild(stackTrace);
- String annotation = XMLUtil.xmlElementToString(stackTraceElement);
- this.notifier.invokingServiceFailed(this.context, this.invocationContext, e, message, annotation);
- } else {
- this.notifier.invokingServiceFailed(this.context, this.invocationContext, message);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#receivedFault(java.lang.String)
- */
- @Override
- @Deprecated
- public void receivedFault(String message) {
- // XXX If error occurs before invoking a service, create a fake
- // invocation context.
- if (this.invocationContext == null) {
- this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
- }
-
- if (message == null || "".equals(message)) {
- message = "Error";
- }
- this.notifier.receivedFault(this.context, this.invocationContext, message);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#receivedFault(xsul.wsif.WSIFMessage)
- */
- @Override
- public void receivedFault(WSIFMessage fault) {
- // XXX If error occurs before invoking a service, create a fake
- // invocation context.
- if (this.invocationContext == null) {
- this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
- }
-
- String message = "Received a fault message from the service";
- XmlObject header = null;
- XmlObject body;
- try {
- body = XmlObject.Factory.parse(fault.toString());
- } catch (XmlException e) {
- logger.warn("Failed to parse " + fault.toString(), e);
- body = null; // Send notification anyway.
- }
- this.notifier.receivedFault(this.context, this.invocationContext, header, body, message);
- }
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+// */
+//
+//package org.apache.airavata.xbaya.jython.lib;
+//
+//import java.net.URI;
+//import java.util.Iterator;
+//
+//import org.apache.airavata.common.utils.StringUtil;
+//import org.apache.airavata.common.utils.XMLUtil;
+//import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+//import org.apache.airavata.workflow.tracking.common.InvocationContext;
+//import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+//import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+//import org.apache.airavata.workflow.tracking.impl.state.InvocationContextImpl;
+//import org.apache.axis2.addressing.EndpointReference;
+//import org.apache.xmlbeans.XmlException;
+//import org.apache.xmlbeans.XmlObject;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.xmlpull.infoset.XmlElement;
+//
+//import xsul.wsif.WSIFMessage;
+//
+//public class ServiceNotificationSender implements ServiceNotifiable {
+//
+// private static final Logger logger = LoggerFactory.getLogger(ServiceNotificationSender.class);
+//
+// private WorkflowNotifier notifier;
+//
+// private URI workflowID;
+//
+// private String nodeID;
+//
+// private String serviceID;
+//
+// private InvocationEntity receiver;
+//
+// private InvocationEntity initiator;
+//
+// private InvocationContext invocationContext;
+//
+// private WorkflowTrackingContext context;
+//
+// private EndpointReference eventSink;
+//
+// /**
+// * Constructs a ServiceNotificationSender.
+// *
+// * @param notifier
+// * @param eventSink
+// * @param initiator
+// * @param workflowID
+// * @param nodeID
+// */
+// protected ServiceNotificationSender(WorkflowNotifier notifier, EndpointReference eventSink,
+// InvocationEntity initiator, URI workflowID, String nodeID, WorkflowTrackingContext context, InvocationContext invocationContext) {
+// this.notifier = notifier;
+// this.eventSink = eventSink;
+// this.initiator = initiator;
+// this.workflowID = workflowID;
+// this.nodeID = nodeID;
+// this.context = context;
+// // In case of creating a service on the fly, there is no serviceID at
+// // the beginning.
+// this.serviceID = "";
+// this.invocationContext = invocationContext;
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = URI.create(this.serviceID);
+// String receiverWorkflowNodeID = this.nodeID;
+// Integer workflowTimeStep = new Integer(0);
+// this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// workflowTimeStep);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#setServiceID(java.lang.String)
+// */
+// @Override
+// public void setServiceID(String serviceID) {
+// logger.debug("SerivceID:" + serviceID);
+// this.serviceID = serviceID;
+//
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = URI.create(this.serviceID);
+// String receiverWorkflowNodeID = this.nodeID;
+// Integer workflowTimeStep = new Integer(0);
+// this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// workflowTimeStep);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#getEventSink()
+// */
+// @Override
+// public EndpointReference getEventSink() {
+// return this.eventSink;
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#getWorkflowID()
+// */
+// @Override
+// public URI getWorkflowID() {
+// return this.workflowID;
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#invokingService(xsul.wsif.WSIFMessage)
+// */
+// @Override
+// public void invokingService(WSIFMessage inputs) {
+// String message = "";
+// Iterator partIt = inputs.partNames().iterator();
+// boolean first = true;
+// while (partIt.hasNext()) {
+// if (first) {
+// first = false;
+// } else {
+// message += ", ";
+// }
+//
+// String name = (String) partIt.next();
+// Object value = inputs.getObjectPart(name);
+// if(value instanceof org.xmlpull.v1.builder.XmlElement){
+// message += name + "=";
+// Iterator children = ((org.xmlpull.v1.builder.XmlElement) value).children();
+// while (children.hasNext()){
+// message += children.next();
+// }
+// }else{
+// message += name + "=" + value;
+// }
+// }
+// XmlObject header = null;
+// XmlObject body;
+// try {
+// body = XmlObject.Factory.parse(inputs.toString());
+// } catch (XmlException e) {
+// logger.warn("Failed to parse " + inputs.toString(), e);
+// body = null; // Send notification anyway.
+// }
+// this.invocationContext = this.notifier.invokingService(this.context, this.receiver, header, body, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#serviceFinished(xsul.wsif.WSIFMessage)
+// */
+// @Override
+// public void serviceFinished(WSIFMessage outputs) {
+// String message = "";
+// Iterator partIt = outputs.partNames().iterator();
+// boolean first = true;
+// while (partIt.hasNext()) {
+// if (first) {
+// first = false;
+// } else {
+// message += ", ";
+// }
+// String name = (String) partIt.next();
+// Object value = outputs.getObjectPart(name);
+// if(value instanceof org.xmlpull.v1.builder.XmlElement){
+// message += name + "=";
+// Iterator children = ((org.xmlpull.v1.builder.XmlElement) value).children();
+// while (children.hasNext()){
+// message += children.next();
+// }
+// }else{
+// message += name + "=" + value;
+// }
+// }
+// XmlObject header = null;
+// XmlObject body;
+// try {
+// body = XmlObject.Factory.parse(outputs.toString());
+// } catch (XmlException e) {
+// logger.warn("Failed to parse " + outputs.toString(), e);
+// body = null; // Send notification anyway.
+// }
+// this.notifier.receivedResult(this.context, this.invocationContext, header, body, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#invocationFailed(java.lang.String,
+// * java.lang.Throwable)
+// */
+// @Override
+// public void invocationFailed(String message, Throwable e) {
+//
+// // TODO there are two types of error messages.
+// // The first one is while creating a service. (No API)
+// // The second is while invoking a service.
+// // e.g. notifier.invokingServiceFailed().
+//
+// // XXX If error occurs before invoking a service, create a fake
+// // invocation context.
+// if (this.invocationContext == null) {
+// this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
+// }
+//
+// logger.error(e.getMessage(), e);
+// if (message == null || "".equals(message)) {
+// message = "Error";
+// }
+// if (e != null) {
+// message += ": " + e.toString();
+// }
+// if (e != null) {
+// String stackTrace = StringUtil.getStackTraceInString(e);
+// XmlElement stackTraceElement = XMLUtil.BUILDER.newFragment("stackTrace");
+// stackTraceElement.addChild(stackTrace);
+// String annotation = XMLUtil.xmlElementToString(stackTraceElement);
+// this.notifier.invokingServiceFailed(this.context, this.invocationContext, e, message, annotation);
+// } else {
+// this.notifier.invokingServiceFailed(this.context, this.invocationContext, message);
+// }
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#receivedFault(java.lang.String)
+// */
+// @Override
+// @Deprecated
+// public void receivedFault(String message) {
+// // XXX If error occurs before invoking a service, create a fake
+// // invocation context.
+// if (this.invocationContext == null) {
+// this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
+// }
+//
+// if (message == null || "".equals(message)) {
+// message = "Error";
+// }
+// this.notifier.receivedFault(this.context, this.invocationContext, message);
+// }
+//
+// /*
+// * (non-Javadoc)
+// *
+// * @see org.apache.airavata.xbaya.jython.lib.ServiceNotifiable#receivedFault(xsul.wsif.WSIFMessage)
+// */
+// @Override
+// public void receivedFault(WSIFMessage fault) {
+// // XXX If error occurs before invoking a service, create a fake
+// // invocation context.
+// if (this.invocationContext == null) {
+// this.invocationContext = new InvocationContextImpl(this.initiator, this.receiver);
+// }
+//
+// String message = "Received a fault message from the service";
+// XmlObject header = null;
+// XmlObject body;
+// try {
+// body = XmlObject.Factory.parse(fault.toString());
+// } catch (XmlException e) {
+// logger.warn("Failed to parse " + fault.toString(), e);
+// body = null; // Send notification anyway.
+// }
+// this.notifier.receivedFault(this.context, this.invocationContext, header, body, message);
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java b/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
index 4298692..2d5af0b 100644
--- a/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
+++ b/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
@@ -1,32 +1,32 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.interpreter;
-
-
-import org.apache.airavata.xbaya.messaging.NotificationHandler;
-
-public class Listener implements NotificationHandler {
-
- public void handleNotification(String message) {
- System.out.println("MessageRecieved: " + message);
- }
-
-}
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//package org.apache.airavata.xbaya.interpreter;
+//
+//
+//import org.apache.airavata.xbaya.messaging.NotificationHandler;
+//
+//public class Listener implements NotificationHandler {
+//
+// public void handleNotification(String message) {
+// System.out.println("MessageRecieved: " + message);
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java b/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
index 261b07f..d953e84 100644
--- a/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
+++ b/modules/xbaya-gui/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
@@ -1,204 +1,204 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.interpreter;
-
-
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.WorkflowNotifier;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.axis2.addressing.EndpointReference;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.net.URI;
-import java.util.Properties;
-
-public class NotificationSender {
-
- protected WorkflowNotifier notifier;
-
- protected String brokerURL;
-
- protected String topic;
-
- protected URI workflowID;
-
- protected InvocationEntity initiator;
-
- protected InvocationEntity receiver;
-
- protected InvocationContext invocationContext;
-
- protected EndpointReference eventSink;
-
- protected WorkflowTrackingContext context;
-
- /**
- * Constructs a NotificationSender.
- *
- * @param brokerURL
- * @param topic
- */
- public NotificationSender(URI brokerURL, String topic) {
- this(brokerURL.toString(), topic);
- }
-
- /**
- * Creates a NotificationSender.
- *
- * @param brokerURL The location of notification brokerUrl.
- * @param topic The notification topic.
- */
- public NotificationSender(String brokerURL, String topic) {
- this.topic = topic;
- this.brokerURL = brokerURL;
- this.workflowID = URI.create(this.convertToJavaIdentifier(this.topic));
- this.eventSink = new EndpointReference(this.brokerURL);
- Properties props = new Properties();
-
- this.notifier = NotifierFactory.createNotifier();
- URI initiatorWorkflowID = null;
- URI initiatorServiceID = URI.create(this.convertToJavaIdentifier(topic));
- String initiatorWorkflowNodeID = null;
- Integer initiatorWorkflowTimeStep = null;
- this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID,
- initiatorServiceID, initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
- this.context.setTopic(topic);
- this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
- initiatorWorkflowTimeStep);
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = this.workflowID;
- String receiverWorkflowNodeID = null;
- Integer receiverWorkflowTimeStep = null;
- this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- receiverWorkflowTimeStep);
- }
-
- /**
- * @return The event sink EPR.
- */
- public EndpointReference getEventSink() {
- return this.eventSink;
- }
-
-
- public void workflowStarted(String message) {
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
- }
-
-
- public void workflowFinished(String message) {
- this.notifier.sendingResult(context, this.invocationContext, message);
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
- }
-
- public void sendingPartialResults(Object[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.notifier.sendingResult(context, this.invocationContext, message);
- }
-
-
- public void workflowTerminated() {
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param message The message to send
- */
- public void workflowFailed(String message) {
- workflowFailed(message, null);
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param e
- */
- public void workflowFailed(Throwable e) {
- workflowFailed(null, e);
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param message The message to send
- * @param e
- */
- public void workflowFailed(String message, Throwable e) {
- this.notifier.sendingFault(context, this.invocationContext, message);
- }
-
- public void info(String message) {
- this.notifier.info(context, message);
- }
-
- /**
- * @param throwable
- * @return The stackTrace in String
- */
- public static String getStackTraceInString(Throwable throwable) {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- PrintStream printStream = new PrintStream(byteArrayOutputStream);
- throwable.printStackTrace(printStream);
- printStream.flush();
- return byteArrayOutputStream.toString();
- }
-
- public static String convertToJavaIdentifier(String name) {
-
- final char REPLACE_CHAR = '_';
-
- if (name == null || name.length() == 0) {
- return "" + REPLACE_CHAR;
- }
-
- StringBuilder buf = new StringBuilder();
-
- char c = name.charAt(0);
- if (!Character.isJavaIdentifierStart(c)) {
- // Add _ at the beggining instead of replacing it to _. This is
- // more readable if the name is like 3D_Model.
- buf.append(REPLACE_CHAR);
- }
-
- for (int i = 0; i < name.length(); i++) {
- c = name.charAt(i);
- if (Character.isJavaIdentifierPart(c)) {
- buf.append(c);
- } else {
- buf.append(REPLACE_CHAR);
- }
- }
-
- return buf.toString();
- }
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//package org.apache.airavata.xbaya.interpreter;
+//
+//
+//import org.apache.airavata.workflow.tracking.NotifierFactory;
+//import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+//import org.apache.airavata.workflow.tracking.common.InvocationContext;
+//import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+//import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+//import org.apache.axis2.addressing.EndpointReference;
+//
+//import java.io.ByteArrayOutputStream;
+//import java.io.PrintStream;
+//import java.net.URI;
+//import java.util.Properties;
+//
+//public class NotificationSender {
+//
+// protected WorkflowNotifier notifier;
+//
+// protected String brokerURL;
+//
+// protected String topic;
+//
+// protected URI workflowID;
+//
+// protected InvocationEntity initiator;
+//
+// protected InvocationEntity receiver;
+//
+// protected InvocationContext invocationContext;
+//
+// protected EndpointReference eventSink;
+//
+// protected WorkflowTrackingContext context;
+//
+// /**
+// * Constructs a NotificationSender.
+// *
+// * @param brokerURL
+// * @param topic
+// */
+// public NotificationSender(URI brokerURL, String topic) {
+// this(brokerURL.toString(), topic);
+// }
+//
+// /**
+// * Creates a NotificationSender.
+// *
+// * @param brokerURL The location of notification brokerUrl.
+// * @param topic The notification topic.
+// */
+// public NotificationSender(String brokerURL, String topic) {
+// this.topic = topic;
+// this.brokerURL = brokerURL;
+// this.workflowID = URI.create(this.convertToJavaIdentifier(this.topic));
+// this.eventSink = new EndpointReference(this.brokerURL);
+// Properties props = new Properties();
+//
+// this.notifier = NotifierFactory.createNotifier();
+// URI initiatorWorkflowID = null;
+// URI initiatorServiceID = URI.create(this.convertToJavaIdentifier(topic));
+// String initiatorWorkflowNodeID = null;
+// Integer initiatorWorkflowTimeStep = null;
+// this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID,
+// initiatorServiceID, initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+// this.context.setTopic(topic);
+// this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+// initiatorWorkflowTimeStep);
+//
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = this.workflowID;
+// String receiverWorkflowNodeID = null;
+// Integer receiverWorkflowTimeStep = null;
+// this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// receiverWorkflowTimeStep);
+// }
+//
+// /**
+// * @return The event sink EPR.
+// */
+// public EndpointReference getEventSink() {
+// return this.eventSink;
+// }
+//
+//
+// public void workflowStarted(String message) {
+// this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
+// }
+//
+//
+// public void workflowFinished(String message) {
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+// }
+//
+// public void sendingPartialResults(Object[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// }
+//
+//
+// public void workflowTerminated() {
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param message The message to send
+// */
+// public void workflowFailed(String message) {
+// workflowFailed(message, null);
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param e
+// */
+// public void workflowFailed(Throwable e) {
+// workflowFailed(null, e);
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param message The message to send
+// * @param e
+// */
+// public void workflowFailed(String message, Throwable e) {
+// this.notifier.sendingFault(context, this.invocationContext, message);
+// }
+//
+// public void info(String message) {
+// this.notifier.info(context, message);
+// }
+//
+// /**
+// * @param throwable
+// * @return The stackTrace in String
+// */
+// public static String getStackTraceInString(Throwable throwable) {
+// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+// PrintStream printStream = new PrintStream(byteArrayOutputStream);
+// throwable.printStackTrace(printStream);
+// printStream.flush();
+// return byteArrayOutputStream.toString();
+// }
+//
+// public static String convertToJavaIdentifier(String name) {
+//
+// final char REPLACE_CHAR = '_';
+//
+// if (name == null || name.length() == 0) {
+// return "" + REPLACE_CHAR;
+// }
+//
+// StringBuilder buf = new StringBuilder();
+//
+// char c = name.charAt(0);
+// if (!Character.isJavaIdentifierStart(c)) {
+// // Add _ at the beggining instead of replacing it to _. This is
+// // more readable if the name is like 3D_Model.
+// buf.append(REPLACE_CHAR);
+// }
+//
+// for (int i = 0; i < name.length(); i++) {
+// c = name.charAt(i);
+// if (Character.isJavaIdentifierPart(c)) {
+// buf.append(c);
+// } else {
+// buf.append(REPLACE_CHAR);
+// }
+// }
+//
+// return buf.toString();
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ebc35a1..8e16e40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -519,9 +519,9 @@
<module>modules/orchestrator</module>
<module>tools</module>
<module>modules/server</module>
- <module>modules/test-suite</module>
+ <!--<module>modules/test-suite</module>-->
<module>modules/distribution</module>
- <module>modules/ws-messenger</module>
+ <!--<module>modules/ws-messenger</module>-->
<module>modules/messaging</module>
<module>modules/integration-tests</module>
<module>modules/xbaya-gui</module>
@@ -597,7 +597,7 @@
<module>airavata-api</module>
<module>modules/commons</module>
<module>modules/gfac</module>
- <module>modules/ws-messenger</module>
+ <!--<module>modules/ws-messenger</module>-->
<module>modules/workflow-model</module>
<module>modules/registry</module>
<module>modules/security</module>
@@ -605,7 +605,7 @@
<module>modules/orchestrator</module>
<module>tools</module>
<module>modules/server</module>
- <module>modules/test-suite</module>
+ <!--<module>modules/test-suite</module>-->
<module>modules/distribution</module>
<module>modules/integration-tests</module>
</modules>
[04/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgPersistantStorage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgPersistantStorage.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgPersistantStorage.java
deleted file mode 100644
index 60a9705..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgPersistantStorage.java
+++ /dev/null
@@ -1,773 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.BatchUpdateException;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.storage.DatabaseCreator.DatabaseType;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.util.Counter;
-import org.apache.airavata.wsmg.util.TimerThread;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WsmgPersistantStorage implements WsmgStorage, WsmgQueue {
- private static final Logger logger = LoggerFactory.getLogger(WsmgPersistantStorage.class);
-
- /*
- * Table name
- */
- private static final String TABLE_NAME_TO_CHECK = SubscriptionConstants.TABLE_NAME_EXPIRABLE_SUBCRIPTIONS;
-
- private Counter storeToDBCounter = new Counter();
-
- private JdbcStorage db;
-
- public WsmgPersistantStorage(String jdbcUrl, String jdbcDriver) {
-
- db = new JdbcStorage(jdbcUrl, jdbcDriver);
-
- Connection conn = null;
- try {
- /*
- * Check database
- */
- conn = db.connect();
- if (!DatabaseCreator.isDatabaseStructureCreated(TABLE_NAME_TO_CHECK, conn)) {
- DatabaseCreator.createMsgBrokerDatabase(conn);
- logger.info("New Database created for Message Broker");
- } else {
- logger.debug("Database already created for Message Broker!");
- }
-
- if (WSMGParameter.measureMessageRate) {
- TimerThread timerThread = new TimerThread(storeToDBCounter, " StoreSubScriptionToDBCounter");
- new Thread(timerThread).start();
- }
-
- initMessageQueueStorage();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure");
- } finally {
- db.closeConnection(conn);
- }
- }
-
- public void dispose() {
- if (db != null) {
- db.closeAllConnections();
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.wsmg.commons.storage.WsmgStorage#getAllSubscription()
- */
- public List<SubscriptionEntry> getAllSubscription() {
-
- ArrayList<SubscriptionEntry> ret = new ArrayList<SubscriptionEntry>();
-
- Connection conn = null;
- PreparedStatement stmt = null;
- try {
-
- // get number of row first and increase the arrayList size for
- // better performance
- int size = db.countRow(SubscriptionConstants.TABLE_NAME_EXPIRABLE_SUBCRIPTIONS, "*");
-
- conn = db.connect();
- stmt = conn.prepareStatement(SubscriptionConstants.EXP_SELECT_QUERY);
- ResultSet rs = stmt.executeQuery();
- ret.ensureCapacity(size);
-
- if (rs != null) {
-
- /*
- * Buffer data
- */
- int nRead;
- byte[] buffer = new byte[1024];
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
-
- while (rs.next()) {
- SubscriptionEntry subscriptionEntry = new SubscriptionEntry();
- subscriptionEntry.setSubscriptionId(rs.getString("SubscriptionId"));
-
- /*
- * Read Binary Stream
- */
- InputStream inStream = null;
-
- try {
- inStream = rs.getBinaryStream("content");
- while ((nRead = inStream.read(buffer)) != -1) {
- outStream.write(buffer, 0, nRead);
- }
- outStream.flush();
-
- subscriptionEntry.setSubscribeXml(new String(outStream.toByteArray()));
-
- } catch (IOException ie) {
- logger.error("Unable to read XML from database", ie);
-
- // skip this subscription entry
- continue;
- } finally {
- // clear all data in outputStream
- outStream.reset();
-
- // close database stream
- if (inStream != null) {
- try {
- inStream.close();
- } catch (Exception e) {
- logger.error("Cannot close database stream", e);
- }
- }
- }
-
- ret.add(subscriptionEntry);
-
- }
- }
- } catch (SQLException ex) {
- logger.error("sql exception occured", ex);
- } finally {
- db.quietlyClose(conn, stmt);
- }
- return ret;
- }
-
- public int insert(SubscriptionState subscription) {
- String address = subscription.getConsumerReference().getAddress();
- Map<QName, OMElement> referenceParametersMap = subscription.getConsumerReference().getAllReferenceParameters();
-
- String consumerReferenceParameters = null;
- if (referenceParametersMap == null) {
- consumerReferenceParameters = "";
- } else {
-
- StringBuffer buffer = new StringBuffer();
-
- for (Iterator<OMElement> ite = referenceParametersMap.values().iterator(); ite.hasNext();) {
- OMElement currentReferenceParameter = ite.next();
-
- try {
- buffer.append(currentReferenceParameter.toStringWithConsume());
- } catch (XMLStreamException se) {
- logger.error("unable to convert reference parameter", se);
- }
-
- }
- consumerReferenceParameters = buffer.toString();
- }
-
- int policyValue = WsmgCommonConstants.WSRM_POLICY_FALSE;
- if (subscription.isWsrmPolicy()) {
- policyValue = WsmgCommonConstants.WSRM_POLICY_TRUE;
- }
-
- Timestamp now = new Timestamp(System.currentTimeMillis());
-
- int result = 0;
- Connection connection = null;
- PreparedStatement stmt = null;
- try {
-
- connection = db.connect();
- stmt = connection.prepareStatement(SubscriptionConstants.EXP_INSERT_SQL_QUERY);
-
- stmt.setString(1, subscription.getId());
- stmt.setBinaryStream(2, new ByteArrayInputStream(subscription.getSubscribeXml().getBytes()), subscription
- .getSubscribeXml().getBytes().length);
- stmt.setInt(3, policyValue);
- stmt.setString(4, subscription.getLocalTopic());
- stmt.setString(5, subscription.getXpathString());
- stmt.setString(6, address);
- stmt.setBinaryStream(7, new ByteArrayInputStream(consumerReferenceParameters.getBytes()),
- consumerReferenceParameters.getBytes().length);
- stmt.setTimestamp(8, now);
- result = db.executeUpdateAndClose(stmt);
- db.commitAndFree(connection);
-
- storeToDBCounter.addCounter();
-
- } catch (SQLException ex) {
- logger.error("sql exception occured", ex);
- db.rollbackAndFree(connection);
- }
- return result;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.airavata.wsmg.commons.storage.SubscriptionStorage#delete(java .lang.String)
- */
- public int delete(String subscriptionId) {
- int result = 0;
- Connection connection = null;
- try {
- connection = db.connect();
- PreparedStatement stmt = connection.prepareStatement(SubscriptionConstants.EXP_DELETE_SQL_QUERY);
- stmt.setString(1, subscriptionId);
- result = db.executeUpdateAndClose(stmt);
- db.commitAndFree(connection);
- } catch (SQLException sql) {
- db.rollbackAndFree(connection);
- logger.error("sql exception occured", sql);
- }
- return result;
- }
-
- public void cleanup() {
- Connection conn = null;
- Statement stmt = null;
- try {
- conn = db.connect();
- stmt = conn.createStatement();
- batchCleanDB(stmt, conn);
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- } finally {
- if (db.isAutoCommit()) {
- try {
- conn.setAutoCommit(true);
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- }
- }
- db.quietlyClose(conn, stmt);
- }
- }
-
- public Object blockingDequeue() throws InterruptedException {
- while (true) {
- try {
- return retrive();
- } catch (SQLException e) {
- logger.error(e.getMessage(), e);
- e.printStackTrace();
- } catch (IOException e) {
- logger.error(e.getMessage(), e);
- e.printStackTrace();
- }
- }
- }
-
- public void enqueue(Object object, String trackId) {
-
- // Get the Max ID cache and update and unlock the table
- Connection connection = null;
- PreparedStatement stmt = null;
- PreparedStatement stmt2 = null;
- PreparedStatement stmt3 = null;
- try {
- int nextkey;
-
- connection = db.connect();
-
- lockMaxMinTables(connection);
-
- stmt = connection.prepareStatement(QueueContants.SQL_MAX_ID_SEPERATE_TABLE);
-
- ResultSet result = stmt.executeQuery();
-
- if (result.next()) {
- nextkey = result.getInt(1);
-
- stmt2 = connection.prepareStatement(QueueContants.SQL_MAX_ID_INCREMENT + (nextkey));
- stmt2.executeUpdate();
- } else {
- throw new RuntimeException("MAX_ID Table is not init, redeploy the service !!!");
- }
-
- /**
- * Before executing the SQL_INSERT_STATEMENT query, we need to unlock
- * MaxIDTable and MinIDTable since we are going to insert data to another
- * table, disQ. If we do not unlock tables, insert query fails in MySQL. But
- * in Derby, this will execute without any issues even without unlocking
- * tables. Since it fails with MySQL, we need to unlock the tables
- * before executing the insert query.
- */
- try{
- unLockTables(connection);
- }catch (SQLException sql) {
- logger.error("Cannot Unlock Table", sql);
- }
-
-
- /*
- * After update MAX_ID put data into queue table
- */
- stmt3 = connection.prepareStatement(QueueContants.SQL_INSERT_STATEMENT);
- stmt3.setInt(1, nextkey);
- stmt3.setString(2, trackId);
-
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(output);
- out.writeObject(object);
- byte[] buffer = output.toByteArray();
- ByteArrayInputStream in = new ByteArrayInputStream(buffer);
- stmt3.setBinaryStream(3, in, buffer.length);
- stmt3.executeUpdate();
- db.commit(connection);
- } catch (SQLException sqlEx) {
- db.rollback(connection);
- logger.error("unable to enque the message in persistant storage", sqlEx);
- } catch (IOException ioEx) {
- db.rollback(connection);
- logger.error("unable to enque the message in persistant storage", ioEx);
- } finally {
- try {
- unLockTables(connection);
- } catch (SQLException sql) {
- logger.error("Cannot Unlock Table", sql);
- }
-
- db.quietlyClose(connection, stmt, stmt2, stmt3);
- }
- }
-
- private void initMessageQueueStorage() throws SQLException {
- Connection connection = null;
- PreparedStatement stmt = null;
- PreparedStatement stmt2 = null;
- PreparedStatement stmt3 = null;
- PreparedStatement stmt4 = null;
- try {
- connection = db.connect();
-
- lockMaxMinTables(connection);
-
- /*
- * Get Max ID
- */
- stmt = connection.prepareStatement(QueueContants.SQL_MAX_ID_SEPERATE_TABLE);
- ResultSet result = stmt.executeQuery();
- if (!result.next()) {
- stmt2 = connection.prepareStatement(QueueContants.SQL_MAX_ID_INSERT);
- stmt2.executeUpdate();
- }
-
- /*
- * Get Min ID
- */
- stmt3 = connection.prepareStatement(QueueContants.SQL_MIN_ID_SEPERATE_TABLE);
- result = stmt3.executeQuery();
- if (!result.next()) {
- stmt4 = connection.prepareStatement(QueueContants.SQL_MIN_ID_INSERT);
- stmt4.executeUpdate();
- }
- db.commit(connection);
- } catch (SQLException sqle) {
- db.rollback(connection);
- throw sqle;
- } finally {
- try {
- unLockTables(connection);
- } catch (SQLException sql) {
- logger.error("Cannot Unlock Table", sql);
- }
-
- db.quietlyClose(connection, stmt, stmt2, stmt3, stmt4);
- }
- }
-
- private Object retrive() throws SQLException, IOException, InterruptedException {
- long wait = 1000;
- int nextkey = -1;
- int maxid = -2;
- Connection connection = null;
- PreparedStatement stmt = null;
- PreparedStatement stmt2 = null;
- PreparedStatement stmt3 = null;
- ResultSet result = null;
- while (true) {
- try {
- connection = db.connect();
-
- lockMaxMinTables(connection);
-
- /*
- * Get Min ID
- */
- stmt = connection.prepareStatement(QueueContants.SQL_MIN_ID_SEPERATE_TABLE);
- result = stmt.executeQuery();
- if (result.next()) {
- nextkey = result.getInt(1);
- } else {
- throw new RuntimeException("Queue init has failed earlier");
- }
-
- /*
- * Get Max ID
- */
- stmt2 = connection.prepareStatement(QueueContants.SQL_MAX_ID_SEPERATE_TABLE);
- result = stmt2.executeQuery();
- if (result.next()) {
- maxid = result.getInt(1);
- } else {
- throw new RuntimeException("Queue init has failed earlier");
- }
-
- /*
- * Update value and exit the loop
- */
- if (maxid > nextkey) {
- stmt3 = connection.prepareStatement(QueueContants.SQL_MIN_ID_INCREMENT + (nextkey));
- stmt3.executeUpdate();
- logger.debug("Update MIN ID by one");
- db.commit(connection);
- break;
- }
-
- db.commit(connection);
- } catch (SQLException sql) {
- db.rollback(connection);
- throw sql;
- } finally {
- try {
- unLockTables(connection);
- } catch (SQLException sql) {
- sql.printStackTrace();
- logger.error("Cannot Unlock Table", sql);
- }
-
- db.quietlyClose(connection, stmt, stmt2, stmt3);
- }
-
- /*
- * Sleep if there is nothing to do
- */
- try {
- wait = Math.min((wait + 1000), QueueContants.FINAL_WAIT_IN_MILI);
- logger.debug("Wait=" + wait);
- Thread.sleep(wait);
- } catch (InterruptedException e) {
- logger.warn("Queue is interrupted to close");
- throw e;
- }
- }
-
- /*
- * Create Subscription Object from MIN_ID and delete data in table
- */
- Object resultObj = null;
- int key = -1;
- try {
- connection = db.connect();
- stmt = connection.prepareStatement(QueueContants.SQL_SELECT_STATEMENT + nextkey);
- result = stmt.executeQuery();
- if (result.next()) {
- key = result.getInt(1);
- InputStream in = result.getAsciiStream(2);
- ObjectInputStream s = new ObjectInputStream(in);
- try {
- resultObj = s.readObject();
- } catch (ClassNotFoundException e) {
- logger.error("Cannot Deserialize Object from Database, ClassNotFound. ", e);
- }
- } else {
- throw new RuntimeException(
- "MAX_ID and MIN_ID are inconsistent with subscription table, need to reset all data value");
- }
-
- try {
- String query = QueueContants.SQL_DELETE_STATEMENT + key;
- stmt2 = connection.prepareStatement(query);
- stmt2.executeUpdate();
- db.commit(connection);
- } catch (SQLException sqle) {
- db.rollback(connection);
- throw sqle;
- }
- } finally {
- db.quietlyClose(connection, stmt, stmt2);
- }
- return resultObj;
- }
-
- private void batchCleanDB(Statement stmt, Connection con) throws SQLException {
- DatabaseType databaseType = DatabaseType.other;
- int[] aiupdateCounts = new int[0];
- boolean bError = false;
- try {
-
- con.setAutoCommit(false);
-
- stmt.clearBatch();
-
- int totalStatement = 0;
-
- try {
- databaseType = DatabaseCreator.getDatabaseType(con);
- } catch (Exception e) {
- logger.error("Error evaluating database type", e);
- }
- // add SQL statements
- if (DatabaseType.mysql.equals(databaseType)) {
- stmt.addBatch("lock tables disQ write, MaxIDTable write, MinIDTable write;");
- totalStatement++;
- } else if (DatabaseType.derby.equals(databaseType)) {
- stmt.addBatch("lock table disQ in exclusive mode;");
- totalStatement++;
- stmt.addBatch("lock table MaxIDTable in exclusive mode;");
- totalStatement++;
- stmt.addBatch("lock table MinIDTable in exclusive mode;");
- totalStatement++;
- }
- stmt.addBatch("Delete from disQ;");
- totalStatement++;
- stmt.addBatch("Delete from MaxIDTable;");
- totalStatement++;
- stmt.addBatch("Delete from MinIDTable;");
- totalStatement++;
-
- aiupdateCounts = new int[totalStatement];
-
- // execute the statements
- aiupdateCounts = stmt.executeBatch();
-
- } catch (BatchUpdateException bue) {
- bError = true;
- aiupdateCounts = bue.getUpdateCounts();
- logger.error("SQLException: " + bue.getMessage());
- logger.error("SQLState: " + bue.getSQLState());
- logger.error("Message: " + bue.getMessage());
- logger.error("Vendor: " + bue.getErrorCode());
- logger.info("Update counts: ");
-
- for (int i = 0; i < aiupdateCounts.length; i++) {
- logger.error(aiupdateCounts[i] + " ");
- }
-
- SQLException SQLe = bue;
- while (SQLe != null) {
- SQLe = SQLe.getNextException();
- logger.error(SQLe.getMessage(), SQLe);
- }
- } catch (SQLException SQLe) {
- bError = true;
- throw SQLe;
- } finally {
- // determine operation result
- for (int i = 0; !bError && i < aiupdateCounts.length; i++) {
- int iProcessed = aiupdateCounts[i];
- /**
- * The int values that can be returned in the update counts array are: <br/>
- * -3--Operation error. A driver has the option to stop at the first error and throw a
- * BatchUpdateException or to report the error and continue. This value is only seen in the latter case. <br/>
- * -2--The operation was successful, but the number of rows affected is unknown. <br/>
- * Zero--DDL statement or no rows affected by the operation. Greater than zero--Operation was
- * successful, number of rows affected by the operation.
- */
- if (iProcessed < 0 && iProcessed != -2) {
- // error on statement
- logger.info("Error batch." + iProcessed);
- bError = true;
- }
- }
-
- if (bError) {
- con.rollback();
- } else {
- con.commit();
- }
-
- /*
- * Unlock table after rollback and commit, since it is not automatic in MySql
- */
-
- if (DatabaseType.mysql.equals(databaseType)) {
- PreparedStatement prepareStmt = con.prepareCall("unlock tables;");
- db.executeUpdateAndClose(prepareStmt);
- }
- } // end finally
- logger.info("Queue is cleaned.");
- }
-
- private void lockMaxMinTables(Connection connection) throws SQLException {
- DatabaseType databaseType = DatabaseType.other;
- try {
- databaseType = DatabaseCreator.getDatabaseType(connection);
- } catch (Exception e) {
- logger.error("Error evaluating database type", e);
- }
-
- /*
- * Must turn off auto commit
- */
- connection.setAutoCommit(false);
- String sql = null;
- Statement stmt = null;
- try {
- switch (databaseType) {
- case derby:
- sql = "LOCK TABLE " + QueueContants.TABLE_NAME_MAXID + " IN EXCLUSIVE MODE";
- String sql2 = "LOCK TABLE " + QueueContants.TABLE_NAME_MINID + " IN EXCLUSIVE MODE";
- stmt = connection.createStatement();
- stmt.addBatch(sql);
- stmt.addBatch(sql2);
- stmt.executeBatch();
- break;
- case mysql:
- sql = "lock tables " + QueueContants.TABLE_NAME_MAXID + " write" + "," + QueueContants.TABLE_NAME_MINID
- + " write";
- stmt = connection.createStatement();
- stmt.executeQuery(sql);
- break;
- default:
- return;
- }
-
- } finally {
- if (stmt != null && !stmt.isClosed()) {
- stmt.close();
- }
- }
- }
-
- private void unLockTables(Connection connection) throws SQLException {
- DatabaseType databaseType = DatabaseType.other;
- try {
- databaseType = DatabaseCreator.getDatabaseType(connection);
- } catch (Exception e) {
- logger.error("Error evaluating database type", e);
- }
-
- try {
- switch (databaseType) {
- case derby:
- /*
- * Derby doesn't have explicit unlock SQL It uses commit or rollback as a unlock mechanism, so make sure
- * that connection is always commited or rollbacked
- */
- break;
- case mysql:
- String sql = "unlock tables";
- PreparedStatement stmt = null;
- try {
- stmt = connection.prepareStatement(sql);
- stmt.executeQuery();
- db.commit(connection);
- } finally {
- if (stmt != null) {
- stmt.close();
- }
- }
- break;
- default:
- return;
- }
- } finally {
- /*
- * Set auto commit when needed
- */
- if (db.isAutoCommit()) {
- connection.setAutoCommit(true);
- }
- }
- }
-
- private static class SubscriptionConstants {
-
- public static final String TABLE_NAME_EXPIRABLE_SUBCRIPTIONS = "subscription";
-
- public static final String TABLE_NAME_NON_EXPIRABLE_SUBCRIPTIONS = "specialSubscription";
-
- public static final String EXP_INSERT_SQL_QUERY = "INSERT INTO " + TABLE_NAME_EXPIRABLE_SUBCRIPTIONS
- + "(SubscriptionId, content, wsrm, Topics, XPath, ConsumerAddress, ReferenceProperties, CreationTime) "
- + "VALUES( ? , ? , ? , ? , ? , ? , ? , ?)";
-
- public static final String EXP_DELETE_SQL_QUERY = "DELETE FROM " + TABLE_NAME_EXPIRABLE_SUBCRIPTIONS
- + " WHERE SubscriptionId= ?";
-
- public static final String EXP_SELECT_QUERY = "SELECT * FROM " + TABLE_NAME_EXPIRABLE_SUBCRIPTIONS;
-
- public static final String NONEXP_INSERT_SQL_QUERY = "INSERT INTO " + TABLE_NAME_NON_EXPIRABLE_SUBCRIPTIONS
- + "(SubscriptionId, content, wsrm, Topics, XPath, ConsumerAddress, ReferenceProperties, CreationTime) "
- + "VALUES( ? , ? , ? , ? , ? , ? , ? , ?)";
-
- public static final String NONEXP_DELETE_SQL_QUERY = "DELETE FROM " + TABLE_NAME_NON_EXPIRABLE_SUBCRIPTIONS
- + " WHERE SubscriptionId= ?";
-
- public static final String NONEXP_SELECT_QUERY = "SELECT * FROM " + TABLE_NAME_NON_EXPIRABLE_SUBCRIPTIONS;
- }
-
- private static class QueueContants {
- public static final int FINAL_WAIT_IN_MILI = 5000;
-
- public static final String TABLE_NAME = "disQ";
-
- public static final String TABLE_NAME_MAXID = "MaxIDTable";
-
- public static final String TABLE_NAME_MINID = "MinIDTable";
-
- public static final int STATUS_OPEN = 0;
-
- public static final String SQL_INSERT_STATEMENT = "INSERT INTO " + TABLE_NAME
- + " (id, trackId, message, status) " + "VALUES (?,?,?," + STATUS_OPEN + ")";
-
- public static String SQL_DELETE_STATEMENT = "DELETE FROM " + TABLE_NAME + " WHERE id=";
-
- public static String SQL_SELECT_STATEMENT = "SELECT id,message FROM " + TABLE_NAME + " WHERE id=";
-
- public static String SQL_MAX_ID_SEPERATE_TABLE = "SELECT maxID FROM " + TABLE_NAME_MAXID;
-
- public static String SQL_MIN_ID_SEPERATE_TABLE = "SELECT minID FROM " + TABLE_NAME_MINID;
-
- public static String SQL_MAX_ID_INSERT = "INSERT INTO " + TABLE_NAME_MAXID + " (maxID) VALUES (1)";
-
- public static String SQL_MIN_ID_INSERT = "INSERT INTO " + TABLE_NAME_MINID + " (minID) VALUES (1)";
-
- public static String SQL_MAX_ID_INCREMENT = "UPDATE " + TABLE_NAME_MAXID + " SET maxID = maxID+1 WHERE maxID =";
-
- public static String SQL_MIN_ID_INCREMENT = "UPDATE " + TABLE_NAME_MINID + " SET minID = minID+1 WHERE minID =";
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgQueue.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgQueue.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgQueue.java
deleted file mode 100644
index 5430b33..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgQueue.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-public interface WsmgQueue {
-
- void cleanup();
-
- void enqueue(Object object, String trackId);
-
- Object blockingDequeue() throws InterruptedException;
-
- void dispose();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgStorage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgStorage.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgStorage.java
deleted file mode 100644
index 2a1d1cb..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgStorage.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-
-public interface WsmgStorage {
-
- List<SubscriptionEntry> getAllSubscription();
-
- int insert(SubscriptionState subscription);
-
- int delete(String subscriptionId);
-
- void dispose();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/util/OMElementComparator.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/util/OMElementComparator.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/util/OMElementComparator.java
deleted file mode 100644
index d3be422..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/util/OMElementComparator.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.util.BrokerUtil;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Compare two OMElement with its namespace, attributes, children, and text. Current implementation supports ignore
- * namespace checking i.e. if the namespace is in the list, it is skipped and return as equals.
- */
-public class OMElementComparator {
-
- private static final Logger log = LoggerFactory.getLogger(OMElementComparator.class);
-
- private static List<String> ignorableNamespaceList = new ArrayList<String>();
-
- private OMElementComparator() {
- }
-
- public void addIgnorableNamespace(String nsURI) {
- ignorableNamespaceList.add(nsURI);
- }
-
- public void clearIgnorableNamespaces() {
- ignorableNamespaceList.clear();
- }
-
- public static boolean compare(OMElement elementOne, OMElement elementTwo) {
-
- if (isIgnorable(elementOne) || isIgnorable(elementTwo)) {
- // ignore if the elements belong to any of the ignorable namespaces
- // list
- return true;
- } else if (elementOne == null && elementTwo == null) {
- log.debug("Both Elements are null.");
- return true;
- } else if (elementOne == null || elementTwo == null) {
- log.debug("One of item to compare is null");
- return false;
- }
-
- return BrokerUtil.sameStringValue(elementOne.getLocalName(), elementTwo.getLocalName())
- && compare(elementOne.getNamespace(), elementTwo.getNamespace())
- && compareAttibutes(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 practical side of tests
- * and to get the current tests working we have to trim() the contents
- */
- && BrokerUtil.sameStringValue(elementOne.getText().trim(), elementTwo.getText().trim())
- && compareChildren(elementOne, elementTwo);
- }
-
- private static 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 static boolean compareChildren(OMElement elementOne, OMElement elementTwo) {
- HashMap<QName, OMElement> map = new HashMap<QName, OMElement>();
- Iterator oneIter = elementOne.getChildElements();
- while (oneIter.hasNext()) {
- OMElement elementOneChild = (OMElement) oneIter.next();
- OMElement elementTwoChild = elementTwo.getFirstChildWithName(elementOneChild.getQName());
- if (!compare(elementOneChild, elementTwoChild)) {
- return false;
- }
-
- /*
- * Cache for later access
- */
- map.put(elementOneChild.getQName(), elementOneChild);
- }
-
- /*
- * Case the second element has more elements than the first
- */
- Iterator twoIter = elementTwo.getChildElements();
- while (twoIter.hasNext()) {
- OMElement elementTwoChild = (OMElement) twoIter.next();
- if (!isIgnorable(elementTwoChild) && !map.containsKey(elementTwoChild.getQName())) {
- return false;
- }
- }
-
- return true;
- }
-
- private static boolean compareAttibutes(OMElement elementOne, OMElement elementTwo) {
- int elementOneAtribCount = 0;
- int elementTwoAtribCount = 0;
- Iterator oneIter = elementOne.getAllAttributes();
- while (oneIter.hasNext()) {
-
- /*
- * This catches a case where the first one has more items than the second one (one.attributes.size >
- * two.attributes.size) and a case where the first and the second have a different attributes.
- * (one.attributes.size == two.attributes.size)
- */
- OMAttribute omAttribute = (OMAttribute) oneIter.next();
- OMAttribute attr = elementTwo.getAttribute(omAttribute.getQName());
- if (attr == null) {
- log.debug("Attribute " + omAttribute + " is not found in both elements.");
- return false;
- }
- /*
- * Count attributes in the first item
- */
- elementOneAtribCount++;
- }
-
- /*
- * Count attributes in the second item
- */
- Iterator elementTwoIter = elementTwo.getAllAttributes();
- while (elementTwoIter.hasNext()) {
- elementTwoIter.next();
- elementTwoAtribCount++;
- }
-
- /*
- * This catches a case where the second one has more items than the first one. (two.attributes.size >
- * one.attributes.size)
- */
- log.debug("Number of Attributes are equal? : " + (elementOneAtribCount == elementTwoAtribCount));
- return elementOneAtribCount == elementTwoAtribCount;
- }
-
- /*
- * Compare only URI not prefix
- */
- private static boolean compare(OMNamespace x, OMNamespace y) {
- log.debug("Compare namespace:" + x + " with " + y);
- return (x == null && y == null)
- || (x != null && y != null && BrokerUtil.sameStringValue(x.getNamespaceURI(), y.getNamespaceURI()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WSMGParameter.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WSMGParameter.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WSMGParameter.java
deleted file mode 100644
index 06d435a..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WSMGParameter.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.config;
-
-import org.apache.airavata.wsmg.commons.storage.WsmgQueue;
-
-public class WSMGParameter {
-
- /**
- * Global variable for the Out Going queue (contains message to send to subscribers)
- */
- public static WsmgQueue OUT_GOING_QUEUE = null; // default=null
-
- public static final boolean testOutGoingQueueMaxiumLength = false; // default=false
-
- // enable or disable the TimerThread that displays the message rate
- public static final boolean measureMessageRate = false; // default=false
-
- public static final boolean enableAutoCleanSubscriptions = false; // default=true
-
- 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 boolean showTrackId = false;
- public static final String versionSetUpNote = "Added_Sub_Timeout";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WsmgConfigurationContext.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WsmgConfigurationContext.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WsmgConfigurationContext.java
deleted file mode 100644
index c12f460..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/config/WsmgConfigurationContext.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.config;
-
-import java.util.LinkedList;
-import java.util.List;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-import org.apache.airavata.wsmg.broker.NotificationProcessor;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionManager;
-import org.apache.airavata.wsmg.commons.config.ConfigurationManager;
-import org.apache.airavata.wsmg.commons.storage.WsmgQueue;
-import org.apache.airavata.wsmg.commons.storage.WsmgStorage;
-import org.apache.airavata.wsmg.matching.AbstractMessageMatcher;
-import org.apache.airavata.wsmg.matching.XPath.YFilterMessageMatcher;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-
-public class WsmgConfigurationContext {
-
- private OutGoingQueue outgoingQueue = null;
-
- private List<AbstractMessageMatcher> messageMatchers = new LinkedList<AbstractMessageMatcher>();
-
- private ReentrantReadWriteLock messegeMatchersLock = new ReentrantReadWriteLock();
-
- private ConfigurationManager configurationManager;
-
- private SubscriptionManager subscriptionMan;
-
- private NotificationProcessor notificationProcessor;
-
- private WsmgStorage storage;
-
- private WsmgQueue queue;
-
- public WsmgConfigurationContext() {
- outgoingQueue = new OutGoingQueue();
- setDirectFilter();
- }
-
- private void setDirectFilter() {
- messageMatchers.add(new YFilterMessageMatcher());
- // messageMatchers.add(new DirectWsntMessageMatcher(subscriptions,
- // publisherRegistrationDB));
- }
-
- public List<AbstractMessageMatcher> getMessageMatchers() {
- return messageMatchers;
- }
-
- 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 WsmgQueue getQueue() {
- return queue;
- }
-
- public void setQueue(WsmgQueue s) {
- queue = s;
- }
-
- public ReentrantReadWriteLock getMessegeMatcherLock() {
- return messegeMatchersLock;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/AbstractMessageMatcher.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/AbstractMessageMatcher.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/AbstractMessageMatcher.java
deleted file mode 100644
index dbd16f6..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/AbstractMessageMatcher.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching;
-
-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 org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-
-public abstract class AbstractMessageMatcher {
-
- protected Map<String, String> currentMessageCache;
-
- private ReentrantReadWriteLock consumerListLock = new ReentrantReadWriteLock();
-
- // infer types of
- // key and value
- public AbstractMessageMatcher() {
- 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 using 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 void 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();
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterInfo.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterInfo.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterInfo.java
deleted file mode 100644
index 1881968..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterInfo.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.broker.ConsumerList;
-import org.apache.airavata.wsmg.broker.ConsumerListManager;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-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 static final Logger logger = LoggerFactory.getLogger(YFilterInfo.class);
-
- 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;
-
- 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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterMessageMatcher.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterMessageMatcher.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterMessageMatcher.java
deleted file mode 100644
index 0f59ec1..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/XPath/YFilterMessageMatcher.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.broker.ConsumerList;
-import org.apache.airavata.wsmg.broker.ConsumerListManager;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.matching.AbstractMessageMatcher;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class YFilterMessageMatcher extends AbstractMessageMatcher {
-
- private static final Logger logger = LoggerFactory.getLogger(YFilterMessageMatcher.class);
-
- private OutGoingQueue outGoingQueue = null;
-
- private HashMap<String, YFilterInfo> topicToYFilterInfo = new HashMap<String, YFilterInfo>();
- private HashMap<String, String> subIdToTopic = new HashMap<String, String>();
-
- // used for topic only subscription, so that we don't have to create a
- // YFilter object
- private ConsumerListManager consumerListmanager = new ConsumerListManager();
-
- public YFilterMessageMatcher() {
- super();
- }
-
- 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 void 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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java
deleted file mode 100644
index ba50e45..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/matching/simpleTopic/DirectWsntMessageMatcher.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.simpleTopic;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.broker.ConsumerList;
-import org.apache.airavata.wsmg.broker.ConsumerListManager;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.matching.AbstractMessageMatcher;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DirectWsntMessageMatcher extends AbstractMessageMatcher {
-
- private static final Logger logger = LoggerFactory.getLogger(DirectWsntMessageMatcher.class);
-
- private ConsumerListManager consumerListmanager = new ConsumerListManager();
-
- private OutGoingQueue outGoingQueue = null;
-
- public DirectWsntMessageMatcher() {
- super();
- }
-
- public void start(String carrierLocation) {
- currentMessageCache = new Hashtable<String, String>();
- }
-
- public void handleSubscribe(SubscriptionState subscribeRequest, String subscriptionId) {
-
- String topicExpression = subscribeRequest.getLocalTopic();
- if (topicExpression == null || topicExpression.length() == 0) {
- logger.error("ERROR:WsntAdapterConnection creation failed.");
- return;
- }
-
- writeLockUnlockConsumers(true);
-
- try {
- consumerListmanager.addToConsumerList(topicExpression, subscribeRequest, subscriptionId);
- if (outGoingQueue == null) {
- outGoingQueue = subscribeRequest.getOutGoingQueue();
- }
- } finally {
- writeLockUnlockConsumers(false);
- }
-
- return;
-
- }
-
- 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);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/ConsumerUrlManager.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/ConsumerUrlManager.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/ConsumerUrlManager.java
deleted file mode 100644
index c9b255f..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/ConsumerUrlManager.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger;
-
-import java.net.NoRouteToHostException;
-import java.net.SocketTimeoutException;
-import java.util.Map.Entry;
-import java.util.Timer;
-import java.util.TimerTask;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.config.ConfigurationManager;
-import org.apache.airavata.wsmg.util.RunTimeStatistics;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConsumerUrlManager {
-
- private static final Logger logger = LoggerFactory.getLogger(ConsumerUrlManager.class);
-
- private ConcurrentHashMap<String, FailedConsumerInfo> failedConsumerUrls = new ConcurrentHashMap<String, FailedConsumerInfo>();
-
- private final int defaultMaxRetry;
-
- private long expireTimeGap; // milliseconds
-
- private Timer cleanupTimer;
-
- public ConsumerUrlManager(ConfigurationManager config) {
-
- defaultMaxRetry = config.getConfig(WsmgCommonConstants.CONFIG_MAX_MESSAGE_DELIVER_RETRIES, 2);
-
- // time is in milliseconds
- expireTimeGap = 1000 * 60 * config.getConfig(WsmgCommonConstants.CONFIG_CONSUMER_URL_EXPIRATION_TIME_GAP, 5l);
-
- // 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(), 0, timerThreadInterval);
- }
-
- public void stop() {
- logger.info("Stop ConsumerUrlManager");
- if (this.cleanupTimer != null) {
- this.cleanupTimer.cancel();
- }
- logger.info("ConsumerUrlManager Stopped");
- }
-
- 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)) {
-
- synchronized (failedConsumerUrls) {
- 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);
- synchronized (failedConsumerUrls) {
-
- 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) {
- synchronized (failedConsumerUrls) {
- 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 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 {
-
- @Override
- public void run() {
-
- logger.debug("starting to clean up black listed consumer urls");
- long currentTime = System.currentTimeMillis();
-
- synchronized (failedConsumerUrls) {
- for (Entry<String, FailedConsumerInfo> entry : failedConsumerUrls.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.debug("finished cleaning black listed consumer urls");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/Deliverable.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/Deliverable.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/Deliverable.java
deleted file mode 100644
index 92b6cfe..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/Deliverable.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.airavata.wsmg.messenger;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.messenger.protocol.DeliveryProtocol;
-import org.apache.axiom.om.OMElement;
-
-public interface Deliverable {
- void setProtocol(DeliveryProtocol protocol);
-
- void send(ConsumerInfo consumerInfo, OMElement message, AdditionalMessageContent additionalMessageContent);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/DeliveryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/DeliveryProcessor.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/DeliveryProcessor.java
deleted file mode 100644
index 7eb5b4f..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/DeliveryProcessor.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.airavata.wsmg.messenger;
-
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.messenger.strategy.SendingStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DeliveryProcessor {
-
- private static final Logger logger = LoggerFactory.getLogger(DeliveryProcessor.class);
-
- private SendingStrategy strategy;
- private Deliverable deliverable;
-
- private boolean running;
- private Thread t;
-
- public DeliveryProcessor(Deliverable deliverable, SendingStrategy strategy) {
- this.strategy = strategy;
- this.deliverable = deliverable;
- }
-
- public void start() {
- this.running = true;
- this.t = new Thread(new CheckingAndSending());
- this.t.start();
- }
-
- public void stop() {
- this.running = false;
-
- if (this.t != null) {
- this.t.interrupt();
-
- try {
- this.t.join();
- } catch (InterruptedException ie) {
- logger.error("Wait for sending thread to finish (join) is interrupted");
- }
- }
-
- WSMGParameter.OUT_GOING_QUEUE.dispose();
- }
-
- private class CheckingAndSending implements Runnable {
-
- public void run() {
- strategy.init();
- while (running) {
- logger.debug("run - delivery thread");
- try {
-
- OutGoingMessage outGoingMessage = (OutGoingMessage) WSMGParameter.OUT_GOING_QUEUE.blockingDequeue();
-
- if (WSMGParameter.showTrackId)
- logger.debug(outGoingMessage.getAdditionalMessageContent().getTrackId()
- + ": dequeued from outgoing queue");
-
- strategy.addMessageToSend(outGoingMessage, deliverable);
-
- } catch (Exception e) {
- logger.warn("Unexpected_exception:");
- }
- }
- logger.debug("Shutdown Strategy");
- strategy.shutdown();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/OutGoingQueue.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/OutGoingQueue.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/OutGoingQueue.java
deleted file mode 100644
index 6764a42..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/OutGoingQueue.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger;
-
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.util.Counter;
-import org.apache.airavata.wsmg.util.TimerThread;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class OutGoingQueue {
-
- private static final Logger logger = LoggerFactory.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 Queue 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;
- }else{
- loop = false;
- }
- } while (loop);
-
- }
-}
[07/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/pom.xml b/modules/ws-messenger/messagebox/pom.xml
deleted file mode 100644
index 7b7da69..0000000
--- a/modules/ws-messenger/messagebox/pom.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-ws-messenger</artifactId>
- <version>0.12-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-message-box</artifactId>
- <packaging>jar</packaging>
- <name>Airavata Message Box</name>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- Test -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-client</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- Axis2 for test only -->
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-local</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <build>
- <defaultGoal>install</defaultGoal>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${antrun.version}</version><!--$NO-MVN-MAN-VER$-->
- <executions>
- <execution>
- <id>restore-persistence</id>
- <phase>prepare-package</phase>
- <configuration>
- <tasks>
- <copy file="${project.build.outputDirectory}/services.xml" tofile="${project.build.outputDirectory}/META-INF/services.xml" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceLifeCycle.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceLifeCycle.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceLifeCycle.java
deleted file mode 100644
index 0876ae9..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceLifeCycle.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import java.net.URI;
-
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.client.tools.PeriodicExecutorThread;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.ServiceUtils;
-import org.apache.airavata.wsmg.commons.config.ConfigurationManager;
-import org.apache.airavata.wsmg.commons.util.Axis2Utils;
-import org.apache.airavata.wsmg.msgbox.Storage.MsgBoxStorage;
-import org.apache.airavata.wsmg.msgbox.Storage.dbpool.DatabaseStorageImpl;
-import org.apache.airavata.wsmg.msgbox.Storage.memory.InMemoryImpl;
-import org.apache.airavata.wsmg.msgbox.util.ConfigKeys;
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxCommonConstants;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.ServiceLifeCycle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class initialize the messageBox service by setting the messageStore based on the configuration done by the user
- * This is the LifeCycle class
- */
-public class MsgBoxServiceLifeCycle implements ServiceLifeCycle {
-
- private static final Logger logger = LoggerFactory.getLogger(MsgBoxServiceLifeCycle.class);
-// private static final String CONFIGURATION_FILE_NAME = "airavata-server.properties";
- private static final String TRUE = Boolean.toString(true);
-// public static final String REPOSITORY_PROPERTIES = "airavata-server.properties";
- public static final int GFAC_URL_UPDATE_INTERVAL = 1000 * 60 * 60 * 3;
-
- public static final int JCR_AVAIALABILITY_WAIT_INTERVAL = 1000 * 10;
- public static final String JCR_CLASS = "jcr.class";
- public static final String JCR_USER = "jcr.user";
- public static final String JCR_PASS = "jcr.pass";
- public static final String ORG_APACHE_JACKRABBIT_REPOSITORY_URI = "org.apache.jackrabbit.repository.uri";
- private static final String MESSAGE_BOX_SERVICE_NAME = "MsgBoxService";
- private static final String SERVICE_URL = "message_box_service_url";
- private static final String JCR_REGISTRY = "registry";
- private Thread thread;
-
- public void shutDown(ConfigurationContext configurationcontext, AxisService axisservice) {
- logger.info("Message box shutting down");
- AiravataAPI registry = (AiravataAPI) configurationcontext.getProperty(JCR_REGISTRY);
- if (registry != null && thread != null) {
- try {
- registry.getAiravataManager().unsetMessageBoxURI();
- } catch (AiravataAPIInvocationException e) {
- logger.error(e.getMessage(), e);
- }
- thread.interrupt();
- try {
- thread.join();
- } catch (InterruptedException e) {
- logger.info("Message box url update thread is interrupted");
- }
- }
- if (configurationcontext.getProperty(MsgBoxCommonConstants.MSGBOX_STORAGE) != null) {
- MsgBoxStorage msgBoxStorage = (MsgBoxStorage) configurationcontext
- .getProperty(MsgBoxCommonConstants.MSGBOX_STORAGE);
- msgBoxStorage.dispose();
- }
- }
-
- public void startUp(ConfigurationContext configurationcontext, AxisService axisservice) {
- AiravataUtils.setExecutionAsServer();
- Axis2Utils.overrideAddressingPhaseHander(configurationcontext, new StoreMessageHandler());
-
- // Load the configuration file from the classpath
- ConfigurationManager confmanager = new ConfigurationManager();
- initDatabase(configurationcontext, confmanager);
- configurationcontext.setProperty(ConfigKeys.MSG_PRESV_INTERVAL,getIntervaltoExecuteDelete(confmanager));
- final ConfigurationContext context=configurationcontext;
- new Thread(){
- @Override
- public void run() {
-// Properties properties = new Properties();
- try {
-// URL url = this.getClass().getClassLoader().getResource(REPOSITORY_PROPERTIES);
-// properties.load(url.openStream());
-// Map<String, String> map = new HashMap<String, String>((Map) properties);
- try {
- Thread.sleep(JCR_AVAIALABILITY_WAIT_INTERVAL);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
-
- String userName = ServerSettings.getSystemUser();
- String gateway = ServerSettings.getSystemUserGateway();
-
- AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(gateway, userName);
- String localAddress = ServiceUtils.generateServiceURLFromConfigurationContext(context, MESSAGE_BOX_SERVICE_NAME);
- logger.debug("MESSAGE BOX SERVICE_ADDRESS:" + localAddress);
- context.setProperty(SERVICE_URL,new URI(localAddress));
- context.setProperty(JCR_REGISTRY,airavataAPI);
- /*
- * Heart beat message to registry
- */
- thread = new MsgBoxURLRegisterThread(airavataAPI, context);
- thread.start();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- }.start();
- }
-
- public void initDatabase(ConfigurationContext configurationcontext, ConfigurationManager confmanager) {
- /*
- * Determine Storage
- */
- String useDatabase = confmanager.getConfig(ConfigKeys.USE_DATABASE_STORAGE, TRUE);
- MsgBoxStorage msgBoxStorage = null;
- long time = getInterval(confmanager);
- if (useDatabase.equalsIgnoreCase(TRUE)) {
- String jdbcUrl = confmanager.getConfig(ConfigKeys.MSG_BOX_JDBC_URL);
- String jdbcDriver = confmanager.getConfig(ConfigKeys.MSG_BOX_JDBC_DRIVER);
- msgBoxStorage = new DatabaseStorageImpl(jdbcUrl, jdbcDriver, time);
- } else {
- msgBoxStorage = new InMemoryImpl(time);
- }
- configurationcontext.setProperty(MsgBoxCommonConstants.MSGBOX_STORAGE, msgBoxStorage);
-
- }
-
- private long getInterval(ConfigurationManager configs) {
- int messagePreservationDays = configs.getConfig(ConfigKeys.MSG_PRESV_DAYS, 2);
- int messagePreservationHours = configs.getConfig(ConfigKeys.MSG_PRESV_HRS, 0);
- int messagePreservationMinutes = configs.getConfig(ConfigKeys.MSG_PRESV_MINS, 0);
-
- long interval = messagePreservationDays * 24l;
- interval = (interval + messagePreservationHours) * 60;
- interval = (interval + messagePreservationMinutes) * 60;
- interval = interval * 1000;
- return interval;
- }
-
- private long getIntervaltoExecuteDelete(ConfigurationManager configs) {
- int messagePreservationDays = configs.getConfig(ConfigKeys.MSG_PRESV_INTERVAL_DAYS, 0);
- int messagePreservationHours = configs.getConfig(ConfigKeys.MSG_PRESV_INTERVAL_HRS, 0);
- int messagePreservationMinutes = configs.getConfig(ConfigKeys.MSG_PRESV_INTERVAL_MINS, 5);
-
- long interval = messagePreservationDays * 24l;
- interval = (interval + messagePreservationHours) * 60;
- interval = (interval + messagePreservationMinutes) * 60;
- interval = interval * 1000;
- return interval;
- }
-
- class MsgBoxURLRegisterThread extends PeriodicExecutorThread {
- private ConfigurationContext context = null;
-
- MsgBoxURLRegisterThread(AiravataAPI registry, ConfigurationContext context) {
- super(registry);
- this.context = context;
- }
-
- @Override
- protected void updateRegistry(AiravataAPI registry) throws Exception {
- URI localAddress = (URI) this.context.getProperty(SERVICE_URL);
- registry.getAiravataManager().setMessageBoxURI(localAddress);
- logger.debug("Updated Message box service URL in to Repository");
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceMessageReceiverInOut.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceMessageReceiverInOut.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceMessageReceiverInOut.java
deleted file mode 100644
index cf18f49..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceMessageReceiverInOut.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxOperations;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.receivers.AbstractInOutMessageReceiver;
-import org.apache.axis2.transport.http.HTTPConstants;
-import org.apache.axis2.util.JavaUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * MsgBoxServiceMessageReceiverInOut message receiver, this is the actual location where the service operations get
- * invoked.
- */
-
-public class MsgBoxServiceMessageReceiverInOut extends AbstractInOutMessageReceiver {
-
- private static Logger logger = LoggerFactory.getLogger(MsgBoxServiceMessageReceiverInOut.class);
-
- public void invokeBusinessLogic(MessageContext inMsgContext, MessageContext outMsgContext) throws AxisFault {
-
- // get the implementation class for the Web Service
- MsgBoxServiceSkeleton skel = (MsgBoxServiceSkeleton) getTheImplementationObject(inMsgContext);
-
- OMElement response = null;
-
- try {
-
- String operationName = getOperationName(inMsgContext);
- MsgBoxOperations msgType = MsgBoxOperations.valueFrom(operationName);
-
- switch (msgType) {
-
- case STORE_MSGS: {
- SOAPEnvelope enlp = inMsgContext.getEnvelope();
- OMElement message = enlp.getBody().getFirstElement();
- String msgBoxId = getClientId(inMsgContext);
- String messageId = inMsgContext.getMessageID();
- String soapAction = inMsgContext.getSoapAction();
- response = skel.storeMessages(msgBoxId, messageId, soapAction, message);
- break;
- }
-
- case DESTROY_MSGBOX: {
- String msgBoxId = getClientId(inMsgContext);
- response = skel.destroyMsgBox(msgBoxId);
- break;
- }
-
- case TAKE_MSGS: {
- String msgBoxId = getClientId(inMsgContext);
- response = skel.takeMessages(msgBoxId);
- break;
- }
-
- case CREATE_MSGBOX: {
- response = skel.createMsgBox();
- break;
- }
- default:
- throw new AxisFault("unsupported operation" + msgType.toString());
- }
-
- } catch (AxisFault afe) {
- throw afe;
- } catch (Exception e) {
- logger.error("Exception", e);
- throw new AxisFault("Exception in Message Box ", e);
- }
-
- /*
- * Output
- */
- SOAPFactory soapFactory = getSOAPFactory(inMsgContext);
- SOAPEnvelope envelope = toEnvelope(soapFactory, response);
- outMsgContext.setEnvelope(envelope);
- outMsgContext.getOptions().setProperty(HTTPConstants.CHUNKED, Boolean.FALSE);
- }
-
- private String getClientId(MessageContext inMsg) throws AxisFault {
- String toAddress = inMsg.getTo().getAddress();
- int biginIndex = toAddress.indexOf("clientid");
- if (biginIndex == -1) {
- throw new AxisFault("clientid cannot be found");
- }
- String clientId = toAddress.substring(biginIndex + "clientid".length() + 1);
- return clientId;
- }
-
- private SOAPEnvelope toEnvelope(SOAPFactory factory, OMElement response) {
- SOAPEnvelope envelop = factory.getDefaultEnvelope();
- envelop.getBody().addChild(response);
- return envelop;
- }
-
- protected String getOperationName(MessageContext inMsg) throws AxisFault {
-
- AxisOperation op = inMsg.getOperationContext().getAxisOperation();
- if (op == null) {
- throw new AxisFault(
- "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
- }
-
- String operationName = null;
- if ((op.getName() == null) || ((operationName = JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) {
- throw new AxisFault("invalid operation found");
- }
-
- return operationName;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java
deleted file mode 100644
index a2eb271..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/MsgBoxServiceSkeleton.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import java.io.StringReader;
-import java.sql.SQLException;
-import java.util.List;
-
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.msgbox.Storage.MsgBoxStorage;
-import org.apache.airavata.wsmg.msgbox.util.ConfigKeys;
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxCommonConstants;
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxUtils;
-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.context.ServiceContext;
-import org.apache.axis2.service.Lifecycle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import sun.beans.editors.LongEditor;
-
-/**
- * Service class for MsgBoxService this get called by MsgBoxServiceMessageReceiverInOut with ProcessingContext
- */
-public class MsgBoxServiceSkeleton implements Lifecycle {
-
- private static final Logger logger = LoggerFactory.getLogger(MsgBoxServiceSkeleton.class);
- private static final String TRUE = Boolean.toString(true);
- private static final String FALSE = Boolean.toString(false);
- private static OMFactory factory = OMAbstractFactory.getOMFactory();
- private MsgBoxStorage storage;
- private Thread deletingThread;
- private boolean stop;
-
- public void init(ServiceContext context) throws AxisFault {
- this.storage = (MsgBoxStorage) context.getConfigurationContext().getProperty(
- MsgBoxCommonConstants.MSGBOX_STORAGE);
- logger.debug("Starting cleanup thread for Message Box...");
- deletingThread = new Thread(new DeleteOldMessageRunnable(context.getConfigurationContext().getProperty(ConfigKeys.MSG_PRESV_INTERVAL)));
- deletingThread.start();
- }
-
- public void destroy(ServiceContext context) {
- this.storage = null;
-
- // stop Deleting thread
- this.stop = true;
- this.deletingThread.interrupt();
-
- try {
- deletingThread.join();
- } catch (Exception e) {
- logger.error("Cannot shutdown cleanup thread", e);
- }
- }
-
- public OMElement createMsgBox() throws Exception {
- try {
- String createdMsgBoxId = storage.createMsgBox();
-
- logger.debug("MsgBox created:" + createdMsgBoxId);
-
- /*
- * Output response
- */
- OMElement dd = factory.createOMElement(MsgBoxQNameConstants.CREATE_MSGBOX_RESP_QNAME);
- OMElement url = factory.createOMElement(MsgBoxQNameConstants.MSG_BOXID_QNAME);
- url.setText(createdMsgBoxId);
- dd.addChild(url);
- return dd;
- } catch (Exception e) {
- logger.error("Error creating the message box", e);
- AxisFault f = new AxisFault("Error creating the message box", "6000", e);
- throw f;
- }
-
- }
-
- public OMElement storeMessages(String msgBoxAddr, String messageID, String soapAction, OMElement message)
- throws Exception {
- OMElement resp = factory.createOMElement(MsgBoxQNameConstants.STOREMSG_RESP_QNAME);
- OMElement status = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_STATUS_QNAME);
- try {
- storage.putMessageIntoMsgBox(msgBoxAddr, messageID, soapAction, message);
-
- logger.debug("Put Message to MsgBox:" + msgBoxAddr + " with messageID:" + messageID);
-
- status.setText(TRUE);
- } catch (SQLException e) {
- logger.error("Error while storing message: " + message + " in msgbx: " + msgBoxAddr, e);
- status.setText(FALSE);
-
- // FIXME: Should we throw exception?? or client will read false
- // status
- }
- resp.addChild(status);
- resp.declareNamespace(NameSpaceConstants.MSG_BOX);
- return resp;
- }
-
- public OMElement takeMessages(String msgBoxAddr) throws Exception {
- try {
- OMElement respEl = factory.createOMElement(MsgBoxQNameConstants.TAKE_MSGBOX_RESP_QNAME);
- OMElement messageSet = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_MESSAGE_QNAME);
-
- List<String> list = storage.takeMessagesFromMsgBox(msgBoxAddr);
- if (list != null && list.size() != 0) {
- for (String string : list) {
- messageSet.addChild(MsgBoxUtils.reader2OMElement(new StringReader(string)));
- }
- logger.debug("Take all messages from MsgBox:" + msgBoxAddr);
- } else {
- logger.debug(" no messages.. ");
- }
- respEl.addChild(messageSet);
- respEl.declareNamespace(NameSpaceConstants.MSG_BOX);
- return respEl;
- } catch (Exception e) {
- logger.error("Error taking mesages of message box: " + msgBoxAddr, e);
- throw e;
- }
- }
-
- public OMElement destroyMsgBox(String msgBoxAddr) throws Exception {
- OMElement respEl = factory.createOMElement(MsgBoxQNameConstants.DESTROY_MSGBOX_RESP_QNAME);
- OMElement statusEl = factory.createOMElement(MsgBoxQNameConstants.MSGBOX_STATUS_QNAME);
- String addr = msgBoxAddr;
- try {
- storage.destroyMsgBox(addr);
- logger.debug("Destry MsgBox:" + msgBoxAddr);
- statusEl.setText(TRUE);
- } catch (Exception e) {
- logger.warn("Error while delete msgbx: " + msgBoxAddr, e);
- statusEl.setText(FALSE);
-
- // FIXME: Should we throw exception?? or client will read false
- // status
- }
- respEl.addChild(statusEl);
- return respEl;
- }
-
- class DeleteOldMessageRunnable implements Runnable {
- long longInterval = 60 * 60 * 1000;
- DeleteOldMessageRunnable(Object inveral){
- longInterval = (Long)inveral;
- }
- public void run() {
- while (!stop) {
- try {
- // try to remove old message
- if (storage != null) {
- storage.removeAncientMessages();
- }
- Thread.sleep(longInterval);
- } catch (Exception e) {
- logger.warn("Msgbox cleanup thread is interrupted to close");
- }
- }
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/MsgBoxStorage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/MsgBoxStorage.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/MsgBoxStorage.java
deleted file mode 100644
index e095e3c..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/MsgBoxStorage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.Storage;
-
-import java.util.List;
-
-import org.apache.axiom.om.OMElement;
-
-/**
- * Message Box storage backend. This has implemented in two ways in-memory and database.
- */
-public interface MsgBoxStorage {
- public String createMsgBox() throws Exception;
-
- public void destroyMsgBox(String key) throws Exception;
-
- /**
- * IMPORTANT::: List retrieved from this method is sorted by time in ascending order i.e the newest message will
- * appear as the last item in the list.
- *
- * @param key
- * @return
- * @throws Exception
- */
- public List<String> takeMessagesFromMsgBox(String key) throws Exception;
-
- public void putMessageIntoMsgBox(String msgBoxID, String messageID, String soapAction, OMElement message)
- throws Exception;
-
- /**
- * The ancientness is defined in the db.config file.
- */
- public void removeAncientMessages() throws Exception;
-
- /**
- * Clean up method
- */
- public void dispose();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/DatabaseStorageImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/DatabaseStorageImpl.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/DatabaseStorageImpl.java
deleted file mode 100644
index 2cec984..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/DatabaseStorageImpl.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.Storage.dbpool;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.sql.SQLNonTransientConnectionException;
-import java.util.List;
-import java.util.UUID;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.commons.storage.DatabaseCreator;
-import org.apache.airavata.wsmg.commons.storage.JdbcStorage;
-import org.apache.airavata.wsmg.msgbox.Storage.MsgBoxStorage;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Database message Storage Implementation, if airavata-server.properties configured to use database this will set as the storage
- * for MsgBoxSerivceSkeleton
- */
-public class DatabaseStorageImpl implements MsgBoxStorage {
-
- private static final Logger logger = LoggerFactory.getLogger(DatabaseStorageImpl.class);
-
- private static final String TABLE_NAME_TO_CHECK = "msgbox";
-
- private JdbcStorage db;
-
- public DatabaseStorageImpl(String jdbcUrl, String jdbcDriver, long timeOfOldMessage) {
- db = new JdbcStorage(10, 50, jdbcUrl, jdbcDriver, true);
-
- Connection conn = null;
- try {
-
- /*
- * Check database
- */
- conn = db.connect();
- if (!DatabaseCreator.isDatabaseStructureCreated(TABLE_NAME_TO_CHECK, conn)) {
- DatabaseCreator.createMsgBoxDatabase(conn);
- logger.info("New Database created for Message Box");
- } else {
- logger.debug("Database already created for Message Box!");
- }
-
- MessageBoxDB.initialize(db, timeOfOldMessage);
-
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new RuntimeException("Database failure");
- } finally {
- db.closeConnection(conn);
- }
- }
-
- public String createMsgBox() throws SQLException, IOException {
- String uuid = UUID.randomUUID().toString();
- MessageBoxDB.getInstance().createMsgBx(uuid);
- return uuid;
- }
-
- public void destroyMsgBox(String key) throws Exception {
- try {
- MessageBoxDB.getInstance().deleteMessageBox(key);
- } catch (SQLException e) {
- throw new Exception("Could not destroy the message box with key " + key, e);
- }
- }
-
- public List<String> takeMessagesFromMsgBox(String key) throws Exception {
- List<String> list = null;
-
- try {
- list = MessageBoxDB.getInstance().removeAllMessagesforClient(key);
-
- }catch(SQLNonTransientConnectionException e){
- logger.warn("Database connection is interrupted");
- } catch (SQLException e) {
- throw new Exception("Error reading the message with the key " + key, e);
- } catch (IOException e) {
- throw new Exception("Error reading the message with the key " + key, e);
- }
-
- return list;
- }
-
- public void putMessageIntoMsgBox(String msgBoxID, String messageID, String soapAction, OMElement message)
- throws SQLException, IOException, XMLStreamException {
- MessageBoxDB.getInstance().addMessage(msgBoxID, messageID, soapAction, message);
- }
-
- public void removeAncientMessages() throws Exception {
- MessageBoxDB.getInstance().removeAncientMessages();
- }
-
- public void dispose() {
- if (db != null) {
- db.closeAllConnections();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/MessageBoxDB.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/MessageBoxDB.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/MessageBoxDB.java
deleted file mode 100644
index 9cf15c8..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/dbpool/MessageBoxDB.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.Storage.dbpool;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.commons.storage.JdbcStorage;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is the core class which used by DatabaseStorageImpl to perform all the service operations, DatabaseStorageImpl
- * class simply use this class in its operation methods to perform the actual functionality.
- */
-public class MessageBoxDB {
-
- private static final String MSGBOXES_TABLENAME = "msgBoxes";
- private static final String MSGBOX_TABLENAME = "msgbox";
-
- private static final String MSGBOX_TABLE_ID = "MSGBOXID";
-
- private static final Logger logger = LoggerFactory.getLogger(MessageBoxDB.class);
-
- private static Set<String> msgBoxids;
-
- public static final String SELECT_ALL_FROM_MSGBOXES = "SELECT * FROM " + MSGBOXES_TABLENAME;
-
- public static final String SQL_CREATE_MSGBOXES_STATEMENT = "INSERT INTO " + MSGBOXES_TABLENAME
- + " (msgboxid) VALUES (?)";
-
- public static final String SQL_DELETE_MSGBOXES_STATEMENT = "DELETE FROM " + MSGBOXES_TABLENAME
- + " WHERE msgboxid = ?";
-
- public static final String SQL_STORE_MESSAGE_STATEMENT = "INSERT INTO " + MSGBOX_TABLENAME
- + " (content, msgboxid, messageid,soapaction) VALUES (?,?,?,?)";
-
- public static final String SQL_SELECT_MSGBOX_STATEMENT = "SELECT * FROM " + MSGBOX_TABLENAME
- + " WHERE msgboxid = ? ORDER BY time";
-
- public static final String SQL_DELETE_MSGBOX_STATEMENT = "DELETE FROM " + MSGBOX_TABLENAME + " WHERE msgboxid = ?";
-
- public static final String SQL_DELETE_ANCIENT_STATEMENT = "DELETE FROM " + MSGBOX_TABLENAME
- + " WHERE {fn TIMESTAMPDIFF(SQL_TSI_SECOND, time, CURRENT_TIMESTAMP) }*1000000 > ?";
-
- private JdbcStorage db;
-
- private static MessageBoxDB instance;
-
- private long time;
-
- private MessageBoxDB(JdbcStorage db, long time) {
- this.db = db;
- this.time = time;
- }
-
- public static synchronized MessageBoxDB initialize(JdbcStorage db, long time) throws SQLException {
- if (instance == null) {
- instance = new MessageBoxDB(db, time);
- setMsgBoxidList(db);
- }
- return instance;
- }
-
- public static MessageBoxDB getInstance() {
- if (instance == null) {
- throw new RuntimeException("Please initialize this object first using initialize(JdbcStorage, long)");
- }
- return instance;
- }
-
- public synchronized void createMsgBx(String messageBoxId) throws SQLException, IOException {
- if (!msgBoxids.contains(messageBoxId)) {
-
- Connection connection = null;
- try {
- logger.debug(MSGBOXES_TABLENAME + ":" + messageBoxId);
-
- connection = db.connect();
- PreparedStatement statement = connection.prepareStatement(SQL_CREATE_MSGBOXES_STATEMENT);
- statement.setString(1, messageBoxId);
- db.executeUpdateAndClose(statement);
- db.commitAndFree(connection);
-
- msgBoxids.add(messageBoxId);
-
- } catch (SQLException sql) {
- db.rollbackAndFree(connection);
- throw sql;
- }
- } else {
- throw new IOException("The message box ID requested already exists");
- }
- }
-
- public synchronized void addMessage(String msgBoxID, String messageID, String soapAction, OMElement message)
- throws SQLException, IOException, XMLStreamException {
- if (msgBoxids.contains(msgBoxID)) {
-
- Connection connection = null;
- try {
- connection = db.connect();
- PreparedStatement stmt = connection.prepareStatement(SQL_STORE_MESSAGE_STATEMENT);
- ByteArrayOutputStream output = new ByteArrayOutputStream();
- ObjectOutputStream out = new ObjectOutputStream(output);
- out.writeObject(message.toStringWithConsume());
- byte[] buffer = output.toByteArray();
- ByteArrayInputStream in = new ByteArrayInputStream(buffer);
- stmt.setBinaryStream(1, in, buffer.length);
- stmt.setString(2, msgBoxID);
- stmt.setString(3, messageID);
- stmt.setString(4, soapAction);
-
- db.executeUpdateAndClose(stmt);
- db.commitAndFree(connection);
-
- } catch (SQLException sql) {
- db.rollbackAndFree(connection);
- throw sql;
- }
- } else {
- throw new IOException("Currently a messagebox is not available with given message box id :" + msgBoxID + message.toStringWithConsume());
- }
- }
-
- public synchronized void deleteMessageBox(String msgBoxId) throws SQLException {
-
- if (msgBoxids.contains(msgBoxId)) {
-
- Connection connection = null;
- try {
- connection = db.connect();
- PreparedStatement statement = connection.prepareStatement(SQL_DELETE_MSGBOXES_STATEMENT);
- statement.setString(1, msgBoxId);
- db.executeUpdateAndClose(statement);
- statement = connection.prepareStatement(SQL_DELETE_MSGBOX_STATEMENT);
- statement.setString(1, msgBoxId);
- db.executeUpdateAndClose(statement);
-
- // commit
- db.commitAndFree(connection);
-
- // remove from set
- msgBoxids.remove(msgBoxId);
-
- } catch (SQLException sql) {
- db.rollbackAndFree(connection);
- throw sql;
- }
- }
- }
-
- public synchronized List<String> removeAllMessagesforClient(String msgBoxId) throws SQLException, IOException,
- ClassNotFoundException, XMLStreamException {
- ArrayList<String> list = new ArrayList<String>();
- if (msgBoxids.contains(msgBoxId)) {
-
- Connection connection = null;
- PreparedStatement stmt = null;
- PreparedStatement stmt2 = null;
- try {
- connection = db.connect();
- stmt = connection.prepareStatement(SQL_SELECT_MSGBOX_STATEMENT);
- stmt.setString(1, msgBoxId);
- ResultSet resultSet = stmt.executeQuery();
- while (resultSet.next()) {
- InputStream in = resultSet.getAsciiStream("content");
- ObjectInputStream s = new ObjectInputStream(in);
- String xmlString = (String) s.readObject();
- logger.debug(xmlString);
- list.add(xmlString);
- }
-
- /*
- * Delete all retrieved messages
- */
- stmt2 = connection.prepareStatement(SQL_DELETE_MSGBOX_STATEMENT);
- stmt2.setString(1, msgBoxId);
- stmt2.executeUpdate();
-
- // commit
- db.commit(connection);
- } catch(SQLNonTransientConnectionException e){
- logger.warn("Database connection is interrupted");
- } catch (SQLException sql) {
- db.rollback(connection);
- throw sql;
- } finally {
-
- /*
- * If there is error during query, close everything and throw error
- */
- db.quietlyClose(connection, stmt, stmt2);
- }
- }
- return list;
- }
-
- public synchronized void removeAncientMessages() {
- Connection connection = null;
- try {
- connection = db.connect();
- PreparedStatement stmt = connection.prepareStatement(SQL_DELETE_ANCIENT_STATEMENT);
- stmt.setLong(1, this.time);
- db.executeUpdateAndCloseWithPrintLogMessages(stmt, false);
- db.commitAndFree(connection);
- } catch (SQLException sql) {
- db.rollbackAndFree(connection);
- logger.error("Caught exception while removing old entries from msgbox db table", sql);
- }
- }
-
- private static void setMsgBoxidList(JdbcStorage db) throws SQLException {
- msgBoxids = new HashSet<String>();
-
- Connection connection = null;
- PreparedStatement stmt = null;
- try {
- connection = db.connect();
- stmt = connection.prepareStatement(SELECT_ALL_FROM_MSGBOXES);
- ResultSet resultSet = stmt.executeQuery();
- while (resultSet.next()) {
- msgBoxids.add(resultSet.getString("msgboxid"));
- }
- db.commit(connection);
- } catch (SQLException e) {
- db.rollback(connection);
- throw e;
- } finally {
- db.quietlyClose(connection, stmt);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/memory/InMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/memory/InMemoryImpl.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/memory/InMemoryImpl.java
deleted file mode 100644
index 7406ce4..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/Storage/memory/InMemoryImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.Storage.memory;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.airavata.wsmg.msgbox.Storage.MsgBoxStorage;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is the in memory storage implementation for MsgBoxService, this will be initialized if airavata-server.properties is
- * configured not to use database implementation.
- */
-public class InMemoryImpl implements MsgBoxStorage {
- private static final Logger logger = LoggerFactory.getLogger(InMemoryImpl.class);
-
- private HashMap<String, List<Content>> map = new HashMap<String, List<Content>>();
-
- private long time;
-
- public InMemoryImpl(long time) {
- this.time = time;
- }
-
- public String createMsgBox() throws Exception {
- synchronized (map) {
- String clientid = UUID.randomUUID().toString();
- if (map.containsKey(clientid))
- throw new Exception("Message Box is existed with key:" + clientid);
- map.put(clientid, new ArrayList<Content>());
- return clientid;
- }
- }
-
- public void destroyMsgBox(String key) throws Exception {
- synchronized (map) {
- map.remove(key);
- }
- }
-
- public List<String> takeMessagesFromMsgBox(String key) throws Exception {
- synchronized (map) {
- List<Content> x = map.get(key);
- ArrayList<String> result = new ArrayList<String>(x.size());
- for (Content content : x) {
- result.add(content.getContent());
- }
- map.put(key, new ArrayList<Content>());
- return result;
- }
- }
-
- public void putMessageIntoMsgBox(String msgBoxID, String messageID, String soapAction, OMElement message)
- throws Exception {
- synchronized (map) {
- if (!map.containsKey(msgBoxID)) {
- throw new IllegalArgumentException("no message box with key " + msgBoxID + " to store the msg");
- }
- List<Content> list = map.get(msgBoxID);
- list.add(new Content(message.toStringWithConsume(), System.currentTimeMillis()));
- logger.debug("Message Stored in list with key " + msgBoxID);
- }
- }
-
- public void removeAncientMessages() {
- /*
- * O(n^2) algorithms. Better performance can be achieved with more Cache.
- */
- synchronized (map) {
- long currentTime = System.currentTimeMillis();
- Iterator<List<Content>> it = map.values().iterator();
- while (it.hasNext()) {
- Iterator<Content> itToRemove = it.next().iterator();
- while (itToRemove.hasNext()) {
- Content content = itToRemove.next();
- if (currentTime - this.time > content.getTime()) {
- itToRemove.remove();
- }
- }
- }
- }
- }
-
- public void dispose() {
- synchronized (map) {
- map.clear();
- }
- }
-
- class Content {
- private String content;
- private long time;
-
- public Content(String content, long time) {
- this.content = content;
- this.time = time;
- }
-
- public String getContent() {
- return content;
- }
-
- public long getTime() {
- return time;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java
deleted file mode 100644
index 51a60ae..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/StoreMessageHandler.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import java.util.List;
-
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingFaultsHelper;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.dispatchers.AddressingBasedDispatcher;
-import org.apache.axis2.engine.Phase;
-import org.apache.axis2.util.JavaUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This Dispatcher is used to validate the incoming message, this is set to Handler list in MsgBoxServiceLifeCycle.
- */
-public class StoreMessageHandler extends AddressingBasedDispatcher {
- private static final Logger logger = LoggerFactory.getLogger(StoreMessageHandler.class);
- private static final String WSMG_MSGSTORE_SOAP_ACTION = MsgBoxQNameConstants.STOREMSG_QNAME.getNamespaceURI()
- + MsgBoxQNameConstants.STOREMSG_QNAME.getLocalPart();
- private static final String ADDRESSING_VALIDATE_ACTION = "addressing.validateAction";
-
- private Phase addressingPhase;
- private AxisOperation messageBoxOperation;
-
- public org.apache.axis2.engine.Handler.InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- InvocationResponse response = InvocationResponse.CONTINUE;
- if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null) {
-
- boolean validateAction = JavaUtils.isTrue(msgContext.getProperty(ADDRESSING_VALIDATE_ACTION), true);
- msgContext.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false));
-
- response = super.invoke(msgContext);
-
- if (isForMessageBoxService(msgContext))
- validateMsgBoxStoreOperation(msgContext);
- if (validateAction)
- checkAction(msgContext);
- msgContext.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(validateAction));
-
- }
- return response;
- }
-
- private void validateMsgBoxStoreOperation(MessageContext msgContext) {
- if (msgContext.getAxisOperation() == null) {
- AxisService service = msgContext.getAxisService();
- AxisOperation storeMsgOperation = getMessageBoxOperation(service);
-
- msgContext.setAxisOperation(storeMsgOperation);
- }
- }
-
- private boolean isForMessageBoxService(MessageContext msgContext) {
- return msgContext.getAxisService() != null && msgContext.getAxisService().getName().equals("MsgBoxService");
- }
-
- private AxisOperation getMessageBoxOperation(AxisService msgBoxService) {
- if (messageBoxOperation == null)
- messageBoxOperation = msgBoxService.getOperationBySOAPAction(WSMG_MSGSTORE_SOAP_ACTION);
- return messageBoxOperation;
- }
-
- private void checkAction(MessageContext msgContext) throws AxisFault {
-
- Phase addPhase = getAddressingPhase(msgContext);
-
- if (addPhase == null) {
- logger.error("unable to locate addressing phase object");
- }
- if (msgContext != null) {
- if (msgContext.getCurrentPhaseIndex() + 1 == addPhase.getHandlerCount()) {
- if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null)
- AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
- }
- }
- }
-
- private Phase getAddressingPhase(MessageContext context) {
-
- if (addressingPhase == null) {
-
- List<Phase> inFlowPhases = context.getConfigurationContext().getAxisConfiguration().getPhasesInfo()
- .getINPhases();
-
- for (Phase p : inFlowPhases) {
- if (p.getName().equalsIgnoreCase("Addressing")) {
- addressingPhase = p;
- }
- }
-
- }
-
- return addressingPhase;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java
deleted file mode 100644
index 7069f40..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/ConfigKeys.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.util;
-
-public class ConfigKeys {
-// public static final String CONFIG_FILE_NAME = "airavata-server.properties";
- public static final String MSG_PRESV_DAYS = "messagePreservationDays";
- public static final String MSG_PRESV_HRS = "messagePreservationHours";
- public static final String MSG_PRESV_MINS = "messagePreservationMinutes";
- public static final String MSG_BOX_JDBC_DRIVER = "msgBox.jdbc.driver";
- public static final String MSG_BOX_JDBC_URL = "msgBox.jdbc.url";
- public static final String USE_DATABASE_STORAGE = "msgBox.usedatabase";
- public static final String MSG_PRESV_INTERVAL_DAYS = "messagePreservationIntervalDays";
- public static final String MSG_PRESV_INTERVAL_HRS = "messagePreservationIntervalHours";
- public static final String MSG_PRESV_INTERVAL_MINS = "messagePreservationIntervalMinutes";
- public static final String MSG_PRESV_INTERVAL = "messagePreservationInterval";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java
deleted file mode 100644
index cd63b83..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxCommonConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.util;
-
-public class MsgBoxCommonConstants {
- public static final String MSGBOX_STORAGE = "msgbox.storage";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxOperations.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxOperations.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxOperations.java
deleted file mode 100644
index 6e74c2e..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxOperations.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.util;
-
-public enum MsgBoxOperations {
- STORE_MSGS("storeMessages"), DESTROY_MSGBOX("destroyMsgBox"), TAKE_MSGS("takeMessages"), CREATE_MSGBOX(
- "createMsgBox");
-
- private final String name;
-
- private MsgBoxOperations(String n) {
- name = n;
- }
-
- public String toString() {
- return name;
- }
-
- public boolean equals(String s) {
- return name.equals(s);
- }
-
- public static MsgBoxOperations valueFrom(String s) {
- for (MsgBoxOperations status : MsgBoxOperations.values()) {
- if (status.toString().equalsIgnoreCase(s)) {
- return status;
- }
-
- }
-
- throw new RuntimeException("invalid WsEventingOperation:- " + s);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxUtils.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxUtils.java b/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxUtils.java
deleted file mode 100644
index 8b523a0..0000000
--- a/modules/ws-messenger/messagebox/src/main/java/org/apache/airavata/wsmg/msgbox/util/MsgBoxUtils.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.util;
-
-import java.io.Reader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
-
-public class MsgBoxUtils {
-
- public static SOAPEnvelope reader2SOAPEnvilope(Reader reader) throws XMLStreamException {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
-
- StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow);
- SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
- return omEnvelope;
- }
-
- public static OMElement reader2OMElement(Reader reader) throws XMLStreamException {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
-
- StAXOMBuilder builder = new StAXOMBuilder(inflow);
- OMElement omElement = builder.getDocumentElement();
- return omElement;
- }
-
- public static String formatMessageBoxUrl(String msgBoxServiceUrl, String msgboxId) {
- return msgBoxServiceUrl.endsWith("/") ? msgBoxServiceUrl + "clientid/" + msgboxId : msgBoxServiceUrl
- + "/clientid/" + msgboxId;
- }
-
- public static String formatURLString(String url) {
-
- if (url == null) {
- throw new IllegalArgumentException("url can't be null");
- }
-
- if (url.indexOf("//") < 0) {
- url = "http://" + url; // use default http
- }
- return url;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-derby.sql
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-derby.sql b/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-derby.sql
deleted file mode 100644
index d1ff141..0000000
--- a/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-derby.sql
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-CREATE TABLE MSGBOXES (
- MSGBOXID VARCHAR(100) NOT NULL DEFAULT '',
- PRIMARY KEY (MSGBOXID)
-);
-
-CREATE TABLE MSGBOX (
- ID INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY,
- CONTENT BLOB,
- MSGBOXID VARCHAR(100) NOT NULL DEFAULT '',
- MESSAGEID VARCHAR(100) DEFAULT '',
- SOAPACTION VARCHAR(100) DEFAULT '',
- TIME TIMESTAMP ,
- PRIMARY KEY (ID))
-;
-
-CREATE TRIGGER MESSAGE_TIME
- AFTER INSERT ON MSGBOX
- REFERENCING NEW AS NEW
- FOR EACH ROW MODE DB2SQL
- UPDATE MSGBOX SET TIME = CURRENT_TIMESTAMP WHERE ID = NEW.ID;
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-mysql.sql b/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-mysql.sql
deleted file mode 100755
index a2f730b..0000000
--- a/modules/ws-messenger/messagebox/src/main/resources/database_scripts/msgBox-mysql.sql
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-CREATE DATABASE IF NOT EXISTS wsmg;
-
-DROP TABLE IF EXISTS msgBoxes;
-
-CREATE TABLE `msgBoxes` (
- `msgboxid` varchar(100) NOT NULL default '',
- PRIMARY KEY (`msgboxid`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
-
-DROP TABLE IF EXISTS msgbox;
-
-CREATE TABLE `msgbox` (
- `id` int(11) NOT NULL auto_increment,
- `content` longblob NOT NULL,
- `msgboxid` varchar(100) NOT NULL default '""',
- `messageid` varchar(100) default '""',
- `soapaction` varchar(100) default '""',
- `time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
- PRIMARY KEY (`id`),
- KEY `MSGBOXID` (`msgboxid`)
-) ENGINE=MyISAM AUTO_INCREMENT=7665 DEFAULT CHARSET=latin1;
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/main/resources/services.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/main/resources/services.xml b/modules/ws-messenger/messagebox/src/main/resources/services.xml
deleted file mode 100644
index 18dc22e..0000000
--- a/modules/ws-messenger/messagebox/src/main/resources/services.xml
+++ /dev/null
@@ -1,57 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<serviceGroup>
- <service name="MsgBoxService" scope="application" class="org.apache.airavata.wsmg.msgbox.MsgBoxServiceLifeCycle">
- <messageReceivers>
- <messageReceiver mep="http://www.w3.org/ns/wsdl/in-out" class="org.apache.airavata.wsmg.msgbox.MsgBoxServiceMessageReceiverInOut" />
- </messageReceivers>
- <parameter name="ServiceClass">org.apache.airavata.wsmg.msgbox.MsgBoxServiceSkeleton
- </parameter>
- <parameter name="useOriginalwsdl">false</parameter>
- <parameter name="modifyUserWSDLPortAddress">true</parameter>
- <operation name="storeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
- <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/storeMessages
- </actionMapping>
- <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/storeMessagesResponse
- </outputActionMapping>
- </operation>
- <operation name="destroyMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
- <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/destroyMsgBox
- </actionMapping>
- <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/destroyMsgBoxResponse
- </outputActionMapping>
- </operation>
- <operation name="takeMessages" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
- <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/takeMessages
- </actionMapping>
- <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/takeMessagesResponse
- </outputActionMapping>
- </operation>
- <operation name="createMsgBox" mep="http://www.w3.org/ns/wsdl/in-out" namespace="http://org.apache.airavata/ws-messenger/msgbox/2011/">
- <actionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/createMsgBox
- </actionMapping>
- <outputActionMapping>http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/createMsgBoxResponse
- </outputActionMapping>
- </operation>
- </service>
-
-</serviceGroup>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java b/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java
deleted file mode 100644
index 0eee964..0000000
--- a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/InMemoryMessageBoxServer.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.InOutAxisOperation;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-
-public class InMemoryMessageBoxServer {
- private static int count = 0;
-
- private static SimpleHTTPServer receiver;
-
- public static int TESTING_PORT = 7630;
- private static final Logger log = LoggerFactory.getLogger(InMemoryMessageBoxServer.class);
-
- public static final String FAILURE_MESSAGE = "Intentional Failure";
-
- public static synchronized void deployService(AxisService service) throws AxisFault {
- receiver.getConfigurationContext().getAxisConfiguration().addService(service);
- }
-
- public static synchronized void unDeployService(QName service) throws AxisFault {
- receiver.getConfigurationContext().getAxisConfiguration().removeService(service.getLocalPart());
- }
-
- public static synchronized void start(String repository, String axis2xml) throws Exception {
- if (count == 0) {
- ConfigurationContext er = getNewConfigurationContext(repository, axis2xml);
- TESTING_PORT = getAvailablePort();
- receiver = new SimpleHTTPServer(er, TESTING_PORT);
-
- try {
- receiver.start();
- System.out.print("Server started on port " + TESTING_PORT + ".....");
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
-
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e1) {
- throw new AxisFault("Thread interuptted", e1);
- }
- startMessageBox();
- }
- count++;
- }
-
- public static void startMessageBox() throws Exception {
-
- /*
- * Imitate service.xml
- */
- AxisService axisService = new AxisService("MsgBoxService");
- axisService.setServiceLifeCycle(new MsgBoxServiceLifeCycle());
- axisService.addParameter("ServiceClass", "org.apache.airavata.wsmg.msgbox.MsgBoxServiceSkeleton");
- createOperation(axisService, "storeMessages", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/ws-messenger/msgbox/2011/storeMessages",
- "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/storeMessagesResponse");
- createOperation(axisService, "destroyMsgBox", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/ws-messenger/msgbox/2011/destroyMsgBox",
- "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/destroyMsgBoxResponse");
- createOperation(axisService, "takeMessages", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/ws-messenger/msgbox/2011/takeMessages",
- "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/takeMessagesResponse");
- createOperation(axisService, "createMsgBox", new MsgBoxServiceMessageReceiverInOut(),
- "http://org.apache.airavata/ws-messenger/msgbox/2011/createMsgBox",
- "http://org.apache.airavata/ws-messenger/msgbox/2011/MsgBoxPT/createMsgBoxResponse");
-
- InMemoryMessageBoxServer.deployService(axisService);
-
- new MsgBoxServiceLifeCycle().startUp(InMemoryMessageBoxServer.getConfigurationContext(), axisService);
-
- }
-
- public static void createOperation(AxisService axisService, String name, MessageReceiver messageReceiver,
- String inputAction, String outputAction) {
- InOutAxisOperation operation1 = new InOutAxisOperation(new QName(name));
- operation1.setMessageReceiver(messageReceiver);
- operation1.setOutputAction(outputAction);
- axisService.addOperation(operation1);
- if (inputAction != null) {
- axisService.mapActionToOperation(inputAction, operation1);
- }
- }
-
- public static ConfigurationContext getNewConfigurationContext(String repository, String axis2xml) throws Exception {
- return ConfigurationContextFactory.createConfigurationContextFromFileSystem(repository, axis2xml);
- }
-
- public static synchronized void stop() throws AxisFault {
- if (count == 1) {
- receiver.stop();
- while (receiver.isRunning()) {
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- // nothing to do here
- }
- }
- count = 0;
- // tp.doStop();
- System.out.print("Server stopped .....");
- } else {
- count--;
- }
- receiver.getConfigurationContext().terminate();
- }
-
- public static ConfigurationContext getConfigurationContext() {
- return receiver.getConfigurationContext();
- }
-
- public static String prefixBaseDirectory(String path) {
- return path;
- }
-
- public static int getAvailablePort(){
- ServerSocket serverSocket = null;
- try {
- serverSocket = new ServerSocket(0);
- serverSocket.close();
- } catch (IOException e) {
- log.error(e.getMessage(), e);
- }
- return serverSocket.getLocalPort();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java b/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java
deleted file mode 100644
index 715b90c..0000000
--- a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MessageBoxStressTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.UUID;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxUtils;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.ServiceClient;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MessageBoxStressTest extends TestCase {
- private int port = InMemoryMessageBoxServer.TESTING_PORT;
- private long timeout = 5000L;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
-
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- InMemoryMessageBoxServer.start(null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testMessageBox() throws Exception {
-
- MsgBoxClient user = new MsgBoxClient();
- port = InMemoryMessageBoxServer.TESTING_PORT;
- // test publish with Epr
- EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:" + port
- + "/axis2/services/MsgBoxService", timeout);
-
- System.out.println(msgBoxEpr.toString());
- user.storeMessage(msgBoxEpr, timeout,
- MsgBoxUtils.reader2OMElement(new StringReader("<test>A simple test message</test>")));
-
- Iterator<OMElement> iterator = user.takeMessagesFromMsgBox(msgBoxEpr, timeout);
- int i = 0;
- if (iterator != null)
- while (iterator.hasNext()) {
- i++;
- System.out.println("Retrieved message :" + i);
- System.out.println(iterator.next().toStringWithConsume());
- }
-
-
- // test invocations with id encoded in the Url
-// port = InMemoryMessageBoxServer.getAvailablePort();
-// user = new MsgBoxClient();
-// msgBoxEpr = user.createMessageBox("http://localhost:" + port + "/axis2/services/MsgBoxService", timeout);
- String msgBoxId = UUID.randomUUID().toString();
- String address = msgBoxEpr.getAddress();
- int biginIndex = address.indexOf("clientid");
- if (biginIndex != -1) {
- msgBoxId = address.substring(biginIndex + "clientid".length() + 1);
- }
- System.out.println("MSGBOX ID:" + msgBoxId);
-
- String mesgboxUrl = "http://localhost:" + port + "/axis2/services/MsgBoxService/clientid/" + msgBoxId;
-
- OMElement request = OMAbstractFactory.getOMFactory().createOMElement(new QName("foo"));
- request.setText("bar");
- ServiceClient client = null;
-
- try {
- client = new ServiceClient();
- System.out.println(mesgboxUrl);
- client.getOptions().setTo(new EndpointReference(mesgboxUrl));
- OMElement response = client.sendReceive(request);
- } finally {
- client.cleanupTransport();
- }
-
- iterator = user.takeMessagesFromMsgBox(new EndpointReference(mesgboxUrl), timeout);
- assertTrue(iterator.hasNext());
- while (iterator.hasNext()) {
- i++;
- System.out.println("Retrieved message :" + i);
- System.out.println(iterator.next().toStringWithConsume());
- }
- assertFalse(iterator.hasNext());
-
- System.out.println("Delete message box response : " + user.deleteMsgBox(msgBoxEpr, timeout));
- System.out.println("All tests Done");
-
- }
-}
[03/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/SenderUtils.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/SenderUtils.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/SenderUtils.java
deleted file mode 100644
index 072cbb3..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/SenderUtils.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.messenger.protocol.DeliveryProtocol;
-import org.apache.airavata.wsmg.messenger.protocol.SendingException;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/*
- * this class is not thread safe
- * */
-public class SenderUtils implements Deliverable {
-
- private static final Logger logger = LoggerFactory.getLogger(SenderUtils.class);
-
- private static OMFactory factory = OMAbstractFactory.getOMFactory();
-
- private ConsumerUrlManager urlManager;
-
- private DeliveryProtocol protocol;
-
- public SenderUtils(ConsumerUrlManager urlMan) {
- urlManager = urlMan;
- }
-
- public void setProtocol(DeliveryProtocol protocol) {
- this.protocol = protocol;
- }
-
- 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", NameSpaceConstants.WSNT_NS);
-
- OMElement notificationMessageEl = factory.createOMElement("NotificationMessage", NameSpaceConstants.WSNT_NS,
- fullNotif);
-
- String topicElString = additionalMessageContent.getTopicElement();
- if (topicElString != null) {
- OMElement topicEl = null;
- try {
- topicEl = CommonRoutines.reader2OMElement(new StringReader(topicElString));
- } catch (XMLStreamException e) {
- logger.error("XMLStreamreader exception when setting topicEl", e);
- }
- notificationMessageEl.addChild(topicEl);
- }
- String producerReferenceElString = additionalMessageContent.getProducerReference();
- if (producerReferenceElString != null) {
- OMElement producerReferenceEl = null;
- try {
- producerReferenceEl = CommonRoutines.reader2OMElement(new StringReader(producerReferenceElString));
- } catch (XMLStreamException e) {
- logger.error("XMLStreamException at creating producerReferenceEl", e);
- }
- notificationMessageEl.addChild(producerReferenceEl);
- }
-
- OMElement messageEl = factory.createOMElement("Message", NameSpaceConstants.WSNT_NS, notificationMessageEl);
- messageEl.addChild(rawNotif);
-
- return fullNotif;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/DeliveryProtocol.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/DeliveryProtocol.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/DeliveryProtocol.java
deleted file mode 100644
index 417cef7..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/DeliveryProtocol.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.protocol;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.axiom.om.OMElement;
-
-public interface DeliveryProtocol {
-
- public void deliver(ConsumerInfo consumerInfo, OMElement message, AdditionalMessageContent additionalMessageContent)
- throws SendingException;
-
- public void setTimeout(long timeout);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/SendingException.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/SendingException.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/SendingException.java
deleted file mode 100644
index c4dd24a..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/SendingException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.protocol;
-
-import org.apache.axis2.AxisFault;
-
-public class SendingException extends AxisFault {
-
- /**
- *
- */
- private static final long serialVersionUID = 6250791562500752579L;
-
- public SendingException(Throwable cause) {
- super(cause);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/impl/Axis2Protocol.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/impl/Axis2Protocol.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/impl/Axis2Protocol.java
deleted file mode 100644
index 7e2568a..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/protocol/impl/Axis2Protocol.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.protocol.impl;
-
-import java.io.StringReader;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.messenger.protocol.DeliveryProtocol;
-import org.apache.airavata.wsmg.messenger.protocol.SendingException;
-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.axis2.transport.http.HTTPConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Axis2Protocol implements DeliveryProtocol {
-
- private static final Logger logger = LoggerFactory.getLogger(Axis2Protocol.class);
-
- private static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- private ServiceClient nonThreadLocalServiceClient;
-
- long tcpConnectionTimeout;
-
- 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 = NameSpaceConstants.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.error("exception at topicEl xmlStreamException", e);
- }
- }
- }
-
- ServiceClient client = null;
- try {
-
- client = configureServiceClient(actionString, consumerReference, additionalMessageContent.getMessageID(),
- soapHeaders);
-
- client.sendRobust(message);
-
- } catch (AxisFault ex) {
- throw new SendingException(ex.getCause());
- } finally {
- if (client != null) {
- try {
- client.cleanup();
- client.cleanupTransport();
- } catch (AxisFault ex) {
- logger.error(ex.getMessage(), ex);
- }
- }
- }
- }
-
- public void setTimeout(long timeout) {
- this.tcpConnectionTimeout = timeout;
- }
-
- 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", NameSpaceConstants.WSA_NS);
- msgIdEl.setText(msgId);
- SOAPHeaderBlock actionEl = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- actionEl.setText(action);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.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(HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setProperty(HTTPConstants.HTTP_PROTOCOL_VERSION, HTTPConstants.HEADER_PROTOCOL_10);
- client.setOptions(opts);
-
- return client;
- }
-
- private ServiceClient getServiceClient() throws AxisFault {
- if (nonThreadLocalServiceClient == null) {
- nonThreadLocalServiceClient = new ServiceClient();
- }
- nonThreadLocalServiceClient.removeHeaders();
- return nonThreadLocalServiceClient;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/SendingStrategy.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/SendingStrategy.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/SendingStrategy.java
deleted file mode 100644
index 9eb50cc..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/SendingStrategy.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy;
-
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-
-public interface SendingStrategy {
- void init();
-
- void addMessageToSend(OutGoingMessage outMessage, Deliverable deliverable);
-
- void shutdown();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ConsumerHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ConsumerHandler.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ConsumerHandler.java
deleted file mode 100644
index 5236f47..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ConsumerHandler.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy.impl;
-
-import java.io.StringReader;
-import java.util.List;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class ConsumerHandler implements Runnable {
-
- private static final Logger log = LoggerFactory.getLogger(FixedParallelSender.class);
-
- protected LinkedBlockingQueue<LightweightMsg> queue = new LinkedBlockingQueue<LightweightMsg>();
-
- private String consumerUrl;
-
- private Deliverable deliverable;
-
- public ConsumerHandler(String url, Deliverable deliverable) {
- this.consumerUrl = url;
- this.deliverable = deliverable;
- }
-
- public String getConsumerUrl() {
- return consumerUrl;
- }
-
- public void submitMessage(LightweightMsg msg) {
- try {
- queue.put(msg);
- } catch (InterruptedException e) {
- log.error("Interrupted when trying to add message");
- }
- }
-
- protected void send(List<LightweightMsg> list) {
- for (LightweightMsg m : list) {
- try {
- OMElement messgae2Send = CommonRoutines.reader2OMElement(new StringReader(m.getPayLoad()));
- deliverable.send(m.getConsumerInfo(), messgae2Send, m.getHeader());
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/FixedParallelSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/FixedParallelSender.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/FixedParallelSender.java
deleted file mode 100644
index 7d21fdb..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/FixedParallelSender.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-import org.apache.airavata.wsmg.messenger.strategy.SendingStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FixedParallelSender implements SendingStrategy {
-
- private static final Logger log = LoggerFactory.getLogger(FixedParallelSender.class);
-
- private static final long TIME_TO_WAIT_FOR_SHUTDOWN_SECOND = 30;
-
- private HashMap<String, ConsumerHandler> activeConsumerHandlers = new HashMap<String, ConsumerHandler>();
- private HashMap<String, Boolean> submittedConsumerHandlers = new HashMap<String, Boolean>();
-
- private int batchSize;
-
- private ExecutorService threadPool;
-
- private boolean stop;
-
- private Thread t;
-
- public FixedParallelSender(int poolsize, int batchsize) {
- this.threadPool = Executors.newFixedThreadPool(poolsize);
- this.batchSize = batchsize;
- }
-
- public void init() {
- this.t = new Thread(new ChooseHandlerToSubmit());
- this.t.start();
- }
-
- public void addMessageToSend(OutGoingMessage outMessage, Deliverable deliverable) {
- List<ConsumerInfo> consumerInfoList = outMessage.getConsumerInfoList();
- for (ConsumerInfo consumer : consumerInfoList) {
- sendToConsumerHandler(consumer, outMessage, deliverable);
- }
- }
-
- public void shutdown() {
- log.debug("Shutting down");
- this.stop = true;
-
- try {
- this.t.join();
- } catch (InterruptedException ie) {
- log.error("Wait for ChooseHandlerToSubmit thread to finish (join) is interrupted");
- }
-
- threadPool.shutdown();
- try {
- threadPool.awaitTermination(TIME_TO_WAIT_FOR_SHUTDOWN_SECOND, TimeUnit.SECONDS);
- } catch (InterruptedException ie) {
- log.error("Interrupted while waiting thread pool to shutdown");
- }
-
- log.debug("Shut down");
- }
-
- private void sendToConsumerHandler(ConsumerInfo consumer, OutGoingMessage message, Deliverable deliverable) {
-
- String consumerUrl = consumer.getConsumerEprStr();
-
- LightweightMsg lwm = new LightweightMsg(consumer, message.getTextMessage(),
- message.getAdditionalMessageContent());
-
- synchronized (activeConsumerHandlers) {
- ConsumerHandler handler = activeConsumerHandlers.get(consumerUrl);
- if (handler == null) {
- handler = new FixedParallelConsumerHandler(consumerUrl, deliverable);
- activeConsumerHandlers.put(consumerUrl, handler);
- submittedConsumerHandlers.put(consumerUrl, Boolean.FALSE);
- }
- handler.submitMessage(lwm);
- }
- }
-
- class ChooseHandlerToSubmit implements Runnable {
- private static final int SLEEP_TIME_SECONDS = 1;
-
- public void run() {
- /*
- * If stop is true, we will not get any message to send from addMessageToSend() method. So,
- * activeConsumerHandlers size will not increase but decrease only. When shutdown() is invoked, we will have
- * to send out all messages in our queue.
- */
- while (!stop || activeConsumerHandlers.size() > 0) {
-
- synchronized (activeConsumerHandlers) {
- Iterator<String> it = activeConsumerHandlers.keySet().iterator();
- while (it.hasNext()) {
- String key = it.next();
- boolean submitted = submittedConsumerHandlers.get(key);
-
- /*
- * If consumer handlers is not scheduled to run, submit it to thread pool.
- */
- if (!submitted) {
- threadPool.submit(activeConsumerHandlers.get(key));
- submittedConsumerHandlers.put(key, Boolean.TRUE);
- }
- }
- }
-
- try {
- TimeUnit.SECONDS.sleep(SLEEP_TIME_SECONDS);
- } catch (InterruptedException e) {
- log.error("interrupted while waiting", e);
- }
- }
- }
- }
-
- class FixedParallelConsumerHandler extends ConsumerHandler {
-
- public FixedParallelConsumerHandler(String url, Deliverable deliverable) {
- super(url, deliverable);
- }
-
- public void run() {
-
- log.debug(String.format("FixedParallelConsumerHandler starting: %s", getConsumerUrl()));
-
- ArrayList<LightweightMsg> localList = new ArrayList<LightweightMsg>();
-
- queue.drainTo(localList, batchSize);
-
- send(localList);
- localList.clear();
-
- /*
- * Remove handler if and only if there is no message
- */
- synchronized (activeConsumerHandlers) {
-
- /*
- * all message is sent or not, we will set it as not submitted. So, it can be put back to thread pool.
- */
- submittedConsumerHandlers.put(getConsumerUrl(), Boolean.FALSE);
-
- if (queue.size() == 0) {
- submittedConsumerHandlers.remove(getConsumerUrl());
- activeConsumerHandlers.remove(getConsumerUrl());
-
- log.debug(String.format("Consumer handler is already removed: %s", getConsumerUrl()));
- }
- }
-
- log.debug(String.format("FixedParallelConsumerHandler done: %s,", getConsumerUrl()));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/LightweightMsg.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/LightweightMsg.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/LightweightMsg.java
deleted file mode 100644
index ca56c58..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/LightweightMsg.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy.impl;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.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);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ParallelSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ParallelSender.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ParallelSender.java
deleted file mode 100644
index cede65d..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/ParallelSender.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-import org.apache.airavata.wsmg.messenger.strategy.SendingStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Each subscriber (URL Endpoint) will have its own thread to send a message to
- *
- */
-public class ParallelSender implements SendingStrategy {
-
- private static final Logger log = LoggerFactory.getLogger(ParallelSender.class);
-
- private static final long TIME_TO_WAIT_FOR_SHUTDOWN_SECOND = 30;
-
- private HashMap<String, ConsumerHandler> activeConsumerHandlers = new HashMap<String, ConsumerHandler>();
-
- private ExecutorService threadPool;
-
- public void init() {
- this.threadPool = Executors.newCachedThreadPool();
- }
-
- public void addMessageToSend(OutGoingMessage outMessage, Deliverable deliverable) {
- List<ConsumerInfo> consumerInfoList = outMessage.getConsumerInfoList();
- for (ConsumerInfo consumer : consumerInfoList) {
- sendToConsumerHandler(consumer, outMessage, deliverable);
- }
- }
-
- public void shutdown() {
- log.debug("Shutting down");
-
- threadPool.shutdown();
- try {
- threadPool.awaitTermination(TIME_TO_WAIT_FOR_SHUTDOWN_SECOND, TimeUnit.SECONDS);
- } catch (InterruptedException ie) {
- log.error("Interrupted while waiting thread pool to shutdown");
- }
- log.debug("Shut down");
- }
-
- private void sendToConsumerHandler(ConsumerInfo consumer, OutGoingMessage message, Deliverable deliverable) {
- String consumerUrl = consumer.getConsumerEprStr();
-
- LightweightMsg lwm = new LightweightMsg(consumer, message.getTextMessage(),
- message.getAdditionalMessageContent());
-
- synchronized (activeConsumerHandlers) {
- ConsumerHandler handler = activeConsumerHandlers.get(consumerUrl);
- if (handler == null) {
- handler = new ParallelConsumerHandler(consumerUrl, deliverable);
- activeConsumerHandlers.put(consumerUrl, handler);
- handler.submitMessage(lwm);
- threadPool.submit(handler);
- } else {
- handler.submitMessage(lwm);
- }
- }
- }
-
- class ParallelConsumerHandler extends ConsumerHandler {
-
- private static final int MAX_UNSUCCESSFUL_DRAINS = 3;
- private static final int SLEEP_TIME_SECONDS = 1;
- private int numberOfUnsuccessfulDrain = 0;
-
- public ParallelConsumerHandler(String url, Deliverable deliverable) {
- super(url, deliverable);
- }
-
- public void run() {
- log.debug(String.format("ParallelConsumerHandler starting: %s", getConsumerUrl()));
-
- ArrayList<LightweightMsg> localList = new ArrayList<LightweightMsg>();
- while (true) {
-
- /*
- * Try to find more message to send out
- */
- if (queue.drainTo(localList) <= 0) {
- numberOfUnsuccessfulDrain++;
- } else {
- numberOfUnsuccessfulDrain = 0;
- }
-
- /*
- * No new message for sometimes
- */
- if (numberOfUnsuccessfulDrain >= MAX_UNSUCCESSFUL_DRAINS) {
- /*
- * Stop this thread if and only if there is no message
- */
- synchronized (activeConsumerHandlers) {
- if (queue.size() == 0) {
- if (activeConsumerHandlers.remove(getConsumerUrl()) != null) {
- log.debug(String.format("Consumer handler is already removed: %s", getConsumerUrl()));
- }
- log.debug(String.format("ParallelConsumerHandler done: %s,", getConsumerUrl()));
- break;
- }
- }
- }
-
- send(localList);
- localList.clear();
-
- if (numberOfUnsuccessfulDrain > 0) {
- waitForMessages();
- }
- }
- }
-
- 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);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/SerialSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/SerialSender.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/SerialSender.java
deleted file mode 100644
index 380e559..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/messenger/strategy/impl/SerialSender.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.messenger.strategy.impl;
-
-import java.io.StringReader;
-import java.util.List;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-import org.apache.airavata.wsmg.messenger.strategy.SendingStrategy;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SerialSender implements SendingStrategy {
-
- private static final Logger log = LoggerFactory.getLogger(SerialSender.class);
-
- public void init() {
- }
-
- public void shutdown() {
- }
-
- public void addMessageToSend(OutGoingMessage outMessage, Deliverable deliverable) {
- sendNotification(outMessage, deliverable);
- }
-
- public void sendNotification(OutGoingMessage outGoingMessage, Deliverable deliverable) {
-
- if (outGoingMessage == null) {
- log.error("Got a null outgoing message");
- return;
- }
- String messageString = outGoingMessage.getTextMessage();
-
- List<ConsumerInfo> consumerInfoList = outGoingMessage.getConsumerInfoList();
- AdditionalMessageContent soapHeader = outGoingMessage.getAdditionalMessageContent();
-
- try {
- OMElement messgae2Send = CommonRoutines.reader2OMElement(new StringReader(messageString));
-
- for (ConsumerInfo obj : consumerInfoList) {
- deliverable.send(obj, messgae2Send, soapHeader);
- }
-
- } catch (XMLStreamException e) {
- log.error(e.getMessage(), e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/BrokerUtil.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/BrokerUtil.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/BrokerUtil.java
deleted file mode 100644
index 6400f63..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/BrokerUtil.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-
-public class BrokerUtil {
-
- /**
- * Compares String {@code x} with String {@code y}. The result is {@code true} if and only if both arguments are
- * {@code null} or String {@code x} has the same sequence of characters as String {@code y}.
- *
- * @param x
- * @param y
- * @return {@code true} if the String {@code x} and String {@code y} are equivalent, {@code false} otherwise
- */
- public static boolean sameStringValue(String x, String y) {
- return (x == null && y == null) || (x != null && y != null && x.equals(y));
- }
-
- public static String getTopicLocalString(String filterText) {
-
- if (filterText == null)
- throw new IllegalArgumentException("filter text can't be null");
-
- String localName = null;
-
- int pos = filterText.indexOf(':');
-
- if (pos != -1) {
- localName = filterText.substring(pos + 1);
-
- } else {
-
- localName = filterText;
- }
-
- return localName;
- }
-
- /**
- *
- * @return localString
- * @throws AxisFault
- */
- public static String getXPathString(OMElement xpathEl) throws AxisFault {
-
- if (xpathEl == null) {
- throw new IllegalArgumentException("xpath element can't be null");
- }
-
- OMAttribute dialectAttribute = xpathEl.getAttribute(new QName("Dialect"));
-
- if (dialectAttribute == null) {
- dialectAttribute = xpathEl.getAttribute(new QName("DIALECT"));
-
- }
- if (dialectAttribute == null) {
- throw new AxisFault("dialect is required for subscribe");
- }
- String dialectString = dialectAttribute.getAttributeValue();
- if (!dialectString.equals(WsmgCommonConstants.XPATH_DIALECT)) {
- // System.out.println("***Unkown dialect: " + dialectString);
- throw new AxisFault("Unkown dialect: " + dialectString);
- }
- String xpathLocalString = xpathEl.getText();
- return xpathLocalString;
- }
-
- public static String getTopicFromRequestPath(String topicPath) {
- if (topicPath == null)
- return null;
- if (topicPath.length() == 0)
- return null;
- if (topicPath.startsWith("/")) {
- topicPath = topicPath.substring(1);
- if (topicPath.length() == 0)
- return null;
- }
-
- String ret = null;
-
- int index = topicPath.indexOf(WsmgCommonConstants.TOPIC_PREFIX);
- if (index >= 0) {
-
- ret = topicPath.substring(index + WsmgCommonConstants.TOPIC_PREFIX.length());
-
- if (ret.length() == 0) {
- ret = null;
- }
-
- }
-
- return ret;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/Counter.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/Counter.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/Counter.java
deleted file mode 100644
index bcd00a4..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/Counter.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-import java.util.concurrent.atomic.AtomicLong;
-import java.util.concurrent.atomic.AtomicReference;
-
-//Used for stress test. use together with TimerThread
-public class Counter {
-
- private AtomicLong counter = new AtomicLong(0);
-
- private AtomicReference<String> otherStringValue = new AtomicReference<String>();
-
- public void addCounter() {
- counter.getAndIncrement();
-
- }
-
- public synchronized void addCounter(String otherValue) {
- counter.getAndIncrement();
- otherStringValue.set(otherValue);
- }
-
- /**
- * @return Returns the counterValue.
- */
- public long getCounterValue() {
-
- return counter.get();
- }
-
- /**
- * @param counterValue
- * The counterValue to set.
- */
- public void setCounterValue(long counterValue) {
- counter.set(counterValue);
-
- }
-
- /**
- * @return Returns the otherValueString.
- */
- public String getOtherValueString() {
-
- return otherStringValue.get();
- }
-
- /**
- * @param otherValueString
- * The otherValueString to set.
- */
- public void setOtherValueString(String otherValueString) {
- otherStringValue.set(otherValueString);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/RunTimeStatistics.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/RunTimeStatistics.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/RunTimeStatistics.java
deleted file mode 100644
index a2c0bfc..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/RunTimeStatistics.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.TreeSet;
-
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.WsmgVersion;
-
-public class RunTimeStatistics {
- public static long totalMessageSize = 0;
- public static long totalReceivedNotification = 0;
- public static long totalSentOutNotification = 0;
- public static long totalFailedNotification = 0;
- public static long totalSubscriptions = 0;
- public static long totalSubscriptionsAtStartUp = 0;
- public static long totalUnSubscriptions = 0;
- public static long minMessageSize = Long.MAX_VALUE;
- public static long maxMessageSize = 0;
- public static String startUpTime = "";
- public static long totalSuccessfulDeliveryTime = 0;
- public static long totalFailedDeliveryTime = 0;
- public static long minSuccessfulDeliveryTime = Long.MAX_VALUE;
- public static long maxSuccessfulDeliveryTime = 0;
- public static long minFailedDeliveryTime = Long.MAX_VALUE;
- public static long maxFailedDeliveryTime = 0;
- public static final HashMap<String, Integer> failConsumerList = new HashMap<String, Integer>();
-
- // public static TreeSet currentBlackList=new TreeSet();
- // public static TreeSet previousBlackList=new TreeSet();
-
- private static long startUpTimeInMillis;
-
- public static synchronized void addNewNotificationMessageSize(int size) {
- if (size < minMessageSize) {
- minMessageSize = size;
- }
- if (size > maxMessageSize) {
- maxMessageSize = size;
- }
- totalMessageSize += size;
- totalReceivedNotification++;
- }
-
- public static synchronized void addNewSuccessfulDeliverTime(long deliveryTime) {
- if (deliveryTime < minSuccessfulDeliveryTime) {
- minSuccessfulDeliveryTime = deliveryTime;
- }
- if (deliveryTime > maxSuccessfulDeliveryTime) {
- maxSuccessfulDeliveryTime = deliveryTime;
- }
- totalSuccessfulDeliveryTime += deliveryTime;
- totalSentOutNotification++;
- }
-
- public static synchronized void addNewFailedDeliverTime(long deliveryTime) {
- if (deliveryTime < minFailedDeliveryTime) {
- minFailedDeliveryTime = deliveryTime;
- }
- if (deliveryTime > maxFailedDeliveryTime) {
- maxFailedDeliveryTime = deliveryTime;
- }
- totalFailedDeliveryTime += deliveryTime;
- totalFailedNotification++;
- }
-
- public static synchronized void addFailedConsumerURL(String url) {
- Integer previousCount = failConsumerList.get(url);
- if (previousCount == null) {
- failConsumerList.put(url, 1);
- } else {
- previousCount++;
- failConsumerList.put(url, previousCount);
- }
- }
-
- public static void setStartUpTime() {
- Date currentDate = new Date(); // Current date
- startUpTime = CommonRoutines.getXsdDateTime(currentDate);
- startUpTimeInMillis = currentDate.getTime();
- }
-
- public static String getHtmlString() {
- String htmlString = "";
-
- htmlString += "<p>Total incoming message number: <span class=\"xml-requests-count\">"
- + totalReceivedNotification + "</span><br />\n";
- htmlString += "Total successful outgoing message number: " + totalSentOutNotification + "<br>\n";
- htmlString += "Total unreachable outgoing message number: " + totalFailedNotification + "<br>\n";
- htmlString += "Total subscriptions requested: " + totalSubscriptions + "(+" + totalSubscriptionsAtStartUp
- + " startUp)<br>\n";
- htmlString += "Total Unsubscriptions requested: " + totalUnSubscriptions + "<br>\n";
- htmlString += "</p>\n";
- int averageMessageSize = 0;
- if (totalReceivedNotification != 0) {
- averageMessageSize = (int) (totalMessageSize / totalReceivedNotification);
- }
- htmlString += "<p>Average message size: " + averageMessageSize + " bytes<br>\n";
- htmlString += "Max message size: " + maxMessageSize + " bytes<br>\n";
- htmlString += "Min message size: " + minMessageSize + " bytes<br>\n";
- htmlString += "</p>\n";
- long averageSuccessfulDeliveryTime = 0;
- if (totalSuccessfulDeliveryTime != 0) {
- averageSuccessfulDeliveryTime = (totalSuccessfulDeliveryTime / totalSentOutNotification);
- }
- htmlString += "<p>Average Successful Delivery Time: " + averageSuccessfulDeliveryTime + " ms<br>\n";
- htmlString += "Max Successful Delivery Time: " + maxSuccessfulDeliveryTime + " ms<br>\n";
- htmlString += "Min Successful Delivery Time: " + minSuccessfulDeliveryTime + " ms<br>\n";
- htmlString += "</p>\n";
- long averageFailedDeliveryTime = 0;
- if (totalFailedDeliveryTime != 0) {
- averageFailedDeliveryTime = (totalFailedDeliveryTime / totalFailedNotification);
- }
- htmlString += "<p>Average Unreachable Delivery Time: " + averageFailedDeliveryTime + " ms<br>\n";
- htmlString += "Max Unreachable Delivery Time: " + maxFailedDeliveryTime + " ms<br>\n";
- htmlString += "Min Unreachable Delivery Time: " + minFailedDeliveryTime + " ms<br>\n";
- htmlString += "</p>\n";
- htmlString += "<p>Service started at: " + startUpTime + " <span class=\"starttime-seconds\">"
- + startUpTimeInMillis + "</span> [seconds] since UNIX epoch)" + "<br />\n";
-
- htmlString += "Version: <span class=\"service-name\">" + WsmgVersion.getImplementationVersion()
- + "</span></p>\n";
-
- htmlString += "<p>Total unreachable consumerUrl: " + failConsumerList.size() + " <br>\n";
- TreeSet<String> consumerUrlList = new TreeSet<String>(failConsumerList.keySet());
- Iterator<String> iter = consumerUrlList.iterator();
- while (iter.hasNext()) {
- String url = iter.next();
- int failedCount = failConsumerList.get(url);
- htmlString += " " + url + " -->" + failedCount + " <br>\n";
- }
- htmlString += "</p>\n";
- return htmlString;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/TimerThread.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/TimerThread.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/TimerThread.java
deleted file mode 100644
index 77f7c57..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/TimerThread.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-public class TimerThread implements Runnable {
- Counter counter;
-
- long counterValue = 0;
-
- long seqNum = 0;
-
- String comment = "";
-
- public TimerThread(Counter counter, String comment) {
- this.counter = counter;
- this.comment = comment;
- }
-
- public void run() {
- long currentTime = 0;
- long interval = 1000;
- long lastCounter = 0;
- long idleCount = 0;
- // wait for about 5 sec and start from 000 time so that other thread can
- // start together
- currentTime = System.currentTimeMillis();
- long launchTime = ((currentTime + 2000) / 1000) * 1000;
- long sleepTime = launchTime - currentTime;
- System.out.println("launchTime=" + launchTime + " SleepTime=" + sleepTime);
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- while (true) {
- currentTime = System.currentTimeMillis();
- counterValue = counter.getCounterValue();
- long receivedCount = counterValue - lastCounter;
- lastCounter = counterValue;
- if (receivedCount == 0) {
- idleCount++;
- } else {
- idleCount = 0;
- }
- if (receivedCount > 0 || (receivedCount == 0 && idleCount < 3)) {
- // System.out.println("time="+currentTime+" counter="+
- // counter.getCounterValue()+"
- // received="+receivedCount+comment);
- System.out.println(seqNum + " " + counter.getCounterValue() + " " + receivedCount + comment
- + counter.getOtherValueString());
- }
- seqNum++;
- launchTime = launchTime + interval;
- sleepTime = launchTime - currentTime;
- // System.out.println("launchTime="+launchTime+"
- // SleepTime="+sleepTime);
- if (sleepTime < 0)
- sleepTime = 0;
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsEventingOperations.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsEventingOperations.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsEventingOperations.java
deleted file mode 100644
index 931a5bf..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsEventingOperations.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-public enum WsEventingOperations {
-
- RENEW("renew"), PUBLISH("publish"), GET_STATUS("getStatus"), SUBSCRIPTION_END("subscriptionEnd"), SUBSCRIBE(
- "subscribe"), UNSUBSCRIBE("unsubscribe");
-
- private final String name;
-
- private WsEventingOperations(String n) {
- name = n;
- }
-
- public String toString() {
- return name;
- }
-
- public boolean equals(String s) {
- return name.equals(s);
- }
-
- public static WsEventingOperations valueFrom(String s) {
- for (WsEventingOperations status : WsEventingOperations.values()) {
- if (status.toString().equalsIgnoreCase(s)) {
- return status;
- }
-
- }
-
- throw new RuntimeException("invalid WsEventingOperation:- " + s);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsNotificationOperations.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsNotificationOperations.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsNotificationOperations.java
deleted file mode 100644
index c771134..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/util/WsNotificationOperations.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-public enum WsNotificationOperations {
-
- NOTIFY("notify"), SUBSCRIBE("subscribe"), GET_CURRENT_MSG("getCurrentMessage"), PAUSE_REQUEST("gause"), RESUME_REQUEST(
- "resume"), PAUSE_SUBSCRIPTION("pauseSubscription"), RESUME_SUBSCRIPTION("resumeSubscription"), REGISTER_PUBLISHER(
- "registerPublisher"), UNSUBSCRIBE("unsubscribe");
-
- private final String name;
-
- private WsNotificationOperations(String n) {
- name = n;
- }
-
- public String toString() {
- return name;
- }
-
- public boolean equals(String s) {
- return name.equals(s);
- }
-
- public static WsNotificationOperations valueFrom(String s) {
- for (WsNotificationOperations status : WsNotificationOperations.values()) {
- if (status.toString().equalsIgnoreCase(s)) {
- return status;
- }
-
- }
-
- throw new RuntimeException("invalid Ws notification Operation:- " + s);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/cleanDBScript.sql
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/cleanDBScript.sql b/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/cleanDBScript.sql
deleted file mode 100755
index 5663ebf..0000000
--- a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/cleanDBScript.sql
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-delete from disQ;
-delete from MaxIDTable;
-delete from MinIDTable;
-delete from specialSubscription;
-delete from subscription;
-delete from msgbox;
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-derby.sql
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-derby.sql b/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-derby.sql
deleted file mode 100644
index 80b51a4..0000000
--- a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-derby.sql
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-CREATE TABLE SUBSCRIPTION (
- SUBSCRIPTIONID VARCHAR(200) NOT NULL DEFAULT '',
- TOPICS VARCHAR(255) DEFAULT '',
- XPATH VARCHAR(200) DEFAULT '',
- CONSUMERADDRESS VARCHAR(255) DEFAULT '',
- REFERENCEPROPERTIES BLOB,
- CONTENT BLOB,
- WSRM INTEGER NOT NULL DEFAULT 0 ,
- CREATIONTIME TIMESTAMP NOT NULL
- );
-CREATE TABLE SPECIALSUBSCRIPTION (
- SUBSCRIPTIONID VARCHAR(200) NOT NULL DEFAULT '',
- TOPICS VARCHAR(255) DEFAULT '',
- XPATH VARCHAR(200) DEFAULT '',
- CONSUMERADDRESS VARCHAR(255) DEFAULT '',
- REFERENCEPROPERTIES BLOB,
- CONTENT BLOB,
- WSRM INTEGER NOT NULL DEFAULT 0,
- CREATIONTIME TIMESTAMP NOT NULL
- );
-
-
-CREATE TABLE DISQ (
- ID BIGINT GENERATED BY DEFAULT AS IDENTITY,
- TRACKID VARCHAR(100) DEFAULT NULL,
- MESSAGE BLOB,
- STATUS INTEGER DEFAULT NULL,
- TOPIC VARCHAR(255) DEFAULT '',
- PRIMARY KEY (ID)
- );
-
-CREATE TABLE MAXIDTABLE(
- MAXID INTEGER
- );
-
-CREATE TABLE MINIDTABLE(
- MINID INTEGER
- );
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-mysql.sql
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-mysql.sql b/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-mysql.sql
deleted file mode 100755
index cb506ef..0000000
--- a/modules/ws-messenger/messagebroker/src/main/resources/database_scripts/msgBroker-mysql.sql
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-CREATE DATABASE IF NOT EXISTS wsmg;
-CREATE TABLE `subscription` (
- `SubscriptionId` varchar(200) NOT NULL default '',
- `Topics` varchar(255) default '',
- `XPath` varchar(200) default '',
- `ConsumerAddress` varchar(255) default '',
- `ReferenceProperties` blob,
- `content` blob,
- `wsrm` tinyint(1) NOT NULL default '0',
- `CreationTime` datetime NOT NULL default '0000-00-00 00:00:00'
- );
-CREATE TABLE `specialSubscription` (
- `SubscriptionId` varchar(200) NOT NULL default '',
- `Topics` varchar(255) default '',
- `XPath` varchar(200) default '',
- `ConsumerAddress` varchar(255) default '',
- `ReferenceProperties` blob,
- `content` blob,
- `wsrm` tinyint(1) NOT NULL default '0',
- `CreationTime` datetime NOT NULL default '0000-00-00 00:00:00'
- );
-
-
-CREATE TABLE `disQ` (
- `id` bigint(11) NOT NULL auto_increment,
- `trackId` varchar(100) default NULL,
- `message` longblob,
- `status` int(11) default NULL,
- `topic` varchar(255) default '',
- PRIMARY KEY (`id`)
- );
-
-CREATE TABLE MaxIDTable(
- maxID integer
- );
-
-CREATE TABLE MinIDTable(
- minID integer
- );
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/resources/services.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/resources/services.xml b/modules/ws-messenger/messagebroker/src/main/resources/services.xml
deleted file mode 100644
index 229262c..0000000
--- a/modules/ws-messenger/messagebroker/src/main/resources/services.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
--->
-<serviceGroup>
- <service name="EventingService" class="org.apache.airavata.wsmg.broker.BrokerServiceLifeCycle">
-
- <operation name="renew">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver" />
- <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew
- </actionMapping>
- <outputActionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse
- </outputActionMapping>
- </operation>
-
- <operation name="getStatus">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver" />
- <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus
- </actionMapping>
- <outputActionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse
- </outputActionMapping>
- </operation>
-
- <operation name="subscriptionEnd">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver" />
- <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd
- </actionMapping>
- </operation>
-
- <operation name="subscribe">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver" />
- <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe
- </actionMapping>
- <outputActionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse
- </outputActionMapping>
- </operation>
-
- <operation name="unsubscribe">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingMsgReceiver" />
- <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe
- </actionMapping>
- <outputActionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse
- </outputActionMapping>
- </operation>
-
- <operation name="publish">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wseventing.WSEventingPublishMsgReceiver" />
- <actionMapping>http://org.apache.airavata/WseNotification
- </actionMapping>
- </operation>
-
- </service>
-
- <service name="NotificationService" class="org.apache.airavata.wsmg.broker.BrokerServiceLifeCycle">
-
- <operation name="notify">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/Notify
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/NotifyResponse
- </outputActionMapping>
- </operation>
-
- <operation name="subscribe">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequest
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/SubscribeRequestResponse
- </outputActionMapping>
- </operation>
-
- <operation name="getCurrentMessage">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageRequest
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/GetCurrentMessageResponse
- </outputActionMapping>
- </operation>
-
- <operation name="pauseSubscription">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubsriptionRequest
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/PauseSubscriptionResponse
- </outputActionMapping>
- </operation>
-
- <operation name="resumeSubscription">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubsriptionRequest
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/ResumeSubscriptionResponse
- </outputActionMapping>
- </operation>
-
- <operation name="unsubscribe">
- <messageReceiver class="org.apache.airavata.wsmg.broker.wsnotification.WSNotificationMsgReceiver" />
- <actionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubsribeRequest
- </actionMapping>
- <outputActionMapping>http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification/UnsubscribeResponse
- </outputActionMapping>
- </operation>
-
- </service>
-
- <parameter name="configuration.file.name" locked="false">airavata-server.properties</parameter>
-
-</serviceGroup>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
deleted file mode 100644
index 4867ba7..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSETest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.util.TestUtilServer;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.junit.Test;
-
-public class BrokerWSETest extends TestCase implements ConsumerNotificationHandler {
-
- private static int port = TestUtilServer.TESTING_PORT;
- static Properties configs = new Properties();
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
- System.out.println("Received " + msgEnvelope);
- }
-
- @Override
- protected void setUp() throws Exception {
- TestUtilServer.start(null, null);
- }
-
- @Override
- protected void tearDown() throws Exception {
- TestUtilServer.stop();
- }
-
- @Test
- public void testRoundTrip() throws InterruptedException {
-
- try {
-
- String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
- long value = System.currentTimeMillis();
- String msg = String.format("<msg> current time is : %d </msg>", value);
-
- WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
- wseMsgBrokerClient.init(brokerEPR);
- int consumerPort = TestUtilServer.getAvailablePort();
-
- String[] consumerEPRs = wseMsgBrokerClient.startConsumerService(consumerPort, this);
-
- assertTrue(consumerEPRs.length > 0);
-
- String topic = "WseRoundTripTestTopic";
-
- String subscriptionID = wseMsgBrokerClient.subscribe(consumerEPRs[0], topic, null);
- System.out.println("topic sub id = " + subscriptionID);
-
- try {
- wseMsgBrokerClient.publish(topic, msg);
- wseMsgBrokerClient.publish(topic, AXIOMUtil.stringToOM("<foo><bar>Test</bar></foo>"));
- } catch (Exception e) {
- fail(e.getMessage());
- }
-
- Thread.sleep(2000);
-
- try {
- wseMsgBrokerClient.unSubscribe(subscriptionID);
- } catch (AxisFault e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
- wseMsgBrokerClient.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- try {
- System.in.read();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
- fail("unexpected exception occured");
- }
- System.out.println("Broker roundtrip done");
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
deleted file mode 100644
index baebd31..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/broker/BrokerWSNTTest.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.WsntMsgBrokerClient;
-import org.apache.airavata.wsmg.util.TestUtilServer;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.junit.Test;
-
-public class BrokerWSNTTest extends TestCase implements ConsumerNotificationHandler {
-
- static Properties configs = new Properties();
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
- System.out.println("Received " + msgEnvelope);
- }
-
- @Override
- protected void setUp() throws Exception {
- TestUtilServer.start(null, null);
- }
-
- @Override
- protected void tearDown() throws Exception {
- TestUtilServer.stop();
- }
-
- @Test
- public void testRoundTrip() throws InterruptedException {
-
- try {
- long value = System.currentTimeMillis();
- String msg = String.format("<msg> current time is : %d </msg>", value);
-
- WsntMsgBrokerClient wsntMsgBrokerClient = new WsntMsgBrokerClient();
-
- int consumerPort = 6767;
-
- String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/NotificationService";
- wsntMsgBrokerClient.init(brokerEPR);
- String[] consumerEPRs = wsntMsgBrokerClient.startConsumerService(consumerPort, this);
-
- assertTrue(consumerEPRs.length > 0);
-
- String topic = "/WsntRoundTripTestTopic";
-
- String topicSubscriptionID = wsntMsgBrokerClient.subscribe(consumerEPRs[0], topic, null);
- System.out.println("topic subscription id: " + topicSubscriptionID);
-
- try {
- wsntMsgBrokerClient.publish(topic, msg);
- wsntMsgBrokerClient.publish(topic, AXIOMUtil.stringToOM("<foo><bar>Test</bar></foo>"));
- } catch (Exception e) {
- fail(e.getMessage());
- }
-
- Thread.sleep(2000);
-
- try {
- wsntMsgBrokerClient.unSubscribe(topicSubscriptionID);
- } catch (AxisFault e) {
- e.printStackTrace();
- fail(e.getMessage());
- }
-
- wsntMsgBrokerClient.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- try {
- System.in.read();
- } catch (IOException e1) {
- e1.printStackTrace();
- }
-
- fail("unexpected exception occured");
- }
- System.out.println("Broker roundtrip done");
-
- }
-}
[05/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionManager.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionManager.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionManager.java
deleted file mode 100644
index e42e4c1..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionManager.java
+++ /dev/null
@@ -1,440 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.subscription;
-
-import java.io.StringReader;
-import java.util.AbstractMap;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-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 javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.broker.context.ProcessingContextBuilder;
-import org.apache.airavata.wsmg.broker.wseventing.WSEProcessingContextBuilder;
-import org.apache.airavata.wsmg.broker.wseventing.WSEProtocolSupport;
-import org.apache.airavata.wsmg.broker.wsnotification.WSNTProtocolSupport;
-import org.apache.airavata.wsmg.broker.wsnotification.WSNotificationProcessingContextBuilder;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.storage.WsmgStorage;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.matching.AbstractMessageMatcher;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.apache.airavata.wsmg.util.RunTimeStatistics;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axis2.AxisFault;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Manages subscribers.
- *
- */
-public class SubscriptionManager {
-
- private static final Logger log = LoggerFactory.getLogger(SubscriptionManager.class);
-
- private HashMap<String, SubscriptionState> subscriptions = new HashMap<String, SubscriptionState>();
-
- private ReentrantReadWriteLock subscriptionLock = new ReentrantReadWriteLock();
-
- private WSEProtocolSupport wseProtocalSupport = new WSEProtocolSupport();
-
- private WSNTProtocolSupport wsntProtocolSupport = new WSNTProtocolSupport();
-
- private WsmgStorage subscriptionDB;
-
- private WsmgConfigurationContext wsmgConfig;
-
- private OutGoingQueue outGoingQueue;
-
- private int counter = 1;
-
- public SubscriptionManager(WsmgConfigurationContext paramters, WsmgStorage storage) {
- init(paramters, storage);
- }
-
- private void init(WsmgConfigurationContext parameters, WsmgStorage storage) {
-
- this.wsmgConfig = parameters;
-
- subscriptionDB = storage;
- outGoingQueue = parameters.getOutgoingQueue();
- if (WSMGParameter.enableAutoCleanSubscriptions) {
- CleanUpThread cleanUpThread = new CleanUpThread(this);
- Thread t = new Thread(cleanUpThread);
- t.start();
- }
-
- try {
- checkSubscriptionDB(storage);
- } catch (AxisFault e) {
- log.error("Subscription database has malformed" + " subscriptions. Ignoring them.", e);
-
- }
-
- }
-
- /**
- * @return Returns the subscriptions.
- */
- public AbstractMap<String, SubscriptionState> getShallowSubscriptionsCopy() {
-
- AbstractMap<String, SubscriptionState> ret = null;
- readLockUnlockSubscriptions(true);
- try {
- ret = new HashMap<String, SubscriptionState>(subscriptions);
- } finally {
- readLockUnlockSubscriptions(false);
- }
-
- return ret;
-
- }
-
- public void subscribe(ProcessingContext ctx) throws AxisFault {
-
- String subId = createSubscription(null, ctx);
- if (subId == null) {
- log.error("ERROR: No subscription created");
- return;
- }
-
- if (NameSpaceConstants.WSE_NS.equals(ctx.getContextParameter(ContextParameters.SUBSCRIBE_ELEMENT)
- .getNamespace())) {
- wseProtocalSupport.createSubscribeResponse(ctx, subId);
-
- } else { // WSNT
-
- wsntProtocolSupport.createSubscribeResponse(ctx, subId);
- }
- }
-
- /**
- * @param subscriptionId
- * this is the ID that is in the SOAP header
- * @param ctx
- * contexts constructed with the body elements
- * @return subscription id
- * @throws AxisFault
- */
- private String createSubscription(String subscriptionId, ProcessingContext ctx) throws AxisFault {
-
- SubscriptionState state = null;
- String key = null;
-
- // get the first element element inside the soap body element and check
- // whether namespace is WSE
- if (NameSpaceConstants.WSE_NS.equals(ctx.getContextParameter(ContextParameters.SUBSCRIBE_ELEMENT)
- .getNamespace())) {
- state = wseProtocalSupport.createSubscriptionState(ctx, outGoingQueue);
- } else { // Handle WSNT
-
- state = wsntProtocolSupport.createSubscriptionState(ctx, outGoingQueue);
- }
-
- if (subscriptionId == null) { // New subscription entry
- key = checkSubscriptionExist(state);
- if (key != null) { // just renew previous subscriptions
- return key;
- }
- // new subscriptions
-
- state.setCreationTime(System.currentTimeMillis());
-
- key = generateSubscriptionId(state.getXpathString() != null && state.getXpathString().length() > 0);
-
- } else { // Startup from previous subscription database
- key = subscriptionId;
- }
-
- for (AbstractMessageMatcher m : wsmgConfig.getMessageMatchers()) {
- m.handleSubscribe(state, key);
- }
-
- if (subscriptionId == null) { // New subscription entry,
-
- RunTimeStatistics.totalSubscriptions++;
- try {
- String subscribeXml = ctx.getContextParameter(ContextParameters.SUBSCRIBE_ELEMENT)
- .toStringWithConsume();
-
- state.setId(key);
- state.setSubscribeXml(subscribeXml);
- subscriptionDB.insert(state);
-
- } catch (Exception ex) {
- log.error("unable to insert subscription to database", ex);
- throw new AxisFault("unable to insert subscription to database ", ex);
- }
- }
-
- addToSubscriptionMap(key, state);
- return key;
- }
-
- private void addToSubscriptionMap(String key, SubscriptionState state) {
-
- writeLockUnlockSubscription(true);
- try {
- subscriptions.put(key, state);
- } finally {
- writeLockUnlockSubscription(false);
- }
-
- }
-
- /**
- * @param xpathString
- * @return
- */
- private String generateSubscriptionId(boolean xPath) {
- String key;
- String subIdPrefix = null; // Used to indicate weather a subscription
- // has an XPath subscription Or Topic
- // only.
- if (!xPath) {
- subIdPrefix = "T";
- } else {
- subIdPrefix = "X";
- }
- key = subIdPrefix + "sub" + (counter++) + "@" + WsmgCommonConstants.PREFIX;
- return key;
- }
-
- /**
- * if find the subscription already exists, return the current subscriptionId else return null;
- */
-
- public String checkSubscriptionExist(SubscriptionState state) {
-
- String key = null;
-
- readLockUnlockSubscriptions(true);
- try {
-
- for (Iterator<String> keyIterator = subscriptions.keySet().iterator(); keyIterator.hasNext();) {
-
- String currentKey = keyIterator.next();
- SubscriptionState value = subscriptions.get(currentKey);
-
- if (value.equals(state)) {
- value.setCreationTime(System.currentTimeMillis());
- log.info("Subscription Already exists." + " Using the current subscriptionId");
- key = currentKey;
- break;
- }
-
- }
-
- } finally {
- readLockUnlockSubscriptions(false);
- }
-
- return key;
- }
-
- public void checkSubscriptionDB(WsmgStorage storage) throws AxisFault {
- OMElement subscribeXmlElement;
- String subscriptionId;
- // Read subscription Info from Subscription DB
- List<SubscriptionEntry> subscriptionEntry = storage.getAllSubscription();
- if (subscriptionEntry == null) {
- return;
- }
-
- WSNotificationProcessingContextBuilder wsntBuilder = new WSNotificationProcessingContextBuilder();
- WSEProcessingContextBuilder wseBuilder = new WSEProcessingContextBuilder();
-
- // Create subscription for these entries from DB
- for (int i = 0; i < subscriptionEntry.size(); i++) {
-
- ProcessingContextBuilder processingCtxBuilder = null;
-
- log.info("Subscription No. " + i + " is " + subscriptionEntry.get(i).getSubscriptionId());
-
- StringReader sr = new StringReader(subscriptionEntry.get(i).getSubscribeXml());
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader inflow;
- try {
- inflow = inputFactory.createXMLStreamReader(sr);
-
- StAXOMBuilder builder = new StAXOMBuilder(inflow); // get the
- // root
- // element (in
- // this case the
- // envelope)
- subscribeXmlElement = builder.getDocumentElement();
-
- if (subscribeXmlElement.getNamespace().getNamespaceURI()
- .equals(NameSpaceConstants.WSNT_NS.getNamespaceURI())) {
- processingCtxBuilder = wsntBuilder;
-
- } else {
- processingCtxBuilder = wseBuilder;
- }
-
- subscriptionId = subscriptionEntry.get(i).getSubscriptionId();
-
- ProcessingContext context = processingCtxBuilder.build(subscribeXmlElement);
- createSubscription(subscriptionId, context);
-
- } catch (XMLStreamException e) {
- log.error("error occured while checking subscription db", e);
- }
- }
- RunTimeStatistics.totalSubscriptionsAtStartUp += subscriptionEntry.size();
- }
-
- // This is used for debug
- public void showAllSubscription() {
- String key = null;
- SubscriptionState value = null;
- Set<String> keySet = subscriptions.keySet();
- log.info("List of all subscriptions:");
- for (Iterator<String> iterator = keySet.iterator(); iterator.hasNext();) {
- key = iterator.next();
- value = subscriptions.get(key);
- log.info("******" + key + "-->" + value.getConsumerIPAddressStr() + "##" + value.getLocalTopic());
- }
- }
-
- public int unsubscribe(ProcessingContext ctx) throws AxisFault {
-
- String subscriptionId = ctx.getContextParameter(ContextParameters.SUB_ID);
- if (subscriptionId == null || subscriptionId.trim().length() == 0) {
- throw new AxisFault("subscription identifier is not provided");
- }
-
- removeSubscription(subscriptionId);
- RunTimeStatistics.totalUnSubscriptions++;
- return 0;
- }
-
- int removeSubscription(String subId) throws AxisFault {
-
- SubscriptionState subscription = null;
-
- writeLockUnlockSubscription(true);
- try {
- subscription = subscriptions.remove(subId);
- } finally {
- writeLockUnlockSubscription(false);
- }
-
- if (subscription == null) {
- throw AxisFault.makeFault(new RuntimeException("unknown subscription: " + subId));
-
- }
-
- subscriptionDB.delete(subId);
-
- for (AbstractMessageMatcher mm : wsmgConfig.getMessageMatchers()) {
- mm.handleUnsubscribe(subId);
- }
-
- return 0;
- }
-
- public void resumeSubscription(ProcessingContext ctx) throws AxisFault {
-
- String subscriptionId = ctx.getContextParameter(ContextParameters.SUB_ID);
-
- if (subscriptionId == null) {
- throw AxisFault.makeFault(new RuntimeException("missing subscription id"));
- }
-
- writeLockUnlockSubscription(true);// lock
- try {
- SubscriptionState subscription = subscriptions.get(subscriptionId);
-
- if (subscription == null) {
-
- throw AxisFault.makeFault(new RuntimeException("no subscription found for id: " + subscriptionId));
- }
-
- subscription.resume();
- } finally {
- // this will execute even exception is thrown.
- writeLockUnlockSubscription(false);
- }
- }
-
- public void pauseSubscription(ProcessingContext ctx) throws AxisFault {
-
- String subscriptionId = ctx.getContextParameter(ContextParameters.SUB_ID);
-
- if (subscriptionId == null) {
- throw AxisFault.makeFault(new RuntimeException("missing subscription id"));
- }
-
- writeLockUnlockSubscription(true);// read lock should be sufficient
- // (since we are not modifying the
- // map)
- try {
- SubscriptionState subscription = subscriptions.get(subscriptionId);
-
- if (subscription == null) {
-
- throw AxisFault.makeFault(new RuntimeException("no subscription found for id: " + subscriptionId));
-
- }
-
- subscription.pause();
- } finally {
- // this will execute even exception is thrown.
- writeLockUnlockSubscription(false);
- }
- }
-
- public void readLockUnlockSubscriptions(boolean lock) {
- ReadLock readlock = subscriptionLock.readLock();
- lockUnlock(readlock, lock);
- }
-
- public void writeLockUnlockSubscription(boolean lock) {
- WriteLock writeLock = subscriptionLock.writeLock();
- lockUnlock(writeLock, lock);
- }
-
- private void lockUnlock(Lock l, boolean lock) {
-
- if (lock) {
- l.lock();
- } else {
- l.unlock();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionState.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionState.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionState.java
deleted file mode 100644
index 9ddadb3..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionState.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.subscription;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.ConsumerInfo;
-import org.apache.airavata.wsmg.commons.util.OMElementComparator;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SubscriptionState {
-
- private final Logger logger = LoggerFactory.getLogger(SubscriptionState.class);
-
- private long creationTime = 0;
- private long lastAvailableTime = 0;
-
- private int unAvailableCounter = 0;
- private boolean isNeverExpire = false;
- private boolean isWsrmPolicy;
-
- public String subId;
- public String curNotif;
- private String localTopicString;
- private String xpathString;
- private String subscribeXml;
-
- ConsumerInfo consumerInfo = null;
-
- EndpointReference consumerReference;
-
- URI consumerURI = null;
-
- private OutGoingQueue outGoingQueue;
-
- /**
- * @return Returns the creationTime.
- */
- public long getCreationTime() {
- return creationTime;
- }
-
- /**
- * @param creationTime
- * The creationTime to set.
- */
- public void setCreationTime(long creationTime) {
- this.creationTime = creationTime;
- }
-
- public void setId(String id) {
- subId = id;
- }
-
- public String getId() {
- return subId;
- }
-
- public boolean isWsrmPolicy() {
- return isWsrmPolicy;
- }
-
- public void setWsrmPolicy(boolean wsrmPolicy) {
- this.isWsrmPolicy = wsrmPolicy;
- }
-
- // TODO: outGoingQueue is not belong to this class. Move it to elsewhere
- // related to notification handler in wsntAdapter.
- public SubscriptionState(EndpointReference consumerRef, boolean useNotify, boolean wsrmEnabled, String topic,
- String xpath, String type, OutGoingQueue outGoingQueue) {
- this.consumerReference = consumerRef;
- try {
- this.consumerURI = new URI(consumerRef.getAddress());
- } catch (URISyntaxException e) {
- // this should not happen
- logger.error("invalid consumer URI returned by axis om", e);
-
- }
- this.outGoingQueue = outGoingQueue;
- // if (topic == null) {
- // throw new IllegalArgumentException();
- // }
- this.localTopicString = topic;
- this.xpathString = xpath;
- this.isWsrmPolicy = wsrmEnabled;
- consumerInfo = new ConsumerInfo(consumerRef.getAddress(), type, useNotify, false);
-
- }
-
- public void resume() {
- consumerInfo.setPaused(false);
- }
-
- public void pause() {
- consumerInfo.setPaused(true);
- }
-
- public String getConsumerIPAddressStr() {
- return consumerURI.toString();
- }
-
- public URI getConsumerAddressURI() {
- return consumerURI;
- }
-
- public String getLocalTopic() {
- // QName topicExpressionQName =
- // xsul.util.XsulUtil.toQName(localTopicString, localTopicString
- // .requiredTextContent());
- // String topicLocalString = topicExpressionQName.getLocalPart();
- return localTopicString;
- }
-
- /**
- * @return Returns the consumeReference.
- */
- public EndpointReference getConsumerReference() {
- return consumerReference;
- }
-
- /**
- * @return Returns the curNotif.
- */
- public String getCurNotif() {
- return curNotif;
- }
-
- /**
- * @param curNotif
- * The curNotif to set.
- */
- public void setCurNotif(String curNotif) {
- this.curNotif = curNotif;
- }
-
- /**
- * @return Returns the outGoingQueue.
- */
- public OutGoingQueue getOutGoingQueue() {
- return outGoingQueue;
- }
-
- /**
- * @param outGoingQueue
- * The outGoingQueue to set.
- */
- public void setOutGoingQueue(OutGoingQueue outGoingQueue) {
- this.outGoingQueue = outGoingQueue;
- }
-
- /**
- * @return Returns the consumerInfo.
- */
- public ConsumerInfo getConsumerInfo() {
- return consumerInfo;
- }
-
- public void resetUnAvailableCounter() {
- unAvailableCounter = 0;
- }
-
- public int addUnAvailableCounter() {
- unAvailableCounter++;
- return unAvailableCounter;
- }
-
- /**
- * @return Returns the unAvailableCounter.
- */
- public int getUnAvailableCounter() {
- return unAvailableCounter;
- }
-
- public String getXpathString() {
- return xpathString;
- }
-
- public void setXpathString(String xpathString) {
- this.xpathString = xpathString;
- }
-
- /**
- * @return Returns the isNeverExpire.
- */
- public boolean isNeverExpire() {
- return isNeverExpire;
- }
-
- /**
- * @param isNeverExpire
- * The isNeverExpire to set.
- */
- public void setNeverExpire(boolean neverExpire) {
- this.isNeverExpire = neverExpire;
- }
-
- /**
- * @return Returns the lastAvailableTime.
- */
- public long getLastAvailableTime() {
- return lastAvailableTime;
- }
-
- /**
- * @param lastAvailableTime
- * The lastAvailableTime to set.
- */
- public void setLastAvailableTime(long lastAvailableTime) {
- this.lastAvailableTime = lastAvailableTime;
-
- }
-
- public void setSubscribeXml(String xml) {
- subscribeXml = xml;
- }
-
- public String getSubscribeXml() {
- return subscribeXml;
- }
-
- @Override
- public boolean equals(Object o) {
- if (o instanceof SubscriptionState) {
- SubscriptionState subscription = (SubscriptionState) o;
- return BrokerUtil.sameStringValue(subscription.getLocalTopic(), this.getLocalTopic())
- && BrokerUtil.sameStringValue(subscription.getXpathString(), this.getXpathString())
- && BrokerUtil.sameStringValue(subscription.getConsumerIPAddressStr(),
- this.getConsumerIPAddressStr()) && equalReferenceParameters(subscription);
- }
- return false;
- }
-
- private boolean equalReferenceParameters(SubscriptionState anotherSubscription) {
-
- Map<QName, OMElement> otherRefProperties = anotherSubscription.getConsumerReference()
- .getAllReferenceParameters();
- Map<QName, OMElement> myRefProperties = getConsumerReference().getAllReferenceParameters();
-
- /*
- * Basic comparison
- */
- if (otherRefProperties == null && myRefProperties == null) {
- return true;
- } else if (otherRefProperties == null || myRefProperties == null) {
- return false;
- } else if (otherRefProperties.size() != myRefProperties.size()) {
- return false;
- }
-
- /*
- * This OMElementComparator supports ignore list, but we don't use it here.
- */
- Iterator<Entry<QName, OMElement>> iterator = otherRefProperties.entrySet().iterator();
- while (iterator.hasNext()) {
-
- Entry<QName, OMElement> entry = iterator.next();
- if (!myRefProperties.containsKey(entry.getKey())) {
- return false;
- }
-
- OMElement myElement = myRefProperties.get(entry.getKey());
- OMElement otherElement = entry.getValue();
-
- if (!OMElementComparator.compare(myElement, otherElement)) {
- return false;
- }
- }
- return true;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProcessingContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProcessingContextBuilder.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProcessingContextBuilder.java
deleted file mode 100644
index fe276bf..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProcessingContextBuilder.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wseventing;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.broker.context.ProcessingContextBuilder;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-import org.apache.airavata.wsmg.util.WsEventingOperations;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.axis2.context.MessageContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WSEProcessingContextBuilder extends ProcessingContextBuilder {
-
- private static final Logger logger = LoggerFactory.getLogger(WSEProcessingContextBuilder.class);
-
- public ProcessingContext build(OMElement elem) {
-
- ProcessingContext processingContext = new ProcessingContext();
-
- if (elem != null && elem.getLocalName().equals("Subscribe")) {
- logger.debug("found subscribe element");
- onSubscription(processingContext, elem);
-
- }
-
- return processingContext;
- }
-
- public ProcessingContext build(SOAPEnvelope elem) {
-
- ProcessingContext context = null;
-
- SOAPBody soapBody = elem.getBody();
- if (soapBody != null) {
-
- context = build(soapBody.getFirstElement());
-
- } else {
- context = build((OMElement) null);
- }
-
- context.setEnvelope(elem);
- extractInfoFromHeader(context, elem.getHeader());
-
- return context;
- }
-
- public ProcessingContext build(MessageContext msgContext, WsEventingOperations operation) {
-
- ProcessingContext processingContext = new ProcessingContext();
-
- switch (operation) {
- case SUBSCRIBE: {
-
- Iterator<OMElement> iterator = msgContext.getEnvelope().getBody()
- .getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(), "Subscribe"));
-
- if (!iterator.hasNext()) {
- throw new RuntimeException("invalid subscription message - no subscribe element");
- }
-
- onSubscription(processingContext, iterator.next());
- }
- break;
-
- }
-
- processingContext.setMessageConext(msgContext);
- processingContext.setEnvelope(msgContext.getEnvelope());
- extractInfoFromHeader(processingContext, msgContext.getEnvelope().getHeader());
- String topicFromUrl = BrokerUtil.getTopicFromRequestPath(msgContext.getTo().getAddress());
-
- processingContext.setContextParameter(ContextParameters.TOPIC_FROM_URL, topicFromUrl);
-
- return processingContext;
- }
-
- /**
- * @param processingContext
- * @param subscribeElement
- */
- private void onSubscription(ProcessingContext processingContext, OMElement subscribeElement) {
-
- processingContext.setContextParameter(ContextParameters.SUBSCRIBE_ELEMENT, subscribeElement);
-
- // -- check optional element - expires
- Iterator iterator = subscribeElement.getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(),
- "Expires"));
-
- if (iterator.hasNext()) {
-
- processingContext.setContextParameter(ContextParameters.SUBSCRIBER_EXPIRES,
- ((OMElement) iterator.next()).getText());
-
- }
-
- iterator = subscribeElement
- .getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(), "Filter"));
-
- if (!iterator.hasNext()) {
-
- throw new RuntimeException("invalid subscription - unable to find filter dialet");
-
- }
-
- processingContext.setContextParameter(ContextParameters.FILTER_ELEMENT, iterator.next());
-
- iterator = subscribeElement.getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(),
- "Delivery"));
-
- if (!iterator.hasNext()) {
- throw new RuntimeException("invalid subscription - unable to find delivery tag");
- }
-
- OMElement delivery = (OMElement) iterator.next();
-
- iterator = delivery.getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(), "NotifyTo"));
-
- if (!iterator.hasNext()) {
- throw new RuntimeException("invalid subscription - unable to find NotifyTo tag");
- }
-
- OMElement notifyToElement = (OMElement) iterator.next();
-
- processingContext.setContextParameter(ContextParameters.NOTIFY_TO_ELEMENT, notifyToElement);
-
- try {
-
- processingContext.setContextParameter(ContextParameters.NOTIFY_TO_EPR,
- EndpointReferenceHelper.fromOM(notifyToElement));
-
- } catch (AxisFault e) {
- throw new RuntimeException("invalid subscription - unable to parse notify to end point reference", e);
- }
-
- }
-
- private void extractInfoFromHeader(ProcessingContext context, SOAPHeader header) {
-
- Iterator ite = header.getChildrenWithName(new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(),
- WsmgCommonConstants.SUBSCRIPTION_ID));
-
- if (ite.hasNext()) {
- OMElement identifier = (OMElement) ite.next();
- logger.debug("extracted identifier " + identifier.getText());
-
- context.setContextParameter(ContextParameters.SUB_ID, identifier.getText());
-
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProtocolSupport.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProtocolSupport.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProtocolSupport.java
deleted file mode 100644
index f17a980..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEProtocolSupport.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wseventing;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WSEProtocolSupport {
-
- private static final Logger log = LoggerFactory.getLogger(WSEProtocolSupport.class);
-
- public SubscriptionState createSubscriptionState(ProcessingContext ctx, OutGoingQueue outgoingQueue)
- throws AxisFault {
-
- boolean neverExpire = false; // is true if expiration time is less than
- String topicLocalString = "";
- String xpathString = "";
- EndpointReference consumerReference = ctx.getContextParameter(ContextParameters.NOTIFY_TO_EPR);
-
- if (consumerReference == null) {
- throw new AxisFault("Only Push delivery Mode (NotifyTo) is supported in WSE");
- }
-
- String expireTimeString = ctx.getContextParameter(ContextParameters.SUBSCRIBER_EXPIRES);
-
- if (expireTimeString == null) {
- neverExpire = true;
-
- } else {
-
- long expireTime = Long.valueOf(expireTimeString);
- if (expireTime < 0) {
- neverExpire = true;
- }
- }
-
- OMElement filterEl = ctx.getContextParameter(ContextParameters.FILTER_ELEMENT);
-
- if (filterEl == null) {
-
- topicLocalString = ctx.getContextParameter(ContextParameters.TOPIC_FROM_URL);
-
- if (topicLocalString == null) {
- topicLocalString = WsmgCommonConstants.WILDCARD_TOPIC;
- }
-
- log.debug("got topicLocalString=" + topicLocalString);
- // topicLocalString = "wseTopic";
- // // a special topic, used in WSNT and JMS. Do not use a
- // wildcard topic here since wildcard string varies by system
- } else {
-
- String filterDialectAttrib = filterEl.getAttributeValue(new QName(null, "Dialect"));
-
- if (filterDialectAttrib.compareTo(WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT) == 0) {
- topicLocalString = BrokerUtil.getTopicLocalString(filterEl.getText()); // get what ever inside this
- // element
-
- if (topicLocalString == null) {
- throw new AxisFault("topic is not given in the subscription");
- }
-
- } else if (filterDialectAttrib.compareTo(WsmgCommonConstants.XPATH_DIALECT) == 0) {
-
- // use topicFromUrl if
- // was provided
- topicLocalString = ctx.getContextParameter(ContextParameters.TOPIC_FROM_URL);
-
- xpathString = filterEl.getText();
-
- log.debug("got topicLocalString=" + topicLocalString + " xpathString=" + xpathString);
-
- // TODO: Add XPath canonicalization here in the parsing. To
- // generate a
- // canonicalized XPath string
- // Possibly use Query query =
- // XPQuery.parseQuery(xpathExpression, index);
- if (xpathString == null) {
- throw new AxisFault("xpath expression is not given");
- }
- } else if (filterDialectAttrib.compareTo(WsmgCommonConstants.TOPIC_AND_XPATH_DIALECT) == 0) {
- OMElement topicEl = filterEl.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "TopicExpression"));
- if (topicEl != null) {
- topicLocalString = BrokerUtil.getTopicLocalString(topicEl.getText());
- }
- OMElement xpathEl = filterEl.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "MessageContent"));
- if (xpathEl != null) {
- xpathString = xpathEl.getText();
- if (xpathString == null && topicLocalString == null) {
- throw new AxisFault("Both topic string and " + "XPath String are null!");
- }
- }
- } else {
- throw new AxisFault("Unkown dialect: ");
- // topicLocalString = "wseTopic"; //a special topic, used in
- // WSNT and JMS
- }
-
- }
-
- if (topicLocalString == null || topicLocalString.length() == 0) {
- topicLocalString = WsmgCommonConstants.WILDCARD_TOPIC;
- }
-
- // Create SubscriptionState Object
- SubscriptionState state = new SubscriptionState(consumerReference, true, false, topicLocalString, xpathString,
- "wse", outgoingQueue);
-
- state.setNeverExpire(neverExpire); // default false
-
- return state;
- }
-
- public void createSubscribeResponse(ProcessingContext ctx, String subId) throws AxisFault {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- ctx.addResponseMsgNameSpaces(NameSpaceConstants.WSE_NS);
-
- OMElement responseMessage = factory.createOMElement("SubscribeResponse", NameSpaceConstants.WSE_NS);
-
- OMElement identifier = factory.createOMElement(WsmgCommonConstants.SUBSCRIPTION_ID,
- responseMessage.getNamespace());
- identifier.setText(subId);
- EndpointReference serviceLocationEndpointReference = new EndpointReference(ctx.getMessageContext()
- .getAxisService().getEndpointURL());
-
- serviceLocationEndpointReference.addReferenceParameter(identifier);
-
- OMElement expiresEl = factory.createOMElement("Expires", responseMessage.getNamespace(), responseMessage);
-
- Date expiration = getFutureExpirationDate();
- String dateString = CommonRoutines.getXsdDateTime(expiration);
- expiresEl.setText(dateString);
-
- OMElement subscriptionManagerEpr = null;
- try {
-
- subscriptionManagerEpr = EndpointReferenceHelper.toOM(factory, serviceLocationEndpointReference, new QName(
- NameSpaceConstants.WSE_NS.getNamespaceURI(), "SubscriptionManager"), NameSpaceConstants.WSA_NS
- .getNamespaceURI());
-
- responseMessage.addChild(subscriptionManagerEpr);
- subscriptionManagerEpr.setNamespace(responseMessage.getNamespace());
- } catch (AxisFault e) {
- log.error("unable to resolve EPR from OM", e);
- throw e;
- }
-
- ctx.setRespMessage(responseMessage);
- }
-
- private Date getFutureExpirationDate() {
- // Get a Calendar for current locale and time zone
- Calendar cal = Calendar.getInstance();
- // currentDate.setDate(currentDate.getDate()+1);
- // Get a Date object that represents 30 days from now
- Date currentDate = new Date(); // Current date
- cal.setTime(currentDate); // Set it in the Calendar object
- cal.add(Calendar.DATE, 30); // Add 30 days
- Date expiration = cal.getTime(); // Retrieve the resulting date
- return expiration;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingMsgReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingMsgReceiver.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingMsgReceiver.java
deleted file mode 100644
index 6af3bc5..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingMsgReceiver.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wseventing;
-
-import org.apache.airavata.wsmg.broker.AbstractBrokerMsgReceiver;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.util.WsEventingOperations;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * BrokerServiceMessageReceiverInOut message receiver
- */
-
-public class WSEventingMsgReceiver extends AbstractBrokerMsgReceiver {
-
- private static final Logger log = LoggerFactory.getLogger(WSEventingMsgReceiver.class);
- WSEProcessingContextBuilder builder = new WSEProcessingContextBuilder();
-
- public MessageContext process(MessageContext inMsg, String operationName) throws AxisFault {
-
- WsEventingOperations msgType = WsEventingOperations.valueFrom(operationName);
- ProcessingContext processingContext = builder.build(inMsg, msgType);
- MessageContext outputMsg = null;
-
- log.debug("WS-Eventing: " + msgType);
-
- switch (msgType) {
- case SUBSCRIBE: {
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getSubscriptionManager().subscribe(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case UNSUBSCRIBE: {
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getSubscriptionManager().unsubscribe(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case RENEW:
- case GET_STATUS:
- case SUBSCRIPTION_END:
- default:
- throw new AxisFault("unsupported operation" + msgType.toString());
-
- }
- return outputMsg;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingPublishMsgReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingPublishMsgReceiver.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingPublishMsgReceiver.java
deleted file mode 100644
index 63c6bbc..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wseventing/WSEventingPublishMsgReceiver.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wseventing;
-
-import org.apache.airavata.wsmg.broker.AbstractBrokerMsgReceiver;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.util.WsEventingOperations;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-
-public class WSEventingPublishMsgReceiver extends AbstractBrokerMsgReceiver {
-
- WSEProcessingContextBuilder builder = new WSEProcessingContextBuilder();
-
- @Override
- protected MessageContext process(MessageContext inMsgContext, String operationName) throws AxisFault {
-
- ProcessingContext processingContext = builder.build(inMsgContext, WsEventingOperations.PUBLISH);
-
- try {
-
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsgContext
- .getConfigurationContext().getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getNotificationProcessor().processMsg(processingContext, NameSpaceConstants.WSE_NS);
- } catch (Exception e) {
- throw new AxisFault("unable to process message", e);
- }
- return createOutputMessageContext(inMsgContext, processingContext);
- }
-
- @Override
- protected MessageContext createOutputMessageContext(MessageContext inMsg, ProcessingContext processingContext)
- throws AxisFault {
-
- MessageContext outputContext = null;
-
- OMElement responseMessage = processingContext.getRespMessage();
- if (responseMessage != null) {
-
- outputContext = super.createOutputMessageContext(inMsg, processingContext);
-
- String responseAction = String.format("%s/%s", NameSpaceConstants.WSE_NS.getNamespaceURI(),
- responseMessage.getLocalName());
-
- outputContext.setSoapAction(responseAction);
- }
-
- return outputContext;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNTProtocolSupport.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNTProtocolSupport.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNTProtocolSupport.java
deleted file mode 100644
index c8d3e37..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNTProtocolSupport.java
+++ /dev/null
@@ -1,237 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wsnotification;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WSNTProtocolSupport {
-
- private static final Logger log = LoggerFactory.getLogger(WSNTProtocolSupport.class);
-
- public SubscriptionState createSubscriptionState(ProcessingContext ctx, OutGoingQueue outgoingQueue)
- throws AxisFault {
-
- EndpointReference consumerReference = ctx.getContextParameter(ContextParameters.NOTIFY_TO_EPR);
-
- if (consumerReference == null) {
- throw new AxisFault("Only Push delivery Mode (NotifyTo) is supported");
- }
-
- boolean neverExpire = false; // is true if expiration time is less than
- boolean useNotify = true; // notify by event notifications
- boolean wsrmEnabled = false;
- String topicLocalString = "";
- String xpathString = "";
-
- String expireTimeString = ctx.getContextParameter(ContextParameters.SUBSCRIBER_EXPIRES);
-
- if (expireTimeString == null) {
- neverExpire = true;
- } else {
- long expireTime = Long.valueOf(expireTimeString);
- if (expireTime < 0) {
- neverExpire = true;
- }
- }
-
- OMElement useNotifyEl = ctx.getContextParameter(ContextParameters.USE_NOTIFY_ELEMENT);
- if (useNotifyEl != null) {
- String s = useNotifyEl.getText();
- useNotify = Boolean.valueOf(s);
- }
-
- // get policy if exist
- OMElement element = ctx.getContextParameter(ContextParameters.SUB_POLICY);
- if (element != null) {
- wsrmEnabled = true;
- }
-
- OMElement topicExpressionEl = ctx.getContextParameter(ContextParameters.TOPIC_EXPRESSION_ELEMENT);
-
- if (topicExpressionEl != null) {
- topicLocalString = BrokerUtil.getTopicLocalString(topicExpressionEl.getText());
- }
-
- OMElement xpathEl = ctx.getContextParameter(ContextParameters.XPATH_ELEMENT);
-
- if (xpathEl != null) {
- xpathString = BrokerUtil.getXPathString(xpathEl);
- }
- if (xpathString == null && topicLocalString == null) {
- throw new AxisFault("Both topic string and XPath String are null!");
-
- }
-
- if (topicLocalString == null || topicLocalString.length() == 0) {
- topicLocalString = WsmgCommonConstants.WILDCARD_TOPIC;
- }
-
- // Create SubscriptionState Object
- SubscriptionState state = new SubscriptionState(consumerReference, useNotify, wsrmEnabled, topicLocalString,
- xpathString, "wsnt", outgoingQueue);
-
- state.setNeverExpire(neverExpire); // default false
-
- return state;
- }
-
- public void createSubscribeResponse(ProcessingContext ctx, String subId) throws AxisFault {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- ctx.addResponseMsgNameSpaces(NameSpaceConstants.WSNT_NS);
- OMElement responseMessage = factory.createOMElement("SubscribeResponse", NameSpaceConstants.WSNT_NS);
-
- OMElement identifier = factory.createOMElement(WsmgCommonConstants.SUBSCRIPTION_ID,
- responseMessage.getNamespace());
- identifier.setText(subId);
- EndpointReference serviceLocationEndpointReference = new EndpointReference(ctx.getMessageContext()
- .getAxisService().getEndpointURL());
- serviceLocationEndpointReference.addReferenceParameter(identifier);
-
- OMElement subscriptionReference = null;
- try {
- subscriptionReference = EndpointReferenceHelper.toOM(factory, serviceLocationEndpointReference, new QName(
- "SubscriptionReference"), NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- responseMessage.addChild(subscriptionReference);
- subscriptionReference.setNamespace(responseMessage.getNamespace());
-
- } catch (AxisFault e) {
- log.error("unable to resolve EPR from OM", e);
- throw e;
- }
-
- ctx.setRespMessage(responseMessage);
- }
-
- public static class Client {
-
- public static OMElement createSubscriptionMsg(EndpointReference eventSinkLocation, String topicExpression,
- String xpathExpression) throws AxisFault {
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement message = factory.createOMElement("SubscribeRequest", NameSpaceConstants.WSNT_NS);
-
- if (topicExpression != null) {
- OMElement topicExpEl = factory.createOMElement("TopicExpression", NameSpaceConstants.WSNT_NS, message);
-
- topicExpEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT,
- NameSpaceConstants.WSNT_NS);
- topicExpEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topicExpression);
- }
-
- if (xpathExpression != null) {
- OMElement xpathExpEl = factory.createOMElement("Selector", NameSpaceConstants.WSNT_NS, message);
- xpathExpEl.addAttribute("Dialect", WsmgCommonConstants.XPATH_DIALECT, null);
- xpathExpEl.setText(xpathExpression);
- }
-
- OMElement useNotifyEl = factory.createOMElement("UseNotify", message.getNamespace(), message);
- useNotifyEl.setText("true");// check wether we still need this
-
- OMElement eprCrEl = EndpointReferenceHelper.toOM(factory, eventSinkLocation,
- new QName("ConsumerReference"), NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- message.addChild(eprCrEl);
- eprCrEl.setNamespace(message.getNamespace());
-
- return message;
- }
-
- public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault {
-
- String subscriptionId = null;
-
- EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference);
-
- Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters();
-
- if (referenceParams != null) {
- QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(),
- WsmgCommonConstants.SUBSCRIPTION_ID);
-
- OMElement identifierEl = referenceParams.get(identifierQName);
- subscriptionId = (identifierEl != null) ? identifierEl.getText() : null;
-
- }
-
- return subscriptionId;
- }
-
- public static OMElement createUnsubscribeMsg() {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement message = factory.createOMElement("UnsubsribeRequest", NameSpaceConstants.WSNT_NS);
-
- return message;
- }
-
- public static OMElement encodeNotification(String topic, OMElement message, EndpointReference producerReference)
- throws AxisFault {
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement topicExpEl = factory.createOMElement("Topic", NameSpaceConstants.WSNT_NS);
- topicExpEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT, null);
- topicExpEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topic);
-
- OMElement messageToNotify = factory.createOMElement("Notify", NameSpaceConstants.WSNT_NS);
- messageToNotify.declareNamespace(NameSpaceConstants.WSNT_NS);
- messageToNotify.declareNamespace(NameSpaceConstants.WSA_NS);
- OMElement notificationMesssageEl = factory.createOMElement("NotificationMessage",
- messageToNotify.getNamespace(), messageToNotify);
-
- notificationMesssageEl.addChild(topicExpEl);
-
- notificationMesssageEl.addChild(EndpointReferenceHelper.toOM(factory, producerReference, new QName(
- notificationMesssageEl.getNamespace().getNamespaceURI(), "ProducerReference",
- notificationMesssageEl.getNamespace().getPrefix()), NameSpaceConstants.WSA_NS.getNamespaceURI()));
-
- OMElement messageEl = factory.createOMElement("Message", notificationMesssageEl.getNamespace(),
- notificationMesssageEl);
-
- messageEl.addChild(message);
- return messageToNotify;
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationMsgReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationMsgReceiver.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationMsgReceiver.java
deleted file mode 100644
index 9d32ee9..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationMsgReceiver.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wsnotification;
-
-import org.apache.airavata.wsmg.broker.AbstractBrokerMsgReceiver;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.util.WsNotificationOperations;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * BrokerServiceMessageReceiverInOut message receiver
- */
-
-public class WSNotificationMsgReceiver extends AbstractBrokerMsgReceiver {
-
- private static final Logger log = LoggerFactory.getLogger(WSNotificationMsgReceiver.class);
-
- WSNotificationProcessingContextBuilder builder = new WSNotificationProcessingContextBuilder();
-
- public MessageContext process(MessageContext inMsg, String operationName) throws AxisFault {
-
- WsNotificationOperations msgType = WsNotificationOperations.valueFrom(operationName);
-
- ProcessingContext processingContext = builder.build(inMsg, msgType);
-
- MessageContext outputMsg = null;
-
- switch (msgType) {
- case NOTIFY: {
- try {
-
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg
- .getConfigurationContext().getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getNotificationProcessor()
- .processMsg(processingContext, NameSpaceConstants.WSNT_NS);
- } catch (Exception e) {
- throw new AxisFault("unable to process message", e);
- }
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case SUBSCRIBE: {
-
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
- brokerConfigContext.getSubscriptionManager().subscribe(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case UNSUBSCRIBE: {
-
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getSubscriptionManager().unsubscribe(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case RESUME_SUBSCRIPTION: {
-
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getSubscriptionManager().resumeSubscription(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case PAUSE_SUBSCRIPTION: {
- WsmgConfigurationContext brokerConfigContext = (WsmgConfigurationContext) inMsg.getConfigurationContext()
- .getProperty(WsmgCommonConstants.BROKER_WSMGCONFIG);
-
- brokerConfigContext.getSubscriptionManager().pauseSubscription(processingContext);
- outputMsg = createOutputMessageContext(inMsg, processingContext);
- break;
- }
- case GET_CURRENT_MSG:
- default:
- throw new AxisFault("not implemented yet");
- }
-
- return outputMsg;
- }
-
-}// end of class
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationProcessingContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationProcessingContextBuilder.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationProcessingContextBuilder.java
deleted file mode 100644
index b517234..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/wsnotification/WSNotificationProcessingContextBuilder.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.wsnotification;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.broker.context.ProcessingContextBuilder;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-import org.apache.airavata.wsmg.util.WsNotificationOperations;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.axis2.context.MessageContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WSNotificationProcessingContextBuilder extends ProcessingContextBuilder {
-
- private static final Logger logger = LoggerFactory.getLogger(WSNotificationProcessingContextBuilder.class);
-
- public ProcessingContext build(OMElement elem) {
-
- ProcessingContext processingContext = new ProcessingContext();
-
- if (elem == null
- || (!elem.getNamespace().getNamespaceURI().equals(NameSpaceConstants.WSNT_NS.getNamespaceURI()))) {
-
- logger.warn("invalid message payload recieved: " + elem);
-
- return processingContext;
- }
-
- String localName = elem.getLocalName();
-
- if (localName.equals("SubscribeRequest")) {
- onSubscription(processingContext, elem);
- }
- return processingContext;
- }
-
- public void onSubscription(ProcessingContext context, OMElement subscribeElement) {
- context.setContextParameter(ContextParameters.SUBSCRIBE_ELEMENT, subscribeElement);
-
- OMElement consumerReference = subscribeElement.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "ConsumerReference"));
- if (consumerReference == null) {
- logger.warn("unable to find consumer reference" + " in subscribe message: " + subscribeElement);
- return;
- }
- context.setContextParameter(ContextParameters.NOTIFY_TO_ELEMENT, consumerReference);
-
- try {
- EndpointReference consumerEpr = EndpointReferenceHelper.fromOM(consumerReference);
- context.setContextParameter(ContextParameters.NOTIFY_TO_EPR, consumerEpr);
-
- } catch (AxisFault e) {
- logger.warn("invalid epr", e);
- return;
- }
-
- OMElement topicExpression = subscribeElement.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "TopicExpression"));
-
- if (topicExpression != null) { // topic can be null
-
- context.setContextParameter(ContextParameters.TOPIC_EXPRESSION_ELEMENT, topicExpression);
-
- }
-
- OMElement useNotify = subscribeElement.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "UseNotify"));
-
- if (useNotify != null) {
- context.setContextParameter(ContextParameters.USE_NOTIFY_ELEMENT, useNotify);
- }
-
- OMElement selector = subscribeElement.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "Selector"));
-
- if (selector != null) {
- context.setContextParameter(ContextParameters.XPATH_ELEMENT, selector);
- }
-
- OMElement subscriptionPolicy = subscribeElement.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_POLICY));
-
- if (subscriptionPolicy != null) {
- context.setContextParameter(ContextParameters.SUB_POLICY, subscriptionPolicy);
- }
-
- }
-
- public ProcessingContext build(MessageContext msgContext, WsNotificationOperations operation) {
- ProcessingContext context = new ProcessingContext();
-
- SOAPEnvelope soapEnvelope = msgContext.getEnvelope();
-
- if (soapEnvelope == null) {
- throw new RuntimeException("invalid message context - envelope is not found");
- }
-
- SOAPBody soapBody = soapEnvelope.getBody();
-
- if (soapBody == null) {
- throw new RuntimeException("invalid message context - soap envelope is not found");
- }
-
- SOAPHeader soapHeader = soapEnvelope.getHeader();
-
- if (soapHeader == null) {
- throw new RuntimeException("invalid message context - soap header is not found");
- }
-
- switch (operation) {
- case SUBSCRIBE: {
-
- Iterator<OMElement> iterator = soapBody.getChildrenWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "SubscribeRequest"));
- if (!iterator.hasNext()) {
- throw new RuntimeException("invalid message context - unable to find Subscribe information");
- }
-
- onSubscription(context, iterator.next());
- }
- break;
- }
-
- context.setEnvelope(soapEnvelope);
- extractInfoFromHeader(context, soapHeader);
- context.setMessageConext(msgContext);
- String topicFromUrl = BrokerUtil.getTopicFromRequestPath(msgContext.getTo().getAddress());
- context.setContextParameter(ContextParameters.TOPIC_FROM_URL, topicFromUrl);
-
- return context;
- }
-
- private void extractInfoFromHeader(ProcessingContext context, SOAPHeader header) {
-
- Iterator ite = header.getChildrenWithName(new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(),
- WsmgCommonConstants.SUBSCRIPTION_ID));
- if (ite.hasNext()) {
- OMElement identifier = (OMElement) ite.next();
- logger.debug("extracted identifier " + identifier.getText());
-
- context.setContextParameter(ContextParameters.SUB_ID, identifier.getText());
-
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/OutGoingMessage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/OutGoingMessage.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/OutGoingMessage.java
deleted file mode 100644
index 73eba17..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/OutGoingMessage.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.AdditionalMessageContent;
-import org.apache.airavata.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;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgInMemoryStorage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgInMemoryStorage.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgInMemoryStorage.java
deleted file mode 100644
index 6b051b1..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/commons/storage/WsmgInMemoryStorage.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionEntry;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-
-public class WsmgInMemoryStorage implements WsmgStorage, WsmgQueue {
-
- private LinkedBlockingQueue<Object> queue = new LinkedBlockingQueue<Object>();
-
- private Map<String, SubscriptionState> expirableSubscriptions = new ConcurrentHashMap<String, SubscriptionState>();
-
- private Map<String, SubscriptionState> unexpirableSubscriptions = new ConcurrentHashMap<String, SubscriptionState>();
-
- public void dispose() {
- queue.clear();
- expirableSubscriptions.clear();
- unexpirableSubscriptions.clear();
- }
-
- public int insert(SubscriptionState subscription) {
- if (subscription.isNeverExpire()) {
- unexpirableSubscriptions.put(subscription.getId(), subscription);
- } else {
- expirableSubscriptions.put(subscription.getId(), subscription);
- }
- return 0;
- }
-
- public int delete(String subscriptionId) {
- expirableSubscriptions.remove(subscriptionId);
- unexpirableSubscriptions.remove(subscriptionId);
- return 0;
- }
-
- public List<SubscriptionEntry> getAllSubscription() {
-
- List<SubscriptionEntry> ret = new ArrayList<SubscriptionEntry>(expirableSubscriptions.size()
- + unexpirableSubscriptions.size());
-
- Collection<SubscriptionState> entries = expirableSubscriptions.values();
-
- for (SubscriptionState s : entries) {
- SubscriptionEntry se = new SubscriptionEntry();
- se.setSubscribeXml(s.getSubscribeXml());
- se.setSubscriptionId(s.getId());
- ret.add(se);
- }
- entries = unexpirableSubscriptions.values();
- for (SubscriptionState s : entries) {
- SubscriptionEntry se = new SubscriptionEntry();
- se.setSubscribeXml(s.getSubscribeXml());
- se.setSubscriptionId(s.getId());
- ret.add(se);
- }
-
- return ret;
- }
-
- public Object blockingDequeue() {
- Object obj = null;
-
- try {
- obj = queue.take();
- } catch (InterruptedException ie) {
- throw new RuntimeException("interruped exception occured", ie);
- }
-
- return obj;
- }
-
- public void cleanup() {
- queue.clear();
- }
-
- public void enqueue(Object object, String trackId) {
- queue.offer(object);
- }
-}
[10/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java
deleted file mode 100644
index 5b06610..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MsgboxHandler.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.msgbox;
-
-import java.rmi.RemoteException;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.MsgBrokerClientException;
-import org.apache.airavata.wsmg.client.NotificationHandler;
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
-import org.apache.axis2.addressing.EndpointReference;
-
-public class MsgboxHandler {
-
- protected MsgBoxClient msgBoxUser = null;
-
- public EndpointReference createPullMsgBox(String msgBoxLocation, long timeout) throws MsgBrokerClientException {
- msgBoxUser = new MsgBoxClient();
- EndpointReference msgBoxAddr = null;
-
- try {
- msgBoxAddr = msgBoxUser.createMessageBox(msgBoxLocation, timeout);
- } catch (RemoteException e) {
- throw new MsgBrokerClientException("unable to create msgbox", e);
- }
-
- return msgBoxAddr;
- }
-
- public EndpointReference createPullMsgBox(String msgBoxServerLoc) throws MsgBrokerClientException {
- return createPullMsgBox(msgBoxServerLoc, 12000L);
- }
-
- public MessagePuller startPullingEventsFromMsgBox(EndpointReference msgBoxEpr, NotificationHandler handler,
- long interval, long timeout) throws MsgBrokerClientException {
- if (msgBoxUser == null) {
- throw new MsgBrokerClientException("Unable start pulling, the messagebox client was not initialized");
- }
-
- MessagePuller messagePuller = new MessagePuller(msgBoxUser, msgBoxEpr, handler, interval, timeout);
- messagePuller.startPulling();
- return messagePuller;
- }
-
- public MessagePuller startPullingFromExistingMsgBox(EndpointReference msgBoxAddr, NotificationHandler handler,
- long interval, long timeout) throws MsgBrokerClientException {
-
- String toAddress = msgBoxAddr.getAddress();
- int biginIndex = toAddress.indexOf("clientid");
- String clientId = toAddress.substring(biginIndex + "clientid".length() + 1);
-
- if ((msgBoxAddr.getAllReferenceParameters() == null || msgBoxAddr.getAllReferenceParameters()
- .get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText() == null)
- && biginIndex == -1)
- throw new MsgBrokerClientException("Invalid Message Box Address");
- this.msgBoxUser = new MsgBoxClient();
- MessagePuller messagePuller = new MessagePuller(msgBoxUser, msgBoxAddr, handler, interval, timeout);
- messagePuller.startPulling();
- return messagePuller;
- }
-
- public String deleteMsgBox(EndpointReference msgBoxEpr, long timeout) throws MsgBrokerClientException {
-
- String msgBoxEventSink = msgBoxEpr.getAddress();
-
- String formattedEventSink = null;
-
- if (msgBoxEpr.getAddress().contains("clientid")) {
- formattedEventSink = msgBoxEventSink;
- } else {
- if (msgBoxEpr.getAllReferenceParameters() == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
- String msgBoxId = msgBoxEpr.getAllReferenceParameters().get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText();
- if (msgBoxId == null)
- throw new MsgBrokerClientException(
- "Invalid Message Box EPR, reference parameter MsgBoxAddress is missing");
- String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
-
- formattedEventSink = String.format(format, msgBoxEventSink, msgBoxId);
-
- }
-
- if (this.msgBoxUser == null) {
- this.msgBoxUser = new MsgBoxClient();
- }
-
- String resp = null;
- try {
- resp = msgBoxUser.deleteMsgBox(msgBoxEpr, timeout);
- } catch (RemoteException e) {
- throw new MsgBrokerClientException("unable to delete the msg box", e);
- }
-
- return resp;
- }
-
- public void stopPullingEventsFromMsgBox(MessagePuller msgPuller) {
- msgPuller.stopPulling();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSEProtocolClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSEProtocolClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSEProtocolClient.java
deleted file mode 100644
index c8f4d31..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSEProtocolClient.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.protocol;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-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;
-
-public class WSEProtocolClient {
-
- public static EndpointReference createEndpointReference(String brokerURL, String topic) {
- if (brokerURL == null) {
- throw new IllegalArgumentException("Broker URL is null.");
- }
- if (topic == null) {
- throw new IllegalArgumentException("Topic is null.");
- }
-
- String sinkLocation = brokerURL.endsWith("/") ? brokerURL + "topic/" + topic : brokerURL + "/topic/" + topic;
-
- EndpointReference eventSinkReference = new EndpointReference(sinkLocation);
- return eventSinkReference;
- }
-
- private static OMElement createFilter(String topicExpression, String xpathExpression) {
-
- boolean hasTopicExpression = (topicExpression != null && topicExpression.length() != 0);
- boolean hasXPathExpression = (xpathExpression != null && xpathExpression.length() != 0);
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement filterEl = null;
-
- if (hasTopicExpression && hasXPathExpression) {
- filterEl = factory.createOMElement("Filter", NameSpaceConstants.WSE_NS);
-
- filterEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_AND_XPATH_DIALECT, null);
- OMElement topicExpressionEl = factory.createOMElement("TopicExpression", NameSpaceConstants.WSNT_NS);
- topicExpressionEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT, null);
- topicExpressionEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpressionEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topicExpression);
- filterEl.addChild(topicExpressionEl);
- OMElement xpathEl = factory.createOMElement("MessageContent", NameSpaceConstants.WSNT_NS);
- xpathEl.addAttribute("Dialect", WsmgCommonConstants.XPATH_DIALECT, null);
- xpathEl.setText(xpathExpression);
- filterEl.addChild(xpathEl);
- } else if (hasTopicExpression) {
- filterEl = factory.createOMElement("Filter", NameSpaceConstants.WSE_NS);
-
- filterEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT, null);
- filterEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- filterEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topicExpression);
- } else if (hasXPathExpression) {
- filterEl = factory.createOMElement("Filter", NameSpaceConstants.WSE_NS);
-
- filterEl.addAttribute("Dialect", WsmgCommonConstants.XPATH_DIALECT, null);
- filterEl.setText(xpathExpression);
- }
-
- return filterEl;
- }
-
- public static OMElement createSubscription(EndpointReference eventSink, String topicExpression,
- String xpathExpression, long expireTime) throws AxisFault {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement subscribeMsg = factory.createOMElement("Subscribe", NameSpaceConstants.WSE_NS);
-
- OMElement delivery = factory.createOMElement("Delivery", NameSpaceConstants.WSE_NS);
-
- OMElement expires = factory.createOMElement("Expires", NameSpaceConstants.WSE_NS);
- expires.setText(Long.toString(expireTime));
- subscribeMsg.addChild(expires);
-
- OMElement notifyTo = EndpointReferenceHelper.toOM(factory, eventSink,
- new QName(NameSpaceConstants.WSE_NS.getNamespaceURI(), "NotifyTo"),
- NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- delivery.addChild(notifyTo);
- subscribeMsg.addChild(delivery);
-
- OMElement filterEl = createFilter(topicExpression, xpathExpression);
-
- if (filterEl != null) {
- subscribeMsg.addChild(filterEl);
- }
-
- subscribeMsg.declareNamespace(NameSpaceConstants.WSA_NS);
-
- return subscribeMsg;
- }
-
- public static String decodeSubscribeResponse(OMElement responseSubscriptionsManagerElement) throws AxisFault {
- String subscriptionId = null;
- OMElement referencePropertiesEl = responseSubscriptionsManagerElement.getFirstChildWithName(new QName(
- NameSpaceConstants.WSA_NS.getNamespaceURI(), "ReferenceProperties"));
-
- if (referencePropertiesEl == null) {
- referencePropertiesEl = responseSubscriptionsManagerElement.getFirstChildWithName(new QName(
- NameSpaceConstants.WSA_NS.getNamespaceURI(), "ReferenceParameters"));
- }
-
- OMElement identifierEl = referencePropertiesEl.getFirstChildWithName(new QName(NameSpaceConstants.WSE_NS
- .getNamespaceURI(), WsmgCommonConstants.SUBSCRIPTION_ID));
-
- if (identifierEl == null) {
- throw new AxisFault("invalid response message, subscription id was not sent by broker");
- }
-
- subscriptionId = identifierEl.getText();
- return subscriptionId;
- }
-
- public static OMElement createUnsubscribeMsg() {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement message = factory.createOMElement("Unsubscribe", NameSpaceConstants.WSE_NS);
-
- return message;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSNTProtocolClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSNTProtocolClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSNTProtocolClient.java
deleted file mode 100644
index a582e72..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/protocol/WSNTProtocolClient.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.protocol;
-
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-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;
-
-public class WSNTProtocolClient {
-
- public static OMElement createSubscriptionMsg(EndpointReference eventSinkLocation, String topicExpression,
- String xpathExpression) throws AxisFault {
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement message = factory.createOMElement("SubscribeRequest", NameSpaceConstants.WSNT_NS);
-
- if (topicExpression != null) {
- OMElement topicExpEl = factory.createOMElement("TopicExpression", NameSpaceConstants.WSNT_NS, message);
-
- topicExpEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT,
- NameSpaceConstants.WSNT_NS);
- topicExpEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topicExpression);
- }
-
- if (xpathExpression != null) {
- OMElement xpathExpEl = factory.createOMElement("Selector", NameSpaceConstants.WSNT_NS, message);
- xpathExpEl.addAttribute("Dialect", WsmgCommonConstants.XPATH_DIALECT, null);
- xpathExpEl.setText(xpathExpression);
- }
-
- OMElement useNotifyEl = factory.createOMElement("UseNotify", message.getNamespace(), message);
- useNotifyEl.setText("true");// check wether we still need this
-
- OMElement eprCrEl = EndpointReferenceHelper.toOM(factory, eventSinkLocation, new QName("ConsumerReference"),
- NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- message.addChild(eprCrEl);
- eprCrEl.setNamespace(message.getNamespace());
-
- return message;
- }
-
- public static String decodeSubscriptionResponse(OMElement subscriptionReference) throws AxisFault {
-
- String subscriptionId = null;
-
- EndpointReference subscriptionReferenceEPR = EndpointReferenceHelper.fromOM(subscriptionReference);
-
- Map<QName, OMElement> referenceParams = subscriptionReferenceEPR.getAllReferenceParameters();
-
- if (referenceParams != null) {
- QName identifierQName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(),
- WsmgCommonConstants.SUBSCRIPTION_ID);
-
- OMElement identifierEl = referenceParams.get(identifierQName);
- subscriptionId = (identifierEl != null) ? identifierEl.getText() : null;
-
- }
-
- return subscriptionId;
- }
-
- public static OMElement createUnsubscribeMsg() {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement message = factory.createOMElement("UnsubsribeRequest", NameSpaceConstants.WSNT_NS);
-
- return message;
- }
-
- public static OMElement encodeNotification(String topic, OMElement message, EndpointReference producerReference)
- throws AxisFault {
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement topicExpEl = factory.createOMElement("Topic", NameSpaceConstants.WSNT_NS);
- topicExpEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT, null);
- topicExpEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpEl.setText(NameSpaceConstants.WIDGET_NS.getPrefix() + ":" + topic);
-
- OMElement messageToNotify = factory.createOMElement("Notify", NameSpaceConstants.WSNT_NS);
- messageToNotify.declareNamespace(NameSpaceConstants.WSNT_NS);
- messageToNotify.declareNamespace(NameSpaceConstants.WSA_NS);
- OMElement notificationMesssageEl = factory.createOMElement("NotificationMessage",
- messageToNotify.getNamespace(), messageToNotify);
-
- notificationMesssageEl.addChild(topicExpEl);
-
- notificationMesssageEl.addChild(EndpointReferenceHelper.toOM(factory, producerReference, new QName(
- notificationMesssageEl.getNamespace().getNamespaceURI(), "ProducerReference", notificationMesssageEl
- .getNamespace().getPrefix()), NameSpaceConstants.WSA_NS.getNamespaceURI()));
-
- OMElement messageEl = factory.createOMElement("Message", notificationMesssageEl.getNamespace(),
- notificationMesssageEl);
-
- messageEl.addChild(message);
- return messageToNotify;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/ClientUtil.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/ClientUtil.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/ClientUtil.java
deleted file mode 100644
index 5937898..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/ClientUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.util;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-
-public class ClientUtil {
-
- public static final long EXPIRE_TIME = 1000 * 60 * 60 * 72l;
-
- public static String formatMessageBoxUrl(String msgBoxServiceUrl, String msgboxId) {
- return msgBoxServiceUrl.endsWith("/") ? msgBoxServiceUrl + "clientid/" + msgboxId : msgBoxServiceUrl
- + "/clientid/" + msgboxId;
- }
-
- public static String formatURLString(String url) {
- if (url == null) {
- throw new IllegalArgumentException("url can't be null");
- }
- if (url.indexOf("//") < 0) {
- url = "http://" + url; // use default http
- }
- return url;
- }
-
- public static String getHostIP() {
- InetAddress localAddress = null;
- try {
- localAddress = InetAddress.getLocalHost();
- } catch (UnknownHostException ex) {
- System.out.println("Error - unable to resolve localhost");
- }
- // Use IP address since DNS entry cannot update the laptop's entry
- // promptly
- String hostIP = localAddress.getHostAddress();
- return hostIP;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/DcDate.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/DcDate.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/DcDate.java
deleted file mode 100644
index 24b57cf..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/util/DcDate.java
+++ /dev/null
@@ -1,472 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.util;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TimeZone;
-
-//TODO: support for fractional seconds
-
-/**
- * Represent dc:date as an immutable value object. http://www.w3.org/TR/NOTE-datetime
- * http://www.sics.se/~preben/DC/date_help.html
- *
- */
-public final class DcDate implements Cloneable {
-
- public Object clone() throws CloneNotSupportedException {
- // it is easy as object is immutable
- DcDate dd = (DcDate) super.clone();
- return dd;
- }
-
- private String canonical;
-
- // private Date date;
- private int year;
-
- private int month; // 1-12
-
- private int day; // 1-31
-
- private int hh = -1; // 00-23
-
- private int mm = -1; // 00-59
-
- private int ss = -1; // 00-59
-
- private String decimalFraction = null; // decimal fraction
-
- private int zoneOffset; // in minutes +/-(12*60) ???
-
- private Calendar instant;
-
- private int millisOffset = -1; // milliseconds
-
- // public DcDate() throws SException {
- //
- // this(System.currentTimeMillis());
- // }
- //
- // public DcDate(long timeMillis) throws SException {
- // this(timeMillis, null);
- // Calendar local = new GregorianCalendar();
- // local.setTimeInMillis(timeMillis);
- // }
-
- // public DcDate(String tzName) throws SException {
- // TimeZone tz = tzName != null ? TimeZone.getTimeZone(tzName) :
- // TimeZone.getDefault();
- // TimeZone.getTimeZone("GMT")
- public DcDate(TimeZone tz) throws RuntimeException {
-
- // based on http://javaalmanac.com/egs/java.util/GetAllZones.html?l=rel
-
- Calendar cal = new GregorianCalendar(tz);
- init(cal, tz);
- }
-
- public DcDate(Calendar cal) throws RuntimeException {
- init(cal, cal.getTimeZone());
- }
-
- private void init(Calendar cal, TimeZone tz) throws RuntimeException {
- // Get the number of hours from GMT
- int rawOffset = tz.getRawOffset();
- zoneOffset = rawOffset / (60 * 1000);
-
- instant = cal;
- // http://javaalmanac.com/egs/java.util/GetCurDate.html
- year = cal.get(Calendar.YEAR);
- month = cal.get(Calendar.MONTH) + 1; // 0=Jan, 1=Feb, ...
- day = cal.get(Calendar.DAY_OF_MONTH);
- hh = cal.get(Calendar.HOUR_OF_DAY); // 0..23
- mm = cal.get(Calendar.MINUTE); // 0..59
- ss = cal.get(Calendar.SECOND); // 0..59
- // int ms = cal.get(Calendar.MILLISECOND); // 0..999
- // date = cal.getTime();
- canonical = computeCanonical();
- }
-
- public DcDate(String dcDate) throws RuntimeException {
- // try {
- // synchronized(sdf) { //TODO REVISIT: SimpleFormat is not multi-thread
- // safe!
- // d = sdf.parse(dcDate);
- // }
- // } catch (ParseException e) {
- // throw new SException("could not parse dc:date "+dcDate+getCtx(pp),
- // e);
- // }
- // 2003-05-06T23:07:04Z
- // 2003-08-09T18:36:00-05:00
- // 1234567890123456789012345
- // 2004-02-02T19:09:46-05:00
- // 1997
- // 1997-07
- // 1997-07-16
- // 1997-07-16T19:20+01:00
- // 1997-07-16T19:20:30+01:00
- // 1997-07-16T19:20:30.45+01:00
- assert dcDate != null;
- // assert pp != null;
- canonical = dcDate;
- year = getInt(dcDate, 1, 4); // add min, max check for all getInt
- if (dcDate.length() == 4) {
- return;
- }
- check(dcDate, 5, '-');
- month = getInt(dcDate, 6, 2);
- if (dcDate.length() == 7) {
- return;
- }
- check(dcDate, 8, '-');
- day = getInt(dcDate, 9, 2);
- if (dcDate.length() == 10) {
- return;
- }
- check(dcDate, 11, 'T');
- hh = getInt(dcDate, 12, 2);
- check(dcDate, 14, ':');
- mm = getInt(dcDate, 15, 2);
- if (dcDate.length() == 16) {
- throw new RuntimeException("expected date formatted as YYYY-MM-DDThh:mm[:ss[.mmm]]TZD and not " + dcDate);
- }
- int pos = 17;
- char c17 = dcDate.charAt(pos - 1);
- if (c17 == ':') {
- check(dcDate, 17, ':');
- ss = getInt(dcDate, 18, 2);
- pos = 20;
- }
- char zoneIndicator = dcDate.charAt(pos - 1);
- if (zoneIndicator == '.') { // OK we have yet millliseocnds to parse
- // (and ignore ...)
- // Ex: 2004-04-13T11:53:15.4362784-04:00
- // eat digits
- char d;
- int oldPos = pos;
- do {
- d = dcDate.charAt(pos);
- ++pos;
- } while (d >= '0' && d <= '9');
- if (oldPos + 1 == pos) {
- throw new RuntimeException("expected date formtted as YYYY-MM-DDThh:mm[:ss[.s]]TZD and not " + dcDate);
-
- }
- zoneIndicator = d;
- int newPos = pos;
- decimalFraction = dcDate.substring(oldPos, newPos - 1);
- if (newPos - oldPos >= 3) {
- newPos = oldPos + 3;
- }
- int len = newPos - (oldPos + 1);
- int ii = getInt(dcDate, oldPos + 1, len);
- if (len == 1) {
- millisOffset = 100 * ii;
- } else if (len == 2) {
- millisOffset = 10 * ii;
- } else if (len == 3) {
- millisOffset = ii;
- }
- }
- if (zoneIndicator == 'Z') {
- // done
- } else if (zoneIndicator == '-' || zoneIndicator == '+') {
- int zoneHH = getInt(dcDate, pos + 1, 2);
- check(dcDate, pos + 3, ':');
- int zoneMM = getInt(dcDate, pos + 4, 2);
- zoneOffset = 60 * zoneHH + zoneMM;
- if (zoneIndicator == '-') {
- zoneOffset *= -1;
- }
- } else {
- throw new RuntimeException("unknown zone indicator " + zoneIndicator + " in " + dcDate);
- }
- // Get the number of hours from GMT
-
- // TimeZone tz = TimeZone.
- instant = new GregorianCalendar();
- int rawOffset = zoneOffset * 60 * 1000;
- instant.set(Calendar.ZONE_OFFSET, rawOffset);
- instant.set(Calendar.YEAR, year);
- instant.set(Calendar.MONTH, month - 1); // 0=Jan, 1=Feb, ...
- instant.set(Calendar.DAY_OF_MONTH, day);
- instant.set(Calendar.HOUR_OF_DAY, hh); // 0..23
- instant.set(Calendar.MINUTE, mm); // 0..59
- instant.set(Calendar.SECOND, ss); // 0..59
- instant.set(Calendar.MILLISECOND, millisOffset); // /0..999 ?
- instant.getTimeInMillis(); // full time in ms -- test?
- }
-
- public long getTimeInMillis() {
- return instant.getTimeInMillis();
- }
-
- public int getYear() {
- return year;
- }
-
- public int getMonth() {
- return month;
- }
-
- public int getDay() {
- return day;
- }
-
- public int getHour() {
- return hh;
- }
-
- public int getMinute() {
- return mm;
- }
-
- public int getSecond() {
- return ss;
- }
-
- public int getTimeZoneOffset() {
- return zoneOffset;
- }
-
- public String getDcDate() {
- return canonical;
- }
-
- public String getDecimalFraction() {
- return decimalFraction;
- }
-
- private String computeCanonical() {
- // 2003-08-09T18:36:00-05:00
- // 1234567890123456789012345
- StringBuffer sb = new StringBuffer();
- fill(sb, year, 4);
- if (month > 0) {
- sb.append('-');
- fill(sb, month, 2);
- if (day > 0) {
- sb.append('-');
- fill(sb, day, 2);
- if (hh > -1) {
- sb.append('T');
- fill(sb, hh, 2);
- sb.append(':');
- fill(sb, mm, 2);
- if (ss > -1) {
- sb.append(':');
- fill(sb, ss, 2);
- }
- if (decimalFraction != null) {
- sb.append('.');
- sb.append(decimalFraction);
- }
- if (zoneOffset == 0) {
- sb.append('Z');
- } else {
- int off = zoneOffset;
- if (zoneOffset > 0) {
- sb.append('+');
- } else {
- sb.append('-');
- off *= -1;
- }
- int zoneHH = off / 60;
- int zoneMM = off % 60;
- fill(sb, zoneHH, 2);
- sb.append(':');
- fill(sb, zoneMM, 2);
- }
- }
- }
- }
- return sb.toString();
- }
-
- public String toString() {
- return canonical;
- }
-
- public final static String LOCATION_PROPERTY = "http://xmlpull.org/v1/doc/properties.html#location";
-
- public static String printable(char ch) {
- return "'" + escape(ch) + "'";
- }
-
- public static String printable(String s) {
- return "\"" + escape(s) + "\"";
- }
-
- public static String escape(char ch) {
- if (ch == '\n') {
- return "\\n";
- } else if (ch == '\r') {
- return "\\r";
- } else if (ch == '\t') {
- return "\\t";
- } else if (ch == '\'') {
- return "\\'";
- }
- if (ch > 127 || ch < 32) {
- return "\\u" + Integer.toHexString((int) ch);
- }
- return "" + ch;
- }
-
- public static String escape(String s) {
- if (s == null) {
- return null;
- }
- final int sLen = s.length();
- StringBuffer buf = new StringBuffer(sLen + 10);
- for (int i = 0; i < sLen; ++i) {
- buf.append(escape(s.charAt(i)));
- }
- s = buf.toString();
- return s;
- }
-
- private static final int LOOKUP_10S[] = { 1, 10, 10 * 10, 10 * 100, 100 * 100 };
-
- public static void fill(StringBuffer sb, int value, int fields) {
- assert fields > 0;
- assert fields <= 4;
- assert value >= 0;
- int mm = LOOKUP_10S[fields];
- assert value < mm;
- // assert mm > 0
- // TODO: optimize it ...
- while (fields-- > 0) {
- mm /= 10;
- if (value >= mm) {
- sb.append((value / mm) % 10);
- // i /= 10;
- } else {
- sb.append('0');
- }
- }
-
- // String s = sb.toString();
- // assert s.toString().length == fields;
- // return s;
- }
-
- public static void check(String dcDate, int pos, char ch) {
- if (pos > dcDate.length()) {
- throw new RuntimeException("expected " + printable(ch) + " at position " + pos + " but " + dcDate
- + " is too short");
- }
- char c = dcDate.charAt(pos - 1);
- if (c != ch) {
- throw new RuntimeException("expected " + printable(ch) + " but got " + printable(c) + " in " + dcDate);
- }
- }
-
- public static int getInt(String dcDate, int pos, int len) throws RuntimeException {
- assert len > 0;
- int end = pos + len - 1;
- String s = dcDate.substring(pos - 1, end);
- try {
- int i = Integer.parseInt(s);
- return i;
- } catch (NumberFormatException e) {
- throw new RuntimeException("expected number for " + printable(s) + " in " + dcDate, e);
-
- }
- }
-
- /**
- * Take string and return string that has no spaces, only alpahnumerics, each word is capitalized (like WikiWords)
- * sometimes called CamelCase?!.
- */
- public static String getWikiTitle(String title) {
- StringBuffer sb = new StringBuffer();
- List<String> words = breakIntoWords(title);
- boolean start = true;
- for (Iterator<String> it = words.iterator(); it.hasNext();) {
- String word = it.next();
- boolean wordStart = true;
- for (int i = 0; i < word.length(); i++) {
- char c = word.charAt(i);
- if (Character.isLetterOrDigit(c)) {
- if (wordStart && !start) {
- sb.append(Character.toUpperCase(c));
- } else {
- sb.append(c);
- }
- wordStart = false;
- }
- }
- start = false;
- }
- return sb.toString();
- }
-
- public static List<String> breakIntoWords(String s) {
- List<String> words = new ArrayList<String>(s.length() / 5);
- boolean inWord = true;
- int wordStart = 0;
- for (int pos = 0; pos < s.length(); ++pos) {
- char ch = s.charAt(pos);
- boolean isWordSeparator = Character.isWhitespace(ch);
- if (ch == ',') {
- isWordSeparator = true;
- }
- if (ch == '.') {
- isWordSeparator = true;
- }
- if (isWordSeparator) {
- if (inWord) {
- words.add(s.substring(wordStart, pos));
- inWord = false;
- }
- } else {
- if (!inWord) {
- inWord = true;
- wordStart = pos;
- }
- }
- assert inWord == !isWordSeparator;
- }
- if (inWord) {
- words.add(s.substring(wordStart));
- }
- return words;
- }
-
- public static String makeTwoDigit(int oneOrTwoDigits) {
- if (oneOrTwoDigits < 0 || oneOrTwoDigits > 99) {
- throw new IllegalArgumentException();
- }
- if (oneOrTwoDigits < 10) {
- return "0" + oneOrTwoDigits;
- }
- return "" + oneOrTwoDigits;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java
deleted file mode 100644
index def3f20..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewer.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.gui;
-
-import java.awt.Dimension;
-import java.awt.Toolkit;
-
-import javax.swing.SwingUtilities;
-import javax.swing.UIManager;
-
-public class NotificationViewer {
-
- boolean packFrame = false;
-
- /**
- * 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) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- try {
- UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
- } catch (Exception exception) {
- exception.printStackTrace();
- }
-
- new NotificationViewer();
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewerFrame.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewerFrame.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewerFrame.java
deleted file mode 100644
index c735fee..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/NotificationViewerFrame.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.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.airavata.wsmg.client.ConsumerServer;
-import org.apache.airavata.wsmg.client.WsntMsgBrokerClient;
-import org.apache.axis2.AxisFault;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationViewerFrame extends JFrame {
-
- private static final long serialVersionUID = -4924241323165353343L;
-
- private static final Logger logger = LoggerFactory.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);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/README.txt
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/README.txt b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/README.txt
deleted file mode 100644
index 4244b93..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/README.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-USING Notification Listener GUI.
-
-It is designed for Airavata project. The expected message XML schema in Airavata Workflow Management 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.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/WsntViewerConsumerNotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/WsntViewerConsumerNotificationHandler.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/WsntViewerConsumerNotificationHandler.java
deleted file mode 100644
index f1a4feb..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/gui/WsntViewerConsumerNotificationHandler.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.gui;
-
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class WsntViewerConsumerNotificationHandler implements ConsumerNotificationHandler {
- private final static Logger logger = LoggerFactory.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.toString());
- 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(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "Notify",
- NameSpaceConstants.WSNT_NS.getPrefix());
-
- QName notifyMsg = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "NotificationMessage",
- NameSpaceConstants.WSNT_NS.getPrefix());
-
- QName msg = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "Message",
- NameSpaceConstants.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());
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java
deleted file mode 100644
index ae66997..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/CreateMsgBox.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class can be used to invoke createMsgBox operation of msgBoxService and returns the resultant messageBoxId as
- * EndpointReference
- */
-public class CreateMsgBox {
- private static final Logger logger = LoggerFactory.getLogger(CreateMsgBox.class);
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
- protected String msgBoxEndPointReference;
- protected long timeoutInMilliSeconds;
- private String msgBoxId;
- private OMElement responseEl;
-
- public CreateMsgBox(String msgBoxLocation, long timeout) {
- this.msgBoxEndPointReference = msgBoxLocation;
- responseEl = OMAbstractFactory.getOMFactory().createOMElement(MsgBoxQNameConstants.MSG_BOXID_QNAME);
-
- timeoutInMilliSeconds = timeout;
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public EndpointReference execute() throws AxisFault {
- ServiceClient serviceClient = createServiceClient();
- OMElement responseMessage = null;
- try {
- responseMessage = serviceClient.sendReceive(createMessageEl());
- } finally {
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- }
-
- if (responseMessage == null) {
- throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
- }
- String response = responseMessage.getFirstElement().getText();
- this.responseEl.setText(response);
- this.msgBoxEndPointReference = ClientUtil.formatMessageBoxUrl(this.msgBoxEndPointReference, response);
- return new EndpointReference(this.msgBoxEndPointReference);
- }
-
- private OMElement createMessageEl() throws AxisFault {
- OMElement message = factory.createOMElement("createMsgBox", NameSpaceConstants.MSG_BOX);
- OMElement msgBoxId = factory.createOMElement("MsgBoxId", NameSpaceConstants.MSG_BOX);
- msgBoxId.setText("Create message box");
- message.addChild(msgBoxId);
- message.declareNamespace(NameSpaceConstants.MSG_BOX);
- return message;
- }
-
- private ServiceClient createServiceClient() throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(new EndpointReference(this.msgBoxEndPointReference));
- opts.setMessageId(uuid);
- opts.setAction(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "createMsgBox");
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- ServiceClient client = new ServiceClient();
- try {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- if (logger.isDebugEnabled())
- logger.debug("Addressing module engaged");
- } catch (AxisFault e) {
- if (logger.isDebugEnabled())
- logger.debug("Addressing module not engaged :" + e);
- }
- client.setOptions(opts);
- return client;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/DestroyMsgBox.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/DestroyMsgBox.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/DestroyMsgBox.java
deleted file mode 100644
index 057acdf..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/DestroyMsgBox.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.client;
-
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class can be used to invoke destroyMsgBox operation of msgBoxService and returns the resultant messageBoxId as
- * EndpointReference
- */
-public class DestroyMsgBox {
- private static final Logger logger = LoggerFactory.getLogger(DestroyMsgBox.class);
-
- private EndpointReference msgBoxEndPointReference = null;
- private long timeoutInMilliSeconds = 0;
- private String msgBoxId = null;
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
-
- public DestroyMsgBox(EndpointReference msgBoxEpr, long timeout) throws AxisFault {
- this.msgBoxEndPointReference = msgBoxEpr;
- this.timeoutInMilliSeconds = timeout;
- String address = msgBoxEpr.getAddress();
- int biginIndex = address.indexOf("clientid");
- if (biginIndex != -1) {
- msgBoxId = address.substring(biginIndex + "clientid".length() + 1);
- } else {
- throw new AxisFault("Invalid Message Box EPR cannot find message box ID");
- }
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public String execute() throws AxisFault {
- OMElement message = createMessageEl(this.msgBoxId);
- ServiceClient serviceClient = createServiceClient(message);
-
- OMElement responseMessage = null;
- try {
- responseMessage = serviceClient.sendReceive(message);
- } finally {
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- }
-
- responseMessage = serviceClient.sendReceive(message);
- if (responseMessage == null) {
- throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
- }
- return responseMessage.getFirstElement().getText();
- }
-
- private OMElement createMessageEl(String msgboxid) throws AxisFault {
- OMElement message = factory.createOMElement("destroyMsgBox", NameSpaceConstants.MSG_BOX);
- OMElement msgBoxId = factory.createOMElement("MsgBoxId", NameSpaceConstants.MSG_BOX);
- msgBoxId.setText(msgboxid);
- message.addChild(msgBoxId);
- message.declareNamespace(NameSpaceConstants.MSG_BOX);
- return message;
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(msgBoxEndPointReference);
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
-
- ServiceClient client = new ServiceClient();
- try {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- if (logger.isDebugEnabled())
- logger.debug("Addressing module engaged");
- } catch (AxisFault e) {
- if (logger.isDebugEnabled())
- logger.debug("Addressing module not engaged :" + e);
- }
-
- client.setOptions(opts);
- return client;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/MsgBoxClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/MsgBoxClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/MsgBoxClient.java
deleted file mode 100644
index 422c978..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/MsgBoxClient.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.client;
-
-import java.rmi.RemoteException;
-import java.util.Iterator;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This is the client class to invoke MsgBoxService this is using four separate classes to invoke four methods
- * createMsgBox,destroyMsgBox,takeMessages and storeMessages operations of the service.
- */
-public class MsgBoxClient {
-
- int msgsAtOnce = 10;
- static Logger logger = LoggerFactory.getLogger(MsgBoxClient.class);
-
- public MsgBoxClient() {
- }
-
- public EndpointReference createMessageBox(String msgBoxLocation, long timeout) throws RemoteException {
- CreateMsgBox msgBox = new CreateMsgBox(msgBoxLocation, timeout);
- return msgBox.execute();
- }
-
- public String storeMessage(EndpointReference msgBoxEpr, long timeout, OMElement messageIn) throws RemoteException {
- StoreMessage strMsg = new StoreMessage(msgBoxEpr, timeout);
- return strMsg.execute(messageIn);
- }
-
- public Iterator<OMElement> takeMessagesFromMsgBox(EndpointReference msgBoxEpr, long timeout) throws RemoteException {
- TakeMessages takeMsgs = new TakeMessages(msgBoxEpr, timeout);
- return takeMsgs.execute();
- }
-
- public String deleteMsgBox(EndpointReference msgBoxEpr, long timeout) throws RemoteException {
- DestroyMsgBox destroyMsgBox = new DestroyMsgBox(msgBoxEpr, timeout);
- return destroyMsgBox.execute();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java
deleted file mode 100644
index daa62ef..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/StoreMessage.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.client;
-
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class can be used to invoke destroyMsgBox operation of msgBoxService and returns the resultant operation status
- * as EndpointReference
- */
-public class StoreMessage {
- private static final Logger logger = LoggerFactory.getLogger(StoreMessage.class);
-
- protected EndpointReference msgBoxEndPointReference;
- protected long timeoutInMilliSeconds;
-
- public StoreMessage(EndpointReference msgBoxEpr, long timeout) throws AxisFault {
- this.msgBoxEndPointReference = msgBoxEpr;
- this.timeoutInMilliSeconds = timeout;
- String address = msgBoxEpr.getAddress();
-
- /*
- * Validate
- */
- int biginIndex = address.indexOf("clientid");
- if (biginIndex == -1) {
- throw new AxisFault("Invalid Message Box EPR cannot find message box ID");
- }
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public String execute(OMElement messageIn) throws AxisFault {
- ServiceClient serviceClient = createServiceClient();
-
- OMElement responseMessage = null;
-
- try {
- responseMessage = serviceClient.sendReceive(messageIn);
- } finally {
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- }
-
- if (responseMessage == null) {
- throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
- }
- return responseMessage.getFirstElement().getText();
- }
-
- private ServiceClient createServiceClient() throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(msgBoxEndPointReference);
- opts.setMessageId(uuid);
- opts.setAction(NameSpaceConstants.MSG_BOX.getNamespaceURI() + "/" + "storeMessages");
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- ServiceClient client = new ServiceClient();
- try {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- if (logger.isDebugEnabled())
- logger.debug("Addressing module engaged");
- } catch (AxisFault e) {
- if (logger.isDebugEnabled())
- logger.debug("Addressing module not engaged :" + e);
- }
- client.setOptions(opts);
- return client;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java
deleted file mode 100644
index 8acf348..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/msgbox/client/TakeMessages.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox.client;
-
-import java.util.Iterator;
-
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class can be used to invoke takeMessages operation of msgBoxService and returns the resultant operation status
- *
- */
-public class TakeMessages {
- private static final Logger logger = LoggerFactory.getLogger(TakeMessages.class);
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
- protected EndpointReference msgBoxEndPointReference;
- protected long timeoutInMilliSeconds;
- private String msgBoxId;
-
- public TakeMessages(EndpointReference msgBoxEpr, long timeout) throws AxisFault {
- this.msgBoxEndPointReference = msgBoxEpr;
- this.timeoutInMilliSeconds = timeout;
- String address = msgBoxEpr.getAddress();
- int biginIndex = address.indexOf("clientid");
- if (biginIndex != -1) {
- msgBoxId = address.substring(biginIndex + "clientid".length() + 1);
- } else {
- throw new AxisFault("Invalid Message Box EPR cannot find message box ID");
- }
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public Iterator<OMElement> execute() throws AxisFault {
- OMElement message = createMessageEl(this.msgBoxId);
- ServiceClient serviceClient = createServiceClient(message);
-
- OMElement responseMessage = null;
- try {
- responseMessage = serviceClient.sendReceive(message);
-
- if (responseMessage == null) {
- throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
- }
-
- responseMessage.build(); // free the input stream.
-
- } finally {
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- }
-
- return (Iterator<OMElement>) responseMessage.getFirstElement().getChildren();
- }
-
- private OMElement createMessageEl(String msgboxid) throws AxisFault {
- OMElement message = factory.createOMElement("takeMessages", NameSpaceConstants.MSG_BOX);
- OMElement msgBoxId = factory.createOMElement("MsgBoxId", NameSpaceConstants.MSG_BOX);
- msgBoxId.setText(msgboxid);
- message.addChild(msgBoxId);
- message.declareNamespace(NameSpaceConstants.MSG_BOX);
- return message;
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(msgBoxEndPointReference);
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- ServiceClient client = new ServiceClient();
- try {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- if (logger.isDebugEnabled())
- logger.debug("Addressing module engaged");
- } catch (AxisFault e) {
- if (logger.isDebugEnabled())
- logger.debug("Addressing module not engaged :" + e);
- }
-
- client.setOptions(opts);
- return client;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/resources/amqp-routing-keys.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/resources/amqp-routing-keys.xml b/modules/ws-messenger/client/src/main/resources/amqp-routing-keys.xml
deleted file mode 100644
index 74ef675..0000000
--- a/modules/ws-messenger/client/src/main/resources/amqp-routing-keys.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theà "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-<routingKeys>
- <!-- Routing keys for "workflowInvoked" event -->
- <event name="workflowInvoked">
- <key name="primaryKey">
- <segment name="serviceID">notificationSource/@serviceID</segment>
- </key>
- </event>
- <!-- Routing keys for "invokingService" event -->
- <event name="invokingService">
- <key name="primaryKey">
- <segment name="serviceID">notificationSource/@serviceID</segment>
- </key>
- </event>
- <!-- Routing keys for "receivedResult" event -->
- <event name="receivedResult">
- <key name="primaryKey">
- <segment name="serviceID">notificationSource/@serviceID</segment>
- </key>
- </event>
- <!-- Routing keys for "sendingResult" event -->
- <event name="sendingResult">
- <key name="primaryKey">
- <segment name="serviceID">notificationSource/@serviceID</segment>
- </key>
- </event>
- <!-- Routing keys for "workflowTerminated" event -->
- <event name="workflowTerminated">
- <key name="primaryKey">
- <segment name="serviceID">notificationSource/@serviceID</segment>
- </key>
- </event>
-</routingKeys>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/BroadcastSubscriber.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/BroadcastSubscriber.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/BroadcastSubscriber.java
deleted file mode 100644
index 5dbeb1c..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/BroadcastSubscriber.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import java.util.Properties;
-
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPBroadcastReceiverImpl;
-
-public class BroadcastSubscriber {
- public static void main(String args[]) throws AMQPException {
- String host = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, "localhost");
- String port = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, "5672");
- String username = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, "guest");
- String password = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, "guest");
-
- Properties properties = new Properties();
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, host);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, port);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, username);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, password);
-
- MessageConsumer consumer = new MessageConsumer();
- AMQPBroadcastReceiver receiver = new AMQPBroadcastReceiverImpl(properties, consumer);
- System.out.println("Waiting for broadcast messages : \n");
-
- receiver.Subscribe();
- }
-
- public static class MessageConsumer implements AMQPCallback {
- public void onMessage(String message) {
- System.out.println("Received : " + message);
- }
- }
-}
[08/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventData.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventData.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventData.java
deleted file mode 100644
index 6afa9af..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventData.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.net.URI;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
-import org.xmlpull.infoset.XmlElement;
-
-public class EventData {
-
- private String timeText;
-
- private Date timestamp;
-
- private String idText;
-
- private String statusText;
-
- private String message;
-
- private XmlElement event;
-
- private EventType type;
-
- private URI workflowID;
-
- private String nodeID;
-
- private String experimentID;
-
- /**
- * Constructs a MonitorEvent.
- *
- * @param event
- */
- public EventData(XmlElement event) {
- this.event = event;
- parse();
- }
-
- /**
- * Returns the event.
- *
- * @return The event
- */
- public XmlElement getEvent() {
- return this.event;
- }
-
- /**
- * Returns the idText.
- *
- * @return The idText
- */
- public String getIDText() {
- return this.idText;
- }
-
- /**
- * Returns the message.
- *
- * @return The message
- */
- public String getMessage() {
- return this.message;
- }
-
- /**
- * Returns the statusText.
- *
- * @return The statusText
- */
- public String getStatusText() {
- return this.statusText;
- }
-
- /**
- * Returns the timeText.
- *
- * @return The timeText
- */
- public String getTimeText() {
- return this.timeText;
- }
-
- /**
- * Returns the type.
- *
- * @return The type
- */
- public EventType getType() {
- return this.type;
- }
-
- /**
- * Returns the workflowID.
- *
- * @return The workflowID
- */
- public URI getWorkflowID() {
- return this.workflowID;
- }
-
- /**
- * Returns the nodeID.
- *
- * @return The nodeID
- */
- public String getNodeID() {
- return this.nodeID;
- }
-
- private void parse() {
- this.type = MonitorUtil.getType(this.event);
- this.workflowID = MonitorUtil.getWorkflowID(this.event);
- this.nodeID = MonitorUtil.getNodeID(this.event);
- this.experimentID = MonitorUtil.getExperiementID(this.event);
- timestamp = MonitorUtil.getTimestamp(this.event);
-
- if (timestamp != null) {
- SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss.S MM/dd/yy ");
- this.timeText = format.format(timestamp);
- } else {
- this.timeText = "";
- }
-
- this.idText = this.nodeID;
-
- this.statusText = MonitorUtil.getStatus(this.event);
-
- this.message = MonitorUtil.getMessage(this.event);
- if (this.type == MonitorUtil.EventType.PUBLISH_URL) {
- String location = MonitorUtil.getLocation(this.event);
- // should be looked into
- // String url = PREFIX + location + SUFFIX;
- String url = location;
- this.message = "<html>" + this.message + ": " + "<a href=\"" + url + "\">" + url + " </a></html>";
- }
- }
-
- public Date getTimestamp() {
- return timestamp;
- }
-
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getExperimentID() {
- return experimentID;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java
deleted file mode 100644
index ed5875f..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListener.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-public interface EventDataListener {
-
- /**
- * Gets triggered when a new message is received relevant for the experiment subscribed to
- * @param eventDataRepo - Contains a collection of events up to this point in monitoring
- * @param eventData - the new message related to the experiment
- */
- public void notify(EventDataRepository eventDataRepo, EventData eventData);
-
- /**
- * Set the Monitor object
- * @param monitor
- */
- public void setExperimentMonitor(Monitor monitor);
-
- /**
- * Gets triggered just before the experiment monitoring is started
- */
- public void monitoringPreStart();
-
- /**
- * Gets triggered just after the experiment monitoring is started
- */
- public void monitoringPostStart();
-
- /**
- * Gets triggered just before the experiment monitoring is stopped
- */
- public void monitoringPreStop();
-
- /**
- * Gets triggered just after the experiment monitoring is stopped
- */
- public void monitoringPostStop();
-
- /**
- * Gets triggered when experiment fails
- */
- public void onFail(EventData failNotification);
-
- /**
- * Gets triggered when the experiment completes
- */
- public void onCompletion(EventData completionNotification);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java
deleted file mode 100644
index 5eeaeaf..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataListenerAdapter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-public abstract class EventDataListenerAdapter implements EventDataListener {
- private Monitor monitor;
-
- @Override
- public void setExperimentMonitor(Monitor monitor) {
- setMonitor(monitor);
- }
-
- @Override
- public void monitoringPreStart() {
- //Nothing to do
- }
-
- @Override
- public void monitoringPostStart() {
- //Nothing to do
- }
-
- @Override
- public void monitoringPreStop() {
- //Nothing to do
- }
-
- @Override
- public void monitoringPostStop() {
- //Nothing to do
- }
-
- protected Monitor getMonitor() {
- return monitor;
- }
-
- private void setMonitor(Monitor monitor) {
- this.monitor = monitor;
- }
-
- @Override
- public void onFail(EventData failNotification) {
- //Nothing to do
- }
-
- @Override
- public void onCompletion(EventData completionNotification) {
- //Nothing to do
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java
deleted file mode 100644
index 1c20cf8..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventDataRepository.java
+++ /dev/null
@@ -1,503 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.swing.BoundedRangeModel;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.table.TableModel;
-
-import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-public class EventDataRepository implements TableModel, BoundedRangeModel {
-
- /**
- * Column
- */
- public static enum Column {
- /**
- * TIME
- */
- TIME("Time"),
- /**
- * ID
- */
- ID("Component"),
- /**
- * STATUS
- */
- STATUS("Status"),
- /**
- * MESSAGE
- */
- MESSAGE("Message");
-
- private String name;
-
- private Column(String name) {
- this.name = name;
- }
-
- /**
- * @return The name.
- */
- public String getName() {
- return this.name;
- }
- }
-
- private static final Logger logger = LoggerFactory.getLogger(EventDataRepository.class);
-
- private List<TableModelListener> tableModelListeners;
-
- private List<ChangeListener> sliderModelListeners;
-
- private List<EventData> events;
-
- private int sliderValue;
-
- private boolean sliderAdjusting;
-
- private ChangeEvent tableModelChangeEvent;
-
- private EventFilter filter;
-
- private List<EventDataListener> monitorEventListerners;
-
- /**
- *
- * Constructs a MonitorEventData.
- *
- */
- public EventDataRepository() {
- this(null);
- }
-
- /**
- * Constructs a NotificationTableModel.
- */
- public EventDataRepository(EventFilter filter) {
- this.filter = filter;
- this.tableModelListeners = new LinkedList<TableModelListener>();
- this.sliderModelListeners = new LinkedList<ChangeListener>();
- this.tableModelChangeEvent = new ChangeEvent(this); // We only need one.
- this.events = new ArrayList<EventData>();
- }
- public void addEvent(XmlElement message) throws Exception {
- addEvent(new EventData(message));
- }
- /**
- * @param event
- */
- public void addEvent(EventData event) throws Exception {
- // no need the check for not null because second clause is evaluated only if
- // not null
- if (this.filter == null || this.filter.isAcceptable(event)) {
- boolean sliderMax = (this.sliderValue == this.events.size());
-
- this.events.add(event);
-
- if (sliderMax) {
- // Move the slider to the max
- this.sliderValue = this.events.size();
-
- // The new event shows up on the table only when the slider is
- // max.
- TableModelEvent tableEvent = new TableModelEvent(this, this.sliderValue - 1, this.sliderValue,
- TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT);
- fireTableChanged(tableEvent);
- }
-
- // The muxmum of the slider changed regardless whether we move the
- // slider or not.
- fireSliderChanged();
- triggerListenerForMonitorEvent(event);
- }
-
- }
- public void triggerListenerForPreMonitorStart() throws Exception {
- for (EventDataListener listener : getMonitorEventListerners()) {
- try {
- listener.monitoringPreStart();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
-
- public void triggerListenerForPostMonitorStart() throws Exception{
- for (EventDataListener listener : getMonitorEventListerners()) {
- try {
- listener.monitoringPostStart();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
-
- public void triggerListenerForPreMonitorStop() throws Exception {
- for (EventDataListener listener : getMonitorEventListerners()) {
- try {
- listener.monitoringPreStop();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
-
- public void triggerListenerForPostMonitorStop() throws Exception {
- for (EventDataListener listener : getMonitorEventListerners()) {
- try {
- listener.monitoringPostStop();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
- private void triggerListenerForMonitorEvent(EventData event) throws Exception{
- for (EventDataListener listener : getMonitorEventListerners()) {
- try {
- listener.notify(this, event);
- if (event.getType()==EventType.WORKFLOW_TERMINATED){
- listener.onCompletion(event);
- }else if (event.getType()==EventType.SENDING_FAULT){
- listener.onFail(event);
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
-
- /**
- * @return All events.
- */
- public List<EventData> getEvents() {
- return this.events;
- }
-
- /**
- * Returns a notification at a specified row.
- *
- * @param index
- * The specified row.
- * @return The notification at the specified row
- */
- public EventData getEvent(int index) {
- return this.events.get(index);
- }
-
- /**
- * @return The number of events.
- */
- public int getEventSize() {
- return this.events.size();
- }
-
- /**
- * Clears the notifications.
- */
- public void removeAllEvents() {
- int size = this.events.size();
- this.events.clear();
-
- this.sliderValue = 0;
-
- TableModelEvent event = new TableModelEvent(this, 0, Math.max(0, size - 1), TableModelEvent.ALL_COLUMNS,
- TableModelEvent.DELETE);
- fireTableChanged(event);
-
- // The muxmum of the slider changed.
- fireSliderChanged();
- }
-
- // methods implementing TableModel interface.
-
- /**
- * @see javax.swing.table.TableModel#getRowCount()
- */
- public int getRowCount() {
- // Only show the events up to the slider value.
- return this.sliderValue;
- }
-
- /**
- * @see javax.swing.table.TableModel#getColumnCount()
- */
- public int getColumnCount() {
- return Column.values().length;
- }
-
- /**
- * @see javax.swing.table.TableModel#getColumnName(int)
- */
- public String getColumnName(int columnIndex) {
- Column[] columns = Column.values();
- if (columnIndex < 0 || columnIndex >= columns.length) {
- // Should not happen.
- throw new IllegalArgumentException("columnIndex has be be between 0 to " + columns.length);
- }
- return columns[columnIndex].getName();
- }
-
- /**
- * @see javax.swing.table.TableModel#getColumnClass(int)
- */
- public Class<?> getColumnClass(int columnIndex) {
- return String.class;
- }
-
- /**
- * @see javax.swing.table.TableModel#isCellEditable(int, int)
- */
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return false;
- }
-
- /**
- * @see javax.swing.table.TableModel#getValueAt(int, int)
- */
- public Object getValueAt(int rowIndex, int columnIndex) {
- String value;
- try {
- EventData event = this.events.get(rowIndex);
- value = getTextAt(event, columnIndex);
- } catch (RuntimeException e) {
- // This should not happen, but if it happens it blocks the UI.
- // That's why catching it.
- logger.error(e.getMessage(), e);
- value = "Error";
- }
- return value;
- }
-
- /**
- * @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
- */
- public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.swing.table.TableModel#addTableModelListener(javax.swing.event.TableModelListener)
- */
- public void addTableModelListener(TableModelListener listener) {
- this.tableModelListeners.add(listener);
- }
-
- /**
- * @see javax.swing.table.TableModel#removeTableModelListener(javax.swing.event.TableModelListener)
- */
- public void removeTableModelListener(TableModelListener listener) {
- this.tableModelListeners.remove(listener);
- }
-
- // methods implementing BoundedRangeModel interface.
-
- /**
- * @see javax.swing.BoundedRangeModel#getExtent()
- */
- public int getExtent() {
- return 0;
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setExtent(int)
- */
- public void setExtent(int newExtent) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#getMaximum()
- */
- public int getMaximum() {
- return getEventSize();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setMaximum(int)
- */
- public void setMaximum(int newMaximum) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#getMinimum()
- */
- public int getMinimum() {
- return 0;
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setMinimum(int)
- */
- public void setMinimum(int newMinimum) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#getValue()
- */
- public int getValue() {
- return this.sliderValue;
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setValue(int)
- */
- public void setValue(int newValue) {
- if (this.sliderValue == newValue) {
- return;
- }
-
- // Correct the value to be withing the range.
- if (newValue < 0) {
- newValue = 0;
- }
- if (newValue > this.events.size()) {
- newValue = this.events.size();
- }
-
- int oldRowCount = this.sliderValue;
- this.sliderValue = newValue;
-
- TableModelEvent event;
- if (oldRowCount < this.sliderValue) {
- event = new TableModelEvent(this, oldRowCount, this.sliderValue, TableModelEvent.ALL_COLUMNS,
- TableModelEvent.INSERT);
- } else {
- event = new TableModelEvent(this, this.sliderValue, oldRowCount, TableModelEvent.ALL_COLUMNS,
- TableModelEvent.DELETE);
- }
- fireTableChanged(event);
- fireSliderChanged();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#getValueIsAdjusting()
- */
- public boolean getValueIsAdjusting() {
- return this.sliderAdjusting;
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setValueIsAdjusting(boolean)
- */
- public void setValueIsAdjusting(boolean adjusting) {
- this.sliderAdjusting = adjusting;
- fireSliderChanged();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#setRangeProperties(int, int, int, int, boolean)
- */
- public void setRangeProperties(int value, int extent, int min, int max, boolean adjusting) {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#addChangeListener(javax.swing.event.ChangeListener)
- */
- public void addChangeListener(ChangeListener listener) {
- this.sliderModelListeners.add(listener);
- }
-
- /**
- * @see javax.swing.BoundedRangeModel#removeChangeListener(javax.swing.event.ChangeListener)
- */
- public void removeChangeListener(ChangeListener listener) {
- this.sliderModelListeners.remove(listener);
- }
-
- private String getTextAt(EventData event, int columnIndex) {
- Column[] columns = Column.values();
- if (columnIndex < 0 || columnIndex >= columns.length) {
- // Should not happen.
- throw new IllegalArgumentException("columnIndex has be be between 0 to " + columns.length);
- }
- Column column = columns[columnIndex];
- String value;
- switch (column) {
- case TIME:
- value = event.getTimeText();
- break;
- case ID:
- value = event.getIDText();
- break;
- case STATUS:
- value = event.getStatusText();
- break;
- case MESSAGE:
- value = event.getMessage();
- break;
- default:
- // Should not happen.
- throw new IllegalArgumentException("columnIndex has be be between 0 to " + columns.length);
- }
- return value;
- }
-
- private void fireTableChanged(TableModelEvent event) {
- for (TableModelListener listener : this.tableModelListeners) {
- listener.tableChanged(event);
- }
- }
-
- private void fireSliderChanged() {
- for (ChangeListener listener : this.sliderModelListeners) {
- listener.stateChanged(this.tableModelChangeEvent);
- }
- }
- private List<EventDataListener> getMonitorEventListerners() {
- if (monitorEventListerners==null){
- monitorEventListerners=new ArrayList<EventDataListener>();
- }
- return monitorEventListerners;
- }
-
- public void registerEventListener(EventDataListener listener){
- if (listener!=null) {
- getMonitorEventListerners().add(listener);
- }
- }
-
- public void unregisterEventListener(EventDataListener listener){
- if (getMonitorEventListerners().contains(listener)) {
- getMonitorEventListerners().remove(listener);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventFilter.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventFilter.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventFilter.java
deleted file mode 100644
index 6e8b286..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/EventFilter.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-public interface EventFilter {
-
- public boolean isAcceptable(EventData event);
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java
deleted file mode 100644
index 0666bd1..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/Monitor.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.ws.monitor.MonitorUtil.EventType;
-import org.apache.airavata.ws.monitor.event.Event;
-import org.apache.airavata.ws.monitor.event.EventProducer;
-import org.apache.airavata.ws.monitor.event.Event.Type;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-public class Monitor extends EventProducer {
-
- protected static final Logger logger = LoggerFactory.getLogger(Monitor.class);
-
- protected MonitorConfiguration configuration;
-
- protected static final String DEFAULT_MODEL_KEY = "_DEFAULT_MODEL_KEY";
-
- protected Map<String, EventDataRepository> eventDataMap = new HashMap<String, EventDataRepository>();
-
- protected WsmgClient wsmgClient;
-
- protected boolean printRawMessages;
-
- protected long messagePullTimeout = 20000L;
-
- protected boolean monitoring = false;
-
- private boolean monitoringCompleted=false;
-
- private boolean monitoringFailed=false;
-
- private String lastTerminatedWorkflowExecutionId=null;
-
- public Monitor(MonitorConfiguration configuration) {
- this.configuration = configuration;
- // First one keeps all event data & it doesn't have filters
- this.eventDataMap.put(DEFAULT_MODEL_KEY, new EventDataRepository());
- }
-
- /**
- * @return The configuration for monitoring
- */
- public MonitorConfiguration getConfiguration() {
- return this.configuration;
- }
-
- /**
- * Return the event data repository containing all the notifications
- * @return
- */
- public EventDataRepository getEventDataRepository() {
- return this.eventDataMap.get(DEFAULT_MODEL_KEY);
- }
-
- /**
- * Return the event data repository containing all the notifications for the node
- * @param nodeID
- * @return
- */
- public EventDataRepository getEventDataRepository(String nodeID){
- return this.eventDataMap.get(nodeID);
- }
-
- /**
- * @throws MonitorException
- */
- public synchronized void start() throws Exception {
-
- //Make sure currently we are not doing any monitoring
- stop();
-
- // Reset monitoring variables
- monitoringCompleted=false;
- monitoringFailed=false;
-
- //Notify listeners that the monitoring is about to start
- getEventDataRepository().triggerListenerForPreMonitorStart();
-
- subscribe();
-
- if (null != this.configuration.getInteractiveNodeIDs()) {
- List<String> interactiveNodeIDs = this.configuration.getInteractiveNodeIDs();
- // now add models for this as well
- for (String string : interactiveNodeIDs) {
-
- final String nodeID = string;
- // for each wsnode there is one data model which
- this.eventDataMap.put(nodeID, new EventDataRepository(new EventFilter() {
- public boolean isAcceptable(EventData event) {
- return event != null && event.getNodeID() != null && event.getNodeID().equals(nodeID);
- }
- }));
- }
-
- }
- getEventDataRepository().triggerListenerForPostMonitorStart();
- }
-
- /**
- * Stops monitoring without using a thread.
- *
- * @throws MonitorException
- */
- public synchronized void stop() throws MonitorException {
- try {
- if (this.wsmgClient != null) {
- getEventDataRepository().triggerListenerForPreMonitorStop();
- unsubscribe(this.wsmgClient);
- this.wsmgClient = null;
- getEventDataRepository().triggerListenerForPostMonitorStop();
- }
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- throw new MonitorException(e.getMessage(), e);
- } finally{
- monitoringCompleted=true;
- }
- }
-
- /**
- * Start monitoring asynchronously
- */
- public void startMonitoring(){
- new Thread(){
- @Override
- public void run() {
- try {
- Monitor.this.start();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- }.start();
- }
-
- /**
- * Stop monitoring asynchronously
- */
- public void stopMonitoring(){
- // Users don't need to know the end of unsubscription.
- new Thread() {
- @Override
- public void run() {
- try {
- Monitor.this.stop();
- } catch (WorkflowException e) {
- // Ignore the error in unsubscription.
- logger.error(e.getMessage(), e);
- }
- }
- }.start();
- }
-
- /**
- * Resets the graph and clear the monitoring table. Remove all the extra table models available
- */
- public void resetEventData() {
- Set<String> keys = this.eventDataMap.keySet();
- LinkedList<String> keysToBeRemoved = new LinkedList<String>();
- // Remove everthing leaving only the last one
- for (String key : keys) {
- EventDataRepository monitorEventData = this.eventDataMap.get(key);
- monitorEventData.removeAllEvents();
- if (!key.equals(DEFAULT_MODEL_KEY)) {
- keysToBeRemoved.add(key);
- }
- }
- for (String key : keysToBeRemoved) {
- this.eventDataMap.remove(key);
- }
-
- }
-
- /**
- * @param event
- */
- protected synchronized void handleNotification(XmlElement event) {
- EventData eventData = new EventData(event);
- if (eventData.getType()==EventType.WORKFLOW_TERMINATED){
- lastTerminatedWorkflowExecutionId=eventData.getExperimentID();
- }
- Set<String> keys = this.eventDataMap.keySet();
- // Remove everthing leaving only the last one
- if(printRawMessages){
- System.out.println(XMLUtil.xmlElementToString(event));
- }
- for (String key : keys) {
- try {
- this.eventDataMap.get(key).addEvent(eventData);
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Subscribe to the WS Messenger client to pull notifications from the message box
- * @throws MonitorException
- */
- private void subscribe() throws MonitorException {
- this.wsmgClient = new WsmgClient(this);
- //Users can set the timeout and interval for the subscription using wsmg setter methods, here we use the default values
- this.wsmgClient.setTimeout(this.getMessagePullTimeout());
- this.wsmgClient.subscribe();
- setMonitoring(true);
-
- // Enable/disable some menu items and show the monitor panel.
- sendSafeEvent(new Event(Type.MONITOR_STARTED));
- }
-
- /**
- * Unsubcribe from the ws messager client
- * @param client
- * @throws MonitorException
- */
- private void unsubscribe(WsmgClient client) throws MonitorException {
- // Enable/disable some menu items.
- sendSafeEvent(new Event(Type.MONITOR_STOPED));
- client.unsubscribe();
- setMonitoring(false);
- }
-
- /**
- * Wait until the monitoring is completed
- */
- public void waitForCompletion() throws Exception {
- while(!monitoringCompleted && !monitoringFailed){
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
- }
-
- /**
- * Print the raw notification messages to the console as they arrive
- * @param print - if <code>true</code> raw notifications are printed
- */
- public void printRawMessage(boolean print){
- this.printRawMessages = print;
- }
-
- /**
- * Retrieve the timeout in milliseconds for pulling messages
- * @return
- */
- public long getMessagePullTimeout() {
- return messagePullTimeout;
- }
-
- /**
- * Set the timeout in milliseconds for pulling messages
- * @param timeout
- */
- public void setMessagePullTimeout(long timeout) {
- this.messagePullTimeout = timeout;
- }
-
- /**
- * is the monitoring active
- * @return
- */
- public boolean isMonitoring() {
- return monitoring;
- }
-
- public boolean hasCurrentExecutionTerminatedNotificationReceived() {
- return getConfiguration().getTopic()!=null && getConfiguration().getTopic().equals(lastTerminatedWorkflowExecutionId);
- }
-
- private void setMonitoring(boolean monitoring) {
- this.monitoring = monitoring;
- }
-
- /**
- * Return the id of the experiment which the monitoring is done
- * @return
- */
- public String getExperimentId(){
- return getConfiguration().getTopic();
- }
-
- /**
- * @deprecated - Use <code>getEventDataRepository()</code> instead
- * @return
- */
- public EventDataRepository getEventData(){
- return getEventDataRepository();
- }
-
- /**
- * @deprecated - Use <code>getEventDataRepository(...)</code> instead
- * @param nodeID
- * @return
- */
- public EventDataRepository getEventData(String nodeID) {
- return getEventDataRepository(nodeID);
- }
-
- /**
- * @deprecated - Use <code>printRawMessage(...)</code> instead
- * @param print - if <code>true</code> raw notifications are printed
- */
- public void setPrint(boolean print) {
- this.printRawMessages = print;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorConfiguration.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorConfiguration.java
deleted file mode 100644
index 892fa1f..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorConfiguration.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.net.URI;
-import java.util.List;
-
-import org.apache.airavata.ws.monitor.event.Event;
-import org.apache.airavata.ws.monitor.event.EventProducer;
-import org.apache.airavata.ws.monitor.event.Event.Type;
-import org.apache.airavata.common.utils.StringUtil;
-
-public class MonitorConfiguration extends EventProducer implements Cloneable{
-
- // private static final Logger logger = LoggerFactory.getLogger();
-
- private URI brokerURL;
-
- private String topic;
-
- private boolean pullMode;
-
- private URI messageBoxURL;
-
- private List<String> interactiveNodeIDs = null;
-
- /**
- * Constructs a NotificationConfiguration.
- *
- * @param brokerURL
- * @param topic
- * @param pullMode
- * @param messageBoxURL
- */
- public MonitorConfiguration(URI brokerURL, String topic, boolean pullMode, URI messageBoxURL) {
- set(brokerURL, topic, pullMode, messageBoxURL);
- }
-
- /**
- * @param brokerURL
- * @param topic
- * @param pullMode
- * @param messageBoxURL
- */
- public void set(URI brokerURL, String topic, boolean pullMode, URI messageBoxURL) {
- this.brokerURL = brokerURL;
- this.topic = topic;
- this.pullMode = pullMode;
- this.messageBoxURL = messageBoxURL;
- sendSafeEvent(new Event(Type.MONITOR_CONFIGURATION_CHANGED));
- }
-
- /**
- * @param brokerURL
- * The brokerLocation to set.
- */
- public void setBrokerURL(URI brokerURL) {
- this.brokerURL = brokerURL;
- sendSafeEvent(new Event(Type.MONITOR_CONFIGURATION_CHANGED));
- }
-
- /**
- * Returns the URL of the notification broker.
- *
- * @return The URL of the notification broker
- */
- public URI getBrokerURL() {
- return this.brokerURL;
- }
-
- /**
- * @param topic
- * The topic to set
- */
- public void setTopic(String topic) {
- this.topic = StringUtil.trimAndNullify(topic);
- sendSafeEvent(new Event(Type.MONITOR_CONFIGURATION_CHANGED));
- }
-
- /**
- * @return The userId.
- */
- public String getTopic() {
- return this.topic;
- }
-
- /**
- * Returns the messageBoxUrl.
- *
- * @return The messageBoxUrl
- */
- public URI getMessageBoxURL() {
- return this.messageBoxURL;
- }
-
- /**
- * Sets messageBoxUrl.
- *
- * @param messageBoxURL
- * The messageBoxUrl to set.
- */
- public void setMessageBoxURL(URI messageBoxURL) {
- this.messageBoxURL = messageBoxURL;
- sendSafeEvent(new Event(Type.MONITOR_CONFIGURATION_CHANGED));
- }
-
- /**
- * Returns the pullMode.
- *
- * @return The pullMode
- */
- public boolean isPullMode() {
- return this.pullMode;
- }
-
- /**
- * Sets pullMode.
- *
- * @param pullMode
- * The pullMode to set.
- */
- public void setPullMode(boolean pullMode) {
- this.pullMode = pullMode;
- sendSafeEvent(new Event(Type.MONITOR_CONFIGURATION_CHANGED));
- }
-
- /**
- * @return true if the configuration is valid; false otherwise.
- */
- public boolean isValid() {
- if (this.brokerURL == null) {
- return false;
- }
- if (this.topic == null || this.topic.length() == 0) {
- return false;
- }
- if (this.pullMode == true) {
- if (this.messageBoxURL == null) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * @see java.lang.Object#clone()
- */
- @Override
- public MonitorConfiguration clone() {
- return new MonitorConfiguration(this.brokerURL, this.topic, this.pullMode, this.messageBoxURL);
- }
-
- /**
- * Returns the interactiveNodeIDs.
- *
- * @return The interactiveNodeIDs
- */
- public List<String> getInteractiveNodeIDs() {
- return this.interactiveNodeIDs;
- }
-
- /**
- * Sets interactiveNodeIDs.
- *
- * @param interactiveNodeIDs
- * The interactiveNodeIDs to set.
- */
- public void setInteractiveNodeIDs(List<String> interactiveNodeIDs) {
- this.interactiveNodeIDs = interactiveNodeIDs;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEvent.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEvent.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEvent.java
deleted file mode 100644
index 95f9fc5..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEvent.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import org.xmlpull.infoset.XmlElement;
-
-@Deprecated
-public class MonitorEvent extends EventData {
-
- public MonitorEvent(XmlElement event) {
- super(event);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventData.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventData.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventData.java
deleted file mode 100644
index df93144..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventData.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-@Deprecated
-public class MonitorEventData extends EventDataRepository {
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
deleted file mode 100644
index 06d1897..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorEventListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-/**
- * @deprecated - Use <code>EventDataListener</code> instead
- * @author samindaw
- *
- */
-public interface MonitorEventListener extends EventDataListener {
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorException.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorException.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorException.java
deleted file mode 100644
index 6993227..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorException.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-
-public class MonitorException extends WorkflowException {
-
- /**
- * Constructs a MonitorException.
- */
- public MonitorException() {
- super();
- }
-
- /**
- * Constructs a MonitorException.
- *
- * @param message
- */
- public MonitorException(String message) {
- super(message);
- }
-
- /**
- * Constructs a MonitorException.
- *
- * @param cause
- */
- public MonitorException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Constructs a MonitorException.
- *
- * @param message
- * @param cause
- */
- public MonitorException(String message, Throwable cause) {
- super(message, cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorUtil.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorUtil.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorUtil.java
deleted file mode 100644
index 71ec411..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/MonitorUtil.java
+++ /dev/null
@@ -1,627 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Date;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-import org.xmlpull.infoset.XmlNamespace;
-
-import atomixmiser.DcDate;
-
-/**
- * Manipulate XML Events
- */
-public class MonitorUtil {
-
- private static final Logger logger = LoggerFactory.getLogger(MonitorUtil.class);
-
- /**
- * Workflow tracking namespace
- */
- public static final XmlNamespace WOR_NS = XMLUtil.BUILDER.newNamespace("wor",
- "http://airavata.apache.org/schemas/wft/2011/08");
-
- /**
- * XBaya events namespace
- */
- public static final XmlNamespace XBAYA_EVENTS_NS = XMLUtil.BUILDER.newNamespace("xbaya",
- "http://www.extreme.indiana.edu/xgws/xbaya/ns/2006/");
-
- /**
- * gotResult
- */
- public static final String GOT_RESULT_EVENT_TAG = "receivedResult";
-
- /**
- * description
- */
- public static final String DESCRIPTION_TAG = "description";
-
- /**
- * timestamp
- */
- public static final String TIMESTAMP_TAG = "timestamp";
-
- /**
- * request
- *
- * In invokingService
- */
- public static final String REQUEST = "request";
-
- /**
- * result
- *
- * In sendingResult
- */
- public static final String RESULT = "result";
-
- /**
- * body
- *
- * In sendingResult
- */
- public static final String BODY = "body";
-
- /**
- * experimentID
- * In Notification Message
- */
- public static final String WORKFLOW_EXPERIMENT_ID = "experimentID";
- /**
- * workflowID
- *
- * workflow instance ID.
- */
- private static final String WORKFLOW_ID_ATTRIBUTE = "workflowID";
-
- /**
- * serviceID
- *
- * In workflowInitialized notification, this is the worklfow instance ID.
- */
- private static final String SERVICE_ID_ATTRIBUTE = "serviceID";
-
- /**
- * workflowNodeID
- *
- * Node ID.
- */
- private static final String WORKFLOW_NODE_ID_ATTRIBUTE = "workflowNodeID";
-
- /**
- * receiver
- *
- * Extract a node ID from here when a notification is sent by a workflow when the workflow is sending a message to a
- * service.
- */
- private static final String RECEIVER_TAG = "receiver";
-
- /**
- * responder
- *
- * Extract a node ID from here when a notification is sent by a workflow when the workflow is receiving a message
- * from a service.
- */
- private static final String RESPONDER_TAG = "responder";
-
- /**
- * notificationSource
- *
- * Extract a node ID from here when a service sends notification.
- */
- private static final String NOTIFICATION_SOURCE_TAG = "notificationSource";
-
- // Followings are specific to some event types.
-
- /**
- * location
- *
- * In publishURL
- */
- private static final String LOCATION_TAG = "location";
-
- /**
- * retryStatusCount
- *
- * In computationDuration
- */
- private static final String RETRY_STATUS_COUNT_TAG = "retryStatusCount";
-
- /**
- * mappedResource
- *
- * In resourceMapping
- */
- private static final String MAPPED_RESOURCE_TAG = "mappedResource";
-
- /**
- * dataProduct
- *
- * In a couple of data-related notifications.
- */
- private static final String DATA_PRODUCT_TAG = "dataProduct";
-
- /**
- * durationInMillis
- *
- * In computationDuration
- */
- @SuppressWarnings("unused")
- private static final String DURATION_IN_MILLS_TAG = "durationInMillis";
-
- /**
- * Type of the notification event.
- */
- public enum EventType {
- /**
- * unknown
- */
- UNKNOWN("unknown"),
-
- // Notification from a workflow
-
- /**
- * workflowInitialized
- */
- WORKFLOW_INITIALIZED("workflowInitialized"),
-
- /**
- * workflowInvoked
- */
- WORKFLOW_INVOKED("workflowInvoked"),
-
- /**
- * workflowTerminated
- */
- WORKFLOW_TERMINATED("workflowTerminated"),
-
- /**
- * invokingService
- */
- INVOKING_SERVICE("invokingService"),
-
- /**
- * invokingServiceSucceeded
- */
- INVOKING_SERVICE_SUCCEEDED("invokingServiceSucceeded"),
-
- /**
- * invokingServiceFailed
- */
- INVOKING_SERVICE_FAILED("invokingServiceFailed"),
-
- /**
- * receivedResult
- */
- RECEIVED_RESULT("receivedResult"),
-
- /**
- * receivedFault
- */
- RECEIVED_FAULT("receivedFault"),
-
- // Notification from a service
-
- /**
- * serviceInvoked
- */
- SERVICE_INVOKED("serviceInvoked"),
-
- /**
- * sendingResult
- */
- SENDING_RESULT("sendingResult"),
-
- /**
- * sendingResponseFailed
- */
- SENDING_RESPONSE_FAILED("sendingResponseFailed"),
-
- /**
- * sendingFault
- */
- SENDING_FAULT("sendingFault"),
-
- // Other types of notification from a service.
- /**
- * logInfo
- */
- LOG_INFO("logInfo"),
-
- /**
- * logException
- */
- LOG_EXCEPTION("logException"),
-
- /**
- * logWarning
- */
- LOG_WARNING("logWarning"),
-
- /**
- * logDebug
- */
- LOG_DEBUG("logDebug"),
-
- /**
- * dataConsumed
- */
- DATA_CONSUMED("dataConsumed"),
-
- /**
- * dataProduced
- */
- DATA_PRODUCED("dataProduced"),
-
- /**
- * dataReceiveDuration
- */
- DATA_RECEIVE_DURATION("dataReceiveDuration"),
-
- /**
- * applicationAudit
- */
- APPLICATION_AUDIT("applicationAudit"),
-
- /**
- * computationDuration
- */
- COMPUTATION_DURATION("computationDuration"),
-
- /**
- * publishURL
- */
- PUBLISH_URL("publishURL"),
-
- /**
- * resourceMapping
- */
- RESOURCE_MAPPING("resourceMapping");
-
- String name;
-
- EventType(String name) {
- this.name = name;
- }
- }
-
- /**
- * @param event
- * @return The type of the event.
- */
- public static EventType getType(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- XmlNamespace ns = event.getNamespace();
- String name = event.getName();
- if (XBAYA_EVENTS_NS.equals(ns)) {
- if (GOT_RESULT_EVENT_TAG.equals(name)) {
- return EventType.WORKFLOW_TERMINATED;
- } else {
- return EventType.UNKNOWN;
- }
- } else if (WOR_NS.equals(ns)) {
- for (EventType type : EventType.values()) {
- if (type.name.equals(name)) {
- return type;
- }
- }
- }
- return EventType.UNKNOWN;
- }
-
- /**
- * @param event
- * @return The timestamp.
- */
- public static Date getTimestamp(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- XmlElement timestampEl = event.element(WOR_NS, TIMESTAMP_TAG);
- if (timestampEl == null)
- return null;
- String timestamp = timestampEl.requiredText();
- DcDate date = DcDate.create(timestamp);
- return new Date(date.getTimeInMillis());
- }
-
- /**
- * @param event
- * @return The node ID if the message contains it; "", otherwise
- */
- public static String getNodeID(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- XmlElement idElement = getIDElement(event);
- String nodeID = null;
- if (idElement != null) {
- nodeID = idElement.attributeValue(WOR_NS, WORKFLOW_NODE_ID_ATTRIBUTE);
- }
- if(nodeID == null){
- nodeID = event.element(NOTIFICATION_SOURCE_TAG).attributeValue(WOR_NS, WORKFLOW_NODE_ID_ATTRIBUTE);
- }
- if (nodeID == null) {
- nodeID = "";
- }
- return nodeID;
- }
-
- /**
- * @param event
- * @return The node ID if the message contains it; "", otherwise
- */
- public static String getExperiementID(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- XmlElement idElement = event.element(WOR_NS,NOTIFICATION_SOURCE_TAG);
- String nodeID = null;
- if (idElement != null) {
- nodeID = idElement.attributeValue(WOR_NS, WORKFLOW_EXPERIMENT_ID);
- }if(nodeID == null){
- nodeID = event.element(NOTIFICATION_SOURCE_TAG).attributeValue(WOR_NS, WORKFLOW_EXPERIMENT_ID);
- }
- if (nodeID == null) {
- nodeID = "";
- }
- return nodeID;
- }
-
- /**
- * @param event
- * @return The workflow instance ID. null if there is no workflow instance ID.
- */
- public static URI getWorkflowID(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- EventType type = getType(event);
- XmlElement idElement = getIDElement(event);
- if (idElement == null) {
- return null;
- }
-
- String workflowID;
- switch (type) {
- case WORKFLOW_INITIALIZED:
- case WORKFLOW_TERMINATED:
- // Special cases
- workflowID = idElement.attributeValue(WOR_NS, SERVICE_ID_ATTRIBUTE);
- break;
- default:
- // Default
- workflowID = idElement.attributeValue(WOR_NS, WORKFLOW_ID_ATTRIBUTE);
- break;
- }
- if (workflowID == null || workflowID.length() == 0) {
- return null;
- }
- try {
- return new URI(workflowID);
- } catch (URISyntaxException e) {
- logger.error(e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * @param event
- * @return The type of the event to display
- */
- public static String getStatus(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- EventType type = getType(event);
- String status;
- switch (type) {
- case LOG_INFO:
- status = "INFO";
- break;
- case LOG_EXCEPTION:
- status = "EXCEPTION";
- break;
- case LOG_WARNING:
- status = "WARNING";
- break;
- case LOG_DEBUG:
- status = "DEBUG";
- break;
- default:
- status = event.getName();
- }
- return status;
- }
-
- /**
- * @param event
- * @return The message to display.
- */
- public static String getMessage(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- String description = null;
- XmlElement descElement = event.element(WOR_NS, DESCRIPTION_TAG);
- if (descElement != null) {
- description = descElement.requiredText();
- }
-
- if (description == null || description.length() == 0) {
- // It might be a data-related notification
- XmlElement dataProduct = event.element(WOR_NS, DATA_PRODUCT_TAG);
- if (dataProduct != null) {
- descElement = dataProduct.element(WOR_NS, DESCRIPTION_TAG);
- if (descElement != null) {
- description = descElement.requiredText();
- }
- }
- }
-
- if (description == null) {
- description = "";
- }
- return description;
- }
-
- /**
- * @param event
- * @return The location.
- */
- public static String getLocation(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- XmlElement locationEl = event.element(WOR_NS, LOCATION_TAG);
- if (locationEl != null) {
- String location = locationEl.requiredText();
- return location;
- } else {
- return null;
- }
- }
-
- /**
- * Gets the mapped resource from the event.
- *
- * @param event
- * The event, the type of which has to be resourceMapping.
- * @return The resource
- */
- public static String getMappedResource(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- EventType type = getType(event);
- if (type != EventType.RESOURCE_MAPPING) {
- throw new IllegalArgumentException("Event must have resourceMapping type instead of " + type);
- }
- XmlElement mappedResource = event.element(MAPPED_RESOURCE_TAG);
- String resource = mappedResource.requiredText();
- return resource;
- }
-
- /**
- * Gets the retry count from the event.
- *
- * @param event
- * The event, the type of which has to be resourceMapping.
- * @return The resource
- */
- public static String getRetryCount(XmlElement event) {
- if (event == null) {
- throw new IllegalArgumentException("null");
- }
- EventType type = getType(event);
- if (type != EventType.RESOURCE_MAPPING) {
- throw new IllegalArgumentException("Event must have resourceMapping type instead of " + type);
- }
- XmlElement retryCountElement = event.element(RETRY_STATUS_COUNT_TAG);
- String retryCount = retryCountElement.requiredText();
- return retryCount;
- }
-
- /**
- * Gets the workflow instance ID.
- *
- * @param event
- * The event, the type of which has to be workflowInitialized.
- * @return The workflowInstanceID
- */
- public static URI getWorkflowInstanceID(XmlElement event) {
- EventType type = getType(event);
- if (!(type == EventType.WORKFLOW_INITIALIZED || type == EventType.WORKFLOW_TERMINATED)) {
- throw new IllegalArgumentException(
- "Event must be an workflowInitialized type or an workflowTerminated type instead of " + type);
- }
- XmlElement notificationSource = event.element(WOR_NS, NOTIFICATION_SOURCE_TAG);
- if (notificationSource == null) {
- throw new WorkflowRuntimeException("The notification should have " + NOTIFICATION_SOURCE_TAG + " element.");
- }
- String workflowInstanceID = notificationSource.attributeValue(WOR_NS, SERVICE_ID_ATTRIBUTE);
- if (workflowInstanceID == null) {
- throw new WorkflowRuntimeException("The notification should have " + SERVICE_ID_ATTRIBUTE + " attribute.");
- }
- try {
- return new URI(workflowInstanceID);
- } catch (URISyntaxException e) {
- throw new WorkflowRuntimeException(e);
- }
- }
-
- /**
- * @param event
- * @return The element that has workflow ID, node ID, etc.
- */
- private static XmlElement getIDElement(XmlElement event) {
- EventType type = getType(event);
- switch (type) {
- // The following three don't include node ID, but includes workflow ID.
- case WORKFLOW_INITIALIZED:
- case WORKFLOW_INVOKED:
- case WORKFLOW_TERMINATED:
- // The followings include both workflow ID and node ID.
- // TODO they might be used by a workflow too.
- case SERVICE_INVOKED:
- case SENDING_RESULT:
- case SENDING_FAULT:
- case SENDING_RESPONSE_FAILED: // TODO make sure
- // The followings are used only in services.
- case LOG_INFO:
- case LOG_WARNING:
- case LOG_EXCEPTION:
- case LOG_DEBUG:
- case DATA_CONSUMED:
- case DATA_PRODUCED:
- case DATA_RECEIVE_DURATION:
- case APPLICATION_AUDIT:
- case COMPUTATION_DURATION:
- case RESOURCE_MAPPING:
- case PUBLISH_URL:
- case INVOKING_SERVICE:
- return event.element(RECEIVER_TAG);
- case INVOKING_SERVICE_SUCCEEDED: // TODO make sure
- case INVOKING_SERVICE_FAILED: // TODO make sure
- return event.element(RECEIVER_TAG);
- case RECEIVED_RESULT:
- case RECEIVED_FAULT:
- return event.element(RESPONDER_TAG);
- case UNKNOWN:
- // Most of unknown types are from service.
- return event.element(NOTIFICATION_SOURCE_TAG);
- default:
- // Most of unknown types are from service.
- return event.element(NOTIFICATION_SOURCE_TAG);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/WsmgClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/WsmgClient.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/WsmgClient.java
deleted file mode 100644
index b2e8437..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/WsmgClient.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.MsgBrokerClientException;
-import org.apache.airavata.wsmg.client.NotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.infoset.XmlElement;
-
-public class WsmgClient implements ConsumerNotificationHandler, NotificationHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(WsmgClient.class);
-
- private Monitor monitor;
-
- private URI brokerURL;
-
- private String topic;
-
- private boolean pullMode;
-
- private URI messageBoxURL;
-
- private WseMsgBrokerClient wseClient;
-
- private String subscriptionID;
-
- private MessagePuller messagePuller;
-
- private long timeout = 20000L;
-
- private long interval = 1000L;
- /**
- * Constructs a WsmgClient.
- *
- * @param monitor
- */
- public WsmgClient(Monitor monitor) {
- this.monitor = monitor;
-
- MonitorConfiguration configuration = monitor.getConfiguration();
- // We need to copy these because the configuration might change.
- this.brokerURL = configuration.getBrokerURL();
- this.topic = configuration.getTopic();
- this.pullMode = configuration.isPullMode();
- this.messageBoxURL = configuration.getMessageBoxURL();
-
- this.wseClient = new WseMsgBrokerClient();
- this.wseClient.init(this.brokerURL.toString());
- }
-
- /**
- * Subscribes to the notification.
- *
- * @throws MonitorException
- */
- public synchronized void subscribe() throws MonitorException {
- try {
- if (this.pullMode) {
- EndpointReference messageBoxEPR = this.wseClient.createPullMsgBox(this.messageBoxURL.toString(),getTimeout());
- this.subscriptionID = this.wseClient.subscribe(messageBoxEPR.getAddress(), this.topic, null);
- this.messagePuller = this.wseClient.startPullingEventsFromMsgBox(messageBoxEPR, this, getInterval(), getTimeout());
- } else {
- String[] endpoints = this.wseClient.startConsumerService(2222, this);
- this.subscriptionID = this.wseClient.subscribe(endpoints[0], this.topic, null);
- }
- } catch (IOException e) {
- throw new MonitorException("Failed to subscribe.", e);
- } catch (RuntimeException e) {
- throw new MonitorException("Failed to subscribe.", e);
- }
- }
-
- /**
- * Unsubscribes from the notification.
- *
- * @throws MonitorException
- */
- public synchronized void unsubscribe() throws MonitorException {
- // This method needs to be synchronized along with subscribe() because
- // unsubscribe() might be called while subscribe() is being executed.
- if (this.subscriptionID == null) {
- throw new IllegalStateException();
- }
- try {
- if (this.pullMode) {
- this.messagePuller.stopPulling();
- } else {
- this.wseClient.shutdownConsumerService();
- }
- this.wseClient.unSubscribe(this.subscriptionID);
- } catch (MsgBrokerClientException e) {
- throw new MonitorException("Failed to unsubscribe.", e);
- }
-
- }
-
- /**
- * @see org.apache.airavata.wsmg.client.NotificationHandler#handleNotification(java.lang.String)
- */
- public void handleNotification(SOAPEnvelope message) {
- String soapBody = message.getBody().toString();
- this.handleNotification(soapBody);
- }
-
- /**
- *
- * @param message
- */
- public void handleNotification(String message) {
- try {
- XmlElement event = XMLUtil.stringToXmlElement(message);
- this.monitor.handleNotification(event);
- } catch (Exception e) {
- // Just log them because they can be unrelated messages sent to
- // this topic by accident.
- logger.warn("Could not parse received notification: " + message, e);
- }
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
- public long getInterval() {
- return interval;
- }
-
- public void setInterval(long interval) {
- this.interval = interval;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/Event.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/Event.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/Event.java
deleted file mode 100644
index 7f4e87f..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/Event.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor.event;
-
-public class Event {
-
- /**
- */
- public enum Type {
- /**
- * GPEL_CONFIGURATION_CHANGED
- */
- GPEL_CONFIGURATION_CHANGED,
- /**
- * GPEL_CONNECTED
- */
- GPEL_ENGINE_CONNECTED,
- /**
- * GPEL_ENGINE_DISCONNECTED
- */
- GPEL_ENGINE_DISCONNECTED,
-
- /**
- * MONITOR_CONFIGURATION_CHANGED
- */
- MONITOR_CONFIGURATION_CHANGED,
- /**
- * MONITOR_STARTED
- */
- MONITOR_STARTED,
- /**
- * MONITOR_STOPED
- */
- MONITOR_STOPED,
-
- /**
- * KARMA_STARTED
- */
- KARMA_STARTED,
-
- /**
- * MYLEAD_CONFIGURATION_CHANGED
- */
- MYLEAD_CONFIGURATION_CHANGED,
- }
-
- private Type type;
-
- /**
- * Constructs a Event.
- *
- * @param type
- */
- public Event(Type type) {
- this.type = type;
- }
-
- /**
- * @return The type of the event
- */
- public Type getType() {
- return this.type;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventListener.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventListener.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventListener.java
deleted file mode 100644
index 16473a8..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor.event;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-
-public interface EventListener {
-
- /**
- * Called when an event is received.
- *
- * @param event
- * @throws WorkflowException
- */
- public void eventReceived(Event event) throws WorkflowException;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventProducer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventProducer.java b/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventProducer.java
deleted file mode 100644
index 9f33d53..0000000
--- a/modules/ws-messenger/message-monitor/src/main/java/org/apache/airavata/ws/monitor/event/EventProducer.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.ws.monitor.event;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.airavata.workflow.model.exceptions.WorkflowException;
-import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class EventProducer {
-
- private static final Logger logger = LoggerFactory.getLogger(EventProducer.class);
-
- private List<EventListener> listeners = new LinkedList<EventListener>();
-
- /**
- * @param listener
- */
- public void addEventListener(EventListener listener) {
- this.listeners.add(listener);
- }
-
- /**
- * @param listener
- */
- public void removeEventListener(EventListener listener) {
- this.listeners.remove(listener);
- }
-
- /**
- * @param event
- */
- public void sendSafeEvent(Event event) {
- Throwable exception = null;
- for (EventListener listener : this.listeners) {
- try {
- listener.eventReceived(event);
- } catch (Throwable e) {
- logger.error(e.getMessage(), e);
- // Just remember the first one.
- if (exception == null) {
- exception = e;
- }
- }
- }
- if (exception != null) {
- if (exception instanceof RuntimeException) {
- throw (RuntimeException) exception;
- } else {
- throw new WorkflowRuntimeException(exception);
- }
- }
- }
-
- /**
- * Sends an event.
- *
- * @param event
- * @throws WorkflowException
- */
- public void sendEvent(Event event) throws WorkflowException {
- Throwable exception = null;
- for (EventListener listener : this.listeners) {
- try {
- listener.eventReceived(event);
- } catch (Throwable e) {
- logger.error(e.getMessage(), e);
- // Just remember the first one.
- if (exception == null) {
- exception = e;
- }
- }
- }
- if (exception != null) {
- if (exception instanceof WorkflowException) {
- throw (WorkflowException) exception;
- } else {
- throw new WorkflowException(exception);
- }
- }
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/maven-eclipse.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/maven-eclipse.xml b/modules/ws-messenger/messagebox/maven-eclipse.xml
deleted file mode 100644
index 3f67e06..0000000
--- a/modules/ws-messenger/messagebox/maven-eclipse.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project default="copy-resources">
- <target name="init"/>
- <target name="copy-resources" depends="init">
- <copy todir="target/classes/META-INF" filtering="false">
- <fileset dir="resources" includes="**/*.wsdl|**/*.xml" excludes="**/*.java"/>
- </copy>
- </target>
-</project>
\ No newline at end of file
[02/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/commons/TestCommonRoutines.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/commons/TestCommonRoutines.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/commons/TestCommonRoutines.java
deleted file mode 100644
index 098dd49..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/commons/TestCommonRoutines.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestCommonRoutines extends TestCase {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.commons.CommonRoutines#getXsdDateTime(java.util.Date)}.
- */
- @Test
- public void testGetXsdDateTime() {
- assertNotNull(CommonRoutines.getXsdDateTime(new Date()));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
deleted file mode 100644
index 6f1ecbb..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestAddtionalWseXpathAndTopicScenarios.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath;
-
-import java.net.URL;
-import java.util.Properties;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import javax.xml.stream.XMLStreamException;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.util.ConfigKeys;
-import org.apache.airavata.wsmg.util.TestUtilServer;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestAddtionalWseXpathAndTopicScenarios extends TestCase {
-
- static Properties configs = new Properties();
-
- class NotificationReciever implements ConsumerNotificationHandler {
-
- private BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
-
- private String id;
-
- public NotificationReciever(String id) {
- this.id = id;
- }
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
- queue.add(msgEnvelope);
- System.out.println(String.format("[reciever id: %s] %s", id, msgEnvelope));
- }
-
- public BlockingQueue<SOAPEnvelope> getMsgQueue() {
- return queue;
- }
- }
-
- @Before
- public void setUp() throws Exception {
- URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
- configs.load(configURL.openStream());
-
- TestUtilServer.start(null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public final void testXpathAndTopicOnlyRoundTrip() {
-
- try {
-
- String topic = "RoundTripTestXpathAndTopicWse";
-
- String xpathExpression = "/c/b/a[text()=1]";
-
- String msgFormat = "<c><b><a>%d</a></b></c>";
-
- long value = 1;
- String matchingMsg = String.format(msgFormat, value);
- String unmatchingMsg = String.format(msgFormat, value + 1);
-
- int consumerPort = TestUtilServer.getAvailablePort();
-
- String brokerEpr = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
-
- WseMsgBrokerClient topicOnlyReceiverApi = new WseMsgBrokerClient();
- topicOnlyReceiverApi.init(brokerEpr);
- NotificationReciever topicOnlyMsgReceiver = new NotificationReciever("Topic Only");
- String[] topicConsumerEPRs = topicOnlyReceiverApi.startConsumerService(consumerPort, topicOnlyMsgReceiver);
- assertTrue("invalid consumer eprs returned", topicConsumerEPRs.length > 0);
- String topicOnlySubId = topicOnlyReceiverApi.subscribe(topicConsumerEPRs[0], topic, null);
- System.out.println("Topic only subscription ID: " + topicOnlySubId);
-
- WseMsgBrokerClient xpathAndTopicReceiverApi = new WseMsgBrokerClient();
- xpathAndTopicReceiverApi.init(brokerEpr);
- NotificationReciever topicAndXpathMsgReceiver = new NotificationReciever("Topic And Xpath");
- String[] topicAndXpathConsumerEPRs = xpathAndTopicReceiverApi.startConsumerService(consumerPort + 1,
- topicAndXpathMsgReceiver);
- assertTrue("invalid consumer eprs returned", topicAndXpathConsumerEPRs.length > 0);
- String topicAndXpathSubId = xpathAndTopicReceiverApi.subscribe(topicAndXpathConsumerEPRs[0], topic,
- xpathExpression);
- System.out.println("Xpath and Topic subscription ID: " + topicAndXpathSubId);
-
- WseMsgBrokerClient senderApi = new WseMsgBrokerClient();
- senderApi.init(brokerEpr);
-
- try {
-
- senderApi.publish(topic, AXIOMUtil.stringToOM(matchingMsg));
- senderApi.publish(topic, AXIOMUtil.stringToOM(unmatchingMsg));
-
- Thread.sleep(5000);
-
- assertTrue("topic only reciever should get all messages" + topicOnlyMsgReceiver.getMsgQueue().size(),
- topicOnlyMsgReceiver.getMsgQueue().size() == 2);
-
- assertTrue("xpath and topic reciever should only get one message"
- + topicAndXpathMsgReceiver.getMsgQueue().size(),
- topicAndXpathMsgReceiver.getMsgQueue().size() == 1);
- } catch (XMLStreamException x) {
- fail("Error while creating OMElement");
- } catch (InterruptedException e) {
- fail("interrupted while waiting for message");
- }
-
- topicOnlyReceiverApi.unSubscribe(topicOnlySubId);
- topicOnlyReceiverApi.shutdownConsumerService();
-
- xpathAndTopicReceiverApi.unSubscribe(topicAndXpathSubId);
- xpathAndTopicReceiverApi.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- fail("unexpected exception occured");
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
deleted file mode 100644
index 024b5d3..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathAndTopicSubscription.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath;
-
-import java.net.URL;
-import java.util.Properties;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import javax.xml.stream.XMLStreamException;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.util.ConfigKeys;
-import org.apache.airavata.wsmg.util.TestUtilServer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestWseXpathAndTopicSubscription extends TestCase implements ConsumerNotificationHandler {
-
- static Properties configs = new Properties();
-
- BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
-
- queue.add(msgEnvelope);
- System.out.println(msgEnvelope);
- }
-
- BlockingQueue<SOAPEnvelope> getMsgQueue() {
- return queue;
- }
-
- @Before
- public void setUp() throws Exception {
- URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
- configs.load(configURL.openStream());
-
- TestUtilServer.start(null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public final void testXpathOnlyRoundTrip() {
-
- try {
-
- String validMsgFormat = "<c><b><a> %d </a></b></c>";
- String invalidMsgFormat = "<a><b><c> %d </c></b></a>";
-
- long value = System.currentTimeMillis();
- String validMsg = String.format(validMsgFormat, value);
- String invalidMsg = String.format(invalidMsgFormat, value);
-
- int consumerPort = TestUtilServer.getAvailablePort();
-
- String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
- WseMsgBrokerClient msgBrokerClient = new WseMsgBrokerClient();
- msgBrokerClient.init(brokerEPR);
-
- String[] consumerEPRs = msgBrokerClient.startConsumerService(consumerPort, this);
-
- assertTrue(consumerEPRs.length > 0);
-
- String xpathExpression = "/c/b/a";
-
- String subscriptionID = msgBrokerClient.subscribe(consumerEPRs[0], null, xpathExpression);
-
- try {
- msgBrokerClient.publish(null, AXIOMUtil.stringToOM(validMsg));
- msgBrokerClient.publish(null, AXIOMUtil.stringToOM(invalidMsg));
-
- SOAPEnvelope env = getMsgQueue().take();
-
- assertNotNull(env.getBody());
- assertNotNull(env.getBody().getChildrenWithLocalName("c"));
-
- OMElement element = (OMElement) env.getBody().getChildrenWithLocalName("c").next();
-
- String text = element.toStringWithConsume();
-
- assertTrue("round trip of message failed" + " - due to invalid messege content",
- text.indexOf(new Long(value).toString()) > 0);
-
- Thread.sleep(5000);
-
- assertTrue("unexpected msg recieved", getMsgQueue().isEmpty());
-
- } catch (InterruptedException e) {
- fail("interrupted while waiting for message");
- } catch (XMLStreamException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- fail("invalid xml recieved: " + e.getMessage());
- }
-
- msgBrokerClient.unSubscribe(subscriptionID);
- msgBrokerClient.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- fail("unexpected exception occured");
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
deleted file mode 100644
index 097e6b7..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/TestWseXpathSubscription.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath;
-
-import java.net.URL;
-import java.util.Properties;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import javax.xml.stream.XMLStreamException;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.util.ConfigKeys;
-import org.apache.airavata.wsmg.util.TestUtilServer;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class TestWseXpathSubscription extends TestCase implements ConsumerNotificationHandler {
-
- static Properties configs = new Properties();
-
- BlockingQueue<SOAPEnvelope> queue = new LinkedBlockingQueue<SOAPEnvelope>();
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
-
- queue.add(msgEnvelope);
- System.out.println(msgEnvelope);
- }
-
- BlockingQueue<SOAPEnvelope> getMsgQueue() {
- return queue;
- }
-
- @Before
- public void setUp() throws Exception {
- URL configURL = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
- configs.load(configURL.openStream());
-
- TestUtilServer.start(null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public final void testSimpleXpathTopicRoundTrip() {
-
- try {
-
- String validMsgFormat = "<c><b><a> %d </a></b></c>";
- String invalidMsgFormat = "<a><b><c> %d </c></b></a>";
-
- long value = System.currentTimeMillis();
- String validMsg = String.format(validMsgFormat, value);
- String invalidMsg = String.format(invalidMsgFormat, value);
-
- int consumerPort = TestUtilServer.getAvailablePort();
-
- String brokerEPR = "http://localhost:" + TestUtilServer.TESTING_PORT + "/axis2/services/EventingService";
-
- WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
- wseMsgBrokerClient.init(brokerEPR);
-
- String[] consumerEPRs = wseMsgBrokerClient.startConsumerService(consumerPort, this);
-
- assertTrue(consumerEPRs.length > 0);
-
- String xpathExpression = "/c/b/a";
- String topicExpression = "XpathAndTopicTestWse";
-
- String subscriptionID = wseMsgBrokerClient.subscribe(consumerEPRs[0], topicExpression, xpathExpression);
-
- try {
-
- wseMsgBrokerClient.publish(topicExpression, AXIOMUtil.stringToOM(validMsg));
- wseMsgBrokerClient.publish(topicExpression, AXIOMUtil.stringToOM(invalidMsg));
-
- SOAPEnvelope env = getMsgQueue().take();
-
- assertNotNull(env.getBody());
- assertNotNull(env.getBody().getChildrenWithLocalName("c"));
-
- OMElement element = (OMElement) env.getBody().getChildrenWithLocalName("c").next();
-
- String text = element.toStringWithConsume();
-
- assertTrue("round trip of message failed" + " - due to invalid messege content",
- text.indexOf(new Long(value).toString()) > 0);
-
- Thread.sleep(5000);
-
- assertTrue("unexpected msg recieved", getMsgQueue().isEmpty());
-
- } catch (InterruptedException e) {
- fail("interrupted while waiting for message");
- } catch (XMLStreamException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- fail("invalid xml recieved: " + e.getMessage());
- }
-
- wseMsgBrokerClient.unSubscribe(subscriptionID);
- wseMsgBrokerClient.shutdownConsumerService();
-
- } catch (AxisFault e) {
- e.printStackTrace();
- fail("unexpected exception occured");
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/performance/XppXPath.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/performance/XppXPath.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/performance/XppXPath.java
deleted file mode 100644
index da95a00..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/matching/XPath/performance/XppXPath.java
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.matching.XPath.performance;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import edu.berkeley.cs.db.yfilterplus.queryparser.QueryParser;
-import edu.berkeley.cs.db.yfilterplus.queryparser.XPQueryParser;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMXMLParserWrapper;
-import org.apache.axiom.om.impl.llom.factory.OMXMLBuilderFactory;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-public class XppXPath {
-
- private Vector xPathExpressions = new Vector();
- protected BufferedReader m_in = null;
- private static final boolean DEBUG = false;
- long total = 0;
-
- public int[] getMatchedLinks(String message) {
-
- return null;
- }
-
- public Vector checkQueries(String query) {
- Vector result = new Vector();
- Set xPathExpressionsSet = new HashSet(xPathExpressions);
-
- int size = xPathExpressions.size();
-
- for (int i = 0; i < size; i++) {
-
- boolean match = query.equals(xPathExpressions.get(i));
-
- // long start=System.nanoTime();
- if (match) {
-
- result.add(new Integer(i));
-
- }
- // long end=System.nanoTime();
- // total+=(end-start);
- }
-
- // System.out.println("Total="+total);
- return result;
- }
-
- public boolean checkQueriesVectorToSet(Set queries) {
- // Vector result=new Vector();
- Set xPathExpressionsSet = new HashSet(xPathExpressions);
-
- int size = xPathExpressions.size();
- Iterator iter = queries.iterator();
- int counter = 0;
- while (iter.hasNext()) {
- Object query = iter.next();
- for (int i = 0; i < size; i++) {
-
- boolean match = query.equals(xPathExpressions.get(i));
-
- // long start=System.nanoTime();
- if (match) {
-
- return true;
-
- }
- // long end=System.nanoTime();
- // total+=(end-start);
- }
- counter++;
- // System.out.println("counter="+counter);
- }
- // System.out.println("Total="+total);
- return false;
- }
-
- public boolean checkQueriesBySet(Set queries) {
- Set xPathExpressionsSet = new HashSet(xPathExpressions);
- Iterator iter = queries.iterator();
- int counter = 0;
- while (iter.hasNext()) {
- if (xPathExpressionsSet.contains(iter.next())) {
- // System.out.println("counter="+counter);
- return true;
- }
- counter++;
- }
- return false;
- }
-
- public void addXPathExpressions(String xPathExpression) {
- xPathExpressions.add(xPathExpression);
- }
-
- public void readQueriesFromFile(String queryFile) {
- int noQueries = Integer.MAX_VALUE;
- int qNum = 0;
- // QueryParser qp = new XFQueryParser(queryFile);
- QueryParser qp = new XPQueryParser(queryFile);
- // Query query;
- String queryString;
- while (qNum < noQueries && ((queryString = qp.readNextQueryString()) != null)) {
- if (DEBUG)
- System.out.println(queryString);
- addXPathExpressions(queryString);
- qNum++;
- }
- }
-
- public String getARandomQuery() {
- int index = (int) (xPathExpressions.size() * (Math.random()));
- return (String) xPathExpressions.get(index);
- }
-
- // From http://www.rgagnon.com/javadetails/java-0052.html
- public static String readFile(String filename) throws IOException {
- String lineSep = System.getProperty("line.separator");
- BufferedReader br = new BufferedReader(new FileReader(filename));
- String nextLine = "";
- StringBuffer sb = new StringBuffer();
- while ((nextLine = br.readLine()) != null) {
- sb.append(nextLine);
- //
- // note:
- // BufferedReader strips the EOL character.
- //
- sb.append(lineSep);
- }
- return sb.toString();
- }
-
- /**
- * @param args
- * @throws IOException
- * @throws FactoryConfigurationError
- * @throws XMLStreamException
- */
- public static void main(String[] args) throws IOException, XMLStreamException, FactoryConfigurationError {
- String queryFile = "C:\\YiFile\\yfilter-1.0\\yfilter-1.0\\queries2.txt";
- XppXPath xppXPath = new XppXPath();
- xppXPath.readQueriesFromFile(queryFile);
- long total = 0;
- final int round = 100;
- String message = readFile("c:\\YiFile\\testdata\\soap2.txt");
-
- int messageStartPoint = message.indexOf('<');
- String xpathList = message.substring(0, messageStartPoint);
- System.out.println("XpathList=" + xpathList);
- System.out.println("*****************************************");
- long start0 = System.nanoTime();
- StringTokenizer parser0 = new StringTokenizer(xpathList, ";");
- Set xpathTokens = new HashSet();
- while (parser0.hasMoreTokens()) {
- xpathTokens.add(parser0.nextToken());
- }
- long end0 = System.nanoTime();
- long total0 = (end0 - start0);
- // for(int i=0;i<xpathTokens.size();i++){
- // System.out.println((String)xpathTokens.get(i));
- // }
- System.out.println("Avg Time to token=" + (total0));
- System.out.println("Total token=" + xpathTokens.size());
- boolean result = false;
- for (int i = 0; i < round; i++) {
- String randomQuery = xppXPath.getARandomQuery();
- // xpathTokens.add(randomQuery);
- // Vector result=null;
-
- long start = System.nanoTime();
- // result=xppXPath.checkQueries(randomQuery);
- result = xppXPath.checkQueriesBySet(xpathTokens);
- // result=xppXPath.checkQueriesVectorToSet(xpathTokens);
- long end = System.nanoTime();
- total += (end - start);
- }
- System.out.println("Match result=" + result);
- System.out.println("Avg Time for Checking=" + (total / round));
-
- // XSUL
- // long start=System.nanoTime();
- // XmlElement messageEl = builder.parseFragmentFromReader(new
- // StringReader(
- // message));
- // XmlElement messageIdEl= messageEl.element(null,
- // "Header").element(null,"MessageID");
- // String messageId=messageIdEl.requiredTextContent();
- // System.out.println("MessageId="+messageId);
- // long end=System.nanoTime();
- // total=(end-start);
- // System.out.println("Avg Time="+(total));
-
- // AXIOM
- // long start=System.nanoTime();
- // create the parser
- // XMLStreamReader parser =
- // XMLInputFactory.newInstance().createXMLStreamReader(new
- // FileReader("c:\\YiFile\\testdata\\soap_only.txt"));
- // create the builder
- String message1 = readFile("c:\\YiFile\\testdata\\soap_only.txt");
- long start = System.nanoTime();
- XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(
- new ByteArrayInputStream(message1.getBytes()));
-
- OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXSOAPModelBuilder(
- OMAbstractFactory.getSOAP11Factory(), parser);
- // get the root element (in this case the envelope)
-
- SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();
-
- // // create the parser
- // XMLStreamReader parser =
- // XMLInputFactory.newInstance().createXMLStreamReader(new
- // FileReader("c:\\YiFile\\testdata\\soap.txt"));
- // // create the builder
- // OMXMLParserWrapper builder =
- // OMXMLBuilderFactory.createStAXSOAPModelBuilder(OMAbstractFactory.getOMFactory(),parser);
- // // get the root element (in this case the envelope)
- // SOAPEnvelope envelope = (SOAPEnvelope)builder.getDocumentElement();
- //
- //
- String messageIDString = envelope.getHeader().getFirstChildWithName(new QName(null, "MessageID")).getText();
- long end = System.nanoTime();
- total = (end - start);
- System.out.println("Avg Time for Axiom=" + (total));
- // OMElement headerEl=envelope.getHeader().getFirstChildWithName(new
- // QName("http://schemas.xmlsoap.org/soap/envelope/", "Header"));
- envelope.getHeader().getFirstChildWithName(new QName(null, "MessageID")).serialize(System.out);
- System.out.println();
- //
- // headerEl.getFirstChildWithName(new QName(null, "MessageID"));
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/NotificationManager.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/NotificationManager.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/NotificationManager.java
deleted file mode 100644
index c168a5f..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/NotificationManager.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import java.util.LinkedList;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.airavata.wsmg.client.*;
-import org.apache.axiom.soap.SOAPEnvelope;
-
-public class NotificationManager implements ConsumerNotificationHandler {
-
- private MessageBrokerClient client = null;
- private String[] eprs = null;
- private String brokerLocation = null;
- private String protocol = null;
- private int consumerServerPort = 0;
- private LinkedList<String> subscriptionIds;
- private int numberOfTopicSubscribed = 0;
- private int numMultiThreadSupportPerSub = 0;
- private int multipleThreadSupportIndex = 1;
-
- public NotificationManager(String brokerLocationIn, int consumerServerPortIn, String protocolIn,
- int numMultiThreadSupportPerSub) throws MsgBrokerClientException {
-
- this.brokerLocation = brokerLocationIn;
- this.consumerServerPort = consumerServerPortIn;
- this.protocol = protocolIn;
- this.numMultiThreadSupportPerSub = numMultiThreadSupportPerSub;
-
- if (client == null) {
- if (protocol.equalsIgnoreCase("wse")) {
- WsntMsgBrokerClient wseClient = new WsntMsgBrokerClient();
- wseClient.init(this.brokerLocation);
- wseClient.setTimeoutInMilliSeconds(200000000);
- eprs = wseClient.startConsumerService(consumerServerPort, this);
- client = wseClient;
- } else {
- WsntMsgBrokerClient wsntClient = new WsntMsgBrokerClient();
- wsntClient.init(this.brokerLocation);
- wsntClient.setTimeoutInMilliSeconds(200000000);
- eprs = wsntClient.startConsumerService(consumerServerPort, this);
- client = wsntClient;
- }
- }
-
- subscriptionIds = new LinkedList<String>();
-
- }
-
- public Subscription createTopicSubscription(String topic) throws Exception {
-
- if (multipleThreadSupportIndex > numMultiThreadSupportPerSub) {
- multipleThreadSupportIndex = 1;
- }
-
- String subscriptionId = client
- .subscribe(brokerLocation, eprs[0] + "user" + multipleThreadSupportIndex++, topic);
- subscriptionIds.add(subscriptionId);
- Subscription subscription = new Subscription(client, subscriptionId, topic, this, brokerLocation, protocol);
- return subscription;
- }
-
- public Subscription createXpathSubscription(String topicExpression, String xpathExpression) throws Exception {
- if (multipleThreadSupportIndex > numMultiThreadSupportPerSub) {
- multipleThreadSupportIndex = 1;
- }
-
- String subscriptionId = client.subscribe(eprs[0] + "user" + multipleThreadSupportIndex++, topicExpression,
- xpathExpression);
- subscriptionIds.add(subscriptionId);
- Subscription subscription = new Subscription(client, subscriptionId, topicExpression, xpathExpression, this,
- brokerLocation, protocol);
- return subscription;
- }
-
- public void cleanup() throws MsgBrokerClientException {
-
- WseMsgBrokerClient wseClient = null;
- WsntMsgBrokerClient wsntClient = null;
-
- if ("wse".equalsIgnoreCase(this.protocol)) {
- wseClient = (WseMsgBrokerClient) client;
- } else {
- wsntClient = (WsntMsgBrokerClient) client;
- }
-
- if (subscriptionIds != null) {
- if (wseClient != null) {
- while (!subscriptionIds.isEmpty()) {
- String subId = subscriptionIds.remove();
- wseClient.unSubscribe(subId);
- }
- } else {
- while (!subscriptionIds.isEmpty()) {
- String subId = subscriptionIds.remove();
- wsntClient.unSubscribe(subId);
- }
-
- }
- }
-
- if (client != null) {
- client.shutdownConsumerService();
- }
- }
-
- private BlockingQueue<StatContainer> queue = new LinkedBlockingQueue<StatContainer>();
- private int numMsgsReceived = 0;
-
- public void handleNotification(SOAPEnvelope msgEnvelope) {
- queue.add(new StatContainer(msgEnvelope));
- numMsgsReceived += 1;
- }
-
- public BlockingQueue<StatContainer> getQueue() {
- return queue;
- }
-
- public int getNumberOfMsgsReceived() {
- return numMsgsReceived;
- }
-
- public synchronized void incNoTopicsSubscribed() {
- numberOfTopicSubscribed++;
- }
-
- public synchronized int getNoTopicsSubscribed() {
- return numberOfTopicSubscribed;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PerformanceTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PerformanceTest.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PerformanceTest.java
deleted file mode 100644
index 4e90ec0..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PerformanceTest.java
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.airavata.wsmg.performance_evaluator.rtt.util.ConfigKeys;
-import org.apache.airavata.wsmg.performance_evaluator.rtt.util.LoadMsgPayload;
-import org.apache.airavata.wsmg.performance_evaluator.rtt.util.LoadXpath;
-
-class Stat {
- String name;
- Object value;
-
- public Stat(String k, Object v) {
- name = k;
- value = v;
- }
-
-}
-
-public class PerformanceTest {
-
- public static int NOTIFICATIONS_PUBLISHED_PER_TOPIC = 0;
- static String payload = null;
- static LinkedList<String> xpathList = null;
- public static long totalRoundTripTime = 0;
- private static long avgRountTripTime = 0;
- public static BufferedWriter out = null;
- public static Properties configurations = null;
- public static long avgPublishRTTime = 0l;
- private static long totalPublishRTT = 0l;
- private static int notifPerTopic = 0;
- private static int noTopicsPublished = 0;
- private static String protocol = "";
- private static int payLoadMultiplier = 1;
- private static int consumerPort = 3345;
- private static long testExpirationTime = 0l;
- private static int numberOfSubscriber = 0;
- private static int numMultiThreadsSupportPerSub = 0;
- private static String topicPrefix = "";
-
- public static void main(String[] args) throws Exception {
- loadConfigurationsFromFile();
- testPerformance();
- }
-
- public static void testPerformance() throws Exception {
-
- setConfigurationValues();
- File outfile = new File("performance.log");
- CountDownLatch publiserhStartSignal = new CountDownLatch(1);
- CountDownLatch publisherDoneSignal = new CountDownLatch(noTopicsPublished);
- NotificationManager notifManagerArray[] = new NotificationManager[numberOfSubscriber];
- StatCalculatorThread statCalcThread[] = new StatCalculatorThread[numberOfSubscriber];
- setPayload(payLoadMultiplier);
-
- for (int j = 0; j < numberOfSubscriber; j++) {
- notifManagerArray[j] = new NotificationManager(configurations.getProperty(ConfigKeys.BROKER_URL),
- consumerPort + j, protocol, numMultiThreadsSupportPerSub);
-
- }
-
- // thread to calculate stats for notification manager
- // set the subscriptions depending on the topic or xpath based
- int arrayIndex = 0;
- int totalReceivers = 0;
- createSubscriberArray(noTopicsPublished, numberOfSubscriber, notifManagerArray, arrayIndex);
- System.out.println("subscribing to topics completed, creating publisher threads");
-
- // start publishers
- PublisherThread[] publisher = new PublisherThread[noTopicsPublished];
- createPublishers(noTopicsPublished, protocol, publiserhStartSignal, publisherDoneSignal, publisher);
- System.out.println("sending signal to start publishing...");
- long publisherStartTime = System.currentTimeMillis();
- long startTime = System.currentTimeMillis();
- publiserhStartSignal.countDown(); // let all threads proceed
-
- for (int j = 0; j < numberOfSubscriber; j++) {
- statCalcThread[j] = new StatCalculatorThread(notifManagerArray[j], testExpirationTime);
- statCalcThread[j].start();
- }
-
- publisherDoneSignal.await(); // wait for all to finish
-
- for (int j = 0; j < noTopicsPublished; j++) {
- totalPublishRTT += publisher[j].getAvgPubTime();
- }
-
- avgPublishRTTime = totalPublishRTT / noTopicsPublished;
- long publishersRunningTime = System.currentTimeMillis() - publisherStartTime;
- System.out.println("finished publishing messgaes.");
-
- for (StatCalculatorThread stats : statCalcThread) {
- stats.join();
- }
-
- long stopTime = 0l;
- long totNumberOfMessagesReceived = 0;
-
- for (StatCalculatorThread stats : statCalcThread) {
- stopTime = stopTime < stats.getLastMsgReceivedTime() ? stats.getLastMsgReceivedTime() : stopTime;
- totalRoundTripTime += stats.getTotalTime();
- totNumberOfMessagesReceived += stats.getNumberOfMsgReceived();
- }
-
- for (NotificationManager notifMngr : notifManagerArray) {
- totalReceivers += notifMngr.getNoTopicsSubscribed();
- }
-
- avgRountTripTime = totalRoundTripTime / totNumberOfMessagesReceived;
- long executionTime = stopTime - startTime;
- double throughtput = (totNumberOfMessagesReceived * 1000) / (executionTime);
-
- List<Stat> statistics = new ArrayList<Stat>();
-
- statistics.add(new Stat("Payload size (bytes)", payload.getBytes("US-ASCII").length));
- statistics.add(new Stat("Protocol", protocol));
- statistics.add(new Stat("# total expected Msgs", totalReceivers * notifPerTopic));
- statistics.add(new Stat("# total msgs received", totNumberOfMessagesReceived));
- setStatList(notifPerTopic, noTopicsPublished, publishersRunningTime, executionTime, throughtput, statistics);
- printStatistics(statistics, outfile);
-
- for (NotificationManager notifMngr : notifManagerArray) {
- notifMngr.cleanup();
- }
-
- System.out.println("end of test");
- System.exit(0);
- }
-
- private static void setConfigurationValues() {
- notifPerTopic = Integer.parseInt(configurations.getProperty(ConfigKeys.NOTIFICATIONS_PUBLISHED_PER_TOPIC));
- noTopicsPublished = Integer.parseInt(configurations.getProperty(ConfigKeys.NUMBER_OF_TOPICS_PUBLISHED));
- protocol = configurations.getProperty(ConfigKeys.PROTOCOL);
- payLoadMultiplier = Integer.parseInt(configurations.getProperty(ConfigKeys.PAYLOAD_MULTIPLYER));
- consumerPort = Integer.parseInt(configurations.getProperty(ConfigKeys.CONSUMER_PORT));
- testExpirationTime = Math.max(20000,
- Long.parseLong(configurations.getProperty(ConfigKeys.PERFORMANCE_TEST_TIMEOUT, "20000")));
- numberOfSubscriber = Integer.parseInt(configurations.getProperty(ConfigKeys.NUMBER_OF_SUBSCRIBERS));
- numMultiThreadsSupportPerSub = Integer.parseInt(configurations.getProperty(ConfigKeys.MULTI_THREAD_PER_SUB));
- topicPrefix = "topic" + configurations.getProperty(ConfigKeys.TOPIC_SIMPLE);
- NOTIFICATIONS_PUBLISHED_PER_TOPIC = notifPerTopic;
- }
-
- private static void setStatList(int notifPerTopic, int noTopicsPublished, long publishersRunningTime,
- long executionTime, double throughtput, List<Stat> statistics) {
-
- statistics.add(new Stat("# topics published", noTopicsPublished));
- statistics.add(new Stat("Total RTT (millis)", totalRoundTripTime));
- statistics.add(new Stat("Average RTT (millis)", avgRountTripTime));
- statistics.add(new Stat("Total published to receive time (millis)", executionTime));
- statistics.add(new Stat("Throughput (messages per second)", throughtput));
- statistics.add(new Stat("Total publish RTT (millis)", totalPublishRTT));
- statistics.add(new Stat("Average publish RTT (millis)", avgPublishRTTime));
- statistics.add(new Stat("publisher duration (millis)", publishersRunningTime));
- statistics.add(new Stat("Publisher throughput (messages per second)", noTopicsPublished * notifPerTopic * 1000
- / publishersRunningTime));
- }
-
- private static void setPayload(int payLoadMultiplier) {
- String tempPayload = "";
- try {
- tempPayload = LoadMsgPayload.getInstance().getMessage("payload.txt");
- } catch (FileNotFoundException e2) {
- e2.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- for (int i = 1; i <= payLoadMultiplier; i++) {
- payload += tempPayload;
- }
- }
-
- private static void createPublishers(int noTopicsPublished, String protocol, CountDownLatch publiserhStartSignal,
- CountDownLatch publisherDoneSignal, PublisherThread[] publisher) {
- int threadId = 0;
- for (int j = 0; j < noTopicsPublished; j++) {
- threadId++;
- publisher[j] = new PublisherThread(protocol, configurations.getProperty(ConfigKeys.BROKER_URL), topicPrefix
- + j, payload, publiserhStartSignal, publisherDoneSignal, threadId);
- publisher[j].start();
- }
- }
-
- private static void createSubscriberArray(int noTopicsPublished, int numberOfSubscriber,
- NotificationManager[] notifManagerArray, int arrayIndex) throws Exception, IOException {
- if ("false".equalsIgnoreCase(configurations.getProperty(ConfigKeys.IS_XPATH_ENABLED))) {
- if (numberOfSubscriber <= noTopicsPublished) {
- for (int i = 0; i < noTopicsPublished; ++i) {
- notifManagerArray[arrayIndex].createTopicSubscription(topicPrefix + i);
- notifManagerArray[arrayIndex++].incNoTopicsSubscribed();
- if (arrayIndex >= numberOfSubscriber) {
- arrayIndex = 0;
- }
- }
- } else {
- int topicIndex = 0;
- for (int i = 0; i < numberOfSubscriber; ++i) {
- notifManagerArray[i].createTopicSubscription(topicPrefix + topicIndex++);
- notifManagerArray[i].incNoTopicsSubscribed();
- if (topicIndex >= noTopicsPublished) {
- topicIndex = 0;
- }
- }
- }
- } else {
- xpathList = LoadXpath.getInstace().getXpathList("xpath.list");
- if (numberOfSubscriber <= noTopicsPublished) {
- Iterator<String> ite = xpathList.iterator();
- for (int i = 0; i < noTopicsPublished; ++i) {
- if (!ite.hasNext())
- ite = xpathList.iterator();
-
- notifManagerArray[arrayIndex].createXpathSubscription(topicPrefix + i, ite.next());
- notifManagerArray[arrayIndex++].incNoTopicsSubscribed();
- if (arrayIndex >= numberOfSubscriber) {
- arrayIndex = 0;
- }
- }
- } else {
- int topicIndex = 0;
- for (int i = 0; i < numberOfSubscriber; ++i) {
- notifManagerArray[i].incNoTopicsSubscribed();
- if (topicIndex >= noTopicsPublished) {
- topicIndex = 0;
- }
- }
- }
- }
- }
-
- private static Properties getDefaults() {
- Properties defaults = new Properties();
- defaults.setProperty(ConfigKeys.BROKER_URL, "http://localhost:8080/axis2/services/EventingService");
- defaults.setProperty(ConfigKeys.TOPIC_SIMPLE, "simpleSampleTopic");
- defaults.setProperty(ConfigKeys.CONSUMER_PORT, "6666");
- defaults.setProperty(ConfigKeys.NOTIFICATIONS_PUBLISHED_PER_TOPIC, "5");
- defaults.setProperty(ConfigKeys.NUMBER_OF_TOPICS_PUBLISHED, "5");
- defaults.setProperty(ConfigKeys.IS_XPATH_ENABLED, "false");
- defaults.setProperty(ConfigKeys.XPATH, "/c/b/a");
- defaults.setProperty(ConfigKeys.PAYLOAD_MULTIPLYER, "1");
- defaults.setProperty(ConfigKeys.PROTOCOL, "wse");
- defaults.setProperty(ConfigKeys.PUBLISH_TIME_INTERVAL, "10000");
- defaults.setProperty(ConfigKeys.PERFORMANCE_TEST_TIMEOUT, "5000000");
- defaults.setProperty(ConfigKeys.NUMBER_OF_SUBSCRIBERS, "1");
- defaults.setProperty(ConfigKeys.MULTI_THREAD_PER_SUB, "50");
- return defaults;
- }
-
- private static void printStatistics(List<Stat> stats, File aFile) throws IOException {
- int maxLen = 0;
- Writer output = new BufferedWriter(new FileWriter(aFile, true));
-
- for (Stat stat : stats) {
- maxLen = Math.max(maxLen, stat.name.length());
- }
-
- char[] fillchars = null;
-
- for (Stat stat : stats) {
- fillchars = new char[maxLen - stat.name.length() + 1];
- Arrays.fill(fillchars, ' ');
- String formattedStr = String.format("%s%s : %s", stat.name, new String(fillchars), stat.value.toString());
- output.write(formattedStr + "\n");
- System.out.println(formattedStr);
- }
-
- fillchars = new char[maxLen];
- Arrays.fill(fillchars, '-');
- String fillingString = new String(fillchars);
- output.write(fillingString + "\n");
- System.out.println(fillingString);
- output.close();
- }
-
- public static void loadConfigurationsFromFile() {
- configurations = new Properties(getDefaults());
-
- try {
- URL url = ClassLoader.getSystemResource(ConfigKeys.CONFIG_FILE_NAME);
- if (url == null) {
- throw new IOException("configuration file not found");
- }
- configurations.load(url.openStream());
- } catch (IOException ioe) {
- System.out.println("unable to load configuration file, default settings will be used");
- }
- }
-
- // Not used, If required to run as a test case call it from main
- public static void loadConfigurationsFromSystemEnv() {
-
- configurations = new Properties(getDefaults());
-
- Properties envConfigs = System.getProperties();
- String brokerUrl = envConfigs.getProperty(ConfigKeys.BROKER_URL, null);
- String consumerUrl = envConfigs.getProperty(ConfigKeys.CONSUMER_EPR, null);
- String consumerPort = envConfigs.getProperty(ConfigKeys.CONSUMER_PORT, null);
- String isXpathEnabled = envConfigs.getProperty(ConfigKeys.IS_XPATH_ENABLED, null);
- String notifPerTopic = envConfigs.getProperty(ConfigKeys.NOTIFICATIONS_PUBLISHED_PER_TOPIC, null);
- String subsPerTopic = envConfigs.getProperty(ConfigKeys.NUMBER_OF_SUBS_PERTOPIC, null);
- String noTopicsPublished = envConfigs.getProperty(ConfigKeys.NUMBER_OF_TOPICS_PUBLISHED, null);
- String payLoadMultiplier = envConfigs.getProperty(ConfigKeys.PAYLOAD_MULTIPLYER, null);
- String protocol = envConfigs.getProperty(ConfigKeys.PROTOCOL, null);
- String topicSimple = envConfigs.getProperty(ConfigKeys.TOPIC_SIMPLE, null);
- String topicXpath = envConfigs.getProperty(ConfigKeys.XPATH, null);
-
- if (brokerUrl == null) {
- System.err.println(ConfigKeys.BROKER_URL + " not given");
- System.exit(1);
- }
- if (consumerUrl == null) {
- System.err.println(ConfigKeys.CONSUMER_EPR + " not given");
- System.exit(1);
- }
- if (consumerPort == null) {
- System.err.println(ConfigKeys.CONSUMER_PORT + " not given");
- System.exit(1);
- }
- if (isXpathEnabled == null) {
- System.err.println(ConfigKeys.IS_XPATH_ENABLED + " not given");
- System.exit(1);
- }
- if (notifPerTopic == null) {
- System.err.println(ConfigKeys.NOTIFICATIONS_PUBLISHED_PER_TOPIC + " not given");
- System.exit(1);
- }
- if (subsPerTopic == null) {
- System.err.println(ConfigKeys.NUMBER_OF_SUBS_PERTOPIC + " not given");
- System.exit(1);
- }
- if (noTopicsPublished == null) {
- System.err.println(ConfigKeys.NUMBER_OF_TOPICS_PUBLISHED + " not given");
- System.exit(1);
- }
- if (payLoadMultiplier == null) {
- System.err.println(ConfigKeys.PAYLOAD_MULTIPLYER + " not given");
- System.exit(1);
- }
- if (protocol == null) {
- System.err.println(ConfigKeys.PROTOCOL + " not given");
- System.exit(1);
- }
- if (topicSimple == null) {
- System.err.println(ConfigKeys.TOPIC_SIMPLE + " not given");
- System.exit(1);
- }
- if (topicXpath == null) {
- System.err.println(ConfigKeys.XPATH + " not given");
- System.exit(1);
- }
-
- configurations.put(ConfigKeys.BROKER_URL, brokerUrl);
- configurations.put(ConfigKeys.CONSUMER_EPR, consumerUrl);
- configurations.put(ConfigKeys.CONSUMER_PORT, consumerPort);
- configurations.put(ConfigKeys.IS_XPATH_ENABLED, isXpathEnabled);
- configurations.put(ConfigKeys.NOTIFICATIONS_PUBLISHED_PER_TOPIC, notifPerTopic);
- configurations.put(ConfigKeys.NUMBER_OF_SUBS_PERTOPIC, subsPerTopic);
- configurations.put(ConfigKeys.NUMBER_OF_TOPICS_PUBLISHED, noTopicsPublished);
- configurations.put(ConfigKeys.PAYLOAD_MULTIPLYER, payLoadMultiplier);
- configurations.put(ConfigKeys.PROTOCOL, protocol);
- configurations.put(ConfigKeys.TOPIC_SIMPLE, topicSimple);
- configurations.put(ConfigKeys.XPATH, topicXpath);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PublisherThread.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PublisherThread.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PublisherThread.java
deleted file mode 100644
index 4f1215b..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/PublisherThread.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import java.util.concurrent.CountDownLatch;
-
-import org.apache.airavata.wsmg.client.*;
-
-public class PublisherThread extends Thread {
- private String brokerURL;
- private String topic;
- private final CountDownLatch startSignal;
- private final CountDownLatch doneSignal;
- private long totPublishTime = 0l;
- long avgPublishTime = 0l;
-
- private String payload = "";
- String msg = "";
- private MessageBrokerClient client = null;
- int trackId = 0;
- int threadId = 0;
-
- public PublisherThread(String protocolIn, String brokerURLIn, String topicIn, String payloadIn,
- CountDownLatch startSignalIn, CountDownLatch doneSignalIn, int threadIdIn) {
- this.payload = payloadIn;
- this.brokerURL = brokerURLIn;
- this.topic = topicIn;
- this.startSignal = startSignalIn;
- this.doneSignal = doneSignalIn;
- this.threadId = threadIdIn;
- if ("wse".equalsIgnoreCase(protocolIn)) {
-
- WseMsgBrokerClient wseMsgBrokerClient = new WseMsgBrokerClient();
- wseMsgBrokerClient.setTimeoutInMilliSeconds(0);
- wseMsgBrokerClient.init(brokerURL);
- client = wseMsgBrokerClient;
-
- } else {
-
- WsntMsgBrokerClient wsntMsgBrokerClient = new WsntMsgBrokerClient();
- wsntMsgBrokerClient.setTimeoutInMilliSeconds(0);
- wsntMsgBrokerClient.init(brokerURL);
- client = wsntMsgBrokerClient;
- }
-
- }
-
- public void run() {
-
- try {
- trackId = 1;
- startSignal.await();
- System.out.println("Publishing started for topic :" + this.topic);
- for (int i = 0; i < PerformanceTest.NOTIFICATIONS_PUBLISHED_PER_TOPIC; i++) {
- msg = "<perf:performancetest xmlns:perf=\"http://lead.extreme.indiana.edu/namespaces/performance\"><perf:time>"
- + System.currentTimeMillis()
- + "</perf:time><perf:trackInfo><perf:threadId>"
- + threadId
- + "</perf:threadId><perf:trackId>"
- + trackId
- + "</perf:trackId></perf:trackInfo>"
- + "<perf:payload>" + payload + "</perf:payload></perf:performancetest>";
- long publishStartTime = System.currentTimeMillis();
- client.publish(topic, msg);
- totPublishTime += System.currentTimeMillis() - publishStartTime;
- trackId++;
- }
-
- avgPublishTime = totPublishTime / PerformanceTest.NOTIFICATIONS_PUBLISHED_PER_TOPIC;
- System.out.println("Publishing ended for topic :" + this.topic);
- doneSignal.countDown();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- synchronized long getAvgPubTime() {
- return this.avgPublishTime;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatCalculatorThread.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatCalculatorThread.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatCalculatorThread.java
deleted file mode 100644
index 541d80b..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatCalculatorThread.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import java.util.concurrent.TimeUnit;
-
-public class StatCalculatorThread extends Thread {
-
- private NotificationManager notifManager = null;
- private long lastMsgReceivedTime = 0l;
- private long timeTot = 0;
- private long avgTime = 0;
- private int numberOfMssgsReceived = 0; // to avoid concurrency
- private long timeOutMillis;
- private int expectedNoMessages = 0;
-
- public StatCalculatorThread(NotificationManager notificationManager, long timeOutInMillis) throws Exception {
- this.timeOutMillis = timeOutInMillis;
- this.notifManager = notificationManager;
- expectedNoMessages = PerformanceTest.NOTIFICATIONS_PUBLISHED_PER_TOPIC
- * notificationManager.getNoTopicsSubscribed();
- }
-
- @Override
- public void run() {
- do {
-
- StatContainer container = null;
- try {
- container = notifManager.getQueue().poll(timeOutMillis, TimeUnit.MILLISECONDS);
-
- if (container != null) {
- timeTot += container.getRondTripTime();
- lastMsgReceivedTime = container.getMessageReceivedTime();
- numberOfMssgsReceived++;
- // ******un-comment in order to log trakId and message
- // related other information*****
- // if (logger.isInfoEnabled()) {
- // trackInfo = env
- // .getBody()
- // .getFirstElement()
- // .getFirstChildWithName(
- // new QName(
- // "http://lead.extreme.indiana.edu/namespaces/performance",
- // "trackInfo")).toStringWithConsume();
- // logger.info(trackInfo + " Send time :" + time
- // + " Received time :" + System.currentTimeMillis());
- // }
- } else {
- System.out.println("stat calculator thread was interrupted");
- break;
- }
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- break;
- }
-
- } while (expectedNoMessages > numberOfMssgsReceived);
-
- if (numberOfMssgsReceived > 0) {
- avgTime = timeTot / numberOfMssgsReceived;
- } else {
- System.out.println("no messages received");
- }
-
- System.out.println("end of stat calculator");
- }
-
- synchronized long getTotalTime() {
- return timeTot;
- }
-
- synchronized long getAverageTime() {
- return avgTime;
- }
-
- synchronized long getNumberOfMsgReceived() {
- return numberOfMssgsReceived;
- }
-
- synchronized public long getLastMsgReceivedTime() {
- return lastMsgReceivedTime;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatContainer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatContainer.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatContainer.java
deleted file mode 100644
index 31b9c85..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/StatContainer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import org.apache.axiom.soap.SOAPEnvelope;
-
-public class StatContainer {
- private SOAPEnvelope msgEnvelope = null;
- private long rtt = 0l;
- private long receivedTime = 0l;
-
- public StatContainer(SOAPEnvelope msgEnvelope) {
- this.msgEnvelope = msgEnvelope;
- this.receivedTime = System.currentTimeMillis();
- this.rtt = this.receivedTime
- - Long.parseLong(msgEnvelope.getBody().getFirstElement().getFirstElement().getText());
- }
-
- public long getRondTripTime() {
- return this.rtt;
- }
-
- public SOAPEnvelope getMsgEnvelope() {
- return msgEnvelope;
- }
-
- public long getMessageReceivedTime() {
- return this.receivedTime;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/Subscription.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/Subscription.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/Subscription.java
deleted file mode 100644
index d8df04f..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/Subscription.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt;
-
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.MessageBrokerClient;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Subscription {
-
- private String subscriptionID;
-
- private String topic;
- private final static Logger logger = LoggerFactory.getLogger(Subscription.class);
- private ConsumerNotificationHandler handler;
- private MessageBrokerClient client;
- private EndpointReference messageBoxEPR;
- private String xpath;
- private String brokerURL;
-
- private String protocol;
-
- public Subscription(MessageBrokerClient clientIn, String subscriptionID, String topic,
- ConsumerNotificationHandler callback, String brokerURL, String protocolIn) {
- super();
- this.subscriptionID = subscriptionID;
- this.topic = topic;
- this.handler = callback;
- this.brokerURL = brokerURL;
- this.client = clientIn;
- this.protocol = protocolIn;
- }
-
- public Subscription(MessageBrokerClient clientIn, String subscriptionID, String topic, String xpath,
- ConsumerNotificationHandler callback, String brokerURL, String protocolIn) {
- super();
- this.client = clientIn;
- this.subscriptionID = subscriptionID;
- this.topic = topic;
- this.handler = callback;
- this.brokerURL = brokerURL;
- this.xpath = xpath;
- this.protocol = protocolIn;
- }
-
- public ConsumerNotificationHandler getCallback() {
- return handler;
- }
-
- public String getTopic() {
- return topic;
- }
-
- // public void destroy() throws RemoteException {
- // client.shutdownConsumerService();
- // }
-
- public EndpointReference getMessageBoxEPR() {
- return messageBoxEPR;
- }
-
- public void setMessageBoxEpr(EndpointReference messageBoxEPR) {
- this.messageBoxEPR = messageBoxEPR;
- }
-
- public String getSubscriptionID() {
- return subscriptionID;
- }
-
- public void setSubscriptionID(String subscriptionID) {
- this.subscriptionID = subscriptionID;
- }
-
- public String getBrokerURL() {
- return brokerURL;
- }
-
- public void setBrokerURL(String brokerURL) {
- this.brokerURL = brokerURL;
- }
-
- // public String getConsumerEPR() throws UnknownHostException {
- // cli
- // }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/ConfigKeys.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/ConfigKeys.java
deleted file mode 100644
index 6463f31..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/ConfigKeys.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt.util;
-
-public interface ConfigKeys {
- String CONFIG_FILE_NAME = "configurations.properties";
- String BROKER_URL = "broker.eventing.service.epr";
- String CONSUMER_EPR = "consumer.location";
- String CONSUMER_PORT = "consumer.port";
- String TOPIC_SIMPLE = "topic.simple";
- String TOPIC_XPATH = "topic.xpath";
- String PUBLISH_TIME_INTERVAL = "publish.time.interval";
- String IS_XPATH_ENABLED = "is.xpath.enabled";
- String XPATH = "topic.xpath";
- String PAYLOAD_MULTIPLYER = "payload.multiplyer";
- String PROTOCOL = "protocol.used";
- String NUMBER_OF_SUBS_PERTOPIC = "num.subscribers.per.topic";
- String NOTIFICATIONS_PUBLISHED_PER_TOPIC = "notifications.per.topic";
- String NUMBER_OF_TOPICS_PUBLISHED = "number.of.topics";
- String SCHEDULER_REPEAT_PERIOD = "stat.timeout.monitor.scheduler.period";
- String PERFORMANCE_TEST_TIMEOUT = "performance.test.timeout.period.millis";
- String NUMBER_OF_SUBSCRIBERS = "number.of.subscriber.servers";
- String MULTI_THREAD_PER_SUB = "num.muti.thread.per.sub";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadMsgPayload.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadMsgPayload.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadMsgPayload.java
deleted file mode 100644
index 8ed4cb6..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadMsgPayload.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-public class LoadMsgPayload {
-
- private static LoadMsgPayload msg = null;
-
- public static LoadMsgPayload getInstance() {
- if (msg == null)
- msg = new LoadMsgPayload();
- return msg;
- }
-
- public String getMessage(String fileName) throws IOException {
- URL url = ClassLoader.getSystemResource(fileName);
- if (url != null)
- return convertStreamToString(url.openStream());
- else
- return "";
- }
-
- private String convertStreamToString(InputStream is) throws IOException {
- if (is != null) {
- StringBuilder sb = new StringBuilder();
- String line;
-
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- while ((line = reader.readLine()) != null) {
- sb.append(line).append("\n");
- }
- } finally {
- is.close();
- }
- return sb.toString();
- } else {
- return "";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadXpath.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadXpath.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadXpath.java
deleted file mode 100644
index 1a1a5fa..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/performance_evaluator/rtt/util/LoadXpath.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.performance_evaluator.rtt.util;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.LinkedList;
-
-public class LoadXpath {
- private static LoadXpath xpath = null;
- LinkedList<String> xpathList = null;
-
- public static LoadXpath getInstace() {
- if (xpath == null)
- xpath = new LoadXpath();
- return xpath;
- }
-
- public LinkedList<String> getXpathList(String fileName) throws IOException {
- URL url = ClassLoader.getSystemResource(fileName);
- if (url != null && xpathList == null)
- return convertStreamToString(url.openStream());
- return xpathList;
- }
-
- private LinkedList<String> convertStreamToString(InputStream is) throws IOException {
- if (is != null) {
- xpathList = new LinkedList<String>();
- String line;
-
- try {
- BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- while ((line = reader.readLine()) != null) {
- xpathList.add(line);
- }
- } finally {
- is.close();
- }
- return xpathList;
- } else {
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java
deleted file mode 100644
index e0162e7..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/BrokerUtilTest.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-import javax.xml.namespace.QName;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class BrokerUtilTest extends TestCase {
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- }
-
- /**
- * Test method for
- * {@link org.apache.airavata.wsmg.util.BrokerUtil#sameStringValue(java.lang.String, java.lang.String)} .
- */
- @Test
- public void testSameStringValue() {
-
- assertTrue(BrokerUtil.sameStringValue(null, null));
- assertTrue(BrokerUtil.sameStringValue("test", "test"));
-
- assertFalse(BrokerUtil.sameStringValue("one", "two"));
- assertFalse(BrokerUtil.sameStringValue(null, "test"));
- assertFalse(BrokerUtil.sameStringValue("test", null));
-
- }
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.util.BrokerUtil#getTopicLocalString(java.lang.String)}.
- */
- @Test
- public void testGetTopicLocalString() {
-
- assertEquals("localstring", (BrokerUtil.getTopicLocalString("prefix:localstring")));
-
- assertEquals("localstring", BrokerUtil.getTopicLocalString("localstring"));
-
- }
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.util.BrokerUtil#getXPathString(org.apache.axiom.om.OMElement)}.
- */
- @Test
- public void testGetXPathString() {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- try {
-
- BrokerUtil.getXPathString(null);
- fail("method should validate invalid arguments");
- } catch (IllegalArgumentException e) {
-
- } catch (AxisFault e) {
- fail("invalid exception thrown");
- }
-
- try {
-
- QName invalidQName = new QName("invalidURI", "invalidLocalName");
-
- OMElement xpathEl = factory.createOMElement(invalidQName);
-
- BrokerUtil.getXPathString(xpathEl);
-
- fail("method should validate arguments");
-
- } catch (AxisFault fault) {
-
- }
-
- try {
-
- String xpathExpression = "testXpathExpression";
- String dialect = "unknownXpathDialect";
-
- OMNamespace ns = factory.createOMNamespace("unit_test", "jnt");
-
- OMElement xpathEl = factory.createOMElement("TestXpath", ns);
- xpathEl.addAttribute("Dialect", dialect, null);
-
- xpathEl.setText(xpathExpression);
-
- BrokerUtil.getXPathString(xpathEl);
-
- fail("method should reject unknown dialect");
- } catch (AxisFault e) {
-
- }
-
- try {
-
- String xpathExpression = "textXpathExpression";
- String dialect = WsmgCommonConstants.XPATH_DIALECT;
-
- OMNamespace ns = factory.createOMNamespace("unit_test", "jnt");
-
- OMElement xpathEl = factory.createOMElement("TestXpath", ns);
- xpathEl.addAttribute("Dialect", dialect, null);
-
- xpathEl.setText(xpathExpression);
- assertEquals(xpathExpression, BrokerUtil.getXPathString(xpathEl));
-
- } catch (AxisFault e) {
- fail("unable to extract xpath query: " + e.toString());
- }
-
- }
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.util.BrokerUtil#getTopicFromRequestPath(java.lang.String)}.
- */
- @Test
- public void testGetTopicFromRequestPath() {
-
- assertNull(BrokerUtil.getTopicFromRequestPath(null));
- assertNull(BrokerUtil.getTopicFromRequestPath(""));
- assertNull(BrokerUtil.getTopicFromRequestPath("/"));
- assertNull(BrokerUtil.getTopicFromRequestPath("/subscribe/url/"));
- assertNull(BrokerUtil.getTopicFromRequestPath("/subscribe/url/topic/"));
-
- assertEquals(BrokerUtil.getTopicFromRequestPath("/requestpath/topic/xyz"), "xyz");
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java b/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java
deleted file mode 100644
index 0624442..0000000
--- a/modules/ws-messenger/messagebroker/src/test/java/org/apache/airavata/wsmg/util/ConfigKeys.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.util;
-
-public interface ConfigKeys {
-
- String CONFIG_FILE_NAME = "unit_tests.properties";
-
- String CONSUMER_EPR = "consumer.location";
- String CONSUMER_PORT = "consumer.port";
- String TOPIC_SIMPLE = "topic.simple";
- String TOPIC_XPATH = "topic.xpath";
- String AXIS2_REPO = "axis2.repo";
-
-}
[11/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsrfResourceStub.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsrfResourceStub.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsrfResourceStub.java
deleted file mode 100644
index 704aa25..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsrfResourceStub.java
+++ /dev/null
@@ -1,391 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.util.DcDate;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.OMNode;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
- * Templates
- */
-public class WsrfResourceStub {
- private final static Logger logger = LoggerFactory.getLogger(WsrfResourceStub.class);
- private final static OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
- protected Options opts;
-
- private EndpointReference resourceEndpointReference;
-
- private long timeoutInMilliSeconds;
-
- protected WsrfResourceStub(EndpointReference resourceEpr, long timeout) {
- this.resourceEndpointReference = resourceEpr;
- logger.info("resourceEprInWsrfResourceStub Constructor" + resourceEpr.toString());
-
- timeoutInMilliSeconds = timeout;
-
- opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(resourceEpr);
- opts.setTimeOutInMilliSeconds(timeout);
-
- }
-
- public EndpointReference getResourceEpr() {
- return resourceEndpointReference;
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public void destroy() throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- opts.setMessageId(uuid);
- OMElement message = factory.createOMElement("Destroy", NameSpaceConstants.WSRL_NS);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
-
- try {
- client.sendRobust(message);
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }finally {
- client.cleanup();
- client.cleanupTransport();
- }
- }
-
- public void setTerminationTime(Calendar cal) throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- opts.setMessageId(uuid);
- OMElement message = factory.createOMElement("SetTerminationTime", NameSpaceConstants.WSRL_NS);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
-
- OMElement child = factory.createOMElement("RequestedTerminationTime", message.getNamespace(), message);
-
- if (cal == null) {
- OMNamespace XSI_NS = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xsd");
- child.addAttribute("nill", "true", XSI_NS);
- // (XmlConstants.XSI_NS, "nil", "true");
- } else {
-
- DcDate dcDate = new DcDate(cal);
- child.setText(dcDate.toString());
- }
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- try {
- client.sendRobust(message);
- } catch (AxisFault axisFault) {
- axisFault.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }finally {
- client.cleanupTransport();
- }
-
- }
-
- public List<OMElement> getResourceProperty(QName qn) throws AxisFault { // List<XmlElement>
-
- OMElement messageEl = factory.createOMElement("GetResourceProperty", NameSpaceConstants.WSRP_NS);
- String uuid = UUIDGenerator.getUUID();
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- opts.setMessageId(uuid);
- opts.setAction(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- QName textQName = new QName(qn.getNamespaceURI(), qn.getLocalPart(), qn.getPrefix());
-
- factory.createOMText(messageEl, textQName);
-
- if (qn.getPrefix() != null) {
- OMNamespace ns = factory.createOMNamespace(qn.getNamespaceURI(), qn.getPrefix());
- messageEl.declareNamespace(ns);
- }
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
-
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- OMElement responseMessage = client.sendReceive(messageEl);
- client.cleanupTransport();
-
- List<OMElement> list = elementsAsList(responseMessage);
- return list;
- }
-
- public List<OMElement> getMultipleResourceProperties(QName[] qnamez) throws AxisFault { // TODO
-
- OMElement messageEl = factory.createOMElement("GetMultipleResourceProperties", NameSpaceConstants.WSRP_NS);
- String uuid = UUIDGenerator.getUUID();
- opts.setMessageId(uuid);
- opts.setAction(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
-
- // message.addChild(new QNameElText(message, WidgetService.WIDGET_NS,
- // "TerminationTime"));
- // message.declareNamespace(WidgetService.WIDGET_NS);
- // wsrp:ResourceProperty
-
- for (QName qn : qnamez) {
-
- OMNamespace ns = factory.createOMNamespace(qn.getNamespaceURI(), qn.getPrefix());
-
- OMElement child = factory.createOMElement("ResourceProperty", NameSpaceConstants.WSRP_NS);
-
- QName textQName = new QName(qn.getNamespaceURI(), qn.getLocalPart(), qn.getPrefix());
-
- factory.createOMText(child, textQName);
-
- if (qn.getPrefix() != null) {
- messageEl.declareNamespace(ns);
- }
-
- }
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- OMElement responseMessage = client.sendReceive(messageEl);
- client.cleanupTransport();
-
- List<OMElement> list = elementsAsList(responseMessage);
- return list;
- }
-
- public List<OMNode> queryResourcePropertiesByXpath(String query) throws AxisFault {
- if (query == null) {
- throw new IllegalArgumentException();
- }
- String uuid = UUIDGenerator.getUUID();
- opts.setMessageId(uuid);
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- OMElement messageEl = factory.createOMElement("QueryResourceProperties", NameSpaceConstants.WSRP_NS);
-
- opts.setAction(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- OMElement queryExpressionEl = factory.createOMElement("QueryExpression", NameSpaceConstants.WSRP_NS);
-
- queryExpressionEl.addAttribute("dialect", WsmgCommonConstants.XPATH_DIALECT, null);
-
- queryExpressionEl.setText(query);
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
-
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- OMElement responseMessage = client.sendReceive(messageEl);
- client.cleanupTransport();
- List<OMNode> list = childrenAsList(responseMessage);
- return list;
- }
-
- public void setResourceProperties(OMElement[] requests) throws AxisFault {
- if (requests.length == 0) {
- throw new IllegalArgumentException("at least one request is required");
- }
-
- OMElement messageEl = factory.createOMElement("SetResourceProperties", NameSpaceConstants.WSRP_NS);
-
- String uuid = UUIDGenerator.getUUID();
- opts.setMessageId(uuid);
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- opts.setAction(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- for (int i = 0; i < requests.length; i++) {
- messageEl.addChild(requests[i]);
- }
- // message.addChild(new QNameElText(message, WidgetService.WIDGET_NS,
- // "TerminationTime"));
- // message.declareNamespace(WidgetService.WIDGET_NS);
- // wsrp:ResourceProperty
- // message.declareNamespace(WidgetService.WSRL_NS);
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(this.resourceEndpointReference.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(messageEl.getNamespace().getNamespaceURI() + "/" + messageEl.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- client.sendRobust(messageEl);
-
- }
-
- private List<OMElement> elementsAsList(OMElement responseMessage) {
- List<OMElement> list = new ArrayList<OMElement>();
-
- for (Iterator it = responseMessage.getChildElements(); it.hasNext();) {
- OMElement current = (OMElement) it.next();
- list.add(current);
- }
-
- return list;
- }
-
- private List<OMNode> childrenAsList(OMElement responseMessage) {
- List<OMNode> list = new ArrayList<OMNode>();
-
- for (Iterator it = responseMessage.getChildren(); it.hasNext();) {
- OMNode child = (OMNode) it.next();
- list.add(child);
- }
- return list;
- }
-
- public static void verbose(String msg) {
- System.err.println(msg);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastReceiver.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastReceiver.java
deleted file mode 100644
index 46bbb73..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastReceiver.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-/**
- * AMQPBroadcastReceiver defines an interface that should be implemented by a message receiver that
- * receives broadcast messages from the broker.
- */
-public interface AMQPBroadcastReceiver {
-
- /**
- * Subscribe to the broadcast channel.
- *
- * @throws AMQPException
- */
- public void Subscribe() throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastSender.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastSender.java
deleted file mode 100644
index d1343fd..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPBroadcastSender.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.apache.axiom.om.OMElement;
-
-/**
- * AMQPBroadcastSender defines an interface that should be implemented by a message sender that
- * sends messages that can be consumed by any downstream client, irrespective of message routing key.
- */
-public interface AMQPBroadcastSender {
-
- /**
- * Send a message.
- *
- * @param message Message to be delivered.
- * @throws AMQPException
- */
- public void Send(OMElement message) throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPCallback.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPCallback.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPCallback.java
deleted file mode 100644
index 5545edc..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPCallback.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-public interface AMQPCallback {
-
- /**
- * Gets called when a message is available on the receiver.
- *
- * @param message Message that is available.
- */
- public void onMessage(String message);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPClient.java
deleted file mode 100644
index bd3db9e..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPClient.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import com.rabbitmq.client.ConnectionFactory;
-
-import java.util.Properties;
-
-/**
- * AMQPClient class takes care of establishing/terminating connections with the broker.
- */
-public class AMQPClient {
- protected final ConnectionFactory connectionFactory = new ConnectionFactory();
-
- /**
- * Create an instance of client.
- *
- * @param properties Connection properties.
- */
- public AMQPClient(Properties properties) {
- connectionFactory.setHost(properties.getProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST));
- String port = properties.getProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT);
- connectionFactory.setPort((port == null) ? 5672 : Integer.parseInt(port));
- connectionFactory.setUsername(properties.getProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME));
- connectionFactory.setPassword(properties.getProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPException.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPException.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPException.java
deleted file mode 100644
index 2f7c3d8..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-/**
- * AMQPException is an extension for AMQP-specific exception handling.
- */
-public class AMQPException extends Exception {
-
- public AMQPException() {
- super();
- }
-
- public AMQPException(String message) {
- super(message);
- }
-
- public AMQPException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public AMQPException(Throwable cause) {
- super(cause);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPReceiver.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPReceiver.java
deleted file mode 100644
index 82eeb2c..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPReceiver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-/**
- * AMQPReceiver defines an interface that should be implemented by a message receiver that
- * receives messages selectively based on a unique routing key. A message would only get delivered
- * to a subscriber if and only if the routing key of message satisfies the subscription key.
- */
-public interface AMQPReceiver {
-
- /**
- * Subscribe to a channel.
- *
- * @param key Key that defines the channel binging.
- * @throws AMQPException
- */
- public void Subscribe(AMQPRoutingKey key) throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingAwareClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingAwareClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingAwareClient.java
deleted file mode 100644
index 5e7c3ff..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingAwareClient.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.apache.axiom.om.OMElement;
-import org.jaxen.JaxenException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * AMQPRoutingAwareClient class takes care of handling routing keys so that a derived class
- * can only have the logic for sending/receiving messages based on its intended message flow pattern.
- */
-public class AMQPRoutingAwareClient extends AMQPClient {
- private static final Logger log = LoggerFactory.getLogger(AMQPClient.class);
-
- private static final String ELEMENT_EVENT = "event";
- private static final String ELEMENT_KEY = "key";
- private static final String ELEMENT_SEGMENT = "segment";
- private static final String ATTRIBUTE_NAME = "name";
-
- private HashMap<String, HashMap<String, AMQPRoutingKey>> eventRoutingKeys = new HashMap<String, HashMap<String, AMQPRoutingKey>>();
-
- /**
- * Create an instance of client.
- *
- * @param properties Connection properties.
- */
- public AMQPRoutingAwareClient(Properties properties) {
- super(properties);
- }
-
- /**
- * Initialize the client.
- *
- * @param routingKeys Routing key configuration.
- * @throws AMQPException on error.
- */
- public void init(Element routingKeys) throws AMQPException {
- if (routingKeys != null) {
- NodeList events = routingKeys.getElementsByTagName(ELEMENT_EVENT);
- for (int i = 0; i < events.getLength(); i++) {
- // event
- Element event = (Element)(events.item(i));
- String eventName = event.getAttribute(ATTRIBUTE_NAME).trim();
- if ((eventName == null) || (eventName.isEmpty()) || eventRoutingKeys.containsKey(eventName)) {
- continue;
- }
-
- HashMap<String, AMQPRoutingKey> eventKeys = new HashMap<String, AMQPRoutingKey>();
- eventRoutingKeys.put(eventName, eventKeys);
-
- // keys
- NodeList keys = event.getElementsByTagName(ELEMENT_KEY);
- for (int j = 0; j < keys.getLength(); j++) {
- Element key = (Element)(keys.item(j));
- String keyName = key.getAttribute(ATTRIBUTE_NAME).trim();
- if ((keyName == null) || (keyName.isEmpty()) || eventKeys.containsKey(keyName)) {
- continue;
- }
-
- AMQPRoutingKey routingKey = new AMQPRoutingKey(eventName, keyName);
- eventKeys.put(keyName, routingKey);
-
- // segments
- NodeList segments = key.getElementsByTagName(ELEMENT_SEGMENT);
- for (int k = 0; k < segments.getLength(); k++) {
- Element segment = (Element)(segments.item(k));
- String segmentName = segment.getAttribute(ATTRIBUTE_NAME).trim();
- if ((segmentName == null) || (segmentName.isEmpty()) || routingKey.containsSegment(segmentName)) {
- continue;
- }
-
- String segmentExpression = segment.getTextContent().trim();
- if (-1 != segmentExpression.indexOf('@')) {
- // Attribute
- routingKey.addEvaluatableAttributeSegment(segmentName, segmentExpression);
- } else {
- // Element
- routingKey.addEvaluatableElementSegment(segmentName, segmentExpression);
- }
- }
- }
- }
- }
- }
-
- /**
- * Initialize client. Load routing configuration on its own.
- *
- * @throws AMQPException on error.
- */
- public void init() throws AMQPException {
- init(AMQPUtil.loadRoutingKeys());
- }
-
- /**
- * Check if a given message is routable as per routing configuration.
- *
- * @param message Message to be routed.
- * @return true if routable or false otherwise.
- */
- protected boolean isRoutable(OMElement message) {
- return eventRoutingKeys.containsKey(message.getLocalName());
- }
-
- /**
- * Evaluate the set of native routing keys for a given message.
- *
- * @param message Message for which the routing keys are required.
- * @param routingKeys Possible set of routing keys.
- */
- protected void getRoutingKeys(OMElement message, List<String> routingKeys) {
- HashMap<String, AMQPRoutingKey> eventKeys = eventRoutingKeys.get(message.getLocalName());
- if (eventKeys != null) {
-
- for (AMQPRoutingKey eventKey : eventKeys.values()) {
- try {
- String routingKey = eventKey.evaluate(message);
- if (!routingKey.isEmpty()) {
- routingKeys.add(routingKey);
- }
- } catch (JaxenException e) {
- // Do nothing. The erroneous key will be ignored.
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingKey.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingKey.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingKey.java
deleted file mode 100644
index 2cb52cb..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPRoutingKey.java
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.jaxen.JaxenException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * AMQPRoutingKey represents an AMQP routing key. A key would consist of one or more segments where
- * a segment would be an element or an attribute of an event.
- */
-public class AMQPRoutingKey {
- private static final Logger log = LoggerFactory.getLogger(AMQPRoutingKey.class);
-
- private String eventName = "";
- private String keyName = "";
- private List<Segment> segments = new ArrayList<Segment>();
-
- public AMQPRoutingKey(String eventName, String keyName) {
- this.eventName = eventName;
- this.keyName = keyName;
- }
-
- /**
- * Get associated event name.
- *
- * @return Event name.
- */
- public String getEventName() {
- return eventName;
- }
-
- /**
- * Set associated event name.
- *
- * @param eventName Event name.
- */
- public void setEventName(String eventName) {
- this.eventName = eventName;
- }
-
- /**
- * Get name of key.
- *
- * @return Key name.
- */
- public String getKeyName() {
- return keyName;
- }
-
- /**
- * Set name of key.
- *
- * @param keyName Key name.
- */
- public void setKeyName(String keyName) {
- this.keyName = keyName;
- }
-
- /**
- * Check if a segment already exists.
- *
- * @param name Name of the segment.
- * @return true if exists or false otherwise.
- */
- boolean containsSegment(String name) {
- boolean found = false;
-
- for (Segment segment : segments) {
- if (segment.getName().equals(name)) {
- found = true;
- break;
- }
- }
-
- return found;
- }
-
- /**
- * Add a segment.
- *
- * @param name Name of the segment.
- * @param value Value of the segment.
- * @throws AMQPException on duplicate segment.
- */
- public void addSegment(String name, String value) throws AMQPException {
- segments.add(new Segment(name, value));
- }
-
- /**
- * Add an evaluatable element segment.
- *
- * @param name Name of the element.
- * @param expression Expression that needs evaluating to retrieve the value of element.
- * @throws AMQPException on duplicate element.
- */
- public void addEvaluatableElementSegment(String name, String expression) throws AMQPException {
- try {
- segments.add(new EvaluatableElementSegment(name, expression));
- } catch (JaxenException e) {
- throw new AMQPException(e);
- }
- }
-
- /**
- * Add an evaluatable attribute segment.
- *
- * @param name Name of the attribute.
- * @param expression Expression that needs evaluating to retrieve the value of attribute.
- * @throws AMQPException on duplicate attribute.
- */
- public void addEvaluatableAttributeSegment(String name, String expression) throws AMQPException {
- try {
- segments.add(new EvaluatableAttributeSegment(name, expression));
- } catch (JaxenException e) {
- throw new AMQPException(e);
- }
- }
-
- /**
- * Generate native AMQP key using the segments.
- *
- * @return Routing key in native(AMQP) format.
- */
- public String getNativeKey() {
- String routingKey = !eventName.isEmpty() ? eventName : "*";
-
- boolean segmentsGiven = false;
- for (Segment segment : segments) {
-
- String segmentValue = segment.getValue().trim();
- if (!segmentValue.isEmpty()) {
- routingKey += ".";
- routingKey += segment.getValue();
-
- segmentsGiven = true;
- }
- }
-
- if (!segmentsGiven) {
- routingKey += ".";
- routingKey += "#";
- }
-
- return routingKey;
- }
-
- /**
- * Evaluate the routing key for a given message.
- *
- * @param message Message for which the routing key is required.
- * @return Routing key.
- * @throws JaxenException on expression evaluation error.
- */
- public String evaluate(OMElement message) throws JaxenException {
- String routingKey = eventName;
-
- for (Segment segment : segments) {
-
- if (segment instanceof EvaluatableSegment) {
- routingKey += ".";
- routingKey += ((EvaluatableSegment)segment).evaluate(message);
- }
- }
-
- return routingKey;
- }
-
- /**
- * Segment provides a base implementation for segments. This class could be extended
- * by a particular type of segment(element/attribute) based on its specific requirements.
- */
- private class Segment {
-
- private String name = "";
- private String value = "";
-
- /**
- * Create an instance of segment.
- *
- * @param name Name of segment.
- */
- public Segment(String name) {
- this.name = name;
- }
-
- /**
- * Create an instance of segment.
- *
- * @param name Name of segment.
- * @param value Value of segment.
- */
- public Segment(String name, String value) {
- this.name = name;
- this.value = value;
- }
-
- /**
- * Get name of segment.
- *
- * @return Name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set name of segment.
- *
- * @param name Name to be set.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Get value of segment.
- *
- * @return Value.
- */
- public String getValue() {
- return value;
- }
-
- /**
- * Set value of segment.
- *
- * @param value Value to be set.
- */
- public void setValue(String value) {
- this.value = value;
- }
- }
-
- /**
- * EvaluatableSegment provides a base implementation for segments that are evaluated on the fly
- * based on an incoming event. This class could be extended by a particular type of segment(element/attribute)
- * based on its specific requirements.
- */
- private abstract class EvaluatableSegment extends Segment {
-
- private static final String NAMESPACE_PREFIX = "ns";
- private static final String NAMESPACE_URL = "http://airavata.apache.org/schemas/wft/2011/08";
-
- protected AXIOMXPath xpathProcessor = null;
-
- /**
- * Create an instance of EvaluatableSegment.
- *
- * @param name Name of segment.
- * @param expression Expression that needs evaluating to retrieve the value of segment.
- * @throws JaxenException on expression evalution error.
- */
- protected EvaluatableSegment(String name, String expression) throws JaxenException {
- super(name);
-
- xpathProcessor = new AXIOMXPath(getNormalizedExpression(expression));
- xpathProcessor.addNamespace(NAMESPACE_PREFIX, NAMESPACE_URL);
- }
-
- /**
- * Normalize an expression to include namespace.
- *
- * @param expression Expression to be normalized.
- * @return Normalized expression.
- */
- private String getNormalizedExpression(String expression) {
- try {
- StringBuffer normalizedExpression = new StringBuffer();
- normalizedExpression.append(NAMESPACE_PREFIX);
- normalizedExpression.append(":");
-
- expression = expression.trim();
- for (int i = 0; i < expression.length(); i++) {
- char c = expression.charAt(i);
-
- normalizedExpression.append(c);
- if (((c == '/') && (expression.charAt(i + 1) != '@')) || (c == '@')) {
- normalizedExpression.append(NAMESPACE_PREFIX);
- normalizedExpression.append(":");
- }
- }
-
- return normalizedExpression.toString();
- } catch (ArrayIndexOutOfBoundsException e) {
- return "";
- }
- }
-
- /**
- * Returns value of segment.
- *
- * @param message Message from which the data is extracted.
- * @return Value of segment.
- * @throws JaxenException on error.
- */
- public abstract String evaluate(OMElement message) throws JaxenException;
- }
-
- /**
- * EvaluatableElementSegment is the EvaluatableSegment extension for event elements.
- */
- private class EvaluatableElementSegment extends EvaluatableSegment {
-
- public EvaluatableElementSegment(String name, String expression) throws JaxenException {
- super(name, expression);
- }
-
- @Override
- public String evaluate(OMElement message) throws JaxenException {
- String value = "";
-
- OMElement element = (OMElement)xpathProcessor.selectSingleNode(message);
- if (element != null) {
- value = element.getText();
- }
-
- return value;
- }
- }
-
- /**
- * EvaluatableAttributeSegment is the EvaluatableSegment extension for event attributes.
- */
- private class EvaluatableAttributeSegment extends EvaluatableSegment {
-
- public EvaluatableAttributeSegment(String name, String expression) throws JaxenException {
- super(name, expression);
- }
-
- @Override
- public String evaluate(OMElement message) throws JaxenException {
- String value = "";
-
- OMAttribute attribute = (OMAttribute)xpathProcessor.selectSingleNode(message);
- if (attribute != null) {
- value = attribute.getAttributeValue();
- }
-
- return value;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPSender.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPSender.java
deleted file mode 100644
index 30d25ed..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPSender.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.apache.axiom.om.OMElement;
-
-/**
- * AMQPSender defines an interface that should be implemented by a message sender that
- * sends messages to one or more clients that receive messages selectively, based on a
- * routing key. The routing key is formed by a set of fields in the message.
- */
-public interface AMQPSender {
-
- /**
- * Send a message.
- *
- * @param message Message to be delivered.
- * @throws AMQPException on error.
- */
- public void Send(OMElement message) throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicReceiver.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicReceiver.java
deleted file mode 100644
index e49607f..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicReceiver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-/**
- * AMQPTopicReceiver defines an interface that should be implemented by a message receiver that
- * receives messages from a topic. A message would only get delivered to a topic subscriber
- * if and only if the routing key of message satisfies the topic.
- */
-public interface AMQPTopicReceiver {
-
- /**
- * Subscribe to a topic.
- *
- * @param topic Topic that needs to be subscribed to.
- * @throws AMQPException on error.
- */
- public void Subscribe(AMQPRoutingKey topic) throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicSender.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicSender.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicSender.java
deleted file mode 100644
index 0cd6ca8..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPTopicSender.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.apache.axiom.om.OMElement;
-
-/**
- * AMQPTopicSender defines an interface that should be implemented by a message sender that
- * sends messages to one or more consumers that have subscribed to topics. A message
- * would only be delivered to a topic subscriber if and only if the routing key of message
- * satisfies the topic.
- */
-public interface AMQPTopicSender {
-
- /**
- * Send a message.
- *
- * @param message Message to be delivered.
- * @throws AMQPException on error.
- */
- public void Send(OMElement message) throws AMQPException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPUtil.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPUtil.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPUtil.java
deleted file mode 100644
index 71b0210..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/AMQPUtil.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.File;
-import java.net.URL;
-
-/**
- * AMQPUtil provides common utilities required for the AMQP transport implementation.
- */
-public class AMQPUtil {
-
- public static final String CONFIG_AMQP_ENABLE = "amqp.notification.enable";
-
- public static final String CONFIG_AMQP_PROVIDER_HOST = "amqp.broker.host";
- public static final String CONFIG_AMQP_PROVIDER_PORT = "amqp.broker.port";
- public static final String CONFIG_AMQP_PROVIDER_USERNAME = "amqp.broker.username";
- public static final String CONFIG_AMQP_PROVIDER_PASSWORD = "amqp.broker.password";
-
- public static final String CONFIG_AMQP_SENDER = "amqp.sender";
- public static final String CONFIG_AMQP_TOPIC_SENDER = "amqp.topic.sender";
- public static final String CONFIG_AMQP_BROADCAST_SENDER = "amqp.broadcast.sender";
-
- public static final String EXCHANGE_NAME_DIRECT = "ws-messenger-direct";
- public static final String EXCHANGE_TYPE_DIRECT = "direct";
- public static final String EXCHANGE_NAME_TOPIC = "ws-messenger-topic";
- public static final String EXCHANGE_TYPE_TOPIC = "topic";
- public static final String EXCHANGE_NAME_FANOUT = "ws-messenger-fanout";
- public static final String EXCHANGE_TYPE_FANOUT = "fanout";
-
- private static final String ROUTING_KEY_FILENAME = "amqp-routing-keys.xml";
-
- /**
- * Load routing keys from configuration file.
- *
- * @return Root element of routing key object model.
- * @throws AMQPException on error.
- */
- public static Element loadRoutingKeys() throws AMQPException {
- try {
- URL resource = AMQPUtil.class.getClassLoader().getResource(ROUTING_KEY_FILENAME);
- DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
- Document document = docBuilder.parse(new File(resource.getPath()));
-
- return document.getDocumentElement();
- } catch (Exception e) {
- throw new AMQPException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastReceiverImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastReceiverImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastReceiverImpl.java
deleted file mode 100644
index b5d2588..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastReceiverImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.QueueingConsumer;
-import org.apache.airavata.wsmg.client.amqp.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-/**
- * AMQPBroadcastReceiverImpl class provides functionality to consume a broadcast message feed.
- */
-public class AMQPBroadcastReceiverImpl extends AMQPClient implements AMQPBroadcastReceiver {
- private static final Logger log = LoggerFactory.getLogger(AMQPBroadcastReceiverImpl.class);
-
- private AMQPCallback callback = null;
-
- public AMQPBroadcastReceiverImpl(Properties properties, AMQPCallback callback) {
- super(properties);
-
- this.callback = callback;
- }
-
- public void Subscribe() throws AMQPException {
- if (callback != null) {
- try {
- Connection connection = connectionFactory.newConnection();
-
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_FANOUT, AMQPUtil.EXCHANGE_TYPE_FANOUT);
-
- String queueName = channel.queueDeclare().getQueue();
- channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_FANOUT, "");
-
- QueueingConsumer consumer = new QueueingConsumer(channel);
- channel.basicConsume(queueName, true, consumer);
-
- while (true) {
- QueueingConsumer.Delivery delivery = consumer.nextDelivery();
- String message = new String(delivery.getBody());
-
- callback.onMessage(message);
- }
- } catch (Exception e) {
- throw new AMQPException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastSenderImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastSenderImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastSenderImpl.java
deleted file mode 100644
index 26e0bcd..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPBroadcastSenderImpl.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import org.apache.airavata.wsmg.client.amqp.AMQPBroadcastSender;
-import org.apache.airavata.wsmg.client.amqp.AMQPException;
-import org.apache.airavata.wsmg.client.amqp.AMQPRoutingAwareClient;
-import org.apache.airavata.wsmg.client.amqp.AMQPUtil;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * AMQPBroadcastSenderImpl provides functionality to produce a broadcast message feed.
- */
-public class AMQPBroadcastSenderImpl extends AMQPRoutingAwareClient implements AMQPBroadcastSender {
- private static final Logger log = LoggerFactory.getLogger(AMQPBroadcastSenderImpl.class);
-
- public AMQPBroadcastSenderImpl(Properties properties) {
- super(properties);
- }
-
- public void Send(OMElement message) throws AMQPException {
- try {
- if (isRoutable(message)) {
- Connection connection = connectionFactory.newConnection();
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_FANOUT, AMQPUtil.EXCHANGE_TYPE_FANOUT);
-
- channel.basicPublish(AMQPUtil.EXCHANGE_NAME_FANOUT, "", null, message.toString().getBytes());
-
- channel.close();
- connection.close();
- }
- } catch (IOException e) {
- throw new AMQPException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPReceiverImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPReceiverImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPReceiverImpl.java
deleted file mode 100644
index 694c381..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPReceiverImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.QueueingConsumer;
-import org.apache.airavata.wsmg.client.amqp.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-/**
- * AMQPReceiverImpl class provides functionality to receive messages selectively based on a unique routing key.
- */
-public class AMQPReceiverImpl extends AMQPRoutingAwareClient implements AMQPReceiver {
- private static final Logger log = LoggerFactory.getLogger(AMQPReceiverImpl.class);
-
- private AMQPCallback callback = null;
-
- public AMQPReceiverImpl(Properties properties, AMQPCallback callback) {
- super(properties);
-
- this.callback = callback;
- }
-
- public void Subscribe(AMQPRoutingKey key) throws AMQPException {
- if (callback != null) {
- try {
- Connection connection = connectionFactory.newConnection();
-
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_DIRECT, AMQPUtil.EXCHANGE_TYPE_DIRECT);
-
- String queueName = channel.queueDeclare().getQueue();
- channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_DIRECT, key.getNativeKey());
-
- QueueingConsumer consumer = new QueueingConsumer(channel);
- channel.basicConsume(queueName, true, consumer);
-
- while (true) {
- QueueingConsumer.Delivery delivery = consumer.nextDelivery();
- String message = new String(delivery.getBody());
-
- callback.onMessage(message);
- }
- } catch (Exception e) {
- throw new AMQPException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPSenderImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPSenderImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPSenderImpl.java
deleted file mode 100644
index 5cff26a..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPSenderImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import org.apache.airavata.wsmg.client.amqp.AMQPException;
-import org.apache.airavata.wsmg.client.amqp.AMQPRoutingAwareClient;
-import org.apache.airavata.wsmg.client.amqp.AMQPSender;
-import org.apache.airavata.wsmg.client.amqp.AMQPUtil;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * AMQPSenderImpl class provides functionality to send messages with a unique routing key
- * so that a receiver can consume them selectively.
- */
-public class AMQPSenderImpl extends AMQPRoutingAwareClient implements AMQPSender {
- private static final Logger log = LoggerFactory.getLogger(AMQPSenderImpl.class);
-
- public AMQPSenderImpl(Properties properties) {
- super(properties);
- }
-
- public void Send(OMElement message) throws AMQPException {
- try {
- if (isRoutable(message)) {
- Connection connection = connectionFactory.newConnection();
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_DIRECT, AMQPUtil.EXCHANGE_TYPE_DIRECT);
-
- List<String> routingKeys = new ArrayList<String>();
- getRoutingKeys(message, routingKeys);
-
- for (String routingKey : routingKeys) {
- channel.basicPublish(
- AMQPUtil.EXCHANGE_NAME_DIRECT, routingKey, null, message.toString().getBytes());
- }
-
- channel.close();
- connection.close();
- }
- } catch (IOException e) {
- throw new AMQPException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicReceiverImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicReceiverImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicReceiverImpl.java
deleted file mode 100644
index eb9b929..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicReceiverImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.QueueingConsumer;
-import org.apache.airavata.wsmg.client.amqp.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Properties;
-
-/**
- * AMQPTopicReceiver class provides functionality to receive messages based on a pattern.
- * These patterns are also called Topics.
- */
-public class AMQPTopicReceiverImpl extends AMQPRoutingAwareClient implements AMQPTopicReceiver {
- private static final Logger log = LoggerFactory.getLogger(AMQPTopicReceiverImpl.class);
-
- private AMQPCallback callback = null;
-
- public AMQPTopicReceiverImpl(Properties properties, AMQPCallback callback) {
- super(properties);
-
- this.callback = callback;
- }
-
- public void Subscribe(AMQPRoutingKey topic) throws AMQPException {
- if (callback != null) {
- try {
- Connection connection = connectionFactory.newConnection();
-
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_TOPIC, AMQPUtil.EXCHANGE_TYPE_TOPIC);
-
- String queueName = channel.queueDeclare().getQueue();
- channel.queueBind(queueName, AMQPUtil.EXCHANGE_NAME_TOPIC, topic.getNativeKey());
-
- QueueingConsumer consumer = new QueueingConsumer(channel);
- channel.basicConsume(queueName, true, consumer);
-
- while (true) {
- QueueingConsumer.Delivery delivery = consumer.nextDelivery();
- String message = new String(delivery.getBody());
-
- callback.onMessage(message);
- }
- } catch (Exception e) {
- throw new AMQPException(e);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicSenderImpl.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicSenderImpl.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicSenderImpl.java
deleted file mode 100644
index 8a351a5..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/amqp/rabbitmq/AMQPTopicSenderImpl.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp.rabbitmq;
-
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-import org.apache.airavata.wsmg.client.amqp.AMQPException;
-import org.apache.airavata.wsmg.client.amqp.AMQPRoutingAwareClient;
-import org.apache.airavata.wsmg.client.amqp.AMQPTopicSender;
-import org.apache.airavata.wsmg.client.amqp.AMQPUtil;
-import org.apache.axiom.om.OMElement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-/**
- * AMQPTopicSenderImpl class provides functionality to send messages that can be consumed
- * based on a pattern. These patterns are also called Topics.
- */
-public class AMQPTopicSenderImpl extends AMQPRoutingAwareClient implements AMQPTopicSender {
- private static final Logger log = LoggerFactory.getLogger(AMQPTopicSenderImpl.class);
-
- public AMQPTopicSenderImpl(Properties properties) {
- super(properties);
- }
-
- public void Send(OMElement message) throws AMQPException {
- try {
- if (isRoutable(message)) {
- Connection connection = connectionFactory.newConnection();
- Channel channel = connection.createChannel();
- channel.exchangeDeclare(AMQPUtil.EXCHANGE_NAME_TOPIC, AMQPUtil.EXCHANGE_TYPE_TOPIC);
-
- List<String> routingKeys = new ArrayList<String>();
- getRoutingKeys(message, routingKeys);
-
- for (String routingKey : routingKeys) {
- channel.basicPublish(
- AMQPUtil.EXCHANGE_NAME_TOPIC, routingKey, null, message.toString().getBytes());
- }
-
- channel.close();
- connection.close();
- }
- } catch (IOException e) {
- throw new AMQPException(e);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/commons/NotificationProducer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/commons/NotificationProducer.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/commons/NotificationProducer.java
deleted file mode 100644
index b3d5ae8..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/commons/NotificationProducer.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.commons;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.airavata.wsmg.WsmgConstants;
-
-//import org.apache.airavata.wsmg.WsmgConstants;
-
-public class NotificationProducer {
-
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
- private final SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- public NotificationProducer() {
-
- }
-
- public synchronized OMElement deliverMessage(OMElement notificationMessage, String type,
- EndpointReference brokerLocationEPR, long timeout) throws AxisFault {
-
- ServiceClient client = createServiceClient(type, notificationMessage, brokerLocationEPR, timeout, null);
-
- OMElement ret = client.sendReceive(notificationMessage);
- client.cleanup();
- client.cleanupTransport();
- return ret;
-
- }
-
- public synchronized OMElement deliverMessage(OMElement notificationMessage, String type,
- EndpointReference brokerLocationEPR, long timeout, OMElement topicExpressionEl) throws AxisFault {
-
- ServiceClient client = createServiceClient(type, notificationMessage, brokerLocationEPR, timeout,
- topicExpressionEl);
-
- OMElement ret = client.sendReceive(notificationMessage);
- client.cleanup();
- client.cleanupTransport();
- return ret;
-
- }
-
- private ServiceClient createServiceClient(String type, OMElement notificationMessage,
- EndpointReference brokerLocationEPR, long timeout, OMElement topicExpressionEl) throws AxisFault {
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- brokerLocationEPR.addReferenceParameter(topicExpressionEl);
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(UUIDGenerator.getUUID());
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(brokerLocationEPR.getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText("wsnt".equals(type) ? NameSpaceConstants.WSNT_NS.getNamespaceURI() + "/Notify"
- : WsmgCommonConstants.WSMG_PUBLISH_SOAP_ACTION);
- if (topicExpressionEl != null) {
- try {
- client.addHeader(org.apache.axiom.om.util.ElementHelper.toSOAPHeaderBlock(topicExpressionEl,
- soapfactory));
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
- }
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
-
- }
-
- Options opts = new Options();
-
- opts.setAction("wsnt".equals(type) ? NameSpaceConstants.WSNT_NS.getNamespaceURI() + "/Notify"
- : WsmgCommonConstants.WSMG_PUBLISH_SOAP_ACTION);
-
- opts.setTo(brokerLocationEPR);
- opts.setTimeOutInMilliSeconds(timeout);
-
- client.setOptions(opts);
-
- return client;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java
deleted file mode 100644
index 7d5b895..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/msgbox/MessagePuller.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.msgbox;
-
-import java.rmi.RemoteException;
-import java.util.Iterator;
-
-import org.apache.airavata.wsmg.client.NotificationHandler;
-import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MessagePuller {
-
- private final static Logger logger = LoggerFactory.getLogger(MessagePuller.class);
-
- MsgBoxClient msgBoxUser = null;
-
- EndpointReference msgBoxId = null;
-
- NotificationHandler handler = null;
-
- long backoff = 1000;
-
- long unavailableInterval = 300000;
-
- long timeout = 30000L;
-
- boolean stopPulling = false;
-
- public MessagePuller() {
- }
-
- public MessagePuller(MsgBoxClient msgBoxUser, EndpointReference msgBoxAddr, NotificationHandler handler,
- long backoff, long timeout) {
- this.msgBoxUser = msgBoxUser;
- this.msgBoxId = msgBoxAddr;
- this.handler = handler;
- this.backoff = backoff;
- this.timeout = timeout;
- }
-
- public MessagePuller(MsgBoxClient msgBoxUser, EndpointReference msgBoxId, NotificationHandler handler) {
- this(msgBoxUser, msgBoxId, handler, 1000, 30000);
- }
-
- public void startPulling() {
- Puller puller = new Puller();
- new Thread(puller).start();
- }
-
- public void stopPulling() {
- stopPulling = true;
- }
-
-
- protected class Puller implements Runnable {
-
- public void run() {
-
- long backofftime = backoff;
- while (!stopPulling) {
- Iterator<OMElement> messages = null;
- try {
-
- messages = msgBoxUser.takeMessagesFromMsgBox(msgBoxId, timeout);
-
- try {
- if (messages == null || (!messages.hasNext())) {
- // sleep only when nothing was found
- Thread.sleep(backoff);
- }
- } catch (InterruptedException ex) {
- logger.error("the message puller thread was interruped", ex);
- }
-
- if (messages != null && messages.hasNext()) {
- backofftime = backoff;
- while (messages.hasNext()) {
- String notification = messages.next().toStringWithConsume();
- try {
- handler.handleNotification(notification);
- } catch (Throwable e) {
- logger.info("Error occured in the user callback for message" + notification
- + e.toString());
- }
-
- }
- }
- } catch (Exception e) {
- logger.error("exception on MessagePuller", e);
- try {
- backofftime = backofftime * 2;
- Thread.sleep(Math.min(backofftime, unavailableInterval));
- backofftime = Math.min(backofftime, unavailableInterval);
- } catch (InterruptedException e1) {
- logger.error("message puller was interruped while sleeping", e1);
- }
- }
- }
- return;
- }
- }
-
-}
[06/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java b/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java
deleted file mode 100644
index b3a3f4c..0000000
--- a/modules/ws-messenger/messagebox/src/test/java/org/apache/airavata/wsmg/msgbox/MsgBoxTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.msgbox;
-
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.Random;
-
-import junit.framework.TestCase;
-
-import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
-import org.apache.airavata.wsmg.msgbox.util.MsgBoxUtils;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class MsgBoxTest extends TestCase {
-
- private int port = InMemoryMessageBoxServer.TESTING_PORT;
- private long timeout = 5000L;
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
-
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- }
-
- @Before
- public void setUp() throws Exception {
- InMemoryMessageBoxServer.start(null, null);
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testMessageBox() throws Exception {
-
- MsgBoxClient user = new MsgBoxClient();
- StringBuilder builder = new StringBuilder();
- port = InMemoryMessageBoxServer.TESTING_PORT;
- EndpointReference msgBoxEpr = user.createMessageBox("http://localhost:" + port
- + "/axis2/services/MsgBoxService", timeout);
-
- for (int i = 0; i < 10; i++) {
-
- builder.delete(0, builder.capacity());
- Random x = new Random();
- for (int j = 0; j < x.nextInt(50); j++) {
- builder.append("123456789");
- }
-
- String msg = String.format("<msg><seq>%d</seq><fill>%s</fill></msg>", i, builder.toString());
-
- user.storeMessage(msgBoxEpr, timeout, MsgBoxUtils.reader2OMElement(new StringReader(msg)));
-
- Thread.sleep(200L);
- }
-
- Iterator<OMElement> iterator = null;
-
- try {
- iterator = user.takeMessagesFromMsgBox(msgBoxEpr, timeout);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- if (iterator != null)
- while (iterator.hasNext()) {
- System.out.println(iterator.next().toStringWithConsume());
- }
-
- System.out.println("Delete message box response : " + user.deleteMsgBox(msgBoxEpr, 5000L));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/pom.xml b/modules/ws-messenger/messagebroker/pom.xml
deleted file mode 100644
index b62bded..0000000
--- a/modules/ws-messenger/messagebroker/pom.xml
+++ /dev/null
@@ -1,112 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-ws-messenger</artifactId>
- <version>0.12-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-message-broker</artifactId>
- <name>Airavata Message Broker</name>
- <url>http://airavata.apache.org/</url>
- <packaging>jar</packaging>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>${antrun.version}</version>
- <executions>
- <execution>
- <id>restore-persistence</id>
- <phase>prepare-package</phase>
- <configuration>
- <tasks>
- <copy file="${project.build.outputDirectory}/services.xml" tofile="${project.build.outputDirectory}/META-INF/services.xml" />
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>yfilter</artifactId>
- <version>${yfilter.version}</version>
- </dependency>
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.5.2</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-local</artifactId>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- Test -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-server-configuration</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AbstractBrokerMsgReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AbstractBrokerMsgReceiver.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AbstractBrokerMsgReceiver.java
deleted file mode 100644
index 9277dcc..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AbstractBrokerMsgReceiver.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.util.List;
-
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.AxisEngine;
-import org.apache.axis2.receivers.AbstractMessageReceiver;
-import org.apache.axis2.util.MessageContextBuilder;
-
-public abstract class AbstractBrokerMsgReceiver extends AbstractMessageReceiver {
-
- protected abstract MessageContext process(MessageContext inMsgContext, String operationName) throws AxisFault;
-
- @Override
- protected void invokeBusinessLogic(MessageContext inMsgContext) throws AxisFault {
-
- String operationName = getOperationName(inMsgContext);
- MessageContext outMsgContext = process(inMsgContext, operationName);
-
- if (outMsgContext != null) {
- outMsgContext.setTo(null);
- super.replicateState(inMsgContext);
- AxisEngine.send(outMsgContext);
-
- }
-
- }
-
- protected String getOperationName(MessageContext inMsg) throws AxisFault {
-
- org.apache.axis2.description.AxisOperation op = inMsg.getOperationContext().getAxisOperation();
- if (op == null) {
- throw new AxisFault(
- "Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
- }
-
- java.lang.String operationName = null;
- if ((op.getName() == null)
- || ((operationName = org.apache.axis2.util.JavaUtils.xmlNameToJava(op.getName().getLocalPart())) == null)) {
- throw new AxisFault("invalid operation found");
- }
-
- return operationName;
- }
-
- protected MessageContext createOutputMessageContext(MessageContext inMsg, ProcessingContext processingContext)
- throws AxisFault {
-
- MessageContext outMsgContext = MessageContextBuilder.createOutMessageContext(inMsg);
- outMsgContext.getOperationContext().addMessageContext(outMsgContext);
-
- SOAPEnvelope outputEnvelope = getSOAPFactory(inMsg).getDefaultEnvelope();
-
- if (processingContext.getRespMessage() != null) {
-
- outputEnvelope.getBody().addChild(processingContext.getRespMessage());
-
- if (processingContext.getResponseMsgNamespaces() != null) {
- declareResponseMsgNamespace(outputEnvelope, processingContext.getResponseMsgNamespaces());
- }
- }
-
- outMsgContext.setEnvelope(outputEnvelope);
- return outMsgContext;
- }
-
- private void declareResponseMsgNamespace(SOAPEnvelope outputEnvelope, List<OMNamespace> namespaces) {
-
- if (!namespaces.contains(NameSpaceConstants.WSA_NS)) {
- namespaces.add(NameSpaceConstants.WSA_NS);// declare WSA by default
- }
-
- for (OMNamespace ns : namespaces) {
- outputEnvelope.declareNamespace(ns);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AdditionalMessageContent.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AdditionalMessageContent.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AdditionalMessageContent.java
deleted file mode 100644
index acf8f0f..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/AdditionalMessageContent.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.io.Serializable;
-
-public class AdditionalMessageContent implements Serializable {
- /**
- *
- */
- private static final long serialVersionUID = -5163025283681463108L;
-
- String action;
-
- String messageID;
-
- String topicElement;
-
- String producerReference;
- String trackId;
-
- /**
- * @param action
- * @param messageID
- */
- public AdditionalMessageContent(String action, String messageID) {
- super();
- // TODO Auto-generated constructor stub
- this.action = action;
- this.messageID = messageID;
- }
-
- /**
- * @return Returns the action.
- */
- public String getAction() {
- return action;
- }
-
- /**
- * @param action
- * The action to set.
- */
- public void setAction(String action) {
- this.action = action;
- }
-
- /**
- * @return Returns the messageID.
- */
- public String getMessageID() {
- return messageID;
- }
-
- /**
- * @param messageID
- * The messageID to set.
- */
- public void setMessageID(String messageID) {
- this.messageID = messageID;
- }
-
- /**
- * @return Returns the producerReference.
- */
- public String getProducerReference() {
- return producerReference;
- }
-
- /**
- * @param producerReference
- * The producerReference to set.
- */
- public void setProducerReference(String producerReference) {
- this.producerReference = producerReference;
- }
-
- /**
- * @return Returns the topicElement.
- */
- public String getTopicElement() {
- return topicElement;
- }
-
- /**
- * @param topicElement
- * The topicElement to set.
- */
- public void setTopicElement(String topicElement) {
- this.topicElement = topicElement;
- }
-
- /**
- * @return Returns the trackId.
- */
- public String getTrackId() {
- return trackId;
- }
-
- /**
- * @param trackId
- * The trackId to set.
- */
- public void setTrackId(String trackId) {
- this.trackId = trackId;
- }
-
- public String toString() {
- return String.format("msgId = %s, trackId = %s, topic = %s", messageID, trackId, topicElement);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/BrokerServiceLifeCycle.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/BrokerServiceLifeCycle.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/BrokerServiceLifeCycle.java
deleted file mode 100644
index 4737ef9..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/BrokerServiceLifeCycle.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.lang.reflect.Constructor;
-import java.net.URI;
-
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
-import org.apache.airavata.client.tools.PeriodicExecutorThread;
-import org.apache.airavata.common.utils.AiravataUtils;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.ServiceUtils;
-import org.apache.airavata.wsmg.broker.handler.PublishedMessageHandler;
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionManager;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.config.ConfigurationManager;
-import org.apache.airavata.wsmg.commons.storage.WsmgInMemoryStorage;
-import org.apache.airavata.wsmg.commons.storage.WsmgPersistantStorage;
-import org.apache.airavata.wsmg.commons.util.Axis2Utils;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.messenger.ConsumerUrlManager;
-import org.apache.airavata.wsmg.messenger.Deliverable;
-import org.apache.airavata.wsmg.messenger.DeliveryProcessor;
-import org.apache.airavata.wsmg.messenger.SenderUtils;
-import org.apache.airavata.wsmg.messenger.protocol.DeliveryProtocol;
-import org.apache.airavata.wsmg.messenger.protocol.impl.Axis2Protocol;
-import org.apache.airavata.wsmg.messenger.strategy.SendingStrategy;
-import org.apache.airavata.wsmg.messenger.strategy.impl.FixedParallelSender;
-import org.apache.airavata.wsmg.messenger.strategy.impl.ParallelSender;
-import org.apache.airavata.wsmg.messenger.strategy.impl.SerialSender;
-import org.apache.airavata.wsmg.util.RunTimeStatistics;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.ServiceLifeCycle;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class BrokerServiceLifeCycle implements ServiceLifeCycle {
-
- private static final Logger log = LoggerFactory.getLogger(BrokerServiceLifeCycle.class);
-// public static final String REPOSITORY_PROPERTIES = "airavata-server.properties";
- public static final int GFAC_URL_UPDATE_INTERVAL = 1000 * 60 * 60 * 3;
-
- public static final int JCR_AVAIALABILITY_WAIT_INTERVAL = 1000 * 10;
- public static final String JCR_CLASS = "jcr.class";
- public static final String JCR_USER = "jcr.user";
- public static final String JCR_PASS = "jcr.pass";
- public static final String ORG_APACHE_JACKRABBIT_REPOSITORY_URI = "org.apache.jackrabbit.repository.uri";
- private static final String MESSAGE_BROKER_SERVICE_NAME = "EventingService";
- private static final String SERVICE_URL = "message_broker_service_url";
- private static final String JCR_REGISTRY = "registry";
- private Thread thread;
-
- private static final long DEFAULT_SOCKET_TIME_OUT = 20000l;
-
- private DeliveryProcessor proc;
- private ConsumerUrlManager urlManager;
-
- private static Boolean initialized = false;
-
- public void shutDown(ConfigurationContext configurationcontext, AxisService service) {
- log.info("broker shutting down");
- if (proc != null) {
- proc.stop();
- proc = null;
- }
- if (urlManager != null) {
- urlManager.stop();
- urlManager = null;
- }
-
- synchronized (initialized) {
- if (initialized) {
- initialized = false;
- AiravataAPI registry = (AiravataAPI) configurationcontext.getProperty(JCR_REGISTRY);
- if(registry != null && thread != null){
- try {
- registry.getAiravataManager().unsetEventingURI();
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- }
- thread.interrupt();
- try {
- thread.join();
- } catch (InterruptedException e) {
- log.info("Message box url update thread is interrupted");
- }
- }
- }
- }
- log.info("broker shut down");
- }
-
- public void startUp(ConfigurationContext configContext, AxisService axisService) {
- AiravataUtils.setExecutionAsServer();
- Boolean inited = (Boolean) configContext.getProperty(WsmgCommonConstants.BROKER_INITED);
-
- if (inited == null || inited == false) {
- log.info("Starting Message Broker...");
- Axis2Utils.overrideAddressingPhaseHander(configContext, new PublishedMessageHandler());
- WsmgConfigurationContext brokerConext = initConfigurations(configContext, axisService);
- initQueue(brokerConext);
- initDeliveryMethod(brokerConext.getConfigurationManager());
-
- inited = true;
- configContext.setProperty(WsmgCommonConstants.BROKER_INITED, inited);
- } else {
- log.debug("init was already done by another webservice");
- }
-
- final ConfigurationContext context = configContext;
- synchronized (initialized) {
- if (!initialized) {
- initialized = true;
- new Thread() {
- @Override
- public void run() {
-// Properties properties = new Properties();
- try {
-// URL url = this.getClass().getClassLoader()
-// .getResource(REPOSITORY_PROPERTIES);
-// properties.load(url.openStream());
-// Map<String, String> map = new HashMap<String, String>(
-// (Map) properties);
- try {
- Thread.sleep(JCR_AVAIALABILITY_WAIT_INTERVAL);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
-
- String userName = ServerSettings.getSystemUser();
- String gateway = ServerSettings.getSystemUserGateway();
-
- AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(gateway, userName);
- String localAddress = ServiceUtils
- .generateServiceURLFromConfigurationContext(
- context,
- MESSAGE_BROKER_SERVICE_NAME);
- log.debug("MESSAGE BOX SERVICE_ADDRESS:"
- + localAddress);
- context.setProperty(SERVICE_URL, new URI(
- localAddress));
- context.setProperty(JCR_REGISTRY, airavataAPI);
- /*
- * Heart beat message to registry
- */
- thread = new MsgBrokerURLRegisterThread(airavataAPI, context);
- thread.start();
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- }
- }.start();
- }
- }
- }
-
- private WsmgConfigurationContext initConfigurations(ConfigurationContext configContext, AxisService axisService) {
-
- WsmgConfigurationContext wsmgConfig = new WsmgConfigurationContext();
- configContext.setProperty(WsmgCommonConstants.BROKER_WSMGCONFIG, wsmgConfig);
-
- ConfigurationManager configMan = new ConfigurationManager();
-
- wsmgConfig.setConfigurationManager(configMan);
-
- String type = configMan.getConfig(WsmgCommonConstants.CONFIG_STORAGE_TYPE,
- WsmgCommonConstants.STORAGE_TYPE_PERSISTANT);
-
- /*
- * Determine Storage
- */
- if (WsmgCommonConstants.STORAGE_TYPE_IN_MEMORY.equalsIgnoreCase(type)) {
- WsmgInMemoryStorage inmem = new WsmgInMemoryStorage();
-
- wsmgConfig.setStorage(inmem);
- wsmgConfig.setQueue(inmem);
- wsmgConfig.setSubscriptionManager(new SubscriptionManager(wsmgConfig, inmem));
-
- } else {
- String jdbcUrl = configMan.getConfig(WsmgCommonConstants.CONFIG_JDBC_URL);
- String jdbcDriver = configMan.getConfig(WsmgCommonConstants.CONFIG_JDBC_DRIVER);
- WsmgPersistantStorage persis = new WsmgPersistantStorage(jdbcUrl, jdbcDriver);
-
- wsmgConfig.setStorage(persis);
- wsmgConfig.setQueue(persis);
- wsmgConfig.setSubscriptionManager(new SubscriptionManager(wsmgConfig, persis));
- }
-
- NotificationProcessor notificatonProcessor = new NotificationProcessor(wsmgConfig);
- wsmgConfig.setNotificationProcessor(notificatonProcessor);
-
- return wsmgConfig;
- }
-
- private void initQueue(WsmgConfigurationContext context) {
-
- log.debug("setting up queue");
-
- WSMGParameter.OUT_GOING_QUEUE = context.getQueue();
-
- if (WSMGParameter.cleanQueueonStartUp) {
- log.debug("cleaning up persistant queue");
- WSMGParameter.OUT_GOING_QUEUE.cleanup();
- log.debug("cleaned up persistant queue");
- }
-
- RunTimeStatistics.setStartUpTime();
-
- }
-
- private void initDeliveryMethod(ConfigurationManager configMan) {
-
- String shouldStart = configMan.getConfig(WsmgCommonConstants.CONFIG_START_DELIVERY_THREADS);
-
- if (!Boolean.parseBoolean(shouldStart)) {
-
- if (configMan.getConfig(WsmgCommonConstants.CONFIG_STORAGE_TYPE,
- WsmgCommonConstants.STORAGE_TYPE_PERSISTANT).equalsIgnoreCase(
- WsmgCommonConstants.STORAGE_TYPE_IN_MEMORY)) {
-
- /*
- * user has asked to use in memory queue but without starting the delivery thread. this will accumulate
- * message in memory.
- */
- log.error("conflicting configuration detected, using in memory queue without starting delivery thread will result memory growth.");
-
- }
- return;
- }
-
- /*
- * Create Protocol
- */
- DeliveryProtocol protocol;
- String protocolClass = configMan
- .getConfig(WsmgCommonConstants.DELIVERY_PROTOCOL, Axis2Protocol.class.getName());
- try {
- Class cl = Class.forName(protocolClass);
- Constructor<DeliveryProtocol> co = cl.getConstructor(null);
- protocol = co.newInstance((Object[]) null);
-
- } catch (Exception e) {
- log.error("Cannot initial protocol sender", e);
- return;
- }
- protocol.setTimeout(configMan.getConfig(WsmgCommonConstants.CONFIG_SOCKET_TIME_OUT, DEFAULT_SOCKET_TIME_OUT));
-
- /*
- * Create delivery method
- */
- SendingStrategy method = null;
- String initedmethod = null;
- String deliveryMethod = configMan.getConfig(WsmgCommonConstants.CONFIG_DELIVERY_METHOD,
- WsmgCommonConstants.DELIVERY_METHOD_SERIAL);
- if (WsmgCommonConstants.DELIVERY_METHOD_PARALLEL.equalsIgnoreCase(deliveryMethod)) {
- method = new ParallelSender();
- initedmethod = WsmgCommonConstants.DELIVERY_METHOD_PARALLEL;
-
- } else if (WsmgCommonConstants.DELIVERY_METHOD_THREAD_CREW.equalsIgnoreCase(deliveryMethod)) {
- int poolsize = configMan.getConfig(WsmgCommonConstants.CONFIG_SENDING_THREAD_POOL_SIZE,
- WsmgCommonConstants.DEFAULT_SENDING_THREAD_POOL_SIZE);
- int batchsize = configMan.getConfig(WsmgCommonConstants.CONFIG_SENDING_BATCH_SIZE,
- WsmgCommonConstants.DEFAULT_SENDING_BATCH_SIZE);
- method = new FixedParallelSender(poolsize, batchsize);
- initedmethod = WsmgCommonConstants.DELIVERY_METHOD_THREAD_CREW;
-
- } else {
- method = new SerialSender();
- initedmethod = WsmgCommonConstants.DELIVERY_METHOD_SERIAL;
- }
-
- /*
- * Create Deliverable
- */
- urlManager = new ConsumerUrlManager(configMan);
- Deliverable senderUtils = new SenderUtils(urlManager);
- senderUtils.setProtocol(protocol);
-
- proc = new DeliveryProcessor(senderUtils, method);
- proc.start();
- log.debug(initedmethod + " sending method inited");
- }
-
- class MsgBrokerURLRegisterThread extends PeriodicExecutorThread {
-
- private ConfigurationContext context = null;
-
- public MsgBrokerURLRegisterThread(AiravataAPI registry, ConfigurationContext context) {
- super(registry);
- this.context = context;
- }
-
-
- protected void updateRegistry(AiravataAPI registry) {
- try {
- URI localAddress = (URI) this.context.getProperty(SERVICE_URL);
- registry.getAiravataManager().setEventingURI(localAddress);
- } catch (AiravataAPIInvocationException e) {
- e.printStackTrace();
- }
- log.debug("Updated Eventing service URL in to Repository");
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerInfo.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerInfo.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerInfo.java
deleted file mode 100644
index d087a87..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerInfo.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.io.Serializable;
-
-public class ConsumerInfo implements Serializable {
- static final long serialVersionUID = 2274650724788817903L;
-
- // TODO : change this to OM, EndpointReference.
- String consumerEprStr;
-
- String type; // Either "wsnt" or "wse"
-
- boolean useNotify;
-
- boolean paused = false;
-
- boolean wsrmEnabled;
-
- /**
- * @param consumerEprStr
- * @param type
- * @param useNotify
- * @param paused
- */
- public ConsumerInfo(String consumerEprStr, String type, boolean useNotify, boolean paused) {
- super();
- // TODO Auto-generated constructor stub
- this.consumerEprStr = consumerEprStr;
- this.type = type;
- this.useNotify = useNotify;
- this.paused = paused;
- }
-
- /**
- * @return Returns the consumerEprStr.
- */
- public String getConsumerEprStr() {
- return consumerEprStr;
- }
-
- /**
- * @param consumerEprStr
- * The consumerEprStr to set.
- */
- public void setConsumerEprStr(String consumerEprStr) {
- this.consumerEprStr = consumerEprStr;
- }
-
- /**
- * @return Returns the paused.
- */
- public boolean isPaused() {
- return paused;
- }
-
- /**
- * @param paused
- * The paused to set.
- */
- public void setPaused(boolean paused) {
- this.paused = paused;
- }
-
- /**
- * @return Returns the type.
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param type
- * The type to set.
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * @return Returns the useNotify.
- */
- public boolean isUseNotify() {
- return useNotify;
- }
-
- /**
- * @param useNotify
- * The useNotify to set.
- */
- public void setUseNotify(boolean useNotify) {
- this.useNotify = useNotify;
- }
-
- public boolean isWsrmEnabled() {
- return wsrmEnabled;
- }
-
- public void setWsrmEnabled(boolean wsrmEnabled) {
- this.wsrmEnabled = wsrmEnabled;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerList.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerList.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerList.java
deleted file mode 100644
index 38d8a3a..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerList.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ConsumerList {
- Map<String, ConsumerInfo> subId2ConsumerInfo = new HashMap<String, ConsumerInfo>();
-
- ArrayList<ConsumerInfo> consumerInfoList = new ArrayList<ConsumerInfo>();
-
- boolean changed = true;
- int size = 0; // use size instead of consumerInfoList.size() to avoid
-
- // unnecessary copy of subId2ConsumerInfo in
- // refreshConsumerInfoList() if just need the size
-
- public void addConsumer(String subId, ConsumerInfo consumerInfo) {
- subId2ConsumerInfo.put(subId, consumerInfo);
- changed = true;
- size++;
- }
-
- public int removeConsumer(String subId) {
- ConsumerInfo result = subId2ConsumerInfo.remove(subId);
- if (result == null) {
- return 0;
- }
- changed = true;
- size--;
- return 1;
-
- }
-
- public ArrayList<ConsumerInfo> getConsumerList() {
- if (changed) {
- refreshConsumerInfoList();
- }
- return consumerInfoList;
- }
-
- public int size() {
- return size;
- }
-
- private void refreshConsumerInfoList() {
- consumerInfoList.clear();
- consumerInfoList.addAll(subId2ConsumerInfo.values());
- changed = false;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerListManager.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerListManager.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerListManager.java
deleted file mode 100644
index b5ca1bb..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/ConsumerListManager.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConsumerListManager {
-
- private static final Logger logger = LoggerFactory.getLogger(ConsumerListManager.class);
-
- protected Map<String, ConsumerList> token2ConsumerListMap = new HashMap<String, ConsumerList>();
-
- protected Map<String, String> subId2Token = new HashMap<String, String>();
-
- // token can be a topic or an XPath String
- public void addToConsumerList(String token, SubscriptionState subscribeRequest, String subscriptionId) {
- ConsumerList consumerList = token2ConsumerListMap.get(token);
- if (consumerList == null) { // new topic
- consumerList = new ConsumerList();
- token2ConsumerListMap.put(token, consumerList);
- }
- consumerList.addConsumer(subscriptionId, subscribeRequest.getConsumerInfo());
- subId2Token.put(subscriptionId, token);
-
- }
-
- public String getTokenBySubscriptionId(String subscriptionId) {
- String token = subId2Token.get(subscriptionId);
- return token;
- }
-
- public int removeFromConsumerList(String subscriptionId, String token) {
- String tokenString = null;
- if (token == null) {
- tokenString = subId2Token.get(subscriptionId);
- } else {
- tokenString = token;
- }
-
- ConsumerList consumerList = token2ConsumerListMap.get(tokenString);
- if (consumerList == null) {
- logger.error("*****ERROR:Cannot find the token to delete: " + tokenString);
- return 0;
- }
- int result = consumerList.removeConsumer(subscriptionId);
- subId2Token.remove(subscriptionId);
- return result;
- }
-
- public ConsumerList getConsumerListByToken(String token) {
- ConsumerList consumerList = token2ConsumerListMap.get(token);
- return consumerList;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/NotificationProcessor.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/NotificationProcessor.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/NotificationProcessor.java
deleted file mode 100644
index 10ae03b..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/NotificationProcessor.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker;
-
-import java.util.*;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.wsmg.broker.amqp.AMQPNotificationProcessor;
-import org.apache.airavata.wsmg.broker.context.ContextParameters;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.commons.OutGoingMessage;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.airavata.wsmg.config.WsmgConfigurationContext;
-import org.apache.airavata.wsmg.matching.AbstractMessageMatcher;
-import org.apache.airavata.wsmg.messenger.OutGoingQueue;
-import org.apache.airavata.wsmg.util.BrokerUtil;
-import org.apache.airavata.wsmg.util.RunTimeStatistics;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMAttribute;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.axis2.AxisFault;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class NotificationProcessor {
-
- private static final Logger logger = LoggerFactory.getLogger(NotificationProcessor.class);
-
- private WsmgConfigurationContext wsmgConfigContext;
-
- protected long messageCounter = 0;
- protected long messageId = 0;
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- private OutGoingQueue outgoingQueue;
-
- private AMQPNotificationProcessor amqpNotificationProcessor = new AMQPNotificationProcessor();
-
- public NotificationProcessor(WsmgConfigurationContext config) {
- init(config);
- amqpNotificationProcessor.init();
- }
-
- private void init(WsmgConfigurationContext config) {
- this.wsmgConfigContext = config;
- outgoingQueue = config.getOutgoingQueue();
- }
-
- private synchronized long getNextTrackId() {
- messageCounter++;
- return messageCounter;
- }
-
- private synchronized long getNextMsgId() {
- messageId++;
- return messageId;
- }
-
- public void processMsg(ProcessingContext ctx, OMNamespace protocolNs) throws OMException, AxisFault {
-
- String trackId = "trackId_A_" + getNextTrackId();
- if (WSMGParameter.showTrackId) {
- logger.debug(trackId + ": received.");
- }
-
- AdditionalMessageContent additionalMessageContent = new AdditionalMessageContent(ctx.getMessageContext()
- .getSoapAction(), ctx.getMessageContext().getMessageID());
- additionalMessageContent.setTrackId(trackId);
-
- handleExtendedNotifications(ctx, protocolNs);
-
- if (NameSpaceConstants.WSNT_NS.equals(protocolNs)) {
-
- onWSNTMsg(ctx, additionalMessageContent);
- setResponseMsg(ctx, trackId, protocolNs);
- } else { // WSE Notifications No specific namespace
-
- onWSEMsg(ctx, trackId, additionalMessageContent);
- setResponseMsg(ctx, trackId, protocolNs);
- }
- }
-
- /**
- * @param ctx
- * @param topicElString
- * @param trackId
- * @param additionalMessageContent
- * @throws OMException
- * @throws XMLStreamException
- */
- private void onWSEMsg(ProcessingContext ctx, String trackId, AdditionalMessageContent additionalMessageContent)
- throws OMException, AxisFault {
-
- String topicElString = null;
- String topicLocalString = null;
-
- QName qName = new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "Topic");
-
- OMElement topicEl = ctx.getMessageContext().getEnvelope().getHeader().getFirstChildWithName(qName);
-
- if (topicEl == null) {
-
- topicLocalString = ctx.getContextParameter(ContextParameters.TOPIC_FROM_URL);
-
- if (topicLocalString != null) {
-
- topicElString = "<wsnt:Topic "
- + "Dialect=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-Topics/TopicExpression/simple\" "
- + "xmlns:ns2=\"http://tutorial.globus.org/auction\" "
- + "xmlns:wsnt=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification\">" + "ns2:"
- + topicLocalString + "</wsnt:Topic>";
- // / }
- additionalMessageContent.setTopicElement(topicElString);
- } else {
-
- topicLocalString = "wseTopic";
- topicElString = "<wsnt:Topic "
- + "Dialect=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-Topics/TopicExpression/simple\" "
- + "xmlns:ns2=\"http://tutorial.globus.org/auction\" "
- + "xmlns:wsnt=\"http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification\">"
- + "ns2:wseTopic</wsnt:Topic>";
- // / }
- additionalMessageContent.setTopicElement(topicElString);
- }
- } else {
-
- topicLocalString = BrokerUtil.getTopicLocalString(topicEl.getText());
- try {
- topicElString = topicEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error("exceptions occured at WSE eventing notification creating", e);
- }
- additionalMessageContent.setTopicElement(topicElString);
- }
-
- OMElement messageEl = ctx.getSoapBody().getFirstElement();
- if (messageEl == null) {
- throw new AxisFault("no message found");
- }
-
- String message = null;
- try {
- message = messageEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error("unable to serialize the message", e);
- throw new AxisFault("unable to serialize the message", e);
- }
-
- matchAndSave(message, topicLocalString, additionalMessageContent);
- }
-
- /**
- * @param ctx
- * @param trackId
- * @throws OMException
- */
- private void setResponseMsg(ProcessingContext ctx, String trackId, OMNamespace responseNS) throws OMException {
- // set response message
-
- ctx.addResponseMsgNameSpaces(responseNS);
-
- OMAttribute trackIdAttribute = factory.createOMAttribute("trackId", null, trackId);
- OMElement messageElement = ctx.getMessageContext().getEnvelope().getBody().getFirstElement();
- OMElement responseMsgElement = factory.createOMElement(messageElement.getLocalName() + "Response", responseNS);
- responseMsgElement.addAttribute(trackIdAttribute);
- ctx.setRespMessage(responseMsgElement);
-
- }
-
- /**
- * @param ctx
- * @param topicLocalString
- * @param topicElString
- * @param producerReferenceElString
- * @param additionalMessageContent
- * @throws OMException
- * @throws XMLStreamException
- * @throws AxisFault
- */
- private void onWSNTMsg(ProcessingContext ctx, AdditionalMessageContent additionalMessageContent)
- throws OMException, AxisFault {
-
- String producerReferenceElString = null;
- String topicElString = null;
-
- boolean noElements = true;
-
- // TODO: set nicely with a processing context
- OMElement notifyEl = ctx.getSoapBody().getFirstElement();
- for (Iterator<OMElement> iter = notifyEl.getChildrenWithLocalName("NotificationMessage"); iter.hasNext();) {
- noElements = false;
- OMElement wrappedMessageEl = iter.next();
-
- String topicLocalString = null;
-
- OMElement topicEl = wrappedMessageEl.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "Topic"));
- if (topicEl != null) {
-
- topicLocalString = BrokerUtil.getTopicLocalString(topicEl.getText()); // get what ever inside this
- // element
-
- try {
- topicElString = topicEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error("exception occured while creating NotificationConsumer", e);
- }
- additionalMessageContent.setTopicElement(topicElString);
- }
- OMElement producerReferenceEl = wrappedMessageEl.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS
- .getNamespaceURI(), "ProducerReference"));
-
- if (producerReferenceEl != null) {
- try {
- producerReferenceElString = producerReferenceEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error("exception occured while creating notification consumer", e);
-
- }
- additionalMessageContent.setProducerReference(producerReferenceElString);
- }
-
- OMElement notificationMessageEl = wrappedMessageEl.getFirstChildWithName(
- new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "Message")).getFirstElement();
-
- String message = null;
- try {
- message = notificationMessageEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error("exception occured while creating notification consumer", e);
- throw new AxisFault("unable to serialize the message", e);
- }
-
- matchAndSave(message, topicLocalString, additionalMessageContent);
-
- }
- if (noElements) {
- throw new AxisFault("at least one element is required");
- }
- }
-
- private void matchAndSave(String notificationMessage, String topicLocalString,
- AdditionalMessageContent additionalMessageContent) {
-
- List<ConsumerInfo> matchedConsumers = new LinkedList<ConsumerInfo>();
-
- // not use incoming queue
- // This is a fix for the bug seen in yfilter.
- try {
-
- for (AbstractMessageMatcher matcher : wsmgConfigContext.getMessageMatchers()) {
- matcher.populateMatches(null, additionalMessageContent, notificationMessage, topicLocalString,
- matchedConsumers);
- }
-
- save(matchedConsumers, notificationMessage, additionalMessageContent);
-
- } catch (RuntimeException e) {
- logger.error("Caught RuntimeException", e);
- }
-
- }
-
- public void save(List<ConsumerInfo> consumerInfoList, String message,
- AdditionalMessageContent additionalMessageContent) {
-
- if (consumerInfoList.size() == 0) // No subscription
- return;
-
- RunTimeStatistics.addNewNotificationMessageSize(message.length());
- OutGoingMessage outGoingMessage = new OutGoingMessage();
- outGoingMessage.setTextMessage(message);
- outGoingMessage.setConsumerInfoList(consumerInfoList);
- outGoingMessage.setAdditionalMessageContent(additionalMessageContent);
-
- outgoingQueue.storeNotification(outGoingMessage, getNextMsgId());
-
- if (WSMGParameter.showTrackId)
- logger.info(additionalMessageContent.getTrackId() + ": putIn Outgoing queue.");
- }
-
- private void handleExtendedNotifications(ProcessingContext ctx, OMNamespace protocolNs) throws OMException {
- // AMQP
- amqpNotificationProcessor.notify(ctx, protocolNs);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/amqp/AMQPNotificationProcessor.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/amqp/AMQPNotificationProcessor.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/amqp/AMQPNotificationProcessor.java
deleted file mode 100644
index 39970ec..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/amqp/AMQPNotificationProcessor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.amqp;
-
-import org.apache.airavata.common.utils.ApplicationSettings;
-import org.apache.airavata.wsmg.client.amqp.*;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.airavata.wsmg.broker.context.ProcessingContext;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMException;
-import org.apache.axiom.om.OMNamespace;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.w3c.dom.Element;
-
-import javax.xml.namespace.QName;
-
-/**
- * AMQPNotificationProcessor handles AMQP-specific notification processing.
- */
-public class AMQPNotificationProcessor {
-
- private static final Logger logger = LoggerFactory.getLogger(AMQPNotificationProcessor.class);
-
- private boolean amqpEnabled = false;
- private AMQPSender amqpSender = null;
- private AMQPTopicSender amqpTopicSender = null;
- private AMQPBroadcastSender amqpBroadcastSender = null;
-
- public void init() {
- String amqpEnabledAppSetting = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_ENABLE, "");
- if (!amqpEnabledAppSetting.isEmpty() && (1 == Integer.parseInt(amqpEnabledAppSetting))) {
- try {
- String host = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, "localhost");
- String port = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, "5672");
- String username = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, "guest");
- String password = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, "guest");
-
- Properties properties = new Properties();
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, host);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, port);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, username);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, password);
-
- String className = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_SENDER, "");
- Class clazz = Class.forName(className);
- amqpSender = (AMQPSender)clazz.getDeclaredConstructor(Properties.class).newInstance(properties);
-
- className = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_TOPIC_SENDER, "");
- clazz = Class.forName(className);
- amqpTopicSender = (AMQPTopicSender)clazz.getDeclaredConstructor(Properties.class).newInstance(properties);
-
- className = ApplicationSettings.getSetting(AMQPUtil.CONFIG_AMQP_BROADCAST_SENDER, "");
- clazz = Class.forName(className);
- amqpBroadcastSender = (AMQPBroadcastSender)clazz.getDeclaredConstructor(Properties.class).newInstance(properties);
-
- Element routingKeys = AMQPUtil.loadRoutingKeys();
- if (routingKeys != null) {
- ((AMQPRoutingAwareClient)amqpSender).init(routingKeys);
- ((AMQPRoutingAwareClient)amqpTopicSender).init(routingKeys);
- ((AMQPRoutingAwareClient)amqpBroadcastSender).init(routingKeys);
- }
-
- amqpEnabled = true;
- } catch (Exception ex) {
- logger.error(ex.getMessage());
- }
- }
- }
-
- public void notify(ProcessingContext ctx, OMNamespace protocolNs) throws OMException {
- if (amqpEnabled) {
- // Extract messages
- List<OMElement> messages = new ArrayList<OMElement>();
- if (NameSpaceConstants.WSNT_NS.equals(protocolNs)) {
- // WSNT
- OMElement messageElements = ctx.getSoapBody().getFirstElement();
- for (Iterator<OMElement> ite = messageElements.getChildrenWithLocalName("NotificationMessage"); ite.hasNext(); ) {
- try {
- OMElement messageElement = ite.next();
- OMElement message = messageElement.getFirstChildWithName(
- new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(), "Message")).getFirstElement();
- messages.add(message);
- } catch (NullPointerException e) {
- throw new OMException(e);
- }
- }
- } else {
- // WSE
- OMElement message = ctx.getSoapBody().getFirstElement();
- if (message != null) {
- messages.add(message);
- }
- }
-
- // Dispatch messages
- try {
- for (OMElement message : messages) {
- amqpBroadcastSender.Send(message);
- amqpTopicSender.Send(message);
- amqpSender.Send(message);
- }
- } catch (AMQPException e) {
- logger.warn("Failed to send AMQP notification.[Reason=" + e.getMessage() + "]");
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameterInfo.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameterInfo.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameterInfo.java
deleted file mode 100644
index 8c097d4..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameterInfo.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.context;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-
-public class ContextParameterInfo<T> {
-
- private Class<T> parameterType;
- private String parameterName;
-
- public ContextParameterInfo(Class<T> type, String name) {
- parameterType = type;
- parameterName = name;
-
- }
-
- public Class<T> getParameterType() {
- return parameterType;
- }
-
- public String getParameterName() {
- return parameterName;
- }
-
- public T cast(Object obj) {
-
- return parameterType.cast(obj);
- }
-
- public static void main(String[] a) {
-
- new ContextParameterInfo<OMElement>(OMElement.class, "test");
- OMAbstractFactory.getOMFactory().createOMElement("testtest", null);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameters.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameters.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameters.java
deleted file mode 100644
index 61624d8..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ContextParameters.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.context;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-
-public class ContextParameters {
-
- private static <V> ContextParameterInfo<V> createParam(Class<V> c, String name) {
- ContextParameterInfo<V> info = new ContextParameterInfo<V>(c, name);
-
- return info;
- }
-
- public static ContextParameterInfo<String> RESOURCE_ID = createParam(String.class, "resourceID");
-
- public static final ContextParameterInfo<String> SUB_ID = createParam(String.class, "subID");
-
- public static final ContextParameterInfo<String> TOPIC_FROM_URL = createParam(String.class, "topicFromUrl");
-
- public static final ContextParameterInfo<String> SOAP_ACTION = createParam(String.class, "soapAction");
-
- public static final ContextParameterInfo<SubscriptionState> SUBSCRIPTION = createParam(SubscriptionState.class,
- "subscription");
-
- public static final ContextParameterInfo<String> SUBSCRIBER_EXPIRES = createParam(String.class, "subscriberExpires");
-
- public ContextParameterInfo<String> USE_NOTIFY_TEXT = createParam(String.class, "useNotifyText");
-
- public static final ContextParameterInfo<OMElement> USE_NOTIFY_ELEMENT = createParam(OMElement.class, "useNotifyEl");
-
- public static final ContextParameterInfo<OMElement> NOTIFY_TO_ELEMENT = createParam(OMElement.class, "NotifyTo");
-
- public static final ContextParameterInfo<EndpointReference> NOTIFY_TO_EPR = createParam(EndpointReference.class,
- "NotifyToEPR");
-
- public static final ContextParameterInfo<OMElement> SUB_POLICY = createParam(OMElement.class, "subPolicy");
-
- public static final ContextParameterInfo<OMElement> FILTER_ELEMENT = createParam(OMElement.class, "filterElement");
-
- public static final ContextParameterInfo<OMElement> TOPIC_EXPRESSION_ELEMENT = createParam(OMElement.class,
- "topicExpressionEl");
-
- public static final ContextParameterInfo<OMElement> XPATH_ELEMENT = createParam(OMElement.class, "xpathEl");
-
- public static final ContextParameterInfo<OMElement> SUBSCRIBE_ELEMENT = createParam(OMElement.class, "subscribeElement");
-
- public static final ContextParameterInfo<EndpointReference> SUBSCRIBE_ELEMENT_EPR = createParam(EndpointReference.class,
- "subscribeElement");
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContext.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContext.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContext.java
deleted file mode 100644
index 06a50ca..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContext.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.context;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.airavata.wsmg.broker.subscription.SubscriptionState;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axiom.soap.SOAPBody;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.context.MessageContext;
-
-public class ProcessingContext {
-
- private Map<ContextParameterInfo<? extends Object>, Object> contextInfo = new HashMap<ContextParameterInfo<? extends Object>, Object>();
-
- private List<OMNamespace> responseMsgNameSpaces;
-
- private MessageContext messageContext = null;
-
- private SOAPEnvelope envelope; // Used for WSe notification messages.topics
- // are
- // in header.
-
- private OMElement respMessage;
-
- private SubscriptionState subscription = null;
-
- public SOAPEnvelope getEnvelope() {
- return envelope;
- }
-
- public void setEnvelope(SOAPEnvelope envelope) {
- this.envelope = envelope;
- }
-
- public SOAPBody getSoapBody() {
-
- return envelope.getBody();
- }
-
- public OMElement getRespMessage() {
- return respMessage;
- }
-
- public void setRespMessage(OMElement respMessage) {
- this.respMessage = respMessage;
- }
-
- public SubscriptionState getSubscription() {
- return subscription;
- }
-
- public void setSubscription(SubscriptionState subscription) {
- this.subscription = subscription;
- }
-
- public void setMessageConext(MessageContext msgContext) {
- this.messageContext = msgContext;
- }
-
- public MessageContext getMessageContext() {
- return messageContext;
- }
-
- public void addResponseMsgNameSpaces(OMNamespace ns) {
-
- if (responseMsgNameSpaces == null) {
- responseMsgNameSpaces = new ArrayList<OMNamespace>();
- }
-
- if (!responseMsgNameSpaces.contains(ns)) {
- responseMsgNameSpaces.add(ns);
- }
- }
-
- public List<OMNamespace> getResponseMsgNamespaces() {
- return responseMsgNameSpaces;
- }
-
- public void setContextParameter(ContextParameterInfo<?> name, Object value) {
- contextInfo.put(name, value);
- }
-
- public <T> T getContextParameter(ContextParameterInfo<T> name) {
-
- Object o = contextInfo.get(name);
- return name.cast(o);
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContextBuilder.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContextBuilder.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContextBuilder.java
deleted file mode 100644
index 9d4d4ea..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/context/ProcessingContextBuilder.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.context;
-
-import org.apache.axiom.om.OMElement;
-
-public abstract class ProcessingContextBuilder {
-
- public abstract ProcessingContext build(OMElement elem);
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/handler/PublishedMessageHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/handler/PublishedMessageHandler.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/handler/PublishedMessageHandler.java
deleted file mode 100644
index ca23506..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/handler/PublishedMessageHandler.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.handler;
-
-import java.util.List;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingFaultsHelper;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.dispatchers.AddressingBasedDispatcher;
-import org.apache.axis2.engine.Phase;
-import org.apache.axis2.util.JavaUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class PublishedMessageHandler extends AddressingBasedDispatcher {
-
- private static final Logger logger = LoggerFactory.getLogger(PublishedMessageHandler.class);
-
- private static final String ADDRESSING_VALIDATE_ACTION = "addressing.validateAction";
-
- private AxisOperation publishOperation = null;
-
- private Phase addressingPhase = null;
-
- public InvocationResponse invoke(MessageContext msgContext) throws AxisFault {
-
- InvocationResponse response = InvocationResponse.CONTINUE;
-
- if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null) {
- boolean validateAction = JavaUtils.isTrue(msgContext.getProperty(ADDRESSING_VALIDATE_ACTION), true);
- msgContext.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false));
- response = super.invoke(msgContext);
- if (isForBrokerEventingService(msgContext))
- validateBrokerWSEventingOperation(msgContext);
- if (validateAction)
- checkAction(msgContext);
- msgContext.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(validateAction));
-
- }
-
- return response;
- }
-
- private void validateBrokerWSEventingOperation(MessageContext msgContext) {
- if (msgContext.getAxisOperation() == null) {
- AxisService service = msgContext.getAxisService();
- AxisOperation pubOperation = getPublishOperation(service);
- msgContext.setAxisOperation(pubOperation);
- }
- }
-
- private boolean isForBrokerEventingService(MessageContext msgContext) {
- return msgContext.getAxisService() != null && msgContext.getAxisService().getName().equals("EventingService");
- }
-
- private AxisOperation getPublishOperation(AxisService publisherService) {
- if (publishOperation == null)
- publishOperation = publisherService.getOperationBySOAPAction(WsmgCommonConstants.WSMG_PUBLISH_SOAP_ACTION);
- return publishOperation;
- }
-
- private Phase getAddressingPhase(MessageContext context) {
-
- if (addressingPhase == null) {
-
- List<Phase> inFlowPhases = context.getConfigurationContext().getAxisConfiguration().getPhasesInfo()
- .getINPhases();
-
- for (Phase p : inFlowPhases) {
- if (p.getName().equalsIgnoreCase("Addressing")) {
- addressingPhase = p;
- }
- }
-
- }
-
- return addressingPhase;
-
- }
-
- private void checkAction(MessageContext msgContext) throws AxisFault {
-
- Phase addPhase = getAddressingPhase(msgContext);
-
- if (addPhase == null) {
- logger.error("unable to locate addressing phase object");
- }
- if (msgContext != null) {
- if (msgContext.getCurrentPhaseIndex() + 1 == addPhase.getHandlerCount()) {
- if (msgContext.getAxisService() == null || msgContext.getAxisOperation() == null)
- AddressingFaultsHelper.triggerActionNotSupportedFault(msgContext, msgContext.getWSAAction());
- }
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/CleanupThread.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/CleanupThread.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/CleanupThread.java
deleted file mode 100644
index bcd4ec1..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/CleanupThread.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.subscription;
-
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.config.WSMGParameter;
-import org.apache.axis2.AxisFault;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-class CleanUpThread implements Runnable {
-
- private static final Logger logger = LoggerFactory.getLogger(CleanUpThread.class);
-
- private SubscriptionManager subMan;
-
- public CleanUpThread(SubscriptionManager manager) {
- this.subMan = manager;
- }
-
- public void run() {
- logger.debug("CleanUpThread started");
- String key = null;
- SubscriptionState subscription = null;
- Set<String> keySet = null;
- // long expirationTime=300000*12*24; //5 min*12*24=1 day
- final long expirationTime = WSMGParameter.expirationTime;
- final long skipCheckInterval = 1000 * 60 * 10; // 10 minutes
- final long checkupInterval = 1000 * 60 * 5; // 5 minutes
- int MAX_TRY = 3;
- logger.info("Starting Subscription Cleaning up Thread.");
- while (true) {
- long currentTime = System.currentTimeMillis();
- long expiredStartTime = 0;
- if (WSMGParameter.requireSubscriptionRenew) {
- expiredStartTime = currentTime - expirationTime; // expired
- }
- long availabilityCheckTime = 0;
- availabilityCheckTime = currentTime - skipCheckInterval; // It's
- // time
- // to
- // check
- // again
-
- // logger.finest("CleanUpThread loop");
- keySet = subMan.getShallowSubscriptionsCopy().keySet();
- // Go through all the subscriptions and delete expired ones
- for (Iterator<String> iterator = keySet.iterator(); iterator.hasNext();) {
- key = iterator.next();
- subscription = subMan.getShallowSubscriptionsCopy().get(key);
- if (subscription.isNeverExpire()) {
- continue;
- }
- long subscriptionCreationTime = subscription.getCreationTime();
- long lastAvailableTime = subscription.getLastAvailableTime();
- if (WSMGParameter.requireSubscriptionRenew) { // expired
- if (subscriptionCreationTime < expiredStartTime) { // expired
- // or
- // need
- // to
- // check
- // again
- try {
- subMan.removeSubscription(key);
- } catch (AxisFault e) {
- logger.error(e.getMessage(), e);
- }
- // Not need to remove the key from the keyset since
- // the keyset
- // "is backed by the map, so changes to the map are reflected in the set, and vice-versa."
- // i.remove(); //add this will cause
- // ConcurrentModificationException
- logger.info("*****Deleted (expiration)" + key + "-->" + subscription.getConsumerIPAddressStr()
- + "##" + subscription.getLocalTopic());
- logger.info("*****Deleted (expiration)" + key + "-->" + subscription.getConsumerIPAddressStr()
- + "##" + subscription.getLocalTopic());
- continue;
- }
- }
- if (lastAvailableTime < availabilityCheckTime) {
- // It's time to check again
- if (CommonRoutines.isAvailable(subscription.getConsumerAddressURI())) {
- // It's time to check but still available and do not
- // require subscriptio renew
- // set a mark saying it has been check at this time
- subscription.setLastAvailableTime(currentTime);
- if (subscription.getUnAvailableCounter() > 0) { // failed
- // in
- // previous
- // try
- subscription.resetUnAvailableCounter();
- }
- } else {
- int counter = subscription.addUnAvailableCounter();
- // System.out.println("UnavailableCounter="+counter);
- // logger.finest("UnavailableCounter="+counter);
- if (counter > MAX_TRY) {
- try {
- subMan.removeSubscription(key);
- } catch (AxisFault e) {
- // TODO Auto-generated catch block
- logger.error(e.getMessage(), e);
- }
-
- // Remove from hashtable seperately to avoid
- // conccurent access problem to the hashtable
- // with
- // i.next()
- iterator.remove();
- logger.info("*****Deleted (unavailable)" + key + "-->"
- + subscription.getConsumerIPAddressStr() + "##" + subscription.getLocalTopic());
- logger.info("*****Deleted (unavailable)" + key + "-->"
- + subscription.getConsumerIPAddressStr() + "##" + subscription.getLocalTopic());
- }
- }
- }
- }
- try {
- Thread.sleep(checkupInterval);
- } catch (InterruptedException e) {
- logger.error("thread was interrupped", e);
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionEntry.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionEntry.java b/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionEntry.java
deleted file mode 100644
index a9339fd..0000000
--- a/modules/ws-messenger/messagebroker/src/main/java/org/apache/airavata/wsmg/broker/subscription/SubscriptionEntry.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.broker.subscription;
-
-public class SubscriptionEntry {
-
- private String subscriptionId;
-
- private String subscribeXml;
-
- public SubscriptionEntry() {
- }
-
- public String getSubscriptionId() {
- return subscriptionId;
- }
-
- public String getSubscribeXml() {
- return subscribeXml;
- }
-
- public void setSubscriptionId(String subscriptionId) {
- this.subscriptionId = subscriptionId;
- }
-
- public void setSubscribeXml(String subscribeXml) {
- this.subscribeXml = subscribeXml;
- }
-
-}
[12/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/README.txt
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/README.txt b/modules/ws-messenger/README.txt
deleted file mode 100644
index 946b571..0000000
--- a/modules/ws-messenger/README.txt
+++ /dev/null
@@ -1,102 +0,0 @@
-WS-Messenger 0.0.1-SNAPSHOT
----------------
-
-
-
-
-New Features In This Release
-----------------------------
-
-
-
-Key Features
-------------
-
-
-Issues Fixed in This Release
-----------------------------
-
-
-Installation & Running
-----------------------
-1. extract the downloaded zip file
-2. Run the axis2server.sh or axis2server.bat file in the bin directory
-3. Once the server starts, point your Web browser to
- https://localhost:8280/axis2/services
-4. You can see the deployed services in simple Axis2 server, run the samples in client-api/samples directory.
-
-For more details, see the Installation Guide
-
-System Requirements
--------------------
-
-
-
-Known Issues in This Release
-----------------------------
-
-
-
-Including External Dependencies
---------------------------------
-
-
-WS-Messenger Binary Distribution Directory Structure
---------------------------------------------
-
- WS-MESSENGER_HOME
- |-- gui <folder>
- |-- standalone-server <folder>
- | |-- lib <folder>
- | |-- conf <folder>
- | |-- repository <folder>
- | -- services <folder>
- | |-- bin <folder>
- |-- database_scripts
- |-- client-api <folder>
- | |-- lib <folder>
- | |-- samples <folder>
- |-- LICENSE.txt <file>
- |-- README.txt <file>
- |-- INSTALL.txt <file>
-
-
-
- - gui
- Contains the scripts to run WS Notification Listener GUI tool
-
- - standalone-server
- This contains all the artifacts required during axis2Server runtime with required axis2 service archives
-
- - standalone-server - lib
- Contains all the libraries required for Axis2 runtime
-
- - standalone-server - conf
- Contains all the configuration files for Axis2 Rutime and messenger services (messagebroker and messagebox)
-
- - standalone-server - repository - services
- Contains deployed services in Axis2 runtime.
-
- - standalone-server - bin
- Commandline scripts to use to start the SimpleAxis2Server and other Axis2 related scripts.
-
- - standalone-server - bin - database_scripts
- Contains the database scripts which are used to create tables for messagebox and messagebroker services
-
- - client-api
- Contains all the client side artifacts, which contains client samples and required libraries.
-
- - client-api - lib
- Required libraries for client side usage.
-
- - client-api - samples
- Contains set of samples which demostrate the funcationality of messagebroker and messagebox.
-
- - README.txt
- This document.
-
- - INSTALL.txt
- This document will contain information on installing Airavata-WS-Messenger.
-
-
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/pom.xml b/modules/ws-messenger/client/pom.xml
deleted file mode 100644
index dd6ce8c..0000000
--- a/modules/ws-messenger/client/pom.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-ws-messenger</artifactId>
- <version>0.15-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-messenger-client</artifactId>
- <name>Airavata Messenger Client</name>
- <url>http://airavata.apache.org/</url>
- <packaging>jar</packaging>
-
- <dependencies>
- <!-- common -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- Axis2 -->
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- </dependency>
-
-
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- RabbitMQ client -->
- <dependency>
- <groupId>com.rabbitmq</groupId>
- <artifactId>amqp-client</artifactId>
- <version>3.1.2</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java
deleted file mode 100644
index 8632dfc..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/CommonMsgBrokerClient.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.airavata.wsmg.client;
-
-import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
-import org.apache.airavata.wsmg.client.msgbox.MsgboxHandler;
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.airavata.wsmg.commons.WsmgVersion;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-abstract class CommonMsgBrokerClient implements MessageBrokerClient {
-
- protected final static OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- private final static Logger logger = LoggerFactory.getLogger(CommonMsgBrokerClient.class);
- protected ConsumerServer xs;
- private long socketTimeout = 200000L;
-
- protected MsgboxHandler msgboxHandler = new MsgboxHandler();
-
-
- public CommonMsgBrokerClient(long timeout) {
- socketTimeout = timeout;
- WsmgVersion.requireVersionOrExit(WsmgVersion.getVersion());
- }
-
- public String[] getConsumerServiceEndpointReference() {
- if (xs == null) {
- throw new RuntimeException("Consumer server is not started yet");
- }
- return xs.getConsumerServiceEPRs();
- }
-
- public void setTimeOutInMilliSeconds(long timeout) {
- socketTimeout = timeout;
- }
-
- public CommonMsgBrokerClient() {
- WsmgVersion.requireVersionOrExit(WsmgVersion.getVersion());
-
- }
-
- public long getTimeOutInMilliSeconds() {
- return socketTimeout;
- }
-
- public String subscribeMsgBox(String brokerService, EndpointReference msgBoxEpr, String topic, String xpath)
- throws MsgBrokerClientException {
-
- String msgBoxId = null;
- String msgBoxUrl = msgBoxEpr.getAddress();
- int biginIndex = msgBoxUrl.indexOf("clientid");
- msgBoxId = msgBoxUrl.substring(biginIndex + "clientid".length() + 1);
-
- if (msgBoxId == null)
- throw new RuntimeException("Invalid Message Box EPR, message box ID is missing");
-
- return subscribe(msgBoxEpr.getAddress(), topic, xpath);
- }
-
- public String subscribeMsgBox(EndpointReference msgBoxEpr, String topicExpression, String xpathExpression,
- long expireTime) throws MsgBrokerClientException {
-
- String msgBoxEventSink = msgBoxEpr.getAddress();
-
- String formattedEventSink = null;
-
- if (msgBoxEpr.getAddress().contains("clientid")) {
- formattedEventSink = msgBoxEventSink;
- } else {
- if (msgBoxEpr.getAllReferenceParameters() == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
- String msgBoxId = msgBoxEpr.getAllReferenceParameters().get(MsgBoxQNameConstants.MSG_BOXID_QNAME).getText();
- if (msgBoxId == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddr is missing");
- String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
-
- formattedEventSink = String.format(format, msgBoxEventSink, msgBoxId);
-
- }
-
- return subscribe(new EndpointReference(formattedEventSink), topicExpression, xpathExpression, expireTime);
-
- }
-
- // ------------------------Message box user
- // API----------------------------//
-
- public EndpointReference createPullMsgBox(String msgBoxLocation, long timeout) throws MsgBrokerClientException {
-
- EndpointReference ret = null;
- try {
- ret = msgboxHandler.createPullMsgBox(msgBoxLocation, timeout);
- } catch (MsgBrokerClientException e) {
- throw e;
- }
-
- return ret;
- }
-
- public EndpointReference createPullMsgBox(String msgBoxServerLoc) throws MsgBrokerClientException {
- EndpointReference ret = null;
- ret = msgboxHandler.createPullMsgBox(msgBoxServerLoc);
- return ret;
- }
-
-
- public MessagePuller startPullingEventsFromMsgBox(EndpointReference msgBoxEpr, NotificationHandler handler,
- long interval, long timeout) throws MsgBrokerClientException {
-
- MessagePuller ret = null;
- ret = msgboxHandler.startPullingEventsFromMsgBox(msgBoxEpr, handler, interval, timeout);
- return ret;
- }
-
- public MessagePuller startPullingFromExistingMsgBox(EndpointReference msgBoxAddr, NotificationHandler handler,
- long interval, long timeout) throws MsgBrokerClientException {
-
- MessagePuller ret = null;
- ret = msgboxHandler.startPullingFromExistingMsgBox(msgBoxAddr, handler, interval, timeout);
- return ret;
- }
-
- public String deleteMsgBox(EndpointReference msgBoxEpr, long timeout) throws MsgBrokerClientException {
- String ret = null;
- ret = msgboxHandler.deleteMsgBox(msgBoxEpr, timeout);
- return ret;
- }
-
- public void stopPullingEventsFromMsgBox(MessagePuller msgPuller) {
- msgboxHandler.stopPullingEventsFromMsgBox(msgPuller);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerMsgReceiver.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerMsgReceiver.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerMsgReceiver.java
deleted file mode 100644
index fe9c5ba..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerMsgReceiver.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.engine.MessageReceiver;
-
-public class ConsumerMsgReceiver implements MessageReceiver {
-
- private ConsumerNotificationHandler notifHandler;
-
- public ConsumerMsgReceiver(ConsumerNotificationHandler notifHandler) {
- this.notifHandler = notifHandler;
- }
-
- public void receive(MessageContext messageCtx) throws AxisFault {
- notifHandler.handleNotification(messageCtx.getEnvelope());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerNotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerNotificationHandler.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerNotificationHandler.java
deleted file mode 100644
index 8f60ed8..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerNotificationHandler.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axis2.AxisFault;
-
-public interface ConsumerNotificationHandler {
- public void handleNotification(SOAPEnvelope msgEnvelope) throws AxisFault;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServer.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServer.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServer.java
deleted file mode 100644
index 0f82ca6..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.ConfigurationContextFactory;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.transport.http.SimpleHTTPServer;
-
-public class ConsumerServer {
-
- private static final String ADDRESSING_VALIDATE_ACTION = "addressing.validateAction";
- public static final String SUPPORT_SINGLE_OP = "supportSingleOperation";
- private ConsumerNotificationHandler handler;
- private int listeningPort;
- private SimpleHTTPServer server;
- private AxisService consumerService = null;
-
- public ConsumerServer(int listenPort, ConsumerNotificationHandler h) {
-
- if (listenPort <= 0 || h == null) {
- throw new IllegalArgumentException("invalid arguments supplied");
- }
-
- this.listeningPort = listenPort;
- this.handler = h;
- this.server = null;
- this.consumerService = null;
- // setConsumerServiceUrl(listenPort);
-
- }
-
- public String[] getConsumerServiceEPRs() {
- return consumerService.getEPRs();
- }
-
- /**
- * @param args
- * @throws AxisFault
- * @throws Exception
- */
- public void start() throws AxisFault {
- ConfigurationContext context = ConfigurationContextFactory.createConfigurationContextFromFileSystem(null, null);
-
- context.setProperty(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false));
-
- context.getAxisConfiguration().addParameter(SUPPORT_SINGLE_OP, Boolean.valueOf(true));
-
- context.getAxisConfiguration().addParameter(ADDRESSING_VALIDATE_ACTION, Boolean.valueOf(false));
-
- Map<String, MessageReceiver> msgRecieverMap = new HashMap<String, MessageReceiver>();
- ConsumerMsgReceiver conMsgRcv = new ConsumerMsgReceiver(handler);
-
- msgRecieverMap.put("http://www.w3.org/ns/wsdl/in-only", conMsgRcv);
- AxisService service = AxisService.createService(ConsumerService.class.getName(),
- context.getAxisConfiguration(), msgRecieverMap, null, null, ConsumerServer.class.getClassLoader());
-
- context.getAxisConfiguration().addService(service);
- server = new SimpleHTTPServer(context, this.listeningPort);
- server.start();
-
- consumerService = service;
-
- }
-
- public void stop() {
- // TODO: add an exeption
- server.stop();
- }
-
- public int getListenPort() {
- return listeningPort;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServerHandler.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServerHandler.java
deleted file mode 100644
index 6d71961..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerServerHandler.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.axis2.AxisFault;
-
-public class ConsumerServerHandler {
-
- private ConsumerServer xs = null;
-
- public void createConsumerServer(int listenPort, ConsumerNotificationHandler h) throws MsgBrokerClientException {
-
- try {
- xs = new ConsumerServer(listenPort, h);
- xs.start();
- } catch (AxisFault f) {
- throw new MsgBrokerClientException("unable to start the consumer server", f);
- }
- }
-
- public String[] getConsumerServiceEndpointReference() throws MsgBrokerClientException {
- if (xs == null) {
- throw new MsgBrokerClientException("Consumer server is not started yet");
- }
- return xs.getConsumerServiceEPRs();
- }
-
- public void shutdownConsumerService() {
- if (xs != null) {
- xs.stop();
- xs = null;
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerService.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerService.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerService.java
deleted file mode 100644
index 8b7fb70..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/ConsumerService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-public class ConsumerService {
-
- public void consumer(String msg) {
- System.out.println(msg);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MessageBrokerClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MessageBrokerClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MessageBrokerClient.java
deleted file mode 100644
index c5ada0a..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MessageBrokerClient.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-
-import java.rmi.RemoteException;
-
-public interface MessageBrokerClient {
-
- /**
- * May be we just use a constructor here
- *
- * @param brokerLocation
- */
- public void init(String brokerLocation);
-
- /**
- *
- * @param subscriptionId
- * @return
- */
- public boolean unSubscribe(String subscriptionId) throws MsgBrokerClientException;
-
- /**
- *
- * @param eventSinkLocation
- * @param topicExpression
- * @param xpathExpression
- * @return
- * @throws AxisFault
- */
- public String subscribe(String eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException;
-
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException;
-
- /**
- *
- * @param eventSinkLocation
- * @param topicExpression
- * @param xpathExpression
- * @param expireTime
- * with -1, it never expires
- * @return
- * @throws AxisFault
- */
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression,
- long expireTime) throws MsgBrokerClientException;
-
- public void publish(String topic, String plainText) throws MsgBrokerClientException;
-
- public void publish(String topic, OMElement message) throws MsgBrokerClientException;
-
- /**
- *
- * @param brokerLocation
- * @param msgBoxEpr
- * @param topicExpression
- * @param xpathExpression
- * @param expireTime
- * with -1, it never expires
- * @return
- * @throws MsgBrokerClientException
- */
- public String subscribeMsgBox(EndpointReference msgBoxEpr, String topicExpression, String xpathExpression,
- long expireTime) throws MsgBrokerClientException;
-
- /**
- * This method can be used to shutdown the consumer server started
- */
- public void shutdownConsumerService();
-
- /**
- *
- * @param port
- * @param handler
- * @return
- * @throws MsgBrokerClientException
- */
- public String[] startConsumerService(int port, ConsumerNotificationHandler handler) throws MsgBrokerClientException;
-
- /**
- *
- * @param msgBoxAddr
- * @param handler
- * @param backoff
- * @param timeout
- * @return
- * @throws AxisFault
- */
- public MessagePuller startPullingFromExistingMsgBox(EndpointReference msgBoxAddr, NotificationHandler handler,
- long backoff, long timeout) throws MsgBrokerClientException;
-
- /**
- *
- * @param msgBoxAddr
- * @param handler
- * @param backoff
- * @param timeout
- * @return
- * @throws RemoteException
- */
- public MessagePuller startPullingEventsFromMsgBox(EndpointReference msgBoxAddr, NotificationHandler handler,
- long backoff, long timeout) throws MsgBrokerClientException;
-
- // public EndpointReference createPullMsgBox(String msgBoxServerLoc, String userAgent) throws RemoteException ;
-
- /**
- *
- * @param msgPuller
- */
- public void stopPullingEventsFromMsgBox(org.apache.airavata.wsmg.client.msgbox.MessagePuller msgPuller)
- throws MsgBrokerClientException;
-
- /**
- *
- * @return
- */
- public String[] getConsumerServiceEndpointReference();
-
- /**
- *
- * @param brokerService
- * @param msgBoxEpr
- * @param topic
- * @param xpath
- * @return
- */
- public String subscribeMsgBox(String brokerService, EndpointReference msgBoxEpr, String topic, String xpath)
- throws MsgBrokerClientException;
-
- /**
- *
- * @param msgBoxLocation
- * @param timeout
- * @return
- * @throws MsgBrokerClientException
- */
- public EndpointReference createPullMsgBox(String msgBoxLocation, long timeout) throws MsgBrokerClientException;
-
- /**
- *
- * @param msgBoxServerLoc
- * @return
- * @throws MsgBrokerClientException
- */
- public EndpointReference createPullMsgBox(String msgBoxServerLoc) throws MsgBrokerClientException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MsgBrokerClientException.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MsgBrokerClientException.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MsgBrokerClientException.java
deleted file mode 100644
index 8529e58..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/MsgBrokerClientException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.axis2.AxisFault;
-
-public class MsgBrokerClientException extends AxisFault {
-
- private static final long serialVersionUID = 5609577226544941146L;
-
- public MsgBrokerClientException(String msg) {
- super(msg);
- }
-
- public MsgBrokerClientException(String msg, Throwable t) {
- super(msg, t);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationHandler.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationHandler.java
deleted file mode 100644
index 0b62067..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationHandler.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.axis2.AxisFault;
-
-public interface NotificationHandler {
- public void handleNotification(String message) throws AxisFault;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationProducerStub.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationProducerStub.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationProducerStub.java
deleted file mode 100644
index 9aee0b1..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/NotificationProducerStub.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.addressing.EndpointReferenceHelper;
-import org.apache.axis2.client.ServiceClient;
-
-/**
- *
- * TODO To change the template for this generated type comment go to Window -
- * Preferences - Java - Code Style - Code Templates
- */
-/**
- * This stub is NOT multi-thread safe!
- */
-public class NotificationProducerStub extends WidgetStub {
- private static final String RMASSERTION = "RMAssertion";
-
- private static final String WSRM_NAMESPACE = "http://schemas.xmlsoap.org/ws/2005/02/rm";
-
- private static final String WSRM = "wsrm";
-
- private final static OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- public NotificationProducerStub(EndpointReference widgetEpr, long timeout) {
- super(widgetEpr, timeout);
- }
-
- public OMElement getCurrentMessage(OMElement topicExp) throws AxisFault {
-
- OMElement message = factory.createOMElement("GetCurrentMessage", NameSpaceConstants.WSNT_NS);
- message.addChild(topicExp);
-
- ServiceClient client = createServiceClient(message);
-
- OMElement responseMessage = client.sendReceive(message);
- client.cleanupTransport();
-
- if (responseMessage.getFirstElement() == null) {
- return null;
- }
- return (OMElement) responseMessage.getChildren().next();
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
-
- String uuid = UUIDGenerator.getUUID();
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(opts.getTo().getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
-
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- client.setOptions(opts);
-
- return client;
- }
-
- public SubscriptionStub subscribe(EndpointReference consumerReference, OMElement topicExpression, boolean useNotfy)
- throws AxisFault {
- return this.subscribe(consumerReference, topicExpression, null, useNotfy, false);
-
- }
-
- public SubscriptionStub subscribe(EndpointReference consumerReference, OMElement topicExpression,
- OMElement xpathExpression, boolean useNotfy) throws AxisFault {
- return this.subscribe(consumerReference, topicExpression, xpathExpression, useNotfy, false);
-
- }
-
- public SubscriptionStub subscribe(EndpointReference consumerReference, OMElement topicExpression, boolean useNotfy,
- boolean wsrm) throws AxisFault {
- return subscribe(consumerReference, topicExpression, null, useNotfy, wsrm);
- }
-
- public SubscriptionStub subscribe(EndpointReference consumerReference, OMElement topicExpression,
- OMElement xpathExpression, boolean useNotfy, boolean wsrm) throws AxisFault {
-
- OMElement message = factory.createOMElement("SubscribeRequest", NameSpaceConstants.WSNT_NS);
-
- message.declareNamespace(NameSpaceConstants.WSNT_NS);
-
- OMElement eprCrEl = EndpointReferenceHelper.toOM(factory, consumerReference, new QName("ConsumerReference"),
- NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- message.addChild(eprCrEl);
- eprCrEl.setNamespace(message.getNamespace());
-
- if (topicExpression != null) {
- message.addChild(topicExpression);
- topicExpression.setNamespace(message.getNamespace());
- }
- if (xpathExpression != null) {
- message.addChild(xpathExpression);
- xpathExpression.setNamespace(message.getNamespace());
- }
- OMElement useNotifyEl = factory.createOMElement("UseNotify", message.getNamespace(), message);
-
- useNotifyEl.setText(useNotfy ? "true" : "false");
-
- if (wsrm) {
-
- setPolicyAttachment(message);
- }
-
- ServiceClient client = createServiceClient(message);
-
- OMElement responseMessage = client.sendReceive(message);
- client.cleanupTransport();
-
- OMElement sr = responseMessage.getFirstChildWithName(new QName(NameSpaceConstants.WSNT_NS.getNamespaceURI(),
- "SubscriptionReference"));
-
- if (sr == null) {
- throw new AxisFault("unable to subscribe, invalid response returned by broker");
- }
-
- return new SubscriptionStub(EndpointReferenceHelper.fromOM(sr), getTimeoutInMilliSeconds());
- }
-
- public static void verbose(String msg) {
-
- System.err.println(msg);
- }
-
- protected void setPolicyAttachment(OMElement message) {
-
- OMElement policy = factory.createOMElement(WsmgCommonConstants.SUBSCRIPTION_POLICY, message.getNamespace(),
- message);
-
- // builder.newFragment(WsmgConstants.WSNT_NS,
- // WsmgCommonConstants.SUBSCRIPTION_POLICY);
- OMElement childEl = factory.createOMElement(new QName(WSRM_NAMESPACE, WSRM));
- // XmlNamespace wsrmNamespace = builder.newNamespace(WSRM,
- // WSRM_NAMESPACE);
- policy.addChild(childEl);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionInfo.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionInfo.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionInfo.java
deleted file mode 100644
index 7f53021..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionInfo.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-
-public class SubscriptionInfo {
- String eventSourceLocIn = null;
- String eventSinkLocIn = null;
- String topicExpression = null;
- String xpathExpression = null;
- String eventSinkEndpointReferenceNS = null;
- String eventSinkEndpointReference = null;
- long expireTime = ClientUtil.EXPIRE_TIME;
-
- /**
- * @param eventSourceLocIn
- * @param eventSinkLocIn
- * @param topicExpression
- * @param xpathExpression
- * @param eventSinkEndpointReferenceNS
- * @param eventSinkEndpointReference
- * @param expireTime
- */
- public SubscriptionInfo(String eventSourceLocIn, String eventSinkLocIn, String topicExpression,
- String xpathExpression, String eventSinkEndpointReferenceNS, String eventSinkEndpointReference,
- long expireTime) {
- this.eventSourceLocIn = eventSourceLocIn;
- this.eventSinkLocIn = eventSinkLocIn;
- this.topicExpression = topicExpression;
- this.xpathExpression = xpathExpression;
- this.eventSinkEndpointReferenceNS = eventSinkEndpointReferenceNS;
- this.eventSinkEndpointReference = eventSinkEndpointReference;
- this.expireTime = expireTime;
- }
-
- /**
- * @return Returns the eventSinkEndpointReference.
- */
- public String getEventSinkEndpointReference() {
- return eventSinkEndpointReference;
- }
-
- /**
- * @param eventSinkEndpointReference
- * The eventSinkEndpointReference to set.
- */
- public void setEventSinkEndpointReference(String eventSinkEndpointReference) {
- this.eventSinkEndpointReference = eventSinkEndpointReference;
- }
-
- /**
- * @return Returns the eventSinkEndpointReferenceNS.
- */
- public String getEventSinkEndpointReferenceNS() {
- return eventSinkEndpointReferenceNS;
- }
-
- /**
- * @param eventSinkEndpointReferenceNS
- * The eventSinkEndpointReferenceNS to set.
- */
- public void setEventSinkEndpointReferenceNS(String eventSinkEndpointReferenceNS) {
- this.eventSinkEndpointReferenceNS = eventSinkEndpointReferenceNS;
- }
-
- /**
- * @return Returns the eventSinkLocIn.
- */
- public String getEventSinkLocIn() {
- return eventSinkLocIn;
- }
-
- /**
- * @param eventSinkLocIn
- * The eventSinkLocIn to set.
- */
- public void setEventSinkLocIn(String eventSinkLocIn) {
- this.eventSinkLocIn = eventSinkLocIn;
- }
-
- /**
- * @return Returns the eventSourceLocIn.
- */
- public String getEventSourceLocIn() {
- return eventSourceLocIn;
- }
-
- /**
- * @param eventSourceLocIn
- * The eventSourceLocIn to set.
- */
- public void setEventSourceLocIn(String eventSourceLocIn) {
- this.eventSourceLocIn = eventSourceLocIn;
- }
-
- /**
- * @return Returns the expireTime.
- */
- public long getExpireTime() {
- return expireTime;
- }
-
- /**
- * @param expireTime
- * The expireTime to set.
- */
- public void setExpireTime(long expireTime) {
- this.expireTime = expireTime;
- }
-
- /**
- * @return Returns the topicExpression.
- */
- public String getTopicExpression() {
- return topicExpression;
- }
-
- /**
- * @param topicExpression
- * The topicExpression to set.
- */
- public void setTopicExpression(String topicExpression) {
- this.topicExpression = topicExpression;
- }
-
- /**
- * @return Returns the xpathExpression.
- */
- public String getXpathExpression() {
- return xpathExpression;
- }
-
- /**
- * @param xpathExpression
- * The xpathExpression to set.
- */
- public void setXpathExpression(String xpathExpression) {
- this.xpathExpression = xpathExpression;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionStub.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionStub.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionStub.java
deleted file mode 100644
index d094d5c..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/SubscriptionStub.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.ServiceClient;
-
-/**
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
- * Templates
- */
-public class SubscriptionStub extends WsrfResourceStub {
-
- private final static OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- // private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
- SubscriptionStub(EndpointReference widgetEpr, long timeout) {
- super(widgetEpr, timeout);
- }
-
- public void pauseSubscription() throws AxisFault {
-
- OMElement message = factory.createOMElement("PauseSubscription", NameSpaceConstants.WSNT_NS);
-
- ServiceClient client = createServiceClient(message);
- client.sendReceive(message);
- client.cleanupTransport();
- }
-
- public void resumeSubscription() throws AxisFault {
-
- OMElement message = factory.createOMElement("ResumeSubscription", NameSpaceConstants.WSNT_NS);
-
- ServiceClient client = createServiceClient(message);
- client.sendReceive(message);
- client.cleanupTransport();
-
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
-
- String uuid = UUIDGenerator.getUUID();
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(opts.getTo().getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- client.setOptions(opts);
- return client;
- }
-
- public static void verbose(String msg) {
-
- System.err.println(msg);
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WidgetStub.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WidgetStub.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WidgetStub.java
deleted file mode 100644
index 3400390..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WidgetStub.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.ServiceClient;
-
-/**
- * This stub is NOT multi-thread safe!
- */
-public class WidgetStub extends WsrfResourceStub {
-
- private final static OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- public WidgetStub(EndpointReference widgetEpr, long timeout) {
- super(widgetEpr, timeout);
- }
-
- public void generateNotification() throws AxisFault {
-
- OMElement message = factory.createOMElement("generateNotification", NameSpaceConstants.WIDGET_NS);
-
- ServiceClient client = createServiceClient(message);
- client.sendReceive(message);
- client.cleanupTransport();
-
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
-
- ServiceClient client = new ServiceClient();
-
- String uuid = UUIDGenerator.getUUID();
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
-
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(opts.getTo().getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/generateEvent");
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- client.setOptions(opts);
- return client;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseCreateSubscription.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseCreateSubscription.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseCreateSubscription.java
deleted file mode 100644
index c10d123..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseCreateSubscription.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.addressing.EndpointReferenceHelper;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-public class WseCreateSubscription {
- private final OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
- protected EndpointReference brokerEndPointReference;
-
- protected long timeoutInMilliSeconds;
-
- public WseCreateSubscription(EndpointReference brokerLocationEPR, long timeout) {
- this.brokerEndPointReference = brokerLocationEPR;
- timeoutInMilliSeconds = timeout;
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public OMElement subscribe(EndpointReference eventSinkReference, OMElement filterEl, boolean useNotfy)
- throws AxisFault {
- return subscribe(eventSinkReference, filterEl, useNotfy, ClientUtil.EXPIRE_TIME);
- }
-
- public OMElement subscribe(EndpointReference eventSinkReferenceEPR, OMElement filterEl, boolean useNotfy,
- long expireTime) throws AxisFault {
-
- OMElement message = createMessageEl(eventSinkReferenceEPR, filterEl, expireTime);
-
- ServiceClient serviceClient = createServiceClient(message);
- OMElement responseMessage = serviceClient.sendReceive(message);
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- if (responseMessage == null) {
- throw AxisFault.makeFault(new RuntimeException("no response recieved for subscription message"));
- }
- OMElement responseSubscriptionsManagerElement = responseMessage.getFirstChildWithName(new QName(
- NameSpaceConstants.WSE_NS.getNamespaceURI(), "SubscriptionManager"));
- return responseSubscriptionsManagerElement;
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setTo(brokerEndPointReference);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
- opts.setMessageId(UUIDGenerator.getUUID());
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(UUIDGenerator.getUUID());
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(opts.getTo().getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
-
- return client;
- }
-
- private OMElement createMessageEl(EndpointReference eventSinkReferenceEPR, OMElement filterEl, long expireTime)
- throws AxisFault {
-
- OMElement message = factory.createOMElement("Subscribe", NameSpaceConstants.WSE_NS);
-
- OMElement delivery = factory.createOMElement("Delivery", NameSpaceConstants.WSE_NS);
-
- OMElement expires = factory.createOMElement("Expires", NameSpaceConstants.WSE_NS);
- expires.setText(Long.toString(expireTime));
- message.addChild(expires);
-
- OMElement notifyTo = EndpointReferenceHelper.toOM(factory, eventSinkReferenceEPR, new QName(
- NameSpaceConstants.WSE_NS.getNamespaceURI(), "NotifyTo"), NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- delivery.addChild(notifyTo);
- message.addChild(delivery);
-
- if (filterEl != null) {
- message.addChild(filterEl);
- }
-
- message.declareNamespace(NameSpaceConstants.WSA_NS);
-
- return message;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java
deleted file mode 100644
index 5c173e8..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WseMsgBrokerClient.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.commons.NotificationProducer;
-import org.apache.airavata.wsmg.client.protocol.WSEProtocolClient;
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-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.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-public class WseMsgBrokerClient extends CommonMsgBrokerClient implements MessageBrokerClient {
-
- private EndpointReference brokerEndpointRef = null;
-
- protected long timeoutInMilliSeconds = WsmgCommonConstants.DEFAULT_CLIENT_SOCKET_TIME_OUT_MILLIES;
-
- final static String WIDGET_NS_PREFIX = NameSpaceConstants.WIDGET_NS.getPrefix() + ":";
-
- protected NotificationProducer notificationProducer = new NotificationProducer();
- protected ConsumerServerHandler consumerServerHandler = new ConsumerServerHandler();
-
- public static EndpointReference createEndpointReference(String brokerURL, String topic) {
-
- return WSEProtocolClient.createEndpointReference(brokerURL, topic);
- }
-
- public void init(String brokerLocation) {
-
- brokerEndpointRef = new EndpointReference(ClientUtil.formatURLString(brokerLocation));
-
- }
-
- public void publish(String topic, String plainText) throws MsgBrokerClientException {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement wrappedMsg = factory.createOMElement(WsmgCommonConstants.WSMG_PLAIN_TEXT_WRAPPER,
- NameSpaceConstants.WSMG_NS);
-
- wrappedMsg.setText(plainText);
- publish(topic, wrappedMsg);
- }
-
- public void publish(String topic, OMElement message) throws MsgBrokerClientException {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement topicExpressionEl = null;
-
- if (topic != null) {
- topicExpressionEl = factory.createOMElement("Topic", NameSpaceConstants.WSNT_NS);
- topicExpressionEl.addAttribute("Dialect", WsmgCommonConstants.TOPIC_EXPRESSION_SIMPLE_DIALECT, null);
- topicExpressionEl.declareNamespace(NameSpaceConstants.WIDGET_NS);
- topicExpressionEl.setText(WIDGET_NS_PREFIX + topic);
-
- }
-
- try {
- notificationProducer.deliverMessage(message, "wse", brokerEndpointRef, getTimeoutInMilliSeconds(),
- topicExpressionEl);
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to publish msg", e);
- }
- }
-
- public String subscribe(String eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException {
- return subscribe(new EndpointReference(eventSinkLocation), topicExpression, xpathExpression);
- }
-
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException {
-
- return subscribe(eventSinkLocation, topicExpression, xpathExpression,
- WsmgCommonConstants.DEFAULT_SUBSCRIPTION_EXPIRATION_TIME);
- }
-
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression,
- long expireTime) throws MsgBrokerClientException {
-
- String subscriptionId = null;
- ServiceClient serviceClient = null;
- try {
- OMElement subscriptionMsg = WSEProtocolClient.createSubscription(eventSinkLocation, topicExpression,
- xpathExpression, expireTime);
- serviceClient = configureServiceClientForSubscription(subscriptionMsg);
- OMElement responseMessage = serviceClient.sendReceive(subscriptionMsg);
-
- if (responseMessage == null) {
- throw new MsgBrokerClientException("no response recieved for subscription message");
- }
-
- OMElement responseSubscriptionsManagerElement = responseMessage.getFirstChildWithName(new QName(
- NameSpaceConstants.WSE_NS.getNamespaceURI(), "SubscriptionManager"));
-
- subscriptionId = WSEProtocolClient.decodeSubscribeResponse(responseSubscriptionsManagerElement);
-
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to send the subscription", e);
- } finally {
- try {
- serviceClient.cleanup();
- serviceClient.cleanupTransport();
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to send the subscription", e);
- }
- }
-
- return subscriptionId;
- }
-
- public boolean unSubscribe(String subscriptionId) throws MsgBrokerClientException {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement message = WSEProtocolClient.createUnsubscribeMsg();
- ServiceClient client = null;
- OMElement identifierEl = factory.createOMElement("Identifier", message.getNamespace());
-
- identifierEl.setText(subscriptionId);
- String soapAction = message.getNamespace().getNamespaceURI() + "/" + message.getLocalName();
-
- Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef);
-
- try {
- client = new ServiceClient();
- client.setOptions(opts);
- CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client, identifierEl);
- client.sendReceive(message);
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to send unsubscribe msg", e);
- } finally {
- try {
- client.cleanup();
- client.cleanupTransport();
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to send unsubscribe msg", e);
- }
- }
- return true;
- }
-
- private ServiceClient configureServiceClientForSubscription(OMElement message) throws AxisFault {
-
- String soapAction = message.getNamespace().getNamespaceURI() + "/" + message.getLocalName();
-
- Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef);
-
- ServiceClient client = new ServiceClient();
- client.setOptions(opts);
- CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client);
- return client;
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public String[] startConsumerService(int port, ConsumerNotificationHandler handler) throws MsgBrokerClientException {
-
- consumerServerHandler.createConsumerServer(port, handler);
- return consumerServerHandler.getConsumerServiceEndpointReference();
-
- }
-
- public void shutdownConsumerService() {
- consumerServerHandler.shutdownConsumerService();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntCreatePublishReg.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntCreatePublishReg.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntCreatePublishReg.java
deleted file mode 100644
index e14ae9e..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntCreatePublishReg.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.util.UUIDGenerator;
-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.addressing.EndpointReferenceHelper;
-import org.apache.axis2.client.ServiceClient;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- *
- * TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code
- * Templates
- */
-public class WsntCreatePublishReg extends WidgetStub {
- private static final Logger logger = LoggerFactory.getLogger(WseCreateSubscription.class);
- private OMFactory factory = OMAbstractFactory.getOMFactory();
- private final static SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- // private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
- public WsntCreatePublishReg(EndpointReference widgetEpr, long timeout) {
- super(widgetEpr, timeout);
- }
-
- public WsrfResourceStub registerPublisher(EndpointReference omEndpointReference) throws AxisFault {
-
- // invoker.setMessageId(null);
- OMElement message = factory.createOMElement(new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(),
- "RegisterPublisher"));
- // builder.newFragment(WsmgConstants.WSBR_NS,
- // "RegisterPublisher");
-
- // EndpointReference publisherRef;
-
- OMElement publisherRef = null;
-
- publisherRef = EndpointReferenceHelper.toOM(factory, omEndpointReference,
- new QName(NameSpaceConstants.WSBR_NS.getNamespaceURI(), "PublisherReference"),
- NameSpaceConstants.WSA_NS.getNamespaceURI());
-
- message.addChild(publisherRef);
-
- ServiceClient client = createServiceClient(message);
-
- OMElement responseMessage = client.sendReceive(message);
- client.cleanup();
- client.cleanupTransport();
-
- OMElement publisherRegistrationRef = responseMessage.getFirstChildWithName(new QName(NameSpaceConstants.WSBR_NS
- .getNamespaceURI(), "PublisherRegistrationReference"));
-
- EndpointReference epr = EndpointReferenceHelper.fromOM(publisherRegistrationRef);
- return new WsrfResourceStub(epr, getTimeoutInMilliSeconds());
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
- String uuid = UUIDGenerator.getUUID();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setMessageId(uuid);
- opts.setAction(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
- opts.setTimeOutInMilliSeconds(getTimeoutInMilliSeconds());
-
- ServiceClient client = new ServiceClient();
-
- if (client.getAxisConfiguration().getModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING) != null) {
-
- client.engageModule(WsmgCommonConstants.AXIS_MODULE_NAME_ADDRESSING);
- } else {
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(uuid);
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(opts.getTo().getAddress());
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(message.getNamespace().getNamespaceURI() + "/" + message.getLocalName());
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
- }
- client.setOptions(opts);
- return client;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntMsgBrokerClient.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntMsgBrokerClient.java b/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntMsgBrokerClient.java
deleted file mode 100644
index 321bfe0..0000000
--- a/modules/ws-messenger/client/src/main/java/org/apache/airavata/wsmg/client/WsntMsgBrokerClient.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.wsmg.client.commons.NotificationProducer;
-import org.apache.airavata.wsmg.client.protocol.WSNTProtocolClient;
-import org.apache.airavata.wsmg.client.util.ClientUtil;
-import org.apache.airavata.wsmg.commons.CommonRoutines;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.airavata.wsmg.commons.NameSpaceConstants;
-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.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-public class WsntMsgBrokerClient extends CommonMsgBrokerClient implements MessageBrokerClient {
-
- protected long timeoutInMilliSeconds = WsmgCommonConstants.DEFAULT_CLIENT_SOCKET_TIME_OUT_MILLIES;
-
- protected NotificationProducer notifProducer = new NotificationProducer();
- protected ConsumerServerHandler consumerServerHandler = new ConsumerServerHandler();
-
- private EndpointReference brokerEndpointRef = null;
-
- public static EndpointReference createEndpointReference(String brokerURL, String topic) {
- // TODO : implement
- return null;
- }
-
- public void init(String brokerLocation) {
- brokerEndpointRef = new EndpointReference(ClientUtil.formatURLString(brokerLocation));
-
- }
-
- public void publish(String topic, String plainText) throws MsgBrokerClientException {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
-
- OMElement wrappedMsg = factory.createOMElement(WsmgCommonConstants.WSMG_PLAIN_TEXT_WRAPPER,
- NameSpaceConstants.WSMG_NS);
-
- wrappedMsg.setText(plainText);
- publish(topic, wrappedMsg);
-
- }
-
- public void publish(String topic, OMElement message) throws MsgBrokerClientException {
-
- String producerURl = ClientUtil.formatURLString(ClientUtil.getHostIP());
- EndpointReference producerReference = new EndpointReference(producerURl);
-
- try {
-
- OMElement messageToNotify = WSNTProtocolClient.encodeNotification(topic, message, producerReference);
-
- notifProducer.deliverMessage(messageToNotify, "wsnt", brokerEndpointRef, getTimeoutInMilliSeconds());
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to publish msg", e);
- }
-
- }
-
- public String subscribe(String eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException {
-
- return subscribe(new EndpointReference(eventSinkLocation), topicExpression, xpathExpression);
- }
-
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression)
- throws MsgBrokerClientException {
- return subscribe(eventSinkLocation, topicExpression, xpathExpression,
- WsmgCommonConstants.DEFAULT_SUBSCRIPTION_EXPIRATION_TIME);
- }
-
- public String subscribe(EndpointReference eventSinkLocation, String topicExpression, String xpathExpression,
- long expireTime) throws MsgBrokerClientException {
-
- String subscriptionId = null;
-
- try {
-
- OMElement message = WSNTProtocolClient.createSubscriptionMsg(eventSinkLocation, topicExpression,
- xpathExpression);
-
- ServiceClient client = createServiceClient(message);
-
- OMElement responseMessage = client.sendReceive(message);
- client.cleanup();
- client.cleanupTransport();
-
- OMElement sr = responseMessage.getFirstChildWithName(new QName(
- NameSpaceConstants.WSNT_NS.getNamespaceURI(), "SubscriptionReference"));
-
- if (sr == null) {
- throw new MsgBrokerClientException("unable to subscribe, invalid response returned by broker");
- }
-
- subscriptionId = WSNTProtocolClient.decodeSubscriptionResponse(sr);
-
- } catch (AxisFault f) {
- throw new MsgBrokerClientException("unable to send the subscription msg", f);
- }
-
- return subscriptionId;
-
- }
-
- private ServiceClient createServiceClient(OMElement message) throws AxisFault {
-
- String soapAction = message.getNamespace().getNamespaceURI() + "/" + message.getLocalName();
-
- Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef);
-
- ServiceClient client = new ServiceClient();
- CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client);
-
- client.setOptions(opts);
-
- return client;
- }
-
- public boolean unSubscribe(String subscriptionId) throws MsgBrokerClientException {
-
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement message = WSNTProtocolClient.createUnsubscribeMsg();
- OMElement identifierEl = factory.createOMElement("Identifier", message.getNamespace());
-
- identifierEl.setText(subscriptionId);
- String soapAction = message.getNamespace().getNamespaceURI() + "/" + message.getLocalName();
-
- Options opts = CommonRoutines.getOptions(soapAction, getTimeoutInMilliSeconds(), brokerEndpointRef);
-
- try {
- ServiceClient client = new ServiceClient();
- client.setOptions(opts);
- CommonRoutines.setHeaders(soapAction, brokerEndpointRef.getAddress(), client, identifierEl);
-
- client.sendReceive(message);
- client.cleanupTransport();
-
- } catch (AxisFault e) {
- throw new MsgBrokerClientException("unable to send subscribe msg", e);
- }
-
- return true;
- }
-
- public long getTimeoutInMilliSeconds() {
- return timeoutInMilliSeconds;
- }
-
- public void setTimeoutInMilliSeconds(long timeout) {
- timeoutInMilliSeconds = timeout;
- }
-
- public String[] startConsumerService(int port, ConsumerNotificationHandler handler) throws MsgBrokerClientException {
-
- consumerServerHandler.createConsumerServer(port, handler);
- return consumerServerHandler.getConsumerServiceEndpointReference();
-
- }
-
- public void shutdownConsumerService() {
- consumerServerHandler.shutdownConsumerService();
- }
-}
[09/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/TopicSubscriber.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/TopicSubscriber.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/TopicSubscriber.java
deleted file mode 100644
index 6516a6b..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/amqp/TopicSubscriber.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.amqp;
-
-import java.util.Properties;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.wsmg.client.amqp.rabbitmq.AMQPTopicReceiverImpl;
-
-public class TopicSubscriber {
- public static void main(String args[]) throws AMQPException {
- String host = ServerSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, "localhost");
- String port = ServerSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, "5672");
- String username = ServerSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, "guest");
- String password = ServerSettings.getSetting(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, "guest");
-
- Properties properties = new Properties();
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_HOST, host);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PORT, port);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_USERNAME, username);
- properties.setProperty(AMQPUtil.CONFIG_AMQP_PROVIDER_PASSWORD, password);
-
- MessageConsumer consumer = new MessageConsumer();
- AMQPTopicReceiver receiver = new AMQPTopicReceiverImpl(properties, consumer);
- System.out.println("Waiting for topic messages : \n");
-
- AMQPRoutingKey key = new AMQPRoutingKey("workflowTerminated", "");
- receiver.Subscribe(key);
- }
-
- public static class MessageConsumer implements AMQPCallback {
- public void onMessage(String message) {
- System.out.println("Received : " + message);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ClientUtilTest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ClientUtilTest.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ClientUtilTest.java
deleted file mode 100644
index 9aff14f..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ClientUtilTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.util;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Test;
-
-public class ClientUtilTest {
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#formatURLString(java.lang.String)}.
- */
- @Test
- public void testFormatURLString() {
-
- String url = "http://www.test.com/unit_test";
-
- assertSame(url, ClientUtil.formatURLString(url));
-
- url = "scp://test/test";
-
- assertSame(url, ClientUtil.formatURLString(url));
-
- url = "test/test";
-
- assertTrue(ClientUtil.formatURLString(url).startsWith("http://"));
-
- }
-
- /**
- * Test method for {@link org.apache.airavata.wsmg.util.WsmgUtil#getHostIP()}.
- */
- @Test
- public void testGetHostIP() {
- assertNotNull(ClientUtil.getHostIP());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ConfigKeys.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ConfigKeys.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ConfigKeys.java
deleted file mode 100644
index 2a6cce2..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/ConfigKeys.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.util;
-
-public interface ConfigKeys {
-
- String CONFIG_FILE_NAME = "unit_tests.properties";
-
- String BROKER_EVENTING_SERVICE_EPR = "broker.eventing.service.epr";
- String BROKER_NOTIFICATIONS_SERVICE_EPR = "broker.notification.service.epr";
-
- String CONSUMER_EPR = "consumer.location";
- String CONSUMER_PORT = "consumer.port";
- String TOPIC_SIMPLE = "topic.simple";
- String TOPIC_XPATH = "topic.xpath";
- String AXIS2_REPO = "axis2.repo";
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/TestDcDate.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/TestDcDate.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/TestDcDate.java
deleted file mode 100644
index a1ce01b..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/client/util/TestDcDate.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.client.util;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import java.util.TimeZone;
-
-import junit.framework.TestCase;
-
-import org.junit.Test;
-
-public class TestDcDate extends TestCase {
-
- @Test
- public void testDcDate() {
- DcDate d;
-
- // d = new DcDate("1997-07-16T19:20:30.45+01:00");
-
- d = new DcDate(TimeZone.getDefault());
-
- String dc = d.getDcDate();
-
- // System.out.println(getClass()+" dc="+dc);
-
- new DcDate(dc);
- Calendar loc = new GregorianCalendar();
- assertEquals(d.getYear(), loc.get(Calendar.YEAR));
- assertEquals(d.getMonth(), loc.get(Calendar.MONTH) + 1);
- assertEquals(d.getDay(), loc.get(Calendar.DAY_OF_MONTH));
- assertEquals(d.getHour(), loc.get(Calendar.HOUR_OF_DAY));
- assertEquals(d.getMinute(), loc.get(Calendar.MINUTE));
-
- int tzOffset = TimeZone.getDefault().getRawOffset() / (60 * 1000);
- int tzOffsetHours = tzOffset / 60;
- assertEquals(tzOffset, d.getTimeZoneOffset());
-
- DcDate dZ = new DcDate(TimeZone.getTimeZone("GMT"));
-
- // System.out.println(getClass()+" dZ="+dZ);
-
- assertEquals(0, dZ.getTimeZoneOffset());
- // assertEquals(d.getDay() + tzOffset, dZ.getDay()); //may fail!
- int localHour = dZ.getHour() + tzOffsetHours;
- if (localHour > 24) {
- localHour -= 24;
- }
- if (localHour < 0) {
- localHour += 24;
- }
- // assertEquals(d.getHour(), localHour);
-
- //
- d = new DcDate("1997");
- assertEquals(1997, d.getYear());
- //
- d = new DcDate("1997-07");
- assertEquals(1997, d.getYear());
- assertEquals(7, d.getMonth());
- //
- d = new DcDate("1997-07-16");
- assertEquals(1997, d.getYear());
- assertEquals(7, d.getMonth());
- assertEquals(16, d.getDay());
-
- // 1997-07-16T19:20+01:00
- d = new DcDate("1997-07-16T19:20+01:00");
- assertEquals(1997, d.getYear());
- assertEquals(7, d.getMonth());
- assertEquals(16, d.getDay());
- assertEquals(19, d.getHour());
- assertEquals(20, d.getMinute());
- assertEquals(1 * 60, d.getTimeZoneOffset());
- // 1997-07-16T19:20:30+01:00
- d = new DcDate("1997-07-16T19:20:30+01:00");
- // 1997-07-16T19:20:30.45+01:00
- d = new DcDate("1997-07-16T19:20:30.45+01:00");
- assertEquals("45", d.getDecimalFraction());
- // Ex: 2004-04-13T11:53:15.4362784-04:00
- d = new DcDate("2004-04-13T11:53:15.4362784-04:00");
- assertEquals(13, d.getDay());
- assertEquals("4362784", d.getDecimalFraction());
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java b/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java
deleted file mode 100644
index e5bd2a2..0000000
--- a/modules/ws-messenger/client/src/test/java/org/apache/airavata/wsmg/gui/GUITest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.gui;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class GUITest {
-
- @Before
- public void setUp() throws Exception {
- }
-
- @After
- public void tearDown() throws Exception {
- }
-
- @Test
- public void testGUI() {
- NotificationViewer.main(null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/pom.xml b/modules/ws-messenger/commons/pom.xml
deleted file mode 100644
index 36dfb62..0000000
--- a/modules/ws-messenger/commons/pom.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-ws-messenger</artifactId>
- <version>0.15-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-messenger-commons</artifactId>
- <name>Airavata Messenger Commons</name>
- <url>http://airavata.apache.org/</url>
- <packaging>jar</packaging>
-
- <dependencies>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- Axis2 -->
- <!--dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-kernel</artifactId>
- <version>${axis2.version}</version>
- </dependency-->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/CommonRoutines.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/CommonRoutines.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/CommonRoutines.java
deleted file mode 100644
index 4c97419..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/CommonRoutines.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.StringWriter;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.net.SocketTimeoutException;
-import java.net.URI;
-import java.net.UnknownHostException;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.TimeZone;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.om.util.UUIDGenerator;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axiom.soap.SOAPHeaderBlock;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-
-public class CommonRoutines {
-
- private static XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
- private static XMLOutputFactory xmlOutputFactory = XMLOutputFactory.newInstance();
-
- // Format date to string like "2004-06-26T21:07:00.000-08:00"
- public static String getXsdDateTime(Date time) {
- Date now = time;
- DateFormat ISO8601Local = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS");
- TimeZone timeZone = TimeZone.getDefault();
- ISO8601Local.setTimeZone(timeZone);
- int offset = timeZone.getOffset(now.getTime());
- String sign = "+";
- if (offset < 0) {
- offset = -offset;
- sign = "-";
- }
- int hours = offset / 3600000;
- int minutes = (offset - hours * 3600000) / 60000;
- if (offset != hours * 3600000 + minutes * 60000) {
- // E.g. TZ=Asia/Riyadh87
- throw new RuntimeException("TimeZone offset (" + sign + offset + " ms) is not an exact number of minutes");
- }
- DecimalFormat twoDigits = new DecimalFormat("00");
- String ISO8601Now = ISO8601Local.format(now) + sign + twoDigits.format(hours) + ":" + twoDigits.format(minutes);
- return ISO8601Now;
- }
-
- public static SOAPEnvelope reader2SOAPEnvelope(Reader reader) throws XMLStreamException {
-
- XMLStreamReader inflow = getXMLInputFactory().createXMLStreamReader(reader);
-
- StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow);
- SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
- return omEnvelope;
- }
-
- private static XMLInputFactory getXMLInputFactory() {
- return xmlInputFactory;
- }
-
- private static XMLOutputFactory getXMLOutputFactory() {
- return xmlOutputFactory;
- }
-
- public static OMElement reader2OMElement(Reader reader) throws XMLStreamException {
-
- XMLStreamReader inflow = getXMLInputFactory().createXMLStreamReader(reader);
-
- StAXOMBuilder builder = new StAXOMBuilder(inflow);
- OMElement omElement = builder.getDocumentElement();
- return omElement;
- }
-
- public static String omToString(OMElement element) {
-
- StringWriter writer = new StringWriter();
-
- String ret = null;
- try {
- XMLStreamWriter streamWriter = getXMLOutputFactory().createXMLStreamWriter(writer);
-
- element.serializeAndConsume(streamWriter);
- streamWriter.flush();
- ret = writer.toString();
-
- } catch (Exception e) {
- throw new RuntimeException("unable to serialize the OMElement", e);
- }
- return ret;
- }
-
- public static boolean isAvailable(URI address) {
- // Create a socket with a timeout
- try {
- // exclude message box URL from availability check.
- // if(addressString.indexOf("MsgBox")>0) return true;
- // How to parse the address to port
- InetAddress addr = InetAddress.getByName(address.getHost());
- int port = address.getPort();
- if (port == -1) { // URI has no port, invalid URI. Here I choose not
- // to try port 80.
- return false;
- }
- SocketAddress sockaddr = new InetSocketAddress(addr, port);
-
- // Create an unbound socket
- Socket sock = new Socket();
-
- // This method will block no more than timeoutMs.
- // If the timeout occurs, SocketTimeoutException is thrown.
- int timeoutMs = 1000; // 2 seconds
- sock.connect(sockaddr, timeoutMs);
- sock.close();
- // System.out.println("Still
- // availabe:"+address.getHost()+":"+address.getPort());
- } catch (UnknownHostException e) {
- // e.printStackTrace();
- return false;
- } catch (SocketTimeoutException e) {
- // e.printStackTrace();
- return false;
- } catch (IOException e) {
- // e.printStackTrace();
- return false;
- }
-
- return true;
- }
-
- public static String readFromStream(InputStream in) throws IOException {
- StringBuffer wsdlStr = new StringBuffer();
-
- int read;
-
- byte[] buf = new byte[1024];
- while ((read = in.read(buf)) > 0) {
- wsdlStr.append(new String(buf, 0, read));
- }
- in.close();
- return wsdlStr.toString();
- }
-
- public static Options getOptions(String soapAction, long timeout, EndpointReference destination) {
- Options opts = new Options();
- opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.CHUNKED, Boolean.FALSE);
- opts.setAction(soapAction);
-
- opts.setTimeOutInMilliSeconds(timeout);
- opts.setMessageId(UUIDGenerator.getUUID());
- opts.setTo(destination);
-
- return opts;
- }
-
- public static void setHeaders(String soapAction, String destination, ServiceClient client,
- OMElement... customHeaders) throws AxisFault {
-
- SOAPFactory soapfactory = OMAbstractFactory.getSOAP11Factory();
-
- SOAPHeaderBlock msgId = soapfactory.createSOAPHeaderBlock("MessageID", NameSpaceConstants.WSA_NS);
- msgId.setText(UUIDGenerator.getUUID());
-
- SOAPHeaderBlock to = soapfactory.createSOAPHeaderBlock("To", NameSpaceConstants.WSA_NS);
- to.setText(destination);
-
- SOAPHeaderBlock action = soapfactory.createSOAPHeaderBlock("Action", NameSpaceConstants.WSA_NS);
- action.setText(soapAction);
-
- client.addHeader(action);
- client.addHeader(msgId);
- client.addHeader(to);
-
- for (OMElement h : customHeaders) {
- try {
- client.addHeader(org.apache.axiom.om.util.ElementHelper.toSOAPHeaderBlock(h, soapfactory));
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/MsgBoxQNameConstants.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/MsgBoxQNameConstants.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/MsgBoxQNameConstants.java
deleted file mode 100644
index fdef461..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/MsgBoxQNameConstants.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-import javax.xml.namespace.QName;
-
-public class MsgBoxQNameConstants {
-
- public static final QName MSG_BOXID_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "MsgBoxId", "msgbox");
- public static final QName MSGBOX_STATUS_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "status", "msgbox");
- public static final QName MSGBOX_MESSAGE_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "messages", "msgbox");
-
- /*
- * Request
- */
- public static final QName STOREMSG_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "storeMessages", "msgbox");
- public static final QName DESTROYMSG_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "destroyMsgBox", "msgbox");
- public static final QName TAKEMSGS_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "takeMessages", "msgbox");
- public static final QName CREATEMSG_BOX = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "createMsgBox", "msgbox");
-
- /*
- * Response
- */
- public static final QName STOREMSG_RESP_QNAME = new QName("http://org.apache.airavata/ws-messenger/msgbox/2011/",
- "storeMessagesResponse", "msgbox");
- public static final QName DESTROY_MSGBOX_RESP_QNAME = new QName(
- "http://org.apache.airavata/ws-messenger/msgbox/2011/", "destroyMsgBoxResponse", "msgbox");
- public static final QName CREATE_MSGBOX_RESP_QNAME = new QName(
- "http://org.apache.airavata/ws-messenger/msgbox/2011/", "createMsgBoxResponse", "msgbox");
- public static final QName TAKE_MSGBOX_RESP_QNAME = new QName(
- "http://org.apache.airavata/ws-messenger/msgbox/2011/", "takeMessagesResponse", "msgbox");
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/NameSpaceConstants.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/NameSpaceConstants.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/NameSpaceConstants.java
deleted file mode 100644
index 9fce3ff..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/NameSpaceConstants.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-
-public abstract class NameSpaceConstants {
-
- public final static OMFactory factory = OMAbstractFactory.getOMFactory();
-
- public final static OMNamespace WSMG_NS = factory.createOMNamespace(
- "http://org.apache.airavata/ws-messenger/wsmg/2011", "wsmg");
-
- public final static OMNamespace MSG_BOX = factory.createOMNamespace(
- "http://org.apache.airavata/ws-messenger/msgbox/2011", "msgbox");
-
- public final static OMNamespace WIDGET_NS = factory.createOMNamespace("http://widgets.com", "widget");
-
- /**
- * WS Addressing
- */
- public final static OMNamespace WSA_NS = factory.createOMNamespace("http://www.w3.org/2005/08/addressing", "wsa");
-
- /**
- * WS Notification
- *
- * https://www.ibm.com/developerworks/library/specification/ws-notification/
- *
- */
- public final static OMNamespace WSNT_NS = factory.createOMNamespace(
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BaseNotification", "wsnt");
-
- public final static OMNamespace WSBR_NS = factory.createOMNamespace(
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-BrokeredNotification", "wsbn");
-
- /**
- * WS Resource specification namespace
- *
- * http://www.ibm.com/developerworks/webservices/library/specification/ws-resource/
- *
- */
- public final static OMNamespace WSRP_NS = factory.createOMNamespace(
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceProperties", "wsrp");
-
- public final static OMNamespace WSRL_NS = factory.createOMNamespace(
- "http://www.ibm.com/xmlns/stdwip/web-services/WS-ResourceLifetime", "wsrl");
-
- /**
- * Web Services Eventing (WS-Eventing)
- *
- * http://schemas.xmlsoap.org/ws/2004/08/eventing/
- */
- public final static OMNamespace WSE_NS = factory.createOMNamespace(
- "http://schemas.xmlsoap.org/ws/2004/08/eventing", "wse");
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgCommonConstants.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgCommonConstants.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgCommonConstants.java
deleted file mode 100644
index 4e7d245..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgCommonConstants.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-public class WsmgCommonConstants {
-
- public static final String AXIS_MODULE_NAME_ADDRESSING = "addressing";
-
- public final static String VERSION = WsmgVersion.getSpecVersion(); // "0.14";
-
- public final static String UTF8 = "UTF-8";
-
- public final static String TOPIC_PREFIX = "topic/";
-
- public final static String PREFIX = "" + System.currentTimeMillis();
-
- public final static String SUBSCRIPTION_POLICY = "SubscriptionPolicy";
-
- public final static String SUBSCRIPTION_ID = "Identifier";
-
- public final static String WILDCARD_TOPIC = ">";
-
- public final static String TOPIC_EXPRESSION_SIMPLE_DIALECT = "http://www.ibm.com/xmlns/stdwip/web-services/WS-Topics/TopicExpression/simple";
- public final static String XPATH_DIALECT = "http://www.w3.org/TR/1999/REC-xpath-19991116";
- public final static String TOPIC_AND_XPATH_DIALECT = "http://docs.oasis-open.org/wsn";
-
- public static final String WSMG_PLAIN_TEXT_WRAPPER = "plainTextWrapper";
-
- public static final int WSRM_POLICY_TRUE = 1;
-
- public static final int WSRM_POLICY_FALSE = 0;
-
- public static final String BROKER_SERVICE_LOCATION = "broker.service.location";
-
- public static final String BROKER_WSMGCONFIG = "broker.wsmgconfig";
-
- public static final String BROKER_INITED = "broker.inited";
-
- public static final String EPR_SOURCE_HELPER_TO_OM_GET_EPR_PROPERTIES = "http://www.w3.org/2005/08/addressing";
-
- public final static String WSMG_PUBLISH_SOAP_ACTION = "http://org.apache.airavata/WseNotification";
-
- public static final String STORAGE_TYPE_IN_MEMORY = "memory";
- public static final String STORAGE_TYPE_PERSISTANT = "persistent";
-
- public static final String DELIVERY_METHOD_THREAD_CREW = "pcrew";
- public static final String DELIVERY_METHOD_PARALLEL = "parallel";
- public static final String DELIVERY_METHOD_SERIAL = "serial";
-
- public static final int DEFAULT_SENDING_BATCH_SIZE = 10;
- public static final int DEFAULT_SENDING_THREAD_POOL_SIZE = 4;
-
- public static final long DEFAULT_CLIENT_SOCKET_TIME_OUT_MILLIES = 300000L;
- public static final int DEFAULT_SUBSCRIPTION_EXPIRATION_TIME = 1000 * 60 * 60 * 72; // 72 hours
-
-// public static final String CONFIGURATION_FILE_NAME = "configuration.file.name";
- public static final String CONFIG_JDBC_URL = "broker.jdbc.url";
- public static final String CONFIG_JDBC_DRIVER = "broker.jdbc.driver";
- public static final String CONFIG_START_DELIVERY_THREADS = "broker.start.delivery.thread";
- public static final String CONFIG_DELIVERY_METHOD = "broker.delivery.method";
- public static final String CONFIG_STORAGE_TYPE = "broker.storage.type";
- public static final String CONFIG_SOCKET_TIME_OUT = "broker.socket.timeout";
- public static final String CONFIG_MAX_MESSAGE_DELIVER_RETRIES = "broker.msg.delivery.retries";
- public static final String CONFIG_AXIS2_REPO = "axis2.repository";
- public static final String CONFIG_CONSUMER_URL_EXPIRATION_TIME_GAP = "consumer.expiration.time.gap";
-
- public static final String CONFIG_SENDING_BATCH_SIZE = "sending.batch.size";
- public static final String CONFIG_SENDING_THREAD_POOL_SIZE = "sending.thread.pool.size";
-
-// public static final String BROKER_CONFIGURATION_FILE_NAME = "airavata-server.properties";
-
- public static final String DELIVERY_PROTOCOL = "broker.delivery.protocol";
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgVersion.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgVersion.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgVersion.java
deleted file mode 100644
index 8e097eb..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/WsmgVersion.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons;
-
-public class WsmgVersion {
-
- public final static String SPEC_VERSION = "1.0.0";
-
- private final static String BUILD = "";
-
- private final static String PROJECT_NAME = "WSMG";
-
- private final static String IMPL_VERSION = SPEC_VERSION + BUILD;
-
- private final static String USER_AGENT = PROJECT_NAME + "/" + IMPL_VERSION;
-
- private static int VERSION_MAJOR = -1;
-
- private static int VERSION_MINOR = -1;
-
- private static int VERSION_INCREMENT = -1;
-
- public static String getUserAgent() {
- return USER_AGENT;
- }
-
- public static String getVersion() {
- return SPEC_VERSION;
- }
-
- public static String getSpecVersion() {
- return SPEC_VERSION;
- }
-
- public static String getImplementationVersion() {
- return IMPL_VERSION;
- }
-
- /**
- * Print version when exxecuted from command line.
- */
- public static void main(String[] args) {
- String SPEC_OPT = "-spec";
- String IMPL_OPT = "-impl";
- if (SPEC_OPT.equals(args[0])) {
- System.out.println(SPEC_VERSION);
- } else if (IMPL_OPT.equals(args[0])) {
- System.out.println(IMPL_VERSION);
- } else {
- System.err
- .println(WsmgVersion.class.getName() + " Error: " + SPEC_OPT + " or " + IMPL_OPT + " is required");
- System.exit(1);
- }
-
- }
-
- public static void requireVersionOrExit(String version) {
- try {
- requireVersion(version);
- } catch (Exception ex) {
- ex.printStackTrace(System.err);
- System.err.println("Error: could not find required version " + version + " of " + PROJECT_NAME + ": "
- + ex.getMessage());
- System.err.println("Please make sure that JAR file with " + PROJECT_NAME + " with version " + version
- + " (or higher) is available.");
- System.err.println("Please make sure there is no more than one JAR file with " + PROJECT_NAME);
- System.err.println("Exiting");
- System.exit(1);
- }
- }
-
- /**
- * Version mut be of form M.N[.K] where M is major version, N is minor version and K is icrement. This method
- * returns true if current major version is the same and minor is bigger or equal to current minor verion. If
- * provided major and minor verisons are equals to current version then increment is also checked and check is
- * passed when increment is bigger or equal to current increment version.
- */
- public static void requireVersion(String version) throws IllegalStateException {
- // check dependencies
-
- // NOTE: this is safe as int operations are atomic ...
- if (VERSION_MAJOR < 0)
- extractCurrentVersion();
- int[] parsed;
- try {
- parsed = parseVersion(version);
- } catch (NumberFormatException ex) {
- throw new IllegalStateException("could not parse " + PROJECT_NAME + " version string " + version);
- }
- int major = parsed[0];
- int minor = parsed[1];
- int increment = parsed[2];
-
- if (major != VERSION_MAJOR) {
- throw new IllegalStateException("required " + PROJECT_NAME + " " + version + " has different major version"
- + " from current " + SPEC_VERSION);
- }
- if (minor > VERSION_MINOR) {
- throw new IllegalStateException("required " + PROJECT_NAME + " " + version + " has too big minor version"
- + " when compared to current " + SPEC_VERSION);
- }
- if (minor == VERSION_MINOR) {
- if (increment > VERSION_INCREMENT) {
- throw new IllegalStateException("required " + PROJECT_NAME + " " + version
- + " has too big increment version" + " when compared to current " + SPEC_VERSION);
- }
- }
- }
-
- /**
- * Parse verion string N.M[.K] into thre subcomponents (M=major,N=minor,K=increment) that are returned in array with
- * three elements. M and N must be non negative, and K if present must be positive integer. Increment K is optional
- * and if not present in verion strig it is returned as zero.
- */
- public static int[] parseVersion(String version) throws NumberFormatException {
- int[] parsed = new int[3];
- int firstDot = version.indexOf('.');
- if (firstDot == -1) {
- throw new NumberFormatException("expected version string N.M but there is no dot in " + version);
- }
- String majorVersion = version.substring(0, firstDot);
- parsed[0] = Integer.parseInt(majorVersion);
- if (parsed[0] < 0) {
- throw new NumberFormatException("major N version number in N.M can not be negative in " + version);
- }
- int secondDot = version.indexOf('.', firstDot + 1);
- String minorVersion;
- if (secondDot >= 0) {
- minorVersion = version.substring(firstDot + 1, secondDot);
- } else {
- minorVersion = version.substring(firstDot + 1);
- }
- parsed[1] = Integer.parseInt(minorVersion);
- if (parsed[1] < 0) {
- throw new NumberFormatException("minor M version number in N.M can not be negative in " + version);
- }
- if (secondDot >= 0) {
- String incrementVersion = version.substring(secondDot + 1);
- parsed[2] = Integer.parseInt(incrementVersion);
- if (parsed[2] < 0) {
- throw new NumberFormatException("increment K version number in N.M.K must be positive number in "
- + version);
- }
- }
- return parsed;
- }
-
- private static synchronized void extractCurrentVersion() throws IllegalStateException {
- int[] parsed;
- try {
- parsed = parseVersion(SPEC_VERSION);
- } catch (NumberFormatException ex) {
- throw new IllegalStateException("internal problem: could not parse current " + PROJECT_NAME
- + " version string " + SPEC_VERSION);
- }
- VERSION_MAJOR = parsed[0];
- VERSION_MINOR = parsed[1];
- VERSION_INCREMENT = parsed[2];
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/config/ConfigurationManager.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/config/ConfigurationManager.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/config/ConfigurationManager.java
deleted file mode 100644
index 004a98c..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/config/ConfigurationManager.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.config;
-
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ConfigurationManager {
- protected static final Logger logger = LoggerFactory.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:::" + configFileName, e);
-// }
-// }
-
- public String getConfig(String configName) throws Exception {
- try {
- return ServerSettings.getSetting(configName);
- } catch (ApplicationSettingsException e) {
- logger.error(e.getMessage(), e);
- throw new Exception(e.getMessage(), e);
- }
- }
-
- public String getConfig(String configName, String defaultVal) {
- return ServerSettings.getSetting(configName, defaultVal);
- }
-
- public int getConfig(String configName, int defaultVal) {
- return Integer.parseInt(getConfig(configName, Integer.toString(defaultVal)));
- }
-
- public long getConfig(String configName, long defaultVal) throws ApplicationSettingsException {
- return Long.parseLong(getConfig(configName, Long.toString(defaultVal)));
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/ConnectionPool.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/ConnectionPool.java
deleted file mode 100644
index 127c0b2..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/ConnectionPool.java
+++ /dev/null
@@ -1,363 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Stack;
-import java.util.concurrent.Semaphore;
-
-import javax.sql.DataSource;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A class for preallocating, recycling, and managing JDBC connections.
- */
-public class ConnectionPool {
- private static final Logger logger = LoggerFactory.getLogger(ConnectionPool.class);
-
- private long MAX_IDLE_TIME = 5 * 60 * 1000; // 5 minutes
-
- private String driver;
- private String url;
- private String username;
- private String password;
- private String jdbcUrl;
-
- private int maxConnections;
-
- private boolean autoCommit = true;
- private boolean waitIfBusy;
-
- private Semaphore needConnection = new Semaphore(0);
- private boolean stop;
-
- private Stack<Connection> availableConnections;
- private Stack<Connection> busyConnections;
-
- private HashMap<Connection, Long> lastAccessTimeRecord = new HashMap<Connection, Long>();
-
- private String urlType = "";
-
- private DataSource datasource;
-
- private int transactionIsolation = Connection.TRANSACTION_NONE;
-
- private Thread clenupThread;
- private Thread producerThread;
-
- public ConnectionPool(String driver, String url, String username, String password, int initialConnections,
- int maxConnections, boolean waitIfBusy) throws SQLException {
- this.driver = driver;
- this.url = url;
- this.username = username;
- this.password = password;
- this.urlType = "speratedURL";
- initialize(initialConnections, maxConnections, waitIfBusy);
- }
-
- public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections,
- boolean waitIfBusy, boolean autoCommit, int transactionIsolation) throws SQLException {
- this.driver = driver;
- this.jdbcUrl = jdbcUrl;
- this.urlType = "simpleURL";
- this.autoCommit = autoCommit;
- this.transactionIsolation = transactionIsolation;
- initialize(initialConnections, maxConnections, waitIfBusy);
- }
-
- public ConnectionPool(String driver, String jdbcUrl, int initialConnections, int maxConnections, boolean waitIfBusy)
- throws SQLException {
- this.driver = driver;
- this.jdbcUrl = jdbcUrl;
- this.urlType = "simpleURL";
- initialize(initialConnections, maxConnections, waitIfBusy);
- }
-
- public ConnectionPool(DataSource dataSource, int initialConnections, int maxConnections, boolean waitIfBusy)
- throws SQLException {
- this.urlType = "dataSource";
- this.datasource = dataSource;
- initialize(initialConnections, maxConnections, waitIfBusy);
- }
-
- /**
- * Check if this connection pool is auto commit or not
- *
- * @return
- */
- public boolean isAutoCommit() {
- return this.autoCommit;
- }
-
- private void initialize(int initialConnections, int maxConnections, boolean waitIfBusy) throws SQLException {
- this.maxConnections = maxConnections;
- this.waitIfBusy = waitIfBusy;
-
- int sizeOfConnections = (initialConnections > maxConnections) ? maxConnections : initialConnections;
-
- availableConnections = new Stack<Connection>();
- busyConnections = new Stack<Connection>();
-
- for (int i = 0; i < sizeOfConnections; i++) {
- Connection con = makeNewConnection();
- setTimeStamp(con);
- availableConnections.push(con);
-
- }
-
- producerThread = new Thread(new FillUpThread());
- producerThread.start();
-
- clenupThread = new Thread(new CleanUpThread());
- clenupThread.start();
- }
-
- public synchronized Connection getConnection() throws SQLException {
- if (!availableConnections.isEmpty()) {
- Connection existingConnection = availableConnections.pop();
-
- // If connection on available list is closed (e.g.,
- // it timed out), then remove it from available list
- // and race for a connection again.
- if (existingConnection.isClosed()) {
- lastAccessTimeRecord.remove(existingConnection);
- // notifyAll for fairness
- notifyAll();
- } else {
- busyConnections.push(existingConnection);
- setTimeStamp(existingConnection);
- return existingConnection;
- }
- } else if (!waitIfBusy && busyConnections.size() >= maxConnections) {
- // You reached maxConnections limit and waitIfBusy flag is false.
- // Throw SQLException in such a case.
- throw new SQLException("Connection limit reached");
- } else {
-
- if (busyConnections.size() < maxConnections) {
- // available connection is empty, but total number of connection
- // doesn't reach maxConnection. Request for more connection
- needConnection.release();
- }
-
- try {
- // wait for free connection
- wait();
- } catch (InterruptedException ie) {
- }
- }
- // always race for connection forever
- return getConnection();
- }
-
- // This explicitly makes a new connection. Called in
- // the foreground when initializing the ConnectionPool,
- // and called in the background when running.
- private Connection makeNewConnection() throws SQLException {
- try {
- // Load database driver if not already loaded
- Class.forName(driver);
- Connection connection;
- // Establish network connection to database
- if (urlType.equals("speratedURL")) {
- connection = DriverManager.getConnection(url, username, password);
- } else if (urlType.equals("simpleURL")) {
- connection = DriverManager.getConnection(jdbcUrl);
- } else { // if(urlType.equals("dataSource")){
- connection = datasource.getConnection();
- }
- connection.setTransactionIsolation(this.transactionIsolation);
- connection.setAutoCommit(this.autoCommit);
- return connection;
- } catch (ClassNotFoundException cnfe) {
- // Simplify try/catch blocks of people using this by
- // throwing only one exception type.
- throw new SQLException("Can't find class for driver: " + driver);
- }
- }
-
- private synchronized void fillUpConnection(Connection conn) {
- setTimeStamp(conn);
- availableConnections.push(conn);
-
- // notify all since new connection is created
- notifyAll();
- }
-
- private void setTimeStamp(Connection connection) {
- lastAccessTimeRecord.put(connection, System.currentTimeMillis());
- }
-
- // The database connection cannot be left idle for too long, otherwise TCP
- // connection will be broken.
- /**
- * From http://forums.mysql.com/read.php?39,28450,57460#msg-57460 Okay, then it looks like wait_timeout on the
- * server is killing your connection (it is set to 8 hours of idle time by default). Either set that value higher on
- * your server, or configure your connection pool to not hold connections idle that long (I prefer the latter). Most
- * folks I know that run MySQL with a connection pool in high-load production environments only let connections sit
- * idle for a matter of minutes, since it only takes a few milliseconds to open a connection, and the longer one
- * sits idle the more chance it will go "bad" because of a network hiccup or the MySQL server being restarted.
- *
- * @throws SQLException
- */
- private boolean isConnectionStale(Connection connection) {
- long currentTime = System.currentTimeMillis();
- long lastAccess = lastAccessTimeRecord.get(connection);
- if (currentTime - lastAccess > MAX_IDLE_TIME) {
- return true;
- } else
- return false;
- }
-
- private synchronized void closeStaleConnections() {
- // close idle connections
- Iterator<Connection> iter = availableConnections.iterator();
- while (iter.hasNext()) {
- Connection existingConnection = iter.next();
- if (isConnectionStale(existingConnection)) {
- try {
- existingConnection.close();
- iter.remove();
- } catch (SQLException sql) {
- logger.error(sql.getMessage(), sql);
- }
- }
- }
- // close busy connections that have been checked out for too long.
- // This should not happen since this means program has bug for not
- // releasing connections .
- iter = busyConnections.iterator();
- while (iter.hasNext()) {
- Connection busyConnection = iter.next();
- if (isConnectionStale(busyConnection)) {
- try {
- busyConnection.close();
- iter.remove();
- logger.warn("****Connection has checked out too long. Forced release. Check the program for calling release connection [free(Connection) method]");
- } catch (SQLException sql) {
- logger.error(sql.getMessage(), sql);
- }
- }
- }
- }
-
- public synchronized void free(Connection connection) {
- busyConnections.removeElement(connection);
- availableConnections.addElement(connection);
- // Wake up threads that are waiting for a connection
- notifyAll();
- }
-
- /**
- * Close all the connections. Use with caution: be sure no connections are in use before calling. Note that you are
- * not <I>required</I> to call this when done with a ConnectionPool, since connections are guaranteed to be closed
- * when garbage collected. But this method gives more control regarding when the connections are closed.
- */
- public synchronized void dispose() {
- logger.info("Connection Pool Shutting down");
-
- // stop clean up thread
- this.stop = true;
- this.clenupThread.interrupt();
-
- // stop producer up thread
- this.producerThread.interrupt();
-
- // close all connection
- closeConnections(availableConnections);
- availableConnections = new Stack<Connection>();
- closeConnections(busyConnections);
- busyConnections = new Stack<Connection>();
- lastAccessTimeRecord.clear();
-
- logger.info("All connection is closed");
-
- try {
- this.clenupThread.join();
- this.producerThread.join();
- } catch (Exception e) {
- logger.error("Cannot shutdown cleanup thread", e);
- }
-
- logger.info("Connection Pool Shutdown");
- }
-
- private void closeConnections(Stack<Connection> connections) {
- while (!connections.isEmpty()) {
- Connection connection = connections.pop();
- try {
- if (!connection.isClosed()) {
- connection.close();
- }
- } catch (SQLException sqle) {
- // Ignore errors; garbage collect anyhow
- logger.warn(sqle.getMessage());
- }
- }
- }
-
- public synchronized String toString() {
- String info = "ConnectionPool(" + url + "," + username + ")" + ", available=" + availableConnections.size()
- + ", busy=" + busyConnections.size() + ", max=" + maxConnections;
- return (info);
- }
-
- class CleanUpThread implements Runnable {
- public void run() {
- while (!stop) {
- try {
- Thread.sleep(MAX_IDLE_TIME);
- closeStaleConnections();
- } catch (InterruptedException e) {
- logger.info("Clean up thread is interrupted to close");
- }
- }
- }
- }
-
- class FillUpThread implements Runnable {
- public void run() {
- while (!stop) {
- try {
- // block until get
- needConnection.acquire();
-
- Connection conn = makeNewConnection();
- fillUpConnection(conn);
- } catch (SQLException e) {
- // cannot create connection (increase semaphore value back)
- needConnection.release();
- logger.error(e.getMessage(), e);
- } catch (InterruptedException e) {
- logger.info("Fill up thread is interrupted to close");
- break;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/DatabaseCreator.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/DatabaseCreator.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/DatabaseCreator.java
deleted file mode 100644
index 9ca9c1e..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/DatabaseCreator.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.SQLWarning;
-import java.sql.Statement;
-import java.util.StringTokenizer;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class creates the database tables required for messagebox and messagebroker with default configuration this
- * class creates embedded derby database in local file system. User can specify required database in appropriate
- * properties files.
- */
-public class DatabaseCreator {
-
- public enum DatabaseType {
- derby("(?i).*derby.*"), mysql("(?i).*mysql.*"), other("");
-
- private String pattern;
-
- private DatabaseType(String matchingPattern) {
- this.pattern = matchingPattern;
- }
-
- public String getMatchingPattern() {
- return this.pattern;
- }
- }
-
- private static DatabaseType[] supportedDatabase = new DatabaseType[] { DatabaseType.derby, DatabaseType.mysql };
-
- private static Logger log = LoggerFactory.getLogger(DatabaseCreator.class);
- private static final String delimiter = ";";
-
- /**
- * Creates database
- *
- * @throws Exception
- */
- public static void createMsgBoxDatabase(Connection conn) throws Exception {
- createDatabase("msgBox", conn);
- }
-
- /**
- * Creates database
- *
- * @throws Exception
- */
- public static void createMsgBrokerDatabase(Connection conn) throws Exception {
- createDatabase("msgBroker", conn);
- }
-
- /**
- * Checks whether database tables are created by using select * on given table name
- *
- * @param tableName
- * Table which should be existed
- * @return <code>true</core> if checkSQL is success, else <code>false</code> .
- */
- public static boolean isDatabaseStructureCreated(String tableName, Connection conn) {
- try {
-
- log.debug("Running a query to test the database tables existence.");
-
- // check whether the tables are already created with a query
- Statement statement = null;
- try {
- statement = conn.createStatement();
- ResultSet rs = statement.executeQuery("select * from " + tableName);
- if (rs != null) {
- rs.close();
- }
- } finally {
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- return false;
- }
- }
- } catch (SQLException e) {
- return false;
- }
-
- return true;
- }
-
- /**
- * executes given sql
- *
- * @param sql
- * @throws Exception
- */
- private static void executeSQL(String sql, Connection conn) throws Exception {
- // Check and ignore empty statements
- if ("".equals(sql.trim())) {
- return;
- }
-
- Statement statement = null;
- try {
- log.debug("SQL : " + sql);
-
- boolean ret;
- int updateCount = 0, updateCountTotal = 0;
- statement = conn.createStatement();
- ret = statement.execute(sql);
- updateCount = statement.getUpdateCount();
- do {
- if (!ret) {
- if (updateCount != -1) {
- updateCountTotal += updateCount;
- }
- }
- ret = statement.getMoreResults();
- if (ret) {
- updateCount = statement.getUpdateCount();
- }
- } while (ret);
-
- log.debug(sql + " : " + updateCountTotal + " rows affected");
-
- SQLWarning warning = conn.getWarnings();
- while (warning != null) {
- log.warn(warning + " sql warning");
- warning = warning.getNextWarning();
- }
- conn.clearWarnings();
- } catch (SQLException e) {
- if (e.getSQLState().equals("X0Y32")) {
- // eliminating the table already exception for the derby
- // database
- log.info("Table Already Exists", e);
- } else {
- throw new Exception("Error occurred while executing : " + sql, e);
- }
- } finally {
- if (statement != null) {
- try {
- statement.close();
- } catch (SQLException e) {
- log.error("Error occurred while closing result set.", e);
- }
- }
- }
- }
-
- /**
- * computes relatational database type using database name
- *
- * @return DatabaseType
- * @throws Exception
- *
- */
- public static DatabaseType getDatabaseType(Connection conn) throws Exception {
- try {
- if (conn != null && (!conn.isClosed())) {
- DatabaseMetaData metaData = conn.getMetaData();
- String databaseProductName = metaData.getDatabaseProductName();
- return checkType(databaseProductName);
- }
- } catch (SQLException e) {
- String msg = "Failed to create Airavatadatabase." + e.getMessage();
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- return DatabaseType.other;
- }
-
- /**
- * Overloaded method with String input
- *
- * @return DatabaseType
- * @throws Exception
- *
- */
- public static DatabaseType getDatabaseType(String dbUrl) throws Exception {
- return checkType(dbUrl);
- }
-
- private static DatabaseType checkType(String text) throws Exception {
- try {
- if (text != null) {
- for (DatabaseType type : supportedDatabase) {
- if (text.matches(type.getMatchingPattern()))
- return type;
- }
- }
- String msg = "Unsupported database: " + text
- + ". Database will not be created automatically by the Airavata. "
- + "Please create the database using appropriate database scripts for " + "the database.";
- throw new Exception(msg);
-
- } catch (SQLException e) {
- String msg = "Failed to create Airavatadatabase." + e.getMessage();
- log.error(msg, e);
- throw new Exception(msg, e);
- }
- }
-
- /**
- * Get scripts location which is prefix + "-" + databaseType + ".sql"
- *
- * @param prefix
- * @param databaseType
- * @return script location
- */
- private static String getScriptLocation(String prefix, DatabaseType databaseType) {
- String scriptName = prefix + "-" + databaseType + ".sql";
- log.debug("Loading database script from :" + scriptName);
- return "database_scripts" + File.separator + scriptName;
- }
-
- private static void createDatabase(String prefix, Connection conn) throws Exception {
- Statement statement = null;
- try {
- conn.setAutoCommit(false);
- statement = conn.createStatement();
- executeSQLScript(getScriptLocation(prefix, DatabaseCreator.getDatabaseType(conn)), conn);
- conn.commit();
- log.debug("Tables are created successfully.");
- } catch (SQLException e) {
- String msg = "Failed to create database tables for Airavata resource store. " + e.getMessage();
- log.error(msg, e);
- conn.rollback();
- throw new Exception(msg, e);
- } finally {
- conn.setAutoCommit(true);
- try {
- if (statement != null) {
- statement.close();
- }
- } catch (SQLException e) {
- log.error("Failed to close statement.", e);
- }
- }
- }
-
- private static void executeSQLScript(String dbscriptName, Connection conn) throws Exception {
- StringBuffer sql = new StringBuffer();
- BufferedReader reader = null;
-
- try {
- InputStream is = DatabaseCreator.class.getClassLoader().getResourceAsStream(dbscriptName);
- if(is == null){
- is = DatabaseCreator.class.getClassLoader().getResourceAsStream((new File(dbscriptName)).getName());
- }
- reader = new BufferedReader(new InputStreamReader(is));
- String line;
- while ((line = reader.readLine()) != null) {
- line = line.trim();
- if (line.startsWith("//")) {
- continue;
- }
- if (line.startsWith("--")) {
- continue;
- }
- StringTokenizer st = new StringTokenizer(line);
- if (st.hasMoreTokens()) {
- String token = st.nextToken();
- if ("REM".equalsIgnoreCase(token)) {
- continue;
- }
- }
- sql.append(" ").append(line);
-
- // SQL defines "--" as a comment to EOL
- // and in Oracle it may contain a hint
- // so we cannot just remove it, instead we must end it
- if (line.indexOf("--") >= 0) {
- sql.append("\n");
- }
- if ((checkStringBufferEndsWith(sql, delimiter))) {
- executeSQL(sql.substring(0, sql.length() - delimiter.length()), conn);
- sql.replace(0, sql.length(), "");
- }
- }
- // Catch any statements not followed by ;
- if (sql.length() > 0) {
- executeSQL(sql.toString(), conn);
- }
- } catch (IOException e) {
- log.error("Error occurred while executing SQL script for creating Airavata database", e);
- throw new Exception("Error occurred while executing SQL script for creating Airavata database", e);
-
- } finally {
- if (reader != null) {
- reader.close();
- }
- }
- }
-
- /**
- * Checks that a string buffer ends up with a given string. It may sound trivial with the existing JDK API but the
- * various implementation among JDKs can make those methods extremely resource intensive and perform poorly due to
- * massive memory allocation and copying. See
- *
- * @param buffer
- * the buffer to perform the check on
- * @param suffix
- * the suffix
- * @return <code>true</code> if the character sequence represented by the argument is a suffix of the character
- * sequence represented by the StringBuffer object; <code>false</code> otherwise. Note that the result will
- * be <code>true</code> if the argument is the empty string.
- */
- public static boolean checkStringBufferEndsWith(StringBuffer buffer, String suffix) {
- if (suffix.length() > buffer.length()) {
- return false;
- }
- // this loop is done on purpose to avoid memory allocation performance
- // problems on various JDKs
- // StringBuffer.lastIndexOf() was introduced in jdk 1.4 and
- // implementation is ok though does allocation/copying
- // StringBuffer.toString().endsWith() does massive memory
- // allocation/copying on JDK 1.5
- // See http://issues.apache.org/bugzilla/show_bug.cgi?id=37169
- int endIndex = suffix.length() - 1;
- int bufferIndex = buffer.length() - 1;
- while (endIndex >= 0) {
- if (buffer.charAt(bufferIndex) != suffix.charAt(endIndex)) {
- return false;
- }
- bufferIndex--;
- endIndex--;
- }
- return true;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/JdbcStorage.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/JdbcStorage.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/JdbcStorage.java
deleted file mode 100644
index 03c4a0a..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/storage/JdbcStorage.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.storage;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class JdbcStorage {
- private static Logger log = LoggerFactory.getLogger(JdbcStorage.class);
-
- private ConnectionPool connectionPool;
-
- public JdbcStorage(String jdbcUrl, String jdbcDriver) {
- // default init connection and max connection
- this(3, 50, jdbcUrl, jdbcDriver, true);
- }
-
- public JdbcStorage(int initCon, int maxCon, String url, String driver, boolean enableTransactions) {
- try {
- if (enableTransactions) {
- connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true, false,
- Connection.TRANSACTION_SERIALIZABLE);
- } else {
- connectionPool = new ConnectionPool(driver, url, initCon, maxCon, true);
- }
- } catch (Exception e) {
- throw new RuntimeException("Failed to create database connection pool.", e);
- }
- }
-
- /**
- * Check if this connection pool is auto commit or not
- *
- * @return
- */
- public boolean isAutoCommit() {
- return connectionPool.isAutoCommit();
- }
-
- public void commit(Connection conn) {
- try {
- if (conn != null && !conn.getAutoCommit()) {
- conn.commit();
- }
- } catch (SQLException sqle) {
- log.error("Cannot commit data", sqle);
- }
- }
-
- public void commitAndFree(Connection conn) {
- commit(conn);
- closeConnection(conn);
- }
-
- public void rollback(Connection conn) {
- try {
- if (conn != null && !conn.getAutoCommit()) {
- conn.rollback();
- }
- } catch (SQLException sqle) {
- log.error("Cannot Rollback data", sqle);
- }
- }
-
- public void rollbackAndFree(Connection conn) {
- rollback(conn);
- closeConnection(conn);
- }
-
- public Connection connect() throws SQLException{
-
- Connection conn = null;
- try {
- conn = connectionPool.getConnection();
- } catch (SQLException e) {
- log.error(e.getMessage(), e);
- throw new SQLException(e);
- }
- return conn;
- }
-
- /**
- * This method is provided so that you can have better control over the statement. For example: You can use
- * stmt.setString to convert quotation mark automatically in an UPDATE statement
- *
- * NOTE: Statement is closed after execution
- */
- public int executeUpdateAndClose(PreparedStatement stmt) throws SQLException {
- int rows = 0;
- try {
- rows = stmt.executeUpdate();
- if (rows == 0) {
- log.info("Problem: 0 rows affected by insert/update/delete statement.");
- }
- } finally {
- stmt.close();
- }
- return rows;
- }
-
- public int executeUpdateAndCloseWithPrintLogMessages(PreparedStatement stmt, boolean printLogs) throws SQLException {
- int rows = 0;
- try {
- rows = stmt.executeUpdate();
- if (rows == 0) {
- if(printLogs){
- log.info("Problem: 0 rows affected by insert/update/delete statement.");
- }
- }
- } finally {
- stmt.close();
- }
- return rows;
- }
-
- public int countRow(String tableName, String columnName) throws SQLException {
- String query = new String("SELECT COUNT(" + columnName + ") FROM " + tableName);
- int count = -1;
- Connection conn = null;
- PreparedStatement stmt = null;
- try {
- conn = connectionPool.getConnection();
- stmt = conn.prepareStatement(query);
- ResultSet rs = stmt.executeQuery();
- rs.next();
- count = rs.getInt(1);
- commit(conn);
- } catch (SQLException sql) {
- rollback(conn);
- throw sql;
- } finally {
- try {
- if (stmt != null && !stmt.isClosed()) {
- stmt.close();
- }
- } finally {
- closeConnection(conn);
- }
- }
- return count;
- }
-
- public void quietlyClose(Connection conn, Statement... stmts) {
- if (stmts != null) {
- for (Statement stmt : stmts) {
- try {
- if (stmt != null && !stmt.isClosed()) {
- stmt.close();
- }
- } catch (SQLException sql) {
- log.error(sql.getMessage(), sql);
- }
- }
- }
- closeConnection(conn);
- }
-
- public void closeConnection(Connection conn) {
- if (conn != null) {
- connectionPool.free(conn);
- }
- }
-
- public void closeAllConnections() {
- if (connectionPool != null)
- connectionPool.dispose();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/util/Axis2Utils.java
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/util/Axis2Utils.java b/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/util/Axis2Utils.java
deleted file mode 100644
index d74b259..0000000
--- a/modules/ws-messenger/commons/src/main/java/org/apache/airavata/wsmg/commons/util/Axis2Utils.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.wsmg.commons.util;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.dispatchers.AddressingBasedDispatcher;
-import org.apache.axis2.engine.Handler;
-import org.apache.axis2.engine.Phase;
-
-public class Axis2Utils {
-
- public static void overrideAddressingPhaseHander(ConfigurationContext configContext,
- AddressingBasedDispatcher dispatcher) {
-
- List<Phase> inflowPhases = configContext.getAxisConfiguration().getPhasesInfo().getINPhases();
- boolean foundFlag = false;
-
- for (Phase p : inflowPhases) {
-
- if (p.getName().equalsIgnoreCase("Addressing")) {
-
- List<Handler> handlers = p.getHandlers();
-
- for (Iterator<Handler> ite = handlers.iterator(); ite.hasNext();) {
- Handler h = ite.next();
- if (h.getClass().isAssignableFrom(dispatcher.getClass())) {
- p.removeHandler(h.getHandlerDesc());
- break;
- }
- }
-
- p.addHandler(dispatcher, 0);
- foundFlag = true;
- break;
- }
-
- }
-
- if (!foundFlag) {
- throw new RuntimeException("unable to find addressing phase - inside inflow phases");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/message-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/message-monitor/pom.xml b/modules/ws-messenger/message-monitor/pom.xml
deleted file mode 100644
index 35bc3ff..0000000
--- a/modules/ws-messenger/message-monitor/pom.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theÏ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-ws-messenger</artifactId>
- <version>0.15-SNAPSHOT</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-message-monitor</artifactId>
- <name>Airavata WS Monitor</name>
- <url>http://airavata.apache.org/</url>
- <packaging>jar</packaging>
-
-
- <dependencies>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-model-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>atomixmiser</artifactId>
- <version>${atomixmiser.version}</version>
- </dependency>
- <dependency>
- <groupId>org.ogce</groupId>
- <artifactId>yfilter</artifactId>
- <version>${yfilter.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-common-utils</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- <version>1.6.3</version>
- </dependency>
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-http</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.axis2</groupId>
- <artifactId>axis2-transport-local</artifactId>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-client</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- </dependencies>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-</project>
[13/13] airavata git commit: retiring ws-messenger and remove
dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Posted by ch...@apache.org.
retiring ws-messenger and remove dependency of workflow tracking - AIRAVATA-1556, AIRAVATA-1557
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/cab15715
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/cab15715
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/cab15715
Branch: refs/heads/master
Commit: cab15715707215f8812b7bcac98ba71b06688529
Parents: 0b70b69
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Jan 27 10:26:43 2015 -0500
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Jan 27 10:26:43 2015 -0500
----------------------------------------------------------------------
.../app/catalog/test/ComputeResourceTest.java | 4 +
modules/commons/pom.xml | 2 +-
.../main/resources/credential-store/client.xml | 9 +-
.../servlet/CredentialStoreCallbackServlet.java | 2 +-
modules/distribution/server/pom.xml | 40 +-
modules/gfac/gfac-core/pom.xml | 10 +-
.../airavata/gfac/core/cpi/BetterGfacImpl.java | 33 +-
.../listeners/WorkflowTrackingListener.java | 266 +++----
modules/gfac/gfac-ec2/pom.xml | 10 +-
modules/gfac/gfac-monitor/pom.xml | 10 +-
modules/test-suite/pom.xml | 10 +-
modules/workflow-model/workflow-engine/pom.xml | 20 +-
.../engine/interpretor/WorkflowInterpreter.java | 56 +-
.../engine/invoker/AsynchronousInvoker.java | 9 +-
.../invoker/MsgBoxWsaResponsesCorrelator.java | 278 +++----
.../airavata/xbaya/interpreter/Listener.java | 62 +-
.../xbaya/interpreter/NotificationSender.java | 408 +++++-----
modules/ws-messenger/INSTALL.txt | 162 ----
modules/ws-messenger/README.txt | 102 ---
modules/ws-messenger/client/pom.xml | 60 --
.../wsmg/client/CommonMsgBrokerClient.java | 157 ----
.../wsmg/client/ConsumerMsgReceiver.java | 40 -
.../client/ConsumerNotificationHandler.java | 29 -
.../airavata/wsmg/client/ConsumerServer.java | 99 ---
.../wsmg/client/ConsumerServerHandler.java | 54 --
.../airavata/wsmg/client/ConsumerService.java | 30 -
.../wsmg/client/MessageBrokerClient.java | 173 -----
.../wsmg/client/MsgBrokerClientException.java | 37 -
.../wsmg/client/NotificationHandler.java | 28 -
.../wsmg/client/NotificationProducerStub.java | 190 -----
.../airavata/wsmg/client/SubscriptionInfo.java | 161 ----
.../airavata/wsmg/client/SubscriptionStub.java | 106 ---
.../apache/airavata/wsmg/client/WidgetStub.java | 88 ---
.../wsmg/client/WseCreateSubscription.java | 142 ----
.../wsmg/client/WseMsgBrokerClient.java | 201 -----
.../wsmg/client/WsntCreatePublishReg.java | 118 ---
.../wsmg/client/WsntMsgBrokerClient.java | 190 -----
.../airavata/wsmg/client/WsrfResourceStub.java | 391 ----------
.../wsmg/client/amqp/AMQPBroadcastReceiver.java | 36 -
.../wsmg/client/amqp/AMQPBroadcastSender.java | 39 -
.../airavata/wsmg/client/amqp/AMQPCallback.java | 32 -
.../airavata/wsmg/client/amqp/AMQPClient.java | 46 --
.../wsmg/client/amqp/AMQPException.java | 44 --
.../airavata/wsmg/client/amqp/AMQPReceiver.java | 38 -
.../client/amqp/AMQPRoutingAwareClient.java | 154 ----
.../wsmg/client/amqp/AMQPRoutingKey.java | 369 ---------
.../airavata/wsmg/client/amqp/AMQPSender.java | 40 -
.../wsmg/client/amqp/AMQPTopicReceiver.java | 38 -
.../wsmg/client/amqp/AMQPTopicSender.java | 41 -
.../airavata/wsmg/client/amqp/AMQPUtil.java | 75 --
.../rabbitmq/AMQPBroadcastReceiverImpl.java | 72 --
.../amqp/rabbitmq/AMQPBroadcastSenderImpl.java | 63 --
.../client/amqp/rabbitmq/AMQPReceiverImpl.java | 72 --
.../client/amqp/rabbitmq/AMQPSenderImpl.java | 72 --
.../amqp/rabbitmq/AMQPTopicReceiverImpl.java | 73 --
.../amqp/rabbitmq/AMQPTopicSenderImpl.java | 72 --
.../client/commons/NotificationProducer.java | 121 ---
.../wsmg/client/msgbox/MessagePuller.java | 126 ---
.../wsmg/client/msgbox/MsgboxHandler.java | 122 ---
.../wsmg/client/protocol/WSEProtocolClient.java | 146 ----
.../client/protocol/WSNTProtocolClient.java | 127 ---
.../airavata/wsmg/client/util/ClientUtil.java | 58 --
.../airavata/wsmg/client/util/DcDate.java | 472 -----------
.../airavata/wsmg/gui/NotificationViewer.java | 82 --
.../wsmg/gui/NotificationViewerFrame.java | 328 --------
.../org/apache/airavata/wsmg/gui/README.txt | 15 -
.../WsntViewerConsumerNotificationHandler.java | 114 ---
.../wsmg/msgbox/client/CreateMsgBox.java | 118 ---
.../wsmg/msgbox/client/DestroyMsgBox.java | 120 ---
.../wsmg/msgbox/client/MsgBoxClient.java | 63 --
.../wsmg/msgbox/client/StoreMessage.java | 106 ---
.../wsmg/msgbox/client/TakeMessages.java | 123 ---
.../src/main/resources/amqp-routing-keys.xml | 40 -
.../wsmg/client/amqp/BroadcastSubscriber.java | 54 --
.../wsmg/client/amqp/TopicSubscriber.java | 55 --
.../wsmg/client/util/ClientUtilTest.java | 60 --
.../airavata/wsmg/client/util/ConfigKeys.java | 37 -
.../airavata/wsmg/client/util/TestDcDate.java | 106 ---
.../org/apache/airavata/wsmg/gui/GUITest.java | 43 --
modules/ws-messenger/commons/pom.xml | 44 --
.../airavata/wsmg/commons/CommonRoutines.java | 222 ------
.../wsmg/commons/MsgBoxQNameConstants.java | 58 --
.../wsmg/commons/NameSpaceConstants.java | 77 --
.../wsmg/commons/WsmgCommonConstants.java | 93 ---
.../airavata/wsmg/commons/WsmgVersion.java | 180 -----
.../commons/config/ConfigurationManager.java | 62 --
.../wsmg/commons/storage/ConnectionPool.java | 363 ---------
.../wsmg/commons/storage/DatabaseCreator.java | 359 ---------
.../wsmg/commons/storage/JdbcStorage.java | 193 -----
.../airavata/wsmg/commons/util/Axis2Utils.java | 65 --
modules/ws-messenger/message-monitor/pom.xml | 90 ---
.../apache/airavata/ws/monitor/EventData.java | 174 -----
.../airavata/ws/monitor/EventDataListener.java | 68 --
.../ws/monitor/EventDataListenerAdapter.java | 70 --
.../ws/monitor/EventDataRepository.java | 503 ------------
.../apache/airavata/ws/monitor/EventFilter.java | 27 -
.../org/apache/airavata/ws/monitor/Monitor.java | 339 --------
.../ws/monitor/MonitorConfiguration.java | 191 -----
.../airavata/ws/monitor/MonitorEvent.java | 33 -
.../airavata/ws/monitor/MonitorEventData.java | 27 -
.../ws/monitor/MonitorEventListener.java | 31 -
.../airavata/ws/monitor/MonitorException.java | 62 --
.../apache/airavata/ws/monitor/MonitorUtil.java | 627 ---------------
.../apache/airavata/ws/monitor/WsmgClient.java | 165 ----
.../apache/airavata/ws/monitor/event/Event.java | 84 --
.../ws/monitor/event/EventListener.java | 35 -
.../ws/monitor/event/EventProducer.java | 105 ---
.../ws-messenger/messagebox/maven-eclipse.xml | 16 -
modules/ws-messenger/messagebox/pom.xml | 95 ---
.../wsmg/msgbox/MsgBoxServiceLifeCycle.java | 192 -----
.../MsgBoxServiceMessageReceiverInOut.java | 138 ----
.../wsmg/msgbox/MsgBoxServiceSkeleton.java | 186 -----
.../wsmg/msgbox/Storage/MsgBoxStorage.java | 59 --
.../Storage/dbpool/DatabaseStorageImpl.java | 125 ---
.../msgbox/Storage/dbpool/MessageBoxDB.java | 265 -------
.../msgbox/Storage/memory/InMemoryImpl.java | 133 ----
.../wsmg/msgbox/StoreMessageHandler.java | 123 ---
.../airavata/wsmg/msgbox/util/ConfigKeys.java | 36 -
.../wsmg/msgbox/util/MsgBoxCommonConstants.java | 26 -
.../wsmg/msgbox/util/MsgBoxOperations.java | 53 --
.../airavata/wsmg/msgbox/util/MsgBoxUtils.java | 71 --
.../resources/database_scripts/msgBox-derby.sql | 41 -
.../resources/database_scripts/msgBox-mysql.sql | 42 -
.../messagebox/src/main/resources/services.xml | 57 --
.../wsmg/msgbox/InMemoryMessageBoxServer.java | 158 ----
.../wsmg/msgbox/MessageBoxStressTest.java | 129 ----
.../apache/airavata/wsmg/msgbox/MsgBoxTest.java | 103 ---
modules/ws-messenger/messagebroker/pom.xml | 112 ---
.../wsmg/broker/AbstractBrokerMsgReceiver.java | 105 ---
.../wsmg/broker/AdditionalMessageContent.java | 131 ----
.../wsmg/broker/BrokerServiceLifeCycle.java | 328 --------
.../airavata/wsmg/broker/ConsumerInfo.java | 123 ---
.../airavata/wsmg/broker/ConsumerList.java | 73 --
.../wsmg/broker/ConsumerListManager.java | 79 --
.../wsmg/broker/NotificationProcessor.java | 313 --------
.../broker/amqp/AMQPNotificationProcessor.java | 132 ----
.../broker/context/ContextParameterInfo.java | 58 --
.../wsmg/broker/context/ContextParameters.java | 72 --
.../wsmg/broker/context/ProcessingContext.java | 114 ---
.../context/ProcessingContextBuilder.java | 30 -
.../broker/handler/PublishedMessageHandler.java | 120 ---
.../wsmg/broker/subscription/CleanupThread.java | 148 ----
.../broker/subscription/SubscriptionEntry.java | 49 --
.../subscription/SubscriptionManager.java | 440 -----------
.../broker/subscription/SubscriptionState.java | 301 --------
.../wseventing/WSEProcessingContextBuilder.java | 186 -----
.../broker/wseventing/WSEProtocolSupport.java | 204 -----
.../wseventing/WSEventingMsgReceiver.java | 77 --
.../WSEventingPublishMsgReceiver.java | 74 --
.../wsnotification/WSNTProtocolSupport.java | 237 ------
.../WSNotificationMsgReceiver.java | 110 ---
.../WSNotificationProcessingContextBuilder.java | 179 -----
.../airavata/wsmg/commons/OutGoingMessage.java | 125 ---
.../commons/storage/WsmgInMemoryStorage.java | 106 ---
.../commons/storage/WsmgPersistantStorage.java | 773 -------------------
.../wsmg/commons/storage/WsmgQueue.java | 34 -
.../wsmg/commons/storage/WsmgStorage.java | 39 -
.../wsmg/commons/util/OMElementComparator.java | 177 -----
.../airavata/wsmg/config/WSMGParameter.java | 48 --
.../wsmg/config/WsmgConfigurationContext.java | 118 ---
.../wsmg/matching/AbstractMessageMatcher.java | 89 ---
.../wsmg/matching/XPath/YFilterInfo.java | 156 ----
.../matching/XPath/YFilterMessageMatcher.java | 183 -----
.../simpleTopic/DirectWsntMessageMatcher.java | 125 ---
.../wsmg/messenger/ConsumerUrlManager.java | 195 -----
.../airavata/wsmg/messenger/Deliverable.java | 32 -
.../wsmg/messenger/DeliveryProcessor.java | 90 ---
.../airavata/wsmg/messenger/OutGoingQueue.java | 65 --
.../airavata/wsmg/messenger/SenderUtils.java | 161 ----
.../messenger/protocol/DeliveryProtocol.java | 34 -
.../messenger/protocol/SendingException.java | 37 -
.../messenger/protocol/impl/Axis2Protocol.java | 156 ----
.../messenger/strategy/SendingStrategy.java | 33 -
.../strategy/impl/ConsumerHandler.java | 71 --
.../strategy/impl/FixedParallelSender.java | 185 -----
.../messenger/strategy/impl/LightweightMsg.java | 54 --
.../messenger/strategy/impl/ParallelSender.java | 155 ----
.../messenger/strategy/impl/SerialSender.java | 75 --
.../apache/airavata/wsmg/util/BrokerUtil.java | 121 ---
.../org/apache/airavata/wsmg/util/Counter.java | 77 --
.../airavata/wsmg/util/RunTimeStatistics.java | 157 ----
.../apache/airavata/wsmg/util/TimerThread.java | 87 ---
.../wsmg/util/WsEventingOperations.java | 55 --
.../wsmg/util/WsNotificationOperations.java | 56 --
.../database_scripts/cleanDBScript.sql | 27 -
.../database_scripts/msgBroker-derby.sql | 60 --
.../database_scripts/msgBroker-mysql.sql | 61 --
.../src/main/resources/services.xml | 125 ---
.../airavata/wsmg/broker/BrokerWSETest.java | 107 ---
.../airavata/wsmg/broker/BrokerWSNTTest.java | 108 ---
.../wsmg/commons/TestCommonRoutines.java | 57 --
.../TestAddtionalWseXpathAndTopicScenarios.java | 151 ----
.../XPath/TestWseXpathAndTopicSubscription.java | 137 ----
.../XPath/TestWseXpathSubscription.java | 139 ----
.../matching/XPath/performance/XppXPath.java | 269 -------
.../rtt/NotificationManager.java | 151 ----
.../rtt/PerformanceTest.java | 399 ----------
.../rtt/PublisherThread.java | 99 ---
.../rtt/StatCalculatorThread.java | 103 ---
.../rtt/StatContainer.java | 49 --
.../performance_evaluator/rtt/Subscription.java | 107 ---
.../rtt/util/ConfigKeys.java | 43 --
.../rtt/util/LoadMsgPayload.java | 66 --
.../rtt/util/LoadXpath.java | 66 --
.../airavata/wsmg/util/BrokerUtilTest.java | 167 ----
.../apache/airavata/wsmg/util/ConfigKeys.java | 34 -
.../airavata/wsmg/util/TestUtilServer.java | 225 ------
.../src/test/resources/unit_tests.properties | 24 -
modules/ws-messenger/pom.xml | 162 ----
.../xbaya/jython/lib/NotificationSender.java | 578 +++++++-------
.../jython/lib/ServiceNotificationSender.java | 586 +++++++-------
.../airavata/xbaya/interpreter/Listener.java | 64 +-
.../xbaya/interpreter/NotificationSender.java | 408 +++++-----
pom.xml | 8 +-
214 files changed, 1416 insertions(+), 25022 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
----------------------------------------------------------------------
diff --git a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
index 5587cba..28b2983 100644
--- a/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
+++ b/modules/app-catalog/app-catalog-data/src/test/java/org/apache/airavata/app/catalog/test/ComputeResourceTest.java
@@ -146,6 +146,10 @@ public class ComputeResourceTest {
ComputeResourceDescription host = null;
if (computeResource.isComputeResourceExists(resourceId)){
host = computeResource.getComputeResource(resourceId);
+ List<BatchQueue> batchQueues = host.getBatchQueues();
+ for (BatchQueue queue : batchQueues){
+ System.out.println("%%%%%%%%%%%%%%%% queue description : %%%%%%%%%%%%%%%%%%% : " + queue.getQueueDescription());
+ }
List<String> hostAliases = host.getHostAliases();
if (hostAliases != null && !hostAliases.isEmpty()){
for (String alias : hostAliases){
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/commons/pom.xml
----------------------------------------------------------------------
diff --git a/modules/commons/pom.xml b/modules/commons/pom.xml
index e68f4e1..1a8d58f 100644
--- a/modules/commons/pom.xml
+++ b/modules/commons/pom.xml
@@ -32,7 +32,7 @@
<modules>
<module>utils</module>
<module>gfac-schema</module>
- <module>workflow-tracking</module>
+ <!--<module>workflow-tracking</module>-->
<module>workflow-execution-context</module>
</modules>
</profile>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml b/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
index b6cdb1a..bc721ed 100644
--- a/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
+++ b/modules/credential-store-service/credential-store-webapp/src/main/resources/credential-store/client.xml
@@ -20,14 +20,15 @@
debug="true"/>
<id>myproxy:oa4mp,2012:/client/5a323fc6fcffcff7a95401046a303520</id>
<serviceUri>https://oa4mp.xsede.org/oauth</serviceUri>
- <callbackUri>https://149.160.145.44:8443/credential-store/callback</callbackUri>
+ <callbackUri>https://localhost:8443/credential-store/callback</callbackUri>
+ <!--callbackUri>http://149.165.228.118/PHP-Reference-Gateway/xsede_login.php</callbackUri-->
<lifetime>864000</lifetime>
- <publicKeyFile>/Users/chathuri/dev/airavata/source/trunk_git/airavata/modules/credential-store-service/credential-store-webapp/keys/credential-store/oauth-pubkey.pem</publicKeyFile>
- <privateKeyFile>/Users/chathuri/dev/airavata/source/trunk_git/airavata/modules/credential-store-service/credential-store-webapp/keys/credential-store/oauth-privkey.pk8</privateKeyFile>
+ <publicKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-pubkey.pem</publicKeyFile>
+ <privateKeyFile>/Users/chathuri/dev/airavata/credential-store/oa4mp/oauth-privkey.pk8</privateKeyFile>
</client>
<credential-store>
- <successUri>/credential-store/success.jsp</successUri>
+ <successUri>http://gw120.iu.xsede.org/PHP-Reference-Gateway/</successUri>
<errorUri>/credential-store/error.jsp</errorUri>
<redirectUri>/credential-store/show-redirect.jsp</redirectUri>
</credential-store>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
----------------------------------------------------------------------
diff --git a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
index cf6eac8..66d4be7 100644
--- a/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
+++ b/modules/credential-store-service/credential-store/src/main/java/org/apache/airavata/credential/store/servlet/CredentialStoreCallbackServlet.java
@@ -127,7 +127,7 @@ public class CredentialStoreCallbackServlet extends ClientServlet {
// TODO remove hard coded values, once passing query parameters is
// fixed in OA4MP client api
- long duration = 800;
+ long duration = 864000;
if (durationParameter != null) {
duration = Long.parseLong(durationParameter);
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
index 2481136..5f44c45 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -354,31 +354,31 @@
<artifactId>airavata-gfac-service</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-message-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-message-monitor</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-workflow-model-core</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-commons</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-client</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-messenger-commons</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-messenger-client</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>gsissh</artifactId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/gfac/gfac-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/pom.xml b/modules/gfac/gfac-core/pom.xml
index 604fa0c..4fc2a15 100644
--- a/modules/gfac/gfac-core/pom.xml
+++ b/modules/gfac/gfac-core/pom.xml
@@ -56,11 +56,11 @@
<version>${project.version}</version>
</dependency>
<!-- Workflow Tracking -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<!-- Credential Store -->
<dependency>
<groupId>org.apache.airavata</groupId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
index a712a74..9c4decd 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/BetterGfacImpl.java
@@ -41,7 +41,6 @@ import org.apache.airavata.gfac.core.monitor.MonitorID;
import org.apache.airavata.gfac.core.monitor.state.GfacExperimentStateChangeRequest;
import org.apache.airavata.gfac.core.notification.events.ExecutionFailEvent;
import org.apache.airavata.gfac.core.notification.listeners.LoggingListener;
-import org.apache.airavata.gfac.core.notification.listeners.WorkflowTrackingListener;
import org.apache.airavata.gfac.core.provider.GFacProvider;
import org.apache.airavata.gfac.core.provider.GFacProviderException;
import org.apache.airavata.gfac.core.provider.GFacRecoverableProvider;
@@ -51,7 +50,10 @@ import org.apache.airavata.gfac.core.utils.GFacUtils;
import org.apache.airavata.messaging.core.Publisher;
import org.apache.airavata.messaging.core.PublisherFactory;
import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription;
-import org.apache.airavata.model.appcatalog.appinterface.*;
+import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription;
+import org.apache.airavata.model.appcatalog.appinterface.DataType;
+import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
+import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
import org.apache.airavata.model.appcatalog.computeresource.*;
import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference;
import org.apache.airavata.model.messaging.event.*;
@@ -69,12 +71,7 @@ import javax.xml.xpath.XPathExpressionException;
import java.io.File;
import java.io.IOException;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
+import java.util.*;
/**
* This is the GFac CPI class for external usage, this simply have a single method to submit a job to
@@ -475,7 +472,7 @@ public class BetterGfacImpl implements GFac,Watcher {
if ((workflowInstanceID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_INSTANCE_ID)) != null) {
// This mean we need to register workflow tracking listener.
//todo implement WorkflowTrackingListener properly
- registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
+// registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
}
// Register log event listener. This is required in all scenarios.
jobExecutionContext.getNotificationService().registerListener(new LoggingListener());
@@ -525,7 +522,7 @@ public class BetterGfacImpl implements GFac,Watcher {
if ((workflowInstanceID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_INSTANCE_ID)) != null) {
// This mean we need to register workflow tracking listener.
//todo implement WorkflowTrackingListener properly
- registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
+// registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
}
// Register log event listener. This is required in all scenarios.
jobExecutionContext.getNotificationService().registerListener(new LoggingListener());
@@ -870,14 +867,14 @@ public class BetterGfacImpl implements GFac,Watcher {
}
}
- private void registerWorkflowTrackingListener(String workflowInstanceID, JobExecutionContext jobExecutionContext) {
- String workflowNodeID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID);
- String topic = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC);
- String brokerUrl = (String) jobExecutionContext.getProperty(Constants.PROP_BROKER_URL);
- jobExecutionContext.getNotificationService().registerListener(
- new WorkflowTrackingListener(workflowInstanceID, workflowNodeID, brokerUrl, topic));
-
- }
+// private void registerWorkflowTrackingListener(String workflowInstanceID, JobExecutionContext jobExecutionContext) {
+// String workflowNodeID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID);
+// String topic = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC);
+// String brokerUrl = (String) jobExecutionContext.getProperty(Constants.PROP_BROKER_URL);
+// jobExecutionContext.getNotificationService().registerListener(
+// new WorkflowTrackingListener(workflowInstanceID, workflowNodeID, brokerUrl, topic));
+//
+// }
private void invokeInFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getInHandlers();
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
index 4f1dd9e..1ff9346 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/notification/listeners/WorkflowTrackingListener.java
@@ -1,133 +1,133 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-package org.apache.airavata.gfac.core.notification.listeners;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.core.notification.events.*;
-import org.apache.airavata.workflow.tracking.Notifier;
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.common.DurationObj;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-
-import java.net.URI;
-import java.util.Properties;
-
-public class WorkflowTrackingListener {
-
- private Notifier notifier;
-
- private String topic;
-
- private URI workflowID;
-
- private WorkflowTrackingContext context;
-
- private InvocationEntity initiator;
-
- private InvocationEntity receiver;
-
- private DurationObj duration;
-
- private org.apache.airavata.workflow.tracking.common.InvocationContext invocationContext;
-
- public WorkflowTrackingListener(String workflowID, String workflowNodeID, String brokerURL, String topic){
- this.topic = topic;
- this.workflowID = URI.create(this.topic);
- this.notifier = NotifierFactory.createNotifier();
- URI initiatorWorkflowID = URI.create(workflowID);
- URI initiatorServiceID = URI.create(topic);
- String initiatorWorkflowNodeID = workflowNodeID;
- Integer initiatorWorkflowTimeStep = null;
- this.context = this.notifier.createTrackingContext(new Properties(), brokerURL, initiatorWorkflowID, initiatorServiceID,
- initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
- this.context.setTopic(topic);
- this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
- initiatorWorkflowTimeStep);
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = this.workflowID;
- String receiverWorkflowNodeID = null;
- Integer receiverWorkflowTimeStep = null;
-
- setReceiver(this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- receiverWorkflowTimeStep));
- // send start workflow
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator);
- }
-
-
-
- @Subscribe
- public void startExecution(StartExecutionEvent e) {
- this.duration = this.notifier.computationStarted();
- }
-
- @Subscribe
- public void finishExecution(FinishExecutionEvent e) {
- this.duration = this.notifier.computationFinished(this.context, this.duration);
- }
-
- @Subscribe
- public void statusChanged(StatusChangeEvent event) {
- this.notifier.info(this.context, event.getStatusMessage());
- }
-
- @Subscribe
- public void startSchedule(StartScheduleEvent e){
- this.notifier.info(this.context,e.getEventType());
- }
-
- @Subscribe
- public void executionFail(ExecutionFailEvent e) {
- this.notifier.sendingFault(this.context, this.invocationContext, e.getCauseForFailure().getMessage());
- }
-
-
- @Subscribe
- public void info(String... data) {
- this.notifier.info(this.context, data);
- }
-
- @Subscribe
- public void warning(String... data) {
- }
-
- @Subscribe
- public void exception(String... data) {
- }
-
- @Subscribe
- public void finishSchedule(FinishScheduleEvent e){
- this.notifier.info(this.context,e.getEventType());
- }
-
-
- public InvocationEntity getReceiver() {
- return receiver;
- }
-
- public void setReceiver(InvocationEntity receiver) {
- this.receiver = receiver;
- }
-
-}
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//
+//package org.apache.airavata.gfac.core.notification.listeners;
+//
+//import com.google.common.eventbus.Subscribe;
+//import org.apache.airavata.gfac.core.notification.events.*;
+//import org.apache.airavata.workflow.tracking.Notifier;
+//import org.apache.airavata.workflow.tracking.NotifierFactory;
+//import org.apache.airavata.workflow.tracking.common.DurationObj;
+//import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+//import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+//
+//import java.net.URI;
+//import java.util.Properties;
+//
+//public class WorkflowTrackingListener {
+//
+// private Notifier notifier;
+//
+// private String topic;
+//
+// private URI workflowID;
+//
+// private WorkflowTrackingContext context;
+//
+// private InvocationEntity initiator;
+//
+// private InvocationEntity receiver;
+//
+// private DurationObj duration;
+//
+// private org.apache.airavata.workflow.tracking.common.InvocationContext invocationContext;
+//
+// public WorkflowTrackingListener(String workflowID, String workflowNodeID, String brokerURL, String topic){
+// this.topic = topic;
+// this.workflowID = URI.create(this.topic);
+// this.notifier = NotifierFactory.createNotifier();
+// URI initiatorWorkflowID = URI.create(workflowID);
+// URI initiatorServiceID = URI.create(topic);
+// String initiatorWorkflowNodeID = workflowNodeID;
+// Integer initiatorWorkflowTimeStep = null;
+// this.context = this.notifier.createTrackingContext(new Properties(), brokerURL, initiatorWorkflowID, initiatorServiceID,
+// initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+// this.context.setTopic(topic);
+// this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+// initiatorWorkflowTimeStep);
+//
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = this.workflowID;
+// String receiverWorkflowNodeID = null;
+// Integer receiverWorkflowTimeStep = null;
+//
+// setReceiver(this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// receiverWorkflowTimeStep));
+// // send start workflow
+// this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator);
+// }
+//
+//
+//
+// @Subscribe
+// public void startExecution(StartExecutionEvent e) {
+// this.duration = this.notifier.computationStarted();
+// }
+//
+// @Subscribe
+// public void finishExecution(FinishExecutionEvent e) {
+// this.duration = this.notifier.computationFinished(this.context, this.duration);
+// }
+//
+// @Subscribe
+// public void statusChanged(StatusChangeEvent event) {
+// this.notifier.info(this.context, event.getStatusMessage());
+// }
+//
+// @Subscribe
+// public void startSchedule(StartScheduleEvent e){
+// this.notifier.info(this.context,e.getEventType());
+// }
+//
+// @Subscribe
+// public void executionFail(ExecutionFailEvent e) {
+// this.notifier.sendingFault(this.context, this.invocationContext, e.getCauseForFailure().getMessage());
+// }
+//
+//
+// @Subscribe
+// public void info(String... data) {
+// this.notifier.info(this.context, data);
+// }
+//
+// @Subscribe
+// public void warning(String... data) {
+// }
+//
+// @Subscribe
+// public void exception(String... data) {
+// }
+//
+// @Subscribe
+// public void finishSchedule(FinishScheduleEvent e){
+// this.notifier.info(this.context,e.getEventType());
+// }
+//
+//
+// public InvocationEntity getReceiver() {
+// return receiver;
+// }
+//
+// public void setReceiver(InvocationEntity receiver) {
+// this.receiver = receiver;
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/gfac/gfac-ec2/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ec2/pom.xml b/modules/gfac/gfac-ec2/pom.xml
index 4943ae1..4568a11 100644
--- a/modules/gfac/gfac-ec2/pom.xml
+++ b/modules/gfac/gfac-ec2/pom.xml
@@ -51,11 +51,11 @@
<version>${project.version}</version>
</dependency>
<!-- Workflow Tracking -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<!-- SSH -->
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/gfac/gfac-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/pom.xml b/modules/gfac/gfac-monitor/pom.xml
index 58fa9d8..c4a6e2f 100644
--- a/modules/gfac/gfac-monitor/pom.xml
+++ b/modules/gfac/gfac-monitor/pom.xml
@@ -61,11 +61,11 @@
<version>${project.version}</version>
</dependency>
<!-- Workflow Tracking -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<!-- Credential Store -->
<dependency>
<groupId>org.apache.airavata</groupId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/test-suite/pom.xml
----------------------------------------------------------------------
diff --git a/modules/test-suite/pom.xml b/modules/test-suite/pom.xml
index 06eb3c1..ddd555d 100644
--- a/modules/test-suite/pom.xml
+++ b/modules/test-suite/pom.xml
@@ -60,11 +60,11 @@
</dependency>
<!-- Workflow Tracking -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<!-- SSH -->
<dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/pom.xml
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/pom.xml b/modules/workflow-model/workflow-engine/pom.xml
index 7f6c9f2..a043170 100644
--- a/modules/workflow-model/workflow-engine/pom.xml
+++ b/modules/workflow-model/workflow-engine/pom.xml
@@ -219,11 +219,11 @@
<artifactId>airavata-workflow-model-component</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-message-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-message-monitor</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-model-utils</artifactId>
@@ -244,11 +244,11 @@
<artifactId>airavata-common-utils</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-workflow-tracking</artifactId>
- <version>${project.version}</version>
- </dependency>
+ <!--<dependency>-->
+ <!--<groupId>org.apache.airavata</groupId>-->
+ <!--<artifactId>airavata-workflow-tracking</artifactId>-->
+ <!--<version>${project.version}</version>-->
+ <!--</dependency>-->
<dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-jpa-registry</artifactId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
index 9b56b73..59fe8d0 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/interpretor/WorkflowInterpreter.java
@@ -34,20 +34,9 @@ import org.apache.airavata.messaging.core.Publisher;
import org.apache.airavata.model.appcatalog.appinterface.DataType;
import org.apache.airavata.model.appcatalog.appinterface.InputDataObjectType;
import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType;
-import org.apache.airavata.model.messaging.event.ExperimentStatusChangeEvent;
-import org.apache.airavata.model.messaging.event.MessageType;
-import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent;
-import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent;
-import org.apache.airavata.model.messaging.event.WorkflowIdentifier;
-import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent;
+import org.apache.airavata.model.messaging.event.*;
import org.apache.airavata.model.util.ExperimentModelUtil;
-import org.apache.airavata.model.workspace.experiment.ExecutionUnit;
-import org.apache.airavata.model.workspace.experiment.Experiment;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-import org.apache.airavata.model.workspace.experiment.TaskDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus;
+import org.apache.airavata.model.workspace.experiment.*;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
import org.apache.airavata.registry.cpi.ChildDataType;
@@ -63,19 +52,7 @@ import org.apache.airavata.workflow.model.component.Component;
import org.apache.airavata.workflow.model.component.amazon.InstanceComponent;
import org.apache.airavata.workflow.model.component.amazon.TerminateInstanceComponent;
import org.apache.airavata.workflow.model.component.dynamic.DynamicComponent;
-import org.apache.airavata.workflow.model.component.system.ConstantComponent;
-import org.apache.airavata.workflow.model.component.system.DifferedInputComponent;
-import org.apache.airavata.workflow.model.component.system.DoWhileComponent;
-import org.apache.airavata.workflow.model.component.system.EndDoWhileComponent;
-import org.apache.airavata.workflow.model.component.system.EndForEachComponent;
-import org.apache.airavata.workflow.model.component.system.EndifComponent;
-import org.apache.airavata.workflow.model.component.system.ForEachComponent;
-import org.apache.airavata.workflow.model.component.system.IfComponent;
-import org.apache.airavata.workflow.model.component.system.InputComponent;
-import org.apache.airavata.workflow.model.component.system.MemoComponent;
-import org.apache.airavata.workflow.model.component.system.OutputComponent;
-import org.apache.airavata.workflow.model.component.system.S3InputComponent;
-import org.apache.airavata.workflow.model.component.system.SubWorkflowComponent;
+import org.apache.airavata.workflow.model.component.system.*;
import org.apache.airavata.workflow.model.component.ws.WSComponent;
import org.apache.airavata.workflow.model.exceptions.WorkflowException;
import org.apache.airavata.workflow.model.exceptions.WorkflowRuntimeException;
@@ -88,42 +65,24 @@ import org.apache.airavata.workflow.model.graph.dynamic.DynamicNode;
import org.apache.airavata.workflow.model.graph.impl.EdgeImpl;
import org.apache.airavata.workflow.model.graph.impl.NodeImpl;
import org.apache.airavata.workflow.model.graph.subworkflow.SubWorkflowNode;
-import org.apache.airavata.workflow.model.graph.system.ConstantNode;
-import org.apache.airavata.workflow.model.graph.system.DoWhileNode;
-import org.apache.airavata.workflow.model.graph.system.EndForEachNode;
-import org.apache.airavata.workflow.model.graph.system.EndifNode;
-import org.apache.airavata.workflow.model.graph.system.ForEachNode;
-import org.apache.airavata.workflow.model.graph.system.IfNode;
-import org.apache.airavata.workflow.model.graph.system.InputNode;
-import org.apache.airavata.workflow.model.graph.system.OutputNode;
+import org.apache.airavata.workflow.model.graph.system.*;
import org.apache.airavata.workflow.model.graph.ws.WSGraph;
import org.apache.airavata.workflow.model.graph.ws.WSNode;
import org.apache.airavata.workflow.model.graph.ws.WSPort;
import org.apache.airavata.workflow.model.wf.Workflow;
import org.apache.airavata.workflow.model.wf.WorkflowExecutionState;
-import org.apache.airavata.ws.monitor.MonitorException;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xmlpull.infoset.XmlElement;
-import xsul5.XmlConstants;
-import javax.xml.namespace.QName;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import java.net.URL;
import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
+import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
@@ -461,10 +420,7 @@ public class WorkflowInterpreter implements AbstractActivityListener{
notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_STATE_CHANGED, WorkflowExecutionState.PAUSED);
}
- /**
- * @throws MonitorException
- */
- public void cleanup() throws MonitorException {
+ public void cleanup() {
this.getWorkflow().setExecutionState(WorkflowExecutionState.STOPPED);
notifyViaInteractor(WorkflowExecutionMessage.EXECUTION_CLEANUP, null);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
index fa0709d..5a9e527 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/AsynchronousInvoker.java
@@ -70,11 +70,12 @@ public class AsynchronousInvoker extends SimpleInvoker {
correlator = new XsulSoapHttpWsaResponsesCorrelator();
String serverLoc = ((XsulSoapHttpWsaResponsesCorrelator) correlator).getServerLocation();
logger.debug("using async correlator at " + serverLoc);
- } else {
- correlator = new MsgBoxWsaResponsesCorrelator(this.messageBoxURL,this);
- logger.debug("using message box at " + this.messageBoxURL);
+ this.client.useAsyncMessaging(correlator);
}
- this.client.useAsyncMessaging(correlator);
+// else {
+// correlator = new MsgBoxWsaResponsesCorrelator(this.messageBoxURL,this);
+// logger.debug("using message box at " + this.messageBoxURL);
+// }
}
public boolean invoke() throws WorkflowException {
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
index 80825d8..cab3462 100644
--- a/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
+++ b/modules/workflow-model/workflow-engine/src/main/java/org/apache/airavata/workflow/engine/invoker/MsgBoxWsaResponsesCorrelator.java
@@ -1,140 +1,140 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.workflow.engine.invoker;
-
-import org.apache.airavata.common.utils.XMLUtil;
-import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.xmlpull.v1.builder.XmlDocument;
-import org.xmlpull.v1.builder.XmlElement;
-import org.xmlpull.v1.builder.XmlInfosetBuilder;
-import xsul.MLogger;
-import xsul.XmlConstants;
-import xsul.XsulException;
-import xsul.processor.DynamicInfosetProcessorException;
-import xsul.ws_addressing.WsaEndpointReference;
-import xsul.ws_addressing.WsaMessageInformationHeaders;
-import xsul.wsif.WSIFMessage;
-import xsul.wsif.impl.WSIFMessageElement;
-import xsul.xwsif_runtime_async.WSIFAsyncResponseListener;
-import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
-import xsul.xwsif_runtime_async.WSIFAsyncWsaResponsesCorrelatorBase;
-
-import javax.xml.stream.XMLStreamException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-public class MsgBoxWsaResponsesCorrelator extends WSIFAsyncWsaResponsesCorrelatorBase
- implements WSIFAsyncResponsesCorrelator, Runnable
-{
- private static final Logger logger = LoggerFactory.getLogger(MsgBoxWsaResponsesCorrelator.class);
- private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
-
- private String msgBoxServiceLoc;
- private MsgBoxClient msgBoxClient;
- EndpointReference msgBoxAddr;
- private Thread messageBoxDonwloader;
-
- private AsynchronousInvoker invoker;
-
- public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output)
- throws DynamicInfosetProcessorException
- {
- this.invoker = output;
- this.msgBoxServiceLoc = msgBoxServiceLoc;
- msgBoxClient = new MsgBoxClient();
- try {
- msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L);
- try {
- setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress())));
- } catch (URISyntaxException e) {
- logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
- }
- messageBoxDonwloader = new Thread(this, Thread.currentThread().getName()+"-async-msgbox-correlator");
- messageBoxDonwloader.setDaemon(true);
- messageBoxDonwloader.start();
- } catch (RemoteException e) {
- logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-
-// public void setMsgBoxAddr(WsaEndpointReference msgBoxAddr) {
-// this.msgBoxAddr = msgBoxAddr;
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//package org.apache.airavata.workflow.engine.invoker;
+//
+//import org.apache.airavata.common.utils.XMLUtil;
+//import org.apache.airavata.wsmg.msgbox.client.MsgBoxClient;
+//import org.apache.axiom.om.OMElement;
+//import org.apache.axis2.addressing.EndpointReference;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.xmlpull.v1.builder.XmlDocument;
+//import org.xmlpull.v1.builder.XmlElement;
+//import org.xmlpull.v1.builder.XmlInfosetBuilder;
+//import xsul.MLogger;
+//import xsul.XmlConstants;
+//import xsul.XsulException;
+//import xsul.processor.DynamicInfosetProcessorException;
+//import xsul.ws_addressing.WsaEndpointReference;
+//import xsul.ws_addressing.WsaMessageInformationHeaders;
+//import xsul.wsif.WSIFMessage;
+//import xsul.wsif.impl.WSIFMessageElement;
+//import xsul.xwsif_runtime_async.WSIFAsyncResponseListener;
+//import xsul.xwsif_runtime_async.WSIFAsyncResponsesCorrelator;
+//import xsul.xwsif_runtime_async.WSIFAsyncWsaResponsesCorrelatorBase;
+//
+//import javax.xml.stream.XMLStreamException;
+//import java.net.URI;
+//import java.net.URISyntaxException;
+//import java.rmi.RemoteException;
+//import java.util.ArrayList;
+//import java.util.Iterator;
+//import java.util.List;
+//
+//public class MsgBoxWsaResponsesCorrelator extends WSIFAsyncWsaResponsesCorrelatorBase
+// implements WSIFAsyncResponsesCorrelator, Runnable
+//{
+// private static final Logger logger = LoggerFactory.getLogger(MsgBoxWsaResponsesCorrelator.class);
+// private final static XmlInfosetBuilder builder = XmlConstants.BUILDER;
+//
+// private String msgBoxServiceLoc;
+// private MsgBoxClient msgBoxClient;
+// EndpointReference msgBoxAddr;
+// private Thread messageBoxDonwloader;
+//
+// private AsynchronousInvoker invoker;
+//
+// public MsgBoxWsaResponsesCorrelator(String msgBoxServiceLoc,AsynchronousInvoker output)
+// throws DynamicInfosetProcessorException
+// {
+// this.invoker = output;
+// this.msgBoxServiceLoc = msgBoxServiceLoc;
+// msgBoxClient = new MsgBoxClient();
+// try {
+// msgBoxAddr = msgBoxClient.createMessageBox(msgBoxServiceLoc,5000L);
+// try {
+// setReplyTo(new WsaEndpointReference(new URI(msgBoxAddr.getAddress())));
+// } catch (URISyntaxException e) {
+// logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+// }
+// messageBoxDonwloader = new Thread(this, Thread.currentThread().getName()+"-async-msgbox-correlator");
+// messageBoxDonwloader.setDaemon(true);
+// messageBoxDonwloader.start();
+// } catch (RemoteException e) {
+// logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+// }
// }
-
-
-
- public void run() {
- while(true) {
- try {
- Iterator<OMElement> omElementIterator = msgBoxClient.takeMessagesFromMsgBox(msgBoxAddr, 5000L);
- List<XmlElement> xmlArrayList = new ArrayList<XmlElement>();
- while (omElementIterator.hasNext()){
- OMElement next = omElementIterator.next();
- String message = next.toStringWithConsume();
- xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
- }
- // now hard work: find callbacks
- for (int i = 0; i < xmlArrayList.size(); i++) {
- XmlElement m = xmlArrayList.get(i);
- try {
- logger.debug(Thread.currentThread().getName());
- WSIFMessageElement e = new WSIFMessageElement(m);
- this.invoker.setOutputMessage(e);
- //ideally there are no multiple messages, so we can return from this thread at this point
- //otherwise this thread will keep running forever for each worfklow node, so there can be large
- // number of waiting threads in an airavata deployment
- return;
- } catch (Throwable e) {
- logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- try {
- Thread.currentThread().sleep(1000L); //do not overload msg box service ...
- } catch (InterruptedException e) {
- break;
- }
- } catch (XsulException e) {
- logger.error("could not retrieve messages");
- break;
- } catch (RemoteException e) {
- logger.error("could not retrieve messages");
- break;
- } catch (XMLStreamException e) {
- logger.error("could not retrieve messages");
- break;
- } catch (Exception e){
- logger.error("could not retrieve messages");
- break;
- }
- }
- }
-
-
-
-}
+//
+//// public void setMsgBoxAddr(WsaEndpointReference msgBoxAddr) {
+//// this.msgBoxAddr = msgBoxAddr;
+//// }
+//
+//
+//
+// public void run() {
+// while(true) {
+// try {
+// Iterator<OMElement> omElementIterator = msgBoxClient.takeMessagesFromMsgBox(msgBoxAddr, 5000L);
+// List<XmlElement> xmlArrayList = new ArrayList<XmlElement>();
+// while (omElementIterator.hasNext()){
+// OMElement next = omElementIterator.next();
+// String message = next.toStringWithConsume();
+// xmlArrayList.add(XMLUtil.stringToXmlElement3(message));
+// }
+// // now hard work: find callbacks
+// for (int i = 0; i < xmlArrayList.size(); i++) {
+// XmlElement m = xmlArrayList.get(i);
+// try {
+// logger.debug(Thread.currentThread().getName());
+// WSIFMessageElement e = new WSIFMessageElement(m);
+// this.invoker.setOutputMessage(e);
+// //ideally there are no multiple messages, so we can return from this thread at this point
+// //otherwise this thread will keep running forever for each worfklow node, so there can be large
+// // number of waiting threads in an airavata deployment
+// return;
+// } catch (Throwable e) {
+// logger.error(e.getLocalizedMessage(),e); //To change body of catch statement use File | Settings | File Templates.
+// }
+// }
+// try {
+// Thread.currentThread().sleep(1000L); //do not overload msg box service ...
+// } catch (InterruptedException e) {
+// break;
+// }
+// } catch (XsulException e) {
+// logger.error("could not retrieve messages");
+// break;
+// } catch (RemoteException e) {
+// logger.error("could not retrieve messages");
+// break;
+// } catch (XMLStreamException e) {
+// logger.error("could not retrieve messages");
+// break;
+// } catch (Exception e){
+// logger.error("could not retrieve messages");
+// break;
+// }
+// }
+// }
+//
+//
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
index 6443828..aeafd6d 100644
--- a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/Listener.java
@@ -1,31 +1,31 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.interpreter;
-
-import org.apache.airavata.wsmg.client.NotificationHandler;
-
-public class Listener implements NotificationHandler {
-
- public void handleNotification(String message) {
- System.out.println("MessageRecieved: " + message);
- }
-
-}
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+// * under the License.
+// *
+//*/
+//package org.apache.airavata.xbaya.interpreter;
+//
+//import org.apache.airavata.wsmg.client.NotificationHandler;
+//
+//public class Listener implements NotificationHandler {
+//
+// public void handleNotification(String message) {
+// System.out.println("MessageRecieved: " + message);
+// }
+//
+//}
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
----------------------------------------------------------------------
diff --git a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
index 261b07f..5c34cf8 100644
--- a/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
+++ b/modules/workflow-model/workflow-engine/src/test/java/org/apache/airavata/xbaya/interpreter/NotificationSender.java
@@ -1,204 +1,204 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.xbaya.interpreter;
-
-
-import org.apache.airavata.workflow.tracking.NotifierFactory;
-import org.apache.airavata.workflow.tracking.WorkflowNotifier;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.axis2.addressing.EndpointReference;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.net.URI;
-import java.util.Properties;
-
-public class NotificationSender {
-
- protected WorkflowNotifier notifier;
-
- protected String brokerURL;
-
- protected String topic;
-
- protected URI workflowID;
-
- protected InvocationEntity initiator;
-
- protected InvocationEntity receiver;
-
- protected InvocationContext invocationContext;
-
- protected EndpointReference eventSink;
-
- protected WorkflowTrackingContext context;
-
- /**
- * Constructs a NotificationSender.
- *
- * @param brokerURL
- * @param topic
- */
- public NotificationSender(URI brokerURL, String topic) {
- this(brokerURL.toString(), topic);
- }
-
- /**
- * Creates a NotificationSender.
- *
- * @param brokerURL The location of notification brokerUrl.
- * @param topic The notification topic.
- */
- public NotificationSender(String brokerURL, String topic) {
- this.topic = topic;
- this.brokerURL = brokerURL;
- this.workflowID = URI.create(this.convertToJavaIdentifier(this.topic));
- this.eventSink = new EndpointReference(this.brokerURL);
- Properties props = new Properties();
-
- this.notifier = NotifierFactory.createNotifier();
- URI initiatorWorkflowID = null;
- URI initiatorServiceID = URI.create(this.convertToJavaIdentifier(topic));
- String initiatorWorkflowNodeID = null;
- Integer initiatorWorkflowTimeStep = null;
- this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID,
- initiatorServiceID, initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
- this.context.setTopic(topic);
- this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
- initiatorWorkflowTimeStep);
-
- URI receiverWorkflowID = this.workflowID;
- URI receiverServiceID = this.workflowID;
- String receiverWorkflowNodeID = null;
- Integer receiverWorkflowTimeStep = null;
- this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
- receiverWorkflowTimeStep);
- }
-
- /**
- * @return The event sink EPR.
- */
- public EndpointReference getEventSink() {
- return this.eventSink;
- }
-
-
- public void workflowStarted(String message) {
- this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
- }
-
-
- public void workflowFinished(String message) {
- this.notifier.sendingResult(context, this.invocationContext, message);
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
- }
-
- public void sendingPartialResults(Object[] args, String[] keywords) {
- String message = "";
- for (int i = 0; i < args.length; i++) {
- if (i != 0) {
- message += ", ";
- }
- message += keywords[i] + "=" + args[i];
- }
- this.notifier.sendingResult(context, this.invocationContext, message);
- }
-
-
- public void workflowTerminated() {
- this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param message The message to send
- */
- public void workflowFailed(String message) {
- workflowFailed(message, null);
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param e
- */
- public void workflowFailed(Throwable e) {
- workflowFailed(null, e);
- }
-
- /**
- * Sends a START_INCOMPLETED notification message.
- *
- * @param message The message to send
- * @param e
- */
- public void workflowFailed(String message, Throwable e) {
- this.notifier.sendingFault(context, this.invocationContext, message);
- }
-
- public void info(String message) {
- this.notifier.info(context, message);
- }
-
- /**
- * @param throwable
- * @return The stackTrace in String
- */
- public static String getStackTraceInString(Throwable throwable) {
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- PrintStream printStream = new PrintStream(byteArrayOutputStream);
- throwable.printStackTrace(printStream);
- printStream.flush();
- return byteArrayOutputStream.toString();
- }
-
- public static String convertToJavaIdentifier(String name) {
-
- final char REPLACE_CHAR = '_';
-
- if (name == null || name.length() == 0) {
- return "" + REPLACE_CHAR;
- }
-
- StringBuilder buf = new StringBuilder();
-
- char c = name.charAt(0);
- if (!Character.isJavaIdentifierStart(c)) {
- // Add _ at the beggining instead of replacing it to _. This is
- // more readable if the name is like 3D_Model.
- buf.append(REPLACE_CHAR);
- }
-
- for (int i = 0; i < name.length(); i++) {
- c = name.charAt(i);
- if (Character.isJavaIdentifierPart(c)) {
- buf.append(c);
- } else {
- buf.append(REPLACE_CHAR);
- }
- }
-
- return buf.toString();
- }
-}
\ No newline at end of file
+///*
+// *
+// * Licensed to the Apache Software Foundation (ASF) under one
+// * or more contributor license agreements. See the NOTICE file
+// * distributed with this work for additional information
+// * regarding copyright ownership. The ASF licenses this file
+// * to you under the Apache License, Version 2.0 (the
+// * "License"); you may not use this file except in compliance
+// * with the License. You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * Unless required by applicable law or agreed to in writing,
+// * software distributed under the License is distributed on an
+// * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// * KIND, either express or implied. See the License for the
+// * specific language governing permissions and limitations
+//re * under the License.
+// *
+//*/
+//package org.apache.airavata.xbaya.interpreter;
+//
+//
+//import org.apache.airavata.workflow.tracking.NotifierFactory;
+//import org.apache.airavata.workflow.tracking.WorkflowNotifier;
+//import org.apache.airavata.workflow.tracking.common.InvocationContext;
+//import org.apache.airavata.workflow.tracking.common.InvocationEntity;
+//import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+//import org.apache.axis2.addressing.EndpointReference;
+//
+//import java.io.ByteArrayOutputStream;
+//import java.io.PrintStream;
+//import java.net.URI;
+//import java.util.Properties;
+//
+//public class NotificationSender {
+//
+// protected WorkflowNotifier notifier;
+//
+// protected String brokerURL;
+//
+// protected String topic;
+//
+// protected URI workflowID;
+//
+// protected InvocationEntity initiator;
+//
+// protected InvocationEntity receiver;
+//
+// protected InvocationContext invocationContext;
+//
+// protected EndpointReference eventSink;
+//
+// protected WorkflowTrackingContext context;
+//
+// /**
+// * Constructs a NotificationSender.
+// *
+// * @param brokerURL
+// * @param topic
+// */
+// public NotificationSender(URI brokerURL, String topic) {
+// this(brokerURL.toString(), topic);
+// }
+//
+// /**
+// * Creates a NotificationSender.
+// *
+// * @param brokerURL The location of notification brokerUrl.
+// * @param topic The notification topic.
+// */
+// public NotificationSender(String brokerURL, String topic) {
+// this.topic = topic;
+// this.brokerURL = brokerURL;
+// this.workflowID = URI.create(this.convertToJavaIdentifier(this.topic));
+// this.eventSink = new EndpointReference(this.brokerURL);
+// Properties props = new Properties();
+//
+// this.notifier = NotifierFactory.createNotifier();
+// URI initiatorWorkflowID = null;
+// URI initiatorServiceID = URI.create(this.convertToJavaIdentifier(topic));
+// String initiatorWorkflowNodeID = null;
+// Integer initiatorWorkflowTimeStep = null;
+// this.context = this.notifier.createTrackingContext(props, brokerURL, initiatorWorkflowID,
+// initiatorServiceID, initiatorWorkflowNodeID, initiatorWorkflowTimeStep);
+// this.context.setTopic(topic);
+// this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID,
+// initiatorWorkflowTimeStep);
+//
+// URI receiverWorkflowID = this.workflowID;
+// URI receiverServiceID = this.workflowID;
+// String receiverWorkflowNodeID = null;
+// Integer receiverWorkflowTimeStep = null;
+// this.receiver = this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID,
+// receiverWorkflowTimeStep);
+// }
+//
+// /**
+// * @return The event sink EPR.
+// */
+// public EndpointReference getEventSink() {
+// return this.eventSink;
+// }
+//
+//
+// public void workflowStarted(String message) {
+// this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator, message);
+// }
+//
+//
+// public void workflowFinished(String message) {
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+// }
+//
+// public void sendingPartialResults(Object[] args, String[] keywords) {
+// String message = "";
+// for (int i = 0; i < args.length; i++) {
+// if (i != 0) {
+// message += ", ";
+// }
+// message += keywords[i] + "=" + args[i];
+// }
+// this.notifier.sendingResult(context, this.invocationContext, message);
+// }
+//
+//
+// public void workflowTerminated() {
+// this.notifier.workflowTerminated(context, this.workflowID, "Workflow finished successfully.");
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param message The message to send
+// */
+// public void workflowFailed(String message) {
+// workflowFailed(message, null);
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param e
+// */
+// public void workflowFailed(Throwable e) {
+// workflowFailed(null, e);
+// }
+//
+// /**
+// * Sends a START_INCOMPLETED notification message.
+// *
+// * @param message The message to send
+// * @param e
+// */
+// public void workflowFailed(String message, Throwable e) {
+// this.notifier.sendingFault(context, this.invocationContext, message);
+// }
+//
+// public void info(String message) {
+// this.notifier.info(context, message);
+// }
+//
+// /**
+// * @param throwable
+// * @return The stackTrace in String
+// */
+// public static String getStackTraceInString(Throwable throwable) {
+// ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+// PrintStream printStream = new PrintStream(byteArrayOutputStream);
+// throwable.printStackTrace(printStream);
+// printStream.flush();
+// return byteArrayOutputStream.toString();
+// }
+//
+// public static String convertToJavaIdentifier(String name) {
+//
+// final char REPLACE_CHAR = '_';
+//
+// if (name == null || name.length() == 0) {
+// return "" + REPLACE_CHAR;
+// }
+//
+// StringBuilder buf = new StringBuilder();
+//
+// char c = name.charAt(0);
+// if (!Character.isJavaIdentifierStart(c)) {
+// // Add _ at the beggining instead of replacing it to _. This is
+// // more readable if the name is like 3D_Model.
+// buf.append(REPLACE_CHAR);
+// }
+//
+// for (int i = 0; i < name.length(); i++) {
+// c = name.charAt(i);
+// if (Character.isJavaIdentifierPart(c)) {
+// buf.append(c);
+// } else {
+// buf.append(REPLACE_CHAR);
+// }
+// }
+//
+// return buf.toString();
+// }
+//}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/cab15715/modules/ws-messenger/INSTALL.txt
----------------------------------------------------------------------
diff --git a/modules/ws-messenger/INSTALL.txt b/modules/ws-messenger/INSTALL.txt
deleted file mode 100644
index 5a04c9e..0000000
--- a/modules/ws-messenger/INSTALL.txt
+++ /dev/null
@@ -1,162 +0,0 @@
-Installing Airavata WS-Messenger 0.0.1-SNAPSHOT
-------------------------------------------------
-
-Build WS-Messenger from Source
-------------------------------
-
-Prerequisites
--------------
-Java 1.5
-Maven (tested on v 3.0.2)
-
-
-1. Check out the code from SVN.
-
-
-2. Go to project folder and type
-
- mvn clean install -Dmaven.test.skip=true
-
-
-3. The binary distribution is located at
-
- <PROJECT DIR>/distribution/target
-
-Configure WS-Messenger messageBroker service.
-----------------------------------------------
-Given below are the configurations for message broker service. configuration file should be named as
-"airavata-server.properties". This should be included in the class path (e.g. <BROKER_DISTRIBUTION_DIR>/standalone-server/conf) when broker starts.
-
-Configuration Description
-============================= ====================================
-broker.jdbc.driver Database driver.
-broker.jdbc.url Url string used to connect the database
-broker.start.delivery.thread If set to true message delivery thread will be started.
-(true/false) Applicable when only running broker. User must set this to 'false'
- if he wishes run message deliver component separately ( e.g. messenger servlet).
-broker.socket.timeout Connection timeout in milliseconds.Set this to '0' if user wishes connections never to be timed out.
- (not recommended)4000
-broker.storage.type Specifies message, subscriptions should be stored in a database or not. memory or persistent
-(memory/persistent)
-broker.delivery.method Specifies what mechanism to be used deliver messages.
-(serial,parallel,pcrew) serial – single threaded delivery
- parallel – dynamic thread pool based delivery
- pcrew – fixed thread pool based delivery
- serial , parallel or pcrew
-broker.msg.delivery.retries Number of message delivery failures before a url become black listed (default is 2) 2
-consumer.expiration.time.gap Time period (in seconds) a url will be kept blacklisted (default is 5 seconds) 5
-sending.batch.size Maximum number of messages to be send to a one consumer/url at time. applicable if 'broker.delivery.method' is 'pcrew'(default is 10)10
-sending.thread.pool.size Size of the thread pool. only applicable if 'broker.delivery.method' is 'pcrew'. (default is 4) 4
-
-
-Configure WS-Messenger messagebox service
------------------------------------------
-Configuration Description
-msgBox.jdbc.driver Database driver.
-msgBox.jdbc.url Url string used to connect the data base
-msgBox.usedatabase If set to 'true' use MySql database. If set to 'false' use inmemory implementation.
-(true,false) In this scenario database settings i.e-broker.jdbc.url is not required.
-
-Run Ws-messenger
------------------
-1. User has the option to run broker in several modes. Steps for each mode is given below.
-
-Run standalone version supplied with binary distribution
----------------------------------------------------------
-
-1. Unzip binary distribution.
-
-2. Change default configurations if needed.
-
-- configuration files is located at:
- <extracted location>/standalone-server/conf/airavata-server.properties
-
- Run axis2 server by running the command:
- Linux -
- <extracted location>/standalone-server/bin/axis2server.sh
- Windows -
- <extracted location>/standalone-server/bin/axis2server.bat
-
-Run Ws-messenger using axis2 servlet
--------------------------------------
-(Tested on tomcat v 6.0.20 & axis2 v1.5.1)
-1. Copy broker aar file to axis2 distribution accordingly.
-2. Create database tables (Scripts can be found <extracted location>/bin/database_scripts)
-3. Set configurations appropriately and copy configuration file ( named airavata-server.properties) to
-
- <Axis-servlet>/webapps/axis2/WEB-INF/classes
-
-Note: a sample configuration file is located at:
-
-<extracted location>/standalone-server/conf/airavata-server.properties
-
-4. Start tomcat server.
-
-5. For more information follow how to deploy Apache Axis2 as a Web Application.
-
-
-Run Ws-messenger using a external axis2 distribution
-----------------------------------------------------
-
-1. Copy broker aar file to following location:
- <AXIS2_DIST_HOME>/repository/services
-
-2. Copy airavata-server.properties file to <AXIS2_DIST_HOME>/conf
-
- Configure the properties file with broker.start.delivery=false
-
-3. Start axis2 server.
-
-4. Run message delivery component separately.
-
-5. Deploy messenger servlet on tomcat.
-
-Note: messenger servlet can be found at <extracted_location>/messenger directory.
-
-6. Set configurations appropriately.
-
- <TOMECAT_HOME>/webapps/messenger/WEB-INF/classes/airavata-server.properties
-
-Note: Point to the correct database you want to pick the messages and do the message delivery, and check the
-property axis2.repository to the correct location.
-
-7. Start tomcat.
-
-
-Run Samples
------------
-
-Sample programs are located at: <Extracted location>/client-api/samples.
-
-Prerequisites:
---------------
-
-Apache Ant (tested on 1.7.1)
-Steps:
-
-1. Run WS-messenger in any mode previously described.
-
-2. Configure samples following the instructions given in README.txt (located in every sample directory)
-
-3. Run following command:
- ant run
-
-Run WS-Notification Viewer
---------------------------
-
-1. Extract binary distribution.
-
-2. Go to following location:
-
- <extracted location>/gui/
-
-3. Execute script startGUI.sh
-
-
-System Requirements
--------------------
-1. JDK - 1.6.x (1.6.0_24 onwards recommended for production)
-2. Minimum memory - 1 GB
-3. Processor - Pentium 800MHz or equivalent at minimum
-
-