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

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

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ProvenanceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ProvenanceNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ProvenanceNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ProvenanceNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,184 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URI;
+import java.util.List;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.DataObj;
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Convinience interface that groups all methods used to send Lead notification messages from
+ * an application (script or service). This extends the generic, provenance, and performance
+ * Notifier interfaces. Workflow Notifier interface is kept separate.
+ * A typical sequence of usage of this interface would be as follows:
+ * <pre>
+ *
+ * [WF1[S1]]
+ *
+ *        -- initialize components --
+ * WF1    workflowInitialized(baseId, ...)
+ * S1     serviceInitialized(baseId, ...)
+ * ...
+ *        -- invoke workflow --
+ * WF1    workflowInvoked(myID, invokerID, input, ...)
+ * ...
+ *        -- invoke service --
+ * WF1    invokingService(myID, invokeeID, input, ...)
+ * S1         serviceInvoked(myID, invokerID, input, ...)
+ * WF1    invokingServiceSucceeded|Failed(myID, invokeeID, [error], ...)
+ * ...
+ *            -- perform invocation task --
+ * S1         info(...)
+ * S1         fileReceiveStarted(F1)
+ * S1         -- do gridftp get to stage input files --
+ * S1         fileReceiveFinished(F1)
+ * S1         fileConsumed(F1)
+ * S1         computationStarted(C1)
+ * S1         -- perform action/call external application to process input files --
+ * S1         computationFinished(C1)
+ * S1         fileProduced(F2)
+ * S1         fileSendStarted(F2)
+ * S1         -- do gridftp put to save output files --
+ * S1         fileSendFinished(F2)
+ * S1         publishURL(F2)
+ * ...
+ * S1         sendingResult|Fault(myID, invokerID, output|fault, ...)
+ * WF1    receivedResult|Fault(myID, invokeeID, output|fault, ...)
+ * S1         sendingResponseSucceeded|Failed(myID, invokerID, [error], ...)
+ * S1         flush()
+ * ...
+ *        -- finished all work --
+ * WF1    flush()
+ * WF1    workflowTerminated(baseId, ...)
+ * S1     serviceTerminated(baseId, ...)
+ * </pre>
+ *
+ * @version $Revision: 1.5 $
+ * @author 
+ */
+public interface ProvenanceNotifier extends WorkflowNotifier, GenericNotifier {
+
+    /**
+     * Sends a notification indicating that a file/directory was used during this invocation.
+     * The dataId for this file/directory recorded with the naming service may be passed, along
+     * with the absolute path to the local file/directory. This will append a mapping from the
+     * dataId to the local file with the resolver (or create a new dataId if dataId not passed)
+     * A message with the (created or passed) dataId, local path, and size of the local
+     * file/directory is sent.
+     * @param    context     current workflow tracking context, this includes in parameter entity the 
+     *                       identity of the workflow/service's invocation that consumed this file
+     * @param    dataId      the dataId for this file/dir (registered with the name resolver if available).
+     * @param    locations   the list of URLs to the replicas of this file/dir.
+     *                      the first URL should be the absolute path to this file/dir on the local
+     *                      host, in the form of file://localhostName/path/to/file.txt
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   a DataObj recording the dataId, local path, timestamp and size of file/dir
+     *
+     */
+    public DataObj dataConsumed(WorkflowTrackingContext context, URI dataId, List<URI> locations,
+                                String ... descriptionAndAnnotation);
+
+    public DataObj dataConsumed(WorkflowTrackingContext context, URI dataId, List<URI> locations, int sizeInBytes,
+                                String ... descriptionAndAnnotation);
+
+    /**
+     * Sends a notification indicating that a file/directory was used by this invocation.
+     * A fileobj representing this file and returned by another file method should be passed.
+     * This will append a mapping from the
+     * dataId to the local file with the resolver (or create a new dataId if leadId not already set)
+     * if not already done.
+     * A message with the leadId, local path, and size of the local file/directory is sent.
+     *
+     * @param    context     current workflow tracking context, this includes in parameter entity the 
+     *                       identity of the workflow/service's invocation that consumed this file
+     * @param    dataObj        data object recording the dataId, local/remote URLs, timestamp of
+     *                          the file/dir, that was returned by another data notification method
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   the file object passed to this method with file/dir size filled in if not
+     * already when passed.
+     *
+     */
+    public DataObj dataConsumed(WorkflowTrackingContext context, DataObj fileObj,
+                                String ... descriptionAndAnnotation);
+
+    /**
+     * Sends a notification indicating that a file/directory was created by this invocation.
+     * This file/directory is optionally registered with a naming service and a new leadId created for it.
+     * The absolute path to the local file/directory should be passed.
+     * A message with the file leadId, local path, and size of the local file/directory is sent.
+     *
+     * @param    context     current workflow tracking context, this includes in parameter entity the 
+     *                       identity of the workflow/service's invocation that consumed this file
+     * @param    dataId      the dataId for this file/dir (registered with the name resolver if available).
+     * @param    locations   the list of URLs to the replicas of this file/dir.
+     *                      the first URL should be the absolute path to this file/dir on the local
+     *                      host, in the form of file://localhostName/path/to/file.txt
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   a FileObj recording the leadId, local path, timestamp and size of file/dir
+     *
+     */
+    public DataObj dataProduced(WorkflowTrackingContext context, URI dataId, List<URI> locations,
+                                String ... descriptionAndAnnotation);
+
+    public DataObj dataProduced(WorkflowTrackingContext context, URI dataId, List<URI> locations, int sizeInBytes,
+                                String ... descriptionAndAnnotation);
+
+    /**
+     * Sends a notification indicating that a file/directory was created by this invocation.
+     * A fileobj representing this file and returned by another file method should be passed.
+     * if file was not registered with the resolver, this method optionally adds a mapping with
+     * the resolver.
+     * A message with the file leadId, local path, and size of the local file/directory is sent.
+     *
+     * @param    context     current workflow tracking context, this includes in parameter entity the 
+     *                       identity of the workflow/service's invocation that consumed this file
+     * @param    dataObj        data object recording the dataId, local/remote URLs, timestamp of
+     *                          the file/dir, that was returned by another data notification method
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   the file object passed to this method with file/dir size filled in if not
+     * already when passed.
+     *
+     */
+    public DataObj dataProduced(WorkflowTrackingContext context, DataObj fileObj,
+                                String ... descriptionAndAnnotation);
+
+}
+
+
+
+
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PublisherFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PublisherFactory.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PublisherFactory.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PublisherFactory.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,36 @@
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.lang.reflect.Constructor;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.ConstructorProps;
+import edu.indiana.extreme.lead.workflow_tracking.common.NotifierConfig;
+import edu.indiana.extreme.lead.workflow_tracking.common.NotifierCreationException;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+import edu.indiana.extreme.lead.workflow_tracking.impl.publish.NotificationPublisher;
+
+public class PublisherFactory {
+	protected static final Class[] PUBLISHER_CONSTRUCTOR_PARAM_TYPES = { ConstructorProps.class };
+
+	protected static NotificationPublisher createSomePublisher(
+			String publisherClassName, WorkflowTrackingContext context) {
+
+		try {
+			// Try to load the notifier's class.
+			Class publisherClazz = Class.forName(publisherClassName);
+
+			// Try to get the notifier's constructor.
+			Constructor publisherConstructor = publisherClazz
+					.getConstructor(PUBLISHER_CONSTRUCTOR_PARAM_TYPES);
+
+			// Define the parameters for the notifier's constructor.
+			Object[] constructorParameters = { context };
+
+			// Create the notifier by calling its constructor.
+			return (NotificationPublisher) publisherConstructor
+					.newInstance(constructorParameters);
+
+		} catch (Exception exception) {
+			throw new NotifierCreationException(exception);
+		}
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ResourceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ResourceNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ResourceNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ResourceNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send notifications related to resource broker and job status.
+ *
+ * @version $Revision: 1.1 $
+ * @author  
+ */
+public interface ResourceNotifier {
+
+    /**
+     * Method resourceMapping
+     *
+     * @param    entity              an InvocationEntity
+     * @param    mappedResource      a  String
+     * @param    retryStatusCount    an int
+     * @param    descriptionAndAnnotationa  String
+     *
+     */
+    void resourceMapping(WorkflowTrackingContext context,
+                         String mappedResource,
+                         int retryStatusCount,
+                         String ... descriptionAndAnnotation);
+
+    /**
+     * Method jobStatus
+     *
+     * @param    entity              an InvocationEntity
+     * @param    status              a  String
+     * @param    retryCount          an int
+     * @param    descriptionAndAnnotationa  String
+     *
+     */
+    void jobStatus(WorkflowTrackingContext context, 
+                   String status,
+                   int retryCount,
+                   String ... descriptionAndAnnotation);
+}
+
+
+
+
+
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ServiceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ServiceNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ServiceNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/ServiceNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,223 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URI;
+
+import org.apache.xmlbeans.XmlObject;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationContext;
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send Lead provenance related notification messages. this
+ * tracks files used, produced, and transfered by this application, application begin and end.
+ * <pre>
+ *          appStarted(A1)
+ *          fileConsumed(F1)
+ *          fileProduced(F2)
+ *          appFinishedSuccess(A1, F2) | appFinishedFailed(A1, ERR)
+ *          flush()
+ * </pre>
+ *
+ * @version $Revision: 1.1 $
+ * @author 
+ */
+
+
+public interface ServiceNotifier extends GenericNotifier {
+
+    /**
+     * send a message indicating the service has been instantiated and will accept
+     * messages henceforth.
+     *
+     * @param    serviceID           an URI that identifies the service instance
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void serviceInitialized(WorkflowTrackingContext context, URI serviceID,
+                                   String ... descriptionAndAnnotation);
+
+    /**
+     * send a message indicating the service instance has terminated and will not accept or
+     * generate any future messages.
+     *
+     * @param    serviceID           an URI that identifies the service instance
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void serviceTerminated(WorkflowTrackingContext context, URI serviceID,
+                                  String ... descriptionAndAnnotation);
+
+    /**
+     * Method serviceInvoked. This service instance has received a message from the initiator
+     * to start executing.
+     *
+     * @param    receiver            identity of this service invocation
+     * @param    initiator           identity of entity that invoked this service
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation.
+     *
+     */
+    public InvocationContext serviceInvoked(WorkflowTrackingContext context, InvocationEntity receiver,
+                                            String ... descriptionAndAnnotation);
+
+    /**
+     * Method serviceInvoked. This service instance has received a message from the initiator
+     * to start executing.
+     *
+     * @param    receiver            identity of this service invocation
+     * @param    initiator           identity of entity that invoked this service
+     * @param    header              the context for this invocation (soap:header)
+     * @param    body                the message received that has the actions and inputs (soap:body)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation.
+     *
+     */
+    public InvocationContext serviceInvoked(WorkflowTrackingContext wtcontext, InvocationEntity initiator,
+                                            XmlObject header, XmlObject body,
+                                            String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method sendingResult. Return the result of the invocation back to the initiator of the
+     * invocation. This happens when a request-response pattern is followed.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingResult(WorkflowTrackingContext wtcontext, InvocationContext context,
+                              String ... descriptionAndAnnotation);
+
+    /**
+     * Method sendingResult. Return the result of the invocation back to the initiator of the
+     * invocation. This happens when a request-response pattern is followed.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    header              the context for the response to the invocation (soap:header)
+     * @param    body                the message that is sent as output of the invocation (soap:body)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingResult(WorkflowTrackingContext wtcontext, InvocationContext context,
+                              XmlObject header, XmlObject body,
+                              String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method sendingFault. Return a fault as the response to the invocation, sent back to
+     * the initiator of the invocation. This happens when a request-response pattern is followed.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    error    human readable description of the failure to be sent with the message
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     *
+     */
+    public void sendingFault(WorkflowTrackingContext wtcontext, InvocationContext context,
+                             String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method sendingFault. Return a fault as the response to the invocation, sent back to
+     * the initiator of the invocation. This happens when a request-response pattern is followed.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    header    the context for the response to the invocation (soap:header)
+     * @param    fault         the fault that is sent as output of the invocation (soap:fault)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingFault(WorkflowTrackingContext wtcontext, InvocationContext context, XmlObject header, XmlObject faultBody,
+                             String ... descriptionAndAnnotation);
+
+    /**
+     * send sendingResponseSucceeded message. Acknowledges that the response to this invocation was
+     * successfully sent to the initator of the invocation.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingResponseSucceeded(WorkflowTrackingContext wtcontext, InvocationContext context,
+                                         String ... descriptionAndAnnotation);
+
+    /**
+     * send sendingResponseSucceeded message. Acknowledges that the response to this invocation
+     * could not be sent to the initator of the invocation. Can be a local failure or
+     * a remote failure.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    error    human readable description of the failure to be sent with the message
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingResponseFailed(WorkflowTrackingContext wtcontext, InvocationContext context,
+                                      String ... descriptionAndAnnotation);
+
+    /**
+     * send sendingResponseSucceeded message. Acknowledges that the response to this invocation
+     * could not be sent to the initator of the invocation. Can be a local failure or
+     * a remote failure.
+     *
+     * @param    context             the context for this invocation as returned by serviceInvoked
+     * @param    trace               a throwable that has the trace for the error
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void sendingResponseFailed(WorkflowTrackingContext wtcontext, InvocationContext context, Throwable trace,
+                                      String ... descriptionAndAnnotation);
+
+}
+
+
+
+
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,277 @@
+
+
+package edu.indiana.extreme.lead.workflow_tracking;
+import java.net.URI;
+
+import org.apache.xmlbeans.XmlObject;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationContext;
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send Lead notification messages from a Workflow Engine
+ *
+ * A typical sequence of usage of this interface would be as follows:
+ * <pre>
+ *  WORKFLOW (Using this:Workflow Notifier)::
+ *      workflowStarted(W1)
+ *      invokeServiceStarted(S1)
+ *      -- invoke service --
+ *      -- service invokes application --
+ *      APPLICATION (Using Notifier Interface):
+ *          appStarted(A1)
+ *          info(...)
+ *          fileReceiveStarted(F1)
+ *          -- do gridftp get to stage input files --
+ *          fileReceiveFinished(F1)
+ *          fileConsumed(F1)
+ *          computationStarted(C1)
+ *          -- call fortran code to process input files --
+ *          computationFinished(C1)
+ *          fileProduced(F2)
+ *          fileSendStarted(F2)
+ *          -- do gridftp put to save output files --
+ *          fileSendFinished(F2)
+ *          publishURL(F2)
+ *          appFinishedSuccess(A1, F2) | appFinishedFailed(A1, ERR)
+ *          flush()
+ *  WORKFLOW (Using this:Workflow Notifier):
+ *      -- return from service invocation --
+ *      invokeServiceFinishedSuccess(S1) | invokeServiceFinishedFailed(S1, ERR)
+ *      invokeServiceStarted(S2)
+ *      -- invoke service --
+ *      ...
+ *      workflowFinishedSuccess(W1) | workflowFinishedFailer(W1, ERR)
+ *      flush()
+ * </pre>
+ * @version $Revision: 1.4 $
+ * @author 
+ */
+public interface WorkflowNotifier extends ServiceNotifier {
+
+    /**
+     * send a message indicating the workflow has been instantiated and will accept
+     * messages henceforth.
+     * @param    context     current workflow tracking context.
+     * @param    serviceID           an URI that identifies the workflow instance
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void workflowInitialized(WorkflowTrackingContext context, URI serviceID, String ... descriptionAndAnnotation);
+
+
+    /**
+     * send a message indicating the workflow instance has terminated and will not accept or
+     * generate any future messages.
+     * 
+     * @param    context     current workflow tracking context.
+     * @param    serviceID           an URI that identifies the workflow instance
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void workflowTerminated(WorkflowTrackingContext context, URI serviceID, String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method workflowInvoked. This workflow has received a message from the initiator
+     * to start executing.
+     * 
+     * @param    context     current workflow tracking context.
+     * @param    receiver            identity of this workflow invocation
+     * @param    initiator           identity of entity that invoked this workflow
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation. It can also be used as
+     * the InvocationEntity for this workflow in future notifications.
+     *
+     */
+    public InvocationContext workflowInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
+                                             String ... descriptionAndAnnotation);
+
+    /**
+     * Method workflowInvoked. This workflow has received a message from the initiator
+     * to start executing.
+     * 
+     * @param    context     current workflow tracking context.
+     * @param    receiver            identity of this workflow invocation
+     * @param    initiator           identity of entity that invoked this workflow
+     * @param    header              the context within which this invocation takes place (soap:header)
+     * @param    body                the message that causes this invocation (soap:body)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation.
+     *
+     */
+    public InvocationContext workflowInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
+                                             XmlObject header, XmlObject body,
+                                             String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method invokingService. This workflow is initiating an invocation upon another service.
+     *
+     * @param    context     current workflow tracking context.
+     * @param    initiator           identity of this workflow invocation
+     * @param    receiver            identity of entity that this workflow is invoking
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation.
+     *
+     */
+    public InvocationContext invokingService(WorkflowTrackingContext context, InvocationEntity receiver,
+                                             String ... descriptionAndAnnotation);
+
+    /**
+     * Method invokingService. This workflow is initiating an invocation upon another service.
+     *
+     * @param    context     current workflow tracking context.
+     * @param    initiator           identity of this workflow invocation
+     * @param    receiver            identity of entity that this workflow is invoking
+     * @param    header              the context for this invocation (soap:header)
+     * @param    body                the message that is sent with the action and input to start
+     * the invocation (soap:body)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @return   an InvocationContext that encapsulates this invocation. This object should be passed
+     * to any notification that is generated as part of this invocation.
+     *
+     */
+    public InvocationContext invokingService(WorkflowTrackingContext context, InvocationEntity receiver,
+                                             XmlObject header, XmlObject body,
+                                             String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method invokingServiceSucceeded. Acnowledge that the invocation request was received by the
+     * remote service successfully.
+     * @param    context     current workflow tracking context.
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @param    context           the context for this invocation as returned by invokeService
+     *
+     */
+    public void invokingServiceSucceeded(WorkflowTrackingContext wtcontext, InvocationContext context,
+                                         String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method invokingServiceFailed. Report that the invocation request could not be sent to the
+     * remote service. Can be a local failure or a remote failure.
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context           the context for this invocation as returned by invokeService
+     * @param    error             a  String describing the error
+     *
+     */
+    public void invokingServiceFailed(WorkflowTrackingContext wtcontext, InvocationContext context,
+                                      String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method invokingServiceFailed. Report that the invocation request could not be sent to the
+     * remote service. Can be a local failure or a remote failure.
+     * 
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context             the context for this invocation as returned by invokeService
+     * @param    trace               a throwable that has the trace for the error
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void invokingServiceFailed(WorkflowTrackingContext wtcontext, InvocationContext context,
+                                      Throwable trace,
+                                      String ... descriptionAndAnnotation);
+
+
+
+    /**
+     * Method receivedResult. Indicates that the invocation that this workflow initiated
+     * has received a response. This happens when a request-response pattern is followed.
+     * 
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context           the context for this invocation as returned by invokeService
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void receivedResult(WorkflowTrackingContext wtcontext, InvocationContext context,
+                               String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method receivedResult. Indicates that the invocation that this workflow initiated
+     * has received a response. This happens when a request-response pattern is followed.
+     *
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context           the context for this invocation as returned by invokeService
+     * @param    header              the context for the response to the invocation (soap:header)
+     * @param    body                the message that is received as output of the invocation (soap:body)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void receivedResult(WorkflowTrackingContext wtcontext, InvocationContext context,
+                               XmlObject header, XmlObject body,
+                               String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method receivedResult. Indicates that the invocation that this workflow initiated
+     * has received a fault as response. This happens when a request-response pattern is followed.
+     *
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context           the context for this invocation as returned by invokeService
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void receivedFault(WorkflowTrackingContext wtcontext, InvocationContext context,
+                              String ... descriptionAndAnnotation);
+
+
+    /**
+     * Method receivedResult. Indicates that the invocation that this workflow initiated
+     * has received a fault as response. This happens when a request-response pattern is followed.
+     *
+     * @param    wtcontext     current workflow tracking context.
+     * @param    context           the context for this invocation as returned by invokeService
+     * @param    header    the context for the response to the invocation (soap:header)
+     * @param    fault         the fault that is sent as output of the invocation (soap:fault)
+     * @param    descriptionAndAnnotation   optional vararg. The first element is used as the
+     * human readable description for this notification. The subsequent strings need to be
+     * serialized XML fragments that are added as annotation to the notification.
+     *
+     */
+    public void receivedFault(WorkflowTrackingContext wtcontext, InvocationContext context,
+                              XmlObject header, XmlObject faultBody,
+                              String ... descriptionAndAnnotation);
+
+}
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowTrackingException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowTrackingException.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowTrackingException.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/WorkflowTrackingException.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+
+/**
+ * @author 
+ */
+
+public class WorkflowTrackingException extends RuntimeException {
+
+    public WorkflowTrackingException() {
+        super();
+        // TODO Auto-generated constructor stub
+    }
+
+    public WorkflowTrackingException(String message) {
+        super(message);
+        // TODO Auto-generated constructor stub
+    }
+
+    public WorkflowTrackingException(String message, Throwable cause) {
+        super(message, cause);
+        // TODO Auto-generated constructor stub
+    }
+
+    public WorkflowTrackingException(Throwable cause) {
+        super(cause);
+        // TODO Auto-generated constructor stub
+    }
+
+}
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/calder/CalderNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/calder/CalderNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/calder/CalderNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/calder/CalderNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.calder;
+
+
+import edu.indiana.extreme.lead.commons.LeadCrosscutParametersUtil;
+import edu.indiana.extreme.lead.workflow_tracking.GenericNotifier;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Convinience interface that groups all methods used to send Lead notification messages from
+ * an application (script or service). This extends the generic, provenance, and performance
+ * Notifier interfaces. Workflow Notifier interface is kept separate.
+ * A typical sequence of usage of this interface would be as follows:
+ * <pre>
+ *
+ * [WF1[S1]]
+ *
+ *        -- initialize components --
+ * WF1    workflowInitialized(baseId, ...)
+ * S1     serviceInitialized(baseId, ...)
+ * ...
+ *        -- invoke workflow --
+ * WF1    workflowInvoked(myID, invokerID, input, ...)
+ * ...
+ *        -- invoke service --
+ * WF1    invokingService(myID, invokeeID, input, ...)
+ * S1         serviceInvoked(myID, invokerID, input, ...)
+ * WF1    invokingServiceSucceeded|Failed(myID, invokeeID, [error], ...)
+ * ...
+ *            -- perform invocation task --
+ * S1         info(...)
+ * S1         fileReceiveStarted(F1)
+ * S1         -- do gridftp get to stage input files --
+ * S1         fileReceiveFinished(F1)
+ * S1         fileConsumed(F1)
+ * S1         computationStarted(C1)
+ * S1         -- perform action/call external application to process input files --
+ * S1         computationFinished(C1)
+ * S1         fileProduced(F2)
+ * S1         fileSendStarted(F2)
+ * S1         -- do gridftp put to save output files --
+ * S1         fileSendFinished(F2)
+ * S1         publishURL(F2)
+ * ...
+ * S1         sendingResult|Fault(myID, invokerID, output|fault, ...)
+ * WF1    receivedResult|Fault(myID, invokeeID, output|fault, ...)
+ * S1         sendingResponseSucceeded|Failed(myID, invokerID, [error], ...)
+ * S1         flush()
+ * ...
+ *        -- finished all work --
+ * WF1    flush()
+ * WF1    workflowTerminated(baseId, ...)
+ * S1     serviceTerminated(baseId, ...)
+ * </pre>
+ *
+ * @version $Revision: 1.3 $
+ * @author Yogesh L. Simmhan [mailto:ysimmhan@cs.indiana.edu]
+ */
+public interface CalderNotifier extends GenericNotifier {
+    
+    public void queryStarted(WorkflowTrackingContext context, String radarName, String ... descriptionAndAnnotation);
+    public void queryFailedToStart(WorkflowTrackingContext context, String radarName, String ... descriptionAndAnnotation);
+    public void queryActive(WorkflowTrackingContext context, String radarName, String ... descriptionAndAnnotation);
+    public void queryExpired(WorkflowTrackingContext context, String radarName, String ... descriptionAndAnnotation);
+    public void triggerFound(WorkflowTrackingContext context, String radarName, String ... descriptionAndAnnotation);
+    public void queryPublishResult(WorkflowTrackingContext context, LeadCrosscutParametersUtil leadCrosscutParametersUtil);
+    public void queryNoDetection(WorkflowTrackingContext context, String ... descriptionAndAnnotation);
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Callback.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Callback.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Callback.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Callback.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.client;
+
+import org.apache.xmlbeans.XmlObject;
+
+
+ 
+/**
+ * Interface to be implemented to receive notifications after starting
+ * subscription
+ *
+ */
+public interface Callback {
+
+    /**
+     * Method deliverMessage is called when a Lead Message is received on the
+     * subscribed topic.
+     *
+     * @param topic
+     *            the topic to which this message was sent. This can also be
+     *            retrieved from the messageObj XMlObject directly after
+     *            typecasting.
+     * @param messageObj
+     *            the XmlObject representing one of the LeadMessages, This needs
+     *            to be typecast to the correct message type before being used.
+     *
+     */
+    public void deliverMessage(String topic, NotificationType notificationType,
+            XmlObject messageObj);
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/LeadNotificationManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/LeadNotificationManager.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/LeadNotificationManager.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/LeadNotificationManager.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,214 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.client;
+
+import java.rmi.RemoteException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.log4j.Logger;
+
+import wsmg.broker.wseventing.WSEProtocolSupport;
+import wsmg.commons.WsmgNameSpaceConstants;
+import edu.indiana.extreme.lead.commons.WorkFlowUtils;
+import edu.indiana.extreme.lead.workflow_tracking.impl.subscription.LeadNotificationHandler;
+import edu.indiana.extreme.lead.workflow_tracking.impl.subscription.MessageBoxNotificationHandler;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class LeadNotificationManager {
+
+	private final static org.apache.log4j.Logger logger = Logger
+			.getLogger(LeadNotificationManager.class);
+
+	/**
+	 * THis API call could be used if the user created a Sunscription in an
+	 * earlier run and now the service is being restarted and the user wants to
+	 * use the earlier subscription. All the following information is in the
+	 * Subscription object returned in the createSubscription API call.
+	 * 
+	 * @param messageBoxUrl
+	 * @param brokerLocation
+	 * @param eprOfMessageBox
+	 * @param SubscriptionID
+	 * @param topic
+	 * @param xpath
+	 *            Xpath expression to subscribe to. Can be null.
+	 * @param callback
+	 * @param subscribePermanatly
+	 *            Makes the renew a permanant subscription
+	 * @return
+	 * @throws Exception
+	 */
+	public static Subscription startListeningToSavedSubscription(
+			String brokerLocation, EndpointReference msgBoxAddrs,
+			String SubscriptionID, String topic, String xpath,
+			Callback callback, boolean subscribePermanatly) throws Exception {
+
+		return new MessageBoxNotificationHandler(msgBoxAddrs.getAddress(),
+				brokerLocation).startListeningToPreviousMessageBox(msgBoxAddrs,
+				SubscriptionID, topic, xpath, callback, subscribePermanatly);
+	}
+
+	/**
+	 * This API call could be used to keep-alive a subscription. It would not
+	 * start a new listener.
+	 * 
+	 * @param messageBoxUrl
+	 * @param brokerLocation
+	 * @param eprOfMessageBox
+	 * @param SubscriptionID
+	 * @param topic
+	 * @param xpath
+	 *            Xpath expression to subscribe to. Can be null.
+	 * @param subscribePermanatly
+	 *            Makes the renew a permanant subscription
+	 * @return
+	 * @throws Exception
+	 */
+	public static Subscription renewMessageboxSubscription(
+			String messageBoxUrl, String brokerLocation,
+			String eprOfMessageBox, String SubscriptionID, String topic,
+			String xpath, boolean subscribePermanatly) throws Exception {
+
+		return new MessageBoxNotificationHandler(messageBoxUrl, brokerLocation)
+				.renewMessageboxSubscription(eprOfMessageBox, SubscriptionID,
+						topic, xpath, subscribePermanatly);
+	}
+
+	public static Subscription renewMessageboxSubscription(
+			String brokerLocation, EndpointReference eprOfMessageBox,
+			String SubscriptionID, String topic, String xpath,
+			boolean subscribePermanatly) throws Exception {
+
+		return new MessageBoxNotificationHandler(eprOfMessageBox.getAddress(),
+				brokerLocation).renewMessageboxSubscription(eprOfMessageBox,
+				SubscriptionID, topic, xpath, subscribePermanatly);
+	}
+
+	/**
+	 * Create a messagebox subscription and does all the broker subscriptions
+	 * required.
+	 * 
+	 * @param messageBoxUrl
+	 * @param brokerLocation
+	 * @param topic
+	 * @param xpath
+	 *            Xpath expression to subscribe to. Can be null.
+	 * @param callback
+	 * @param subscribePermanatly
+	 *            Cretes the subscriptions permamntly
+	 * @param userAgent
+	 *            This will be displayed in the messagebox subscription can be
+	 *            null
+	 * @return
+	 * @throws RemoteException
+	 */
+	public static Subscription createMessageBoxSubscription(
+			String messageBoxUrl, String brokerLocation, String topic,
+			String xpath, Callback callback, boolean subscribePermanatly)
+			throws Exception {
+
+		return new MessageBoxNotificationHandler(messageBoxUrl, brokerLocation)
+				.createMsgBoxSubscription(topic, xpath, callback,
+						subscribePermanatly);
+	}
+
+	/**
+	 * Create a messagebox subscription and does all the broker subscriptions
+	 * required.
+	 * 
+	 * @param messageBoxUrl
+	 * @param brokerLocation
+	 * @param topic
+	 * @param xpath
+	 * @param callback
+	 * @param userAgent
+	 *            This will be displayed in the messagebox subscription can be
+	 *            null
+	 * @return
+	 * @throws Exception
+	 */
+	public static Subscription createMessageBoxSubscription(
+			String messageBoxUrl, String brokerLocation, String topic,
+			String xpath, Callback callback) throws Exception {
+
+		return new MessageBoxNotificationHandler(messageBoxUrl, brokerLocation)
+				.createSubscription(topic, xpath, callback, false);
+	}
+
+	/**
+	 * @param brokerLocation
+	 * @param topic
+	 * @param callback
+	 * @return
+	 * @throws Exception
+	 */
+	public static Subscription createSubscription(String brokerLocation,
+			String topic, Callback callback, int consumerServerPort)
+			throws Exception {
+		LeadNotificationHandler handler = new LeadNotificationHandler(
+				brokerLocation, topic, callback, consumerServerPort);
+
+		return handler.createSubscription();
+	}
+
+	public static String getBrokerPublishEPR(String brokerURL, String topic) {
+
+		brokerURL = WorkFlowUtils.formatURLString(brokerURL);
+
+		EndpointReference encodedEpr = WSEProtocolSupport.Client
+				.createEndpointReference(brokerURL, topic);
+
+		String ret = null;
+
+		try {
+			OMElement eprCrEl = EndpointReferenceHelper.toOM(OMAbstractFactory
+					.getOMFactory(), encodedEpr,
+					new QName("EndpointReference"),
+					WsmgNameSpaceConstants.WSA_NS.getNamespaceURI());
+
+			ret = eprCrEl.toStringWithConsume();
+
+		} catch (Exception e) {
+			logger.error("unable to convert broker url", e);
+		}
+
+		return ret;
+
+		/*
+		 * String epr = null; brokerURL =
+		 * WorkFlowUtils.formatURLString(brokerURL); if
+		 * (brokerURL.endsWith("/")) { epr = brokerURL + STRING_TOPIC + topic; }
+		 * else { epr = brokerURL + "/" + STRING_TOPIC + topic; }
+		 * 
+		 * epr = "<wsa:EndpointReference " +
+		 * "xmlns:wsa='http://www.w3.org/2005/08/addressing'>" + "<wsa:Address>"
+		 * + epr + "</wsa:Address>" + "</wsa:EndpointReference>"; return epr;
+		 */
+
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/NotificationType.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/NotificationType.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/NotificationType.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/NotificationType.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.client;
+
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public enum NotificationType {
+
+    ServiceInitialized,
+    WorkflowInitialized,
+    ServiceTerminated,
+    WorkflowTerminated,
+    WorkflowPaused,
+    WorkflowResumed,
+    
+
+    InvokingService,
+    WorkflowInvoked,
+    ServiceInvoked,
+    InvokingServiceSucceeded,
+    InvokingServiceFailed,
+
+    SendingResult,
+    SendingFault,
+    ReceivedResult,
+    ReceivedFault,
+    SendingResponseSucceeded,
+    SendingResponseFailed,
+
+    DataConsumed,
+    DataProduced,
+
+    ApplicationAudit,
+    ComputationDuration,
+    DataSendDuration,
+    DataReceiveDuration,
+
+    PublishURL,
+    LogInfo,
+    LogException,
+    LogWarning,
+    LogDebug,
+
+    ResourceMapping,
+    JobStatus,
+
+    Unknown
+}
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Subscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Subscription.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Subscription.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/client/Subscription.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.client;
+
+import java.rmi.RemoteException;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+
+import wsmg.client.ConsumerServer;
+import wsmg.client.MsgBrokerClientException;
+import wsmg.client.WseMsgBrokerClient;
+import edu.indiana.extreme.lead.workflow_tracking.impl.subscription.MessageBoxNotificationHandler;
+
+/**
+ * @author Chathura Herath (cherath@cs.indiana.edu)
+ */
+
+public class Subscription {
+
+	private String subscriptionID;
+
+	private String topic;
+	private final static org.apache.log4j.Logger logger = Logger
+			.getLogger(Subscription.class);
+
+	private Callback callback;
+
+	private ConsumerServer xs;
+
+	private MessageBoxNotificationHandler messageBoxNotificationHandler;
+
+	private EndpointReference messageBoxEPR;
+
+	private String brokerURL;
+
+	public Subscription(
+			MessageBoxNotificationHandler messageBoxNotificationHandler,
+			String subscriptionID, String topic, Callback callback,
+			String brokerURL) {
+		this.messageBoxNotificationHandler = messageBoxNotificationHandler;
+		this.subscriptionID = subscriptionID;
+		this.topic = topic;
+		this.callback = callback;
+		this.brokerURL = brokerURL;
+	}
+
+	public Subscription(ConsumerServer xs, String subscriptionID, String topic,
+			Callback callback, String brokerURL) {
+		super();
+		this.xs = xs;
+		this.subscriptionID = subscriptionID;
+		this.topic = topic;
+		this.callback = callback;
+		this.brokerURL = brokerURL;
+	}
+
+	public Callback getCallback() {
+		return callback;
+	}
+
+	public String getTopic() {
+		return topic;
+	}
+
+	public void destroy() throws RemoteException {
+		if (this.xs != null) {
+			xs.stop();
+			WseMsgBrokerClient client = new WseMsgBrokerClient();
+			client.init(this.brokerURL);
+			try {
+				client.unSubscribe(this.subscriptionID);
+			} catch (MsgBrokerClientException e) {
+				logger.error(
+						"axisFault occured on unsubscribing subscription ID :"
+								+ this.subscriptionID, e);
+				e.printStackTrace();
+			}
+		} else if (this.messageBoxNotificationHandler != null) {
+			this.messageBoxNotificationHandler.destroy(messageBoxEPR);
+		}
+	}
+
+	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 getBrokerPublishEPR() {
+		return LeadNotificationManager.getBrokerPublishEPR(this.brokerURL,
+				this.topic);
+	}
+
+	public String getConsumerEPR() {
+
+		String ret = null;
+
+		if (null != xs) {
+
+			String[] eprs = xs.getConsumerServiceEPRs();
+			if (eprs.length > 0)
+				ret = eprs[0];
+
+		}
+		return ret;
+	}
+
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationConsts.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationConsts.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationConsts.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationConsts.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.common;
+
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+
+public enum AnnotationConsts {
+
+    // localName, simpleType, multiValued
+    ExperimentID("experimentID", true, false), // experiment id used in mylead
+        ServiceLocation("ServiceLocation", true, false), // location (EPR?) of the service
+        AbstractServiceID("abstractServiceID", true, false), // abstract service QName
+        AbstractWorkflowID("abstractWorkflowID", true, false), // abstract workfow QName
+        DataProductType("dataProductType", true, false), // namelist file, etc.
+        TypedSOAPRequest("typedSOAPRequest", false, false), // SOAP request with leadType fields set
+        TypedSOAPResponse("typedSOAPResponse", false, false), // SOAP request with leadType fields set
+        UserDN("userDN", true, false), // User DN of person invoking the service
+        ParamNameInSOAP("paramName", true, false), // element name of the (data) parameter in the SOAP Message
+        ServiceReplicaID("Service_Replica_ID", true, false)
+        ;
+
+    public QName getQName() { return qname; }
+    public boolean isSimpleType(){ return isSimpleType; }
+    public boolean isMultiValued(){ return isMultiValued; }
+
+    private static final String WFT_NS = "http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking";
+    private QName qname;
+    private boolean isSimpleType, isMultiValued;
+    private AnnotationConsts(String name, boolean isSimpleType_, boolean isMultiValued_){
+        this(WFT_NS, name, isSimpleType_, isMultiValued_);
+    }
+    private AnnotationConsts(String ns, String name, boolean isSimpleType_, boolean isMultiValued_){
+        qname = new QName(ns, name);
+        isSimpleType = isSimpleType_;
+        isMultiValued = isMultiValued_;
+    }
+
+    private static List<QName> qNameList = null;
+    public static List<QName> getQNameList(){
+        if(qNameList != null) return new ArrayList<QName>(qNameList);
+        final EnumSet<AnnotationConsts> allAnnos = EnumSet.allOf(AnnotationConsts.class);
+        List<QName> qNameList = new ArrayList<QName>();
+        for(AnnotationConsts anno : allAnnos){
+            qNameList.add(anno.getQName());
+        }
+        return qNameList;
+    }
+}
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationProps.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationProps.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationProps.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/AnnotationProps.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.common;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.namespace.QName;
+
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Use set(list) or setXml(list) to set multi valued annotations.
+ * Use add() or addXml() to add to multi valued annotations.
+ * Use set(string) or setXml(xmlobj) to set single valued annotations.
+ *
+ * @version $Revision: 1.2 $
+ * 
+ */
+public class AnnotationProps {
+
+    private Map<AnnotationConsts, Object> localMap;
+    private AnnotationProps() {
+        localMap = new HashMap<AnnotationConsts, Object>();
+    }
+
+    public static AnnotationProps newProps() {
+        return new AnnotationProps();
+    }
+
+    public static AnnotationProps newProps(AnnotationConsts key, String value) {
+        return newProps().set(key, value);
+    }
+
+    public static AnnotationProps newProps(AnnotationConsts key, XmlObject value) {
+        return newProps().setXml(key, value);
+    }
+
+    /**
+     * Use for single valued string annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  String
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps set(AnnotationConsts key, String value) {
+        if(!key.isSimpleType()) throw new RuntimeException("Expect XML Object value for annotation, not String ["
+                                                           + key + ", " + value + "]");
+        if(key.isMultiValued()) throw new RuntimeException("Expect list XML Object value for annotation, not single ["
+                                                           + key + ", " + value + "]");
+
+        localMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * Use for single valued XmlObj annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  XmlObject
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps setXml(AnnotationConsts key, XmlObject value) {
+        if(key.isSimpleType()) throw new RuntimeException("Expect string value for annotation, not Xml Object ["
+                                                          + key + ", " + value + "]");
+        if(key.isMultiValued()) throw new RuntimeException("Expect list XML Object value for annotation, not single ["
+                                                           + key + ", " + value + "]");
+
+        localMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * Use for multivalued string annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  List
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps set(AnnotationConsts key, List<String> value) {
+        if(!key.isSimpleType()) throw new RuntimeException("Expect XML Object value for annotation, not String ["
+                                                           + key + ", " + value + "]");
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation, not List ["
+                                                            + key + ", " + value + "]");
+
+        localMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * Use for multivalued XmlObj annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  List
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps setXml(AnnotationConsts key, List<XmlObject> value) {
+        if(key.isSimpleType()) throw new RuntimeException("Expect string value for annotation, not Xml Object ["
+                                                          + key + ", " + value + "]");
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation, not List ["
+                                                            + key + ", " + value + "]");
+
+        localMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * Use to add to existing multivalued string annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  String
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps add(AnnotationConsts key, String value) {
+        if(!key.isSimpleType()) throw new RuntimeException("Expect XML Object value for annotation, not String ["
+                                                           + key + ", " + value + "]");
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation. use set, not add ["
+                                                            + key + ", " + value + "]");
+
+        List<String> val = (List<String>)localMap.get(key);
+        if(val == null){
+            val = new ArrayList<String>();
+            localMap.put(key, val);
+        }
+        val.add(value);
+        return this;
+    }
+
+    /**
+     * Use to add to existing multivalued XmlObj annotation
+     *
+     * @param    key                 an AnnotationConsts
+     * @param    value               a  XmlObject
+     *
+     * @return   an AnnotationProps
+     *
+     */
+    public AnnotationProps addXml(AnnotationConsts key, XmlObject value) {
+        if(key.isSimpleType()) throw new RuntimeException("Expect string value for annotation, not Xml Object ["
+                                                          + key + ", " + value + "]");
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation, use set, not add ["
+                                                            + key + ", " + value + "]");
+
+        List<XmlObject> val = (List<XmlObject>)localMap.get(key);
+        if(val == null){
+            val = new ArrayList<XmlObject>();
+            localMap.put(key, val);
+        }
+        val.add(value);
+        return this;
+    }
+
+    public String get(AnnotationConsts key) {
+        if(!key.isSimpleType()) throw new RuntimeException("Expect XML Object value for annotation, not String" +
+                                                           " for anno: " + key);
+        if(key.isMultiValued()) throw new RuntimeException("Expect list XML Object value for annotation, not single" +
+                                                           " for anno: " + key);
+
+        return (String)localMap.get(key);
+    }
+
+    public XmlObject getXml(AnnotationConsts key) {
+        if(key.isSimpleType()) throw new RuntimeException("Expect string value for annotation, not Xml Object" +
+                                                          " for anno: " + key);
+        if(!key.isMultiValued()) throw new RuntimeException("Expect list XML Object value for annotation, not single" +
+                                                            " for anno: " + key);
+
+        return (XmlObject)localMap.get(key);
+    }
+
+    public List<String> getAll(AnnotationConsts key) {
+        if(!key.isSimpleType()) throw new RuntimeException("Expect XML Object value for annotation, not String" +
+                                                           " for anno: " + key);
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation, not List" +
+                                                            " for anno: " + key);
+
+        return (List<String>)localMap.get(key);
+    }
+
+    public List<XmlObject> getAllXml(AnnotationConsts key) {
+        if(key.isSimpleType()) throw new RuntimeException("Expect string value for annotation, not Xml Object" +
+                                                          " for anno: " + key);
+        if(!key.isMultiValued()) throw new RuntimeException("Expect single XML Object value for annotation, not List" +
+                                                            " for anno: " + key);
+
+        return (List<XmlObject>)localMap.get(key);
+    }
+
+    public Set<AnnotationConsts> getKeys(){
+        return localMap.keySet();
+    }
+
+    public int size(){
+        return localMap.size();
+    }
+
+    @Override
+	public String toString(){
+        final StringBuffer anno = new StringBuffer();
+        for(AnnotationConsts key : localMap.keySet()){
+            if(key.isSimpleType()){
+                if(key.isMultiValued()){
+                    // List<String>
+                    List<String> values = (List<String>)localMap.get(key);
+                    for(String val : values){
+                        addStartTag(anno, key);
+                        anno.append(val);
+                        addEndTag(anno, key);
+                    }
+                } else {
+                    // String
+                    String val = (String)localMap.get(key);
+                    addStartTag(anno, key);
+                    anno.append(val);
+                    addEndTag(anno, key);
+                }
+            } else {
+                if(key.isMultiValued()){
+                    // List<XmlObject>
+                    List<XmlObject> values = (List<XmlObject>)localMap.get(key);
+                    for(XmlObject val : values){
+                        addStartTag(anno, key);
+                        anno.append(val.xmlText());
+                        addEndTag(anno, key);
+                    }
+                } else {
+                    // XmlObject
+                    XmlObject val = (XmlObject)localMap.get(key);
+                    addStartTag(anno, key);
+                    anno.append(val.xmlText());
+                    addEndTag(anno, key);
+                }
+            }
+        }
+        return anno.toString();
+    }
+
+    private void addStartTag(StringBuffer anno, AnnotationConsts key) {
+        QName qname = key.getQName();
+        anno.append('<');
+        anno.append(qname.getLocalPart());
+        if(qname.getNamespaceURI() != null){
+            anno.append(" xmlns='");
+            anno.append(qname.getNamespaceURI());
+            anno.append('\'');
+        }
+        anno.append('>');
+    }
+
+    private void addEndTag(StringBuffer anno, AnnotationConsts key) {
+        anno.append("</");
+        anno.append(key.getQName().getLocalPart());
+        anno.append('>');
+    }
+
+}
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/ConstructorConsts.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/ConstructorConsts.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/ConstructorConsts.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/common/ConstructorConsts.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking.common;
+
+import edu.indiana.extreme.lead.workflow_tracking.client.Callback;
+
+/**
+ * This contains the names of parameters passed to the notifier constructor.
+ * e.g. props = util.Props.newProps(CONSTS.WORKFLOW_ID, "wfId001").
+ * set(CONSTS.NODE_ID, "nodeId001"). set(CONSTS.TIMESTEP, "time0001").
+ * set(CONSTS.BROKER_URL, "rainier:12346")); Notifier notifier =
+ * NotifierFactory.createNotifier(props);
+ * 
+ * @version
+ * @author 
+ */
+public enum ConstructorConsts {
+
+	NOTIFIER_IMPL_CLASS(String.class), 
+	ENABLE_BATCH_PROVENANCE(String.class), 
+	PUBLISHER_IMPL_CLASS(String.class), 
+	ENABLE_ASYNC_PUBLISH(String.class), 
+	TOPIC(String.class), 
+	CALLBACK_LISTENER(Callback.class), 
+	BROKER_EPR(String.class), 
+	ANNOTATIONS(AnnotationProps.class), 
+	KARMA_URL(String.class),
+	KARMA_IMPL(Object.class);
+
+	public Class getValueType() {
+		return valueType;
+	}
+
+	public boolean checkValueType(Class otherType) {
+		if (otherType == null)
+			return false;
+		if (valueType.isAssignableFrom(otherType))
+			return true;
+		else
+			return false;
+	}
+
+	private Class valueType;
+
+	private ConstructorConsts(Class type_) {
+		valueType = type_;
+	}
+}
+
+