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 20:33:03 UTC

svn commit: r1142475 [2/7] - in /incubator/airavata/ws-messaging/trunk/workflow-tracking: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/airavata/ src/main/java/org/apache/airavata/comm...

Added: incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,245 @@
+/*
+ *
+ * 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.tracking;
+
+import java.net.URI;
+
+import org.apache.airavata.workflow.tracking.common.DataDurationObj;
+import org.apache.airavata.workflow.tracking.common.DataObj;
+import org.apache.airavata.workflow.tracking.common.DurationObj;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send Lead performance related notification messages. this calculates time taken to send/receive
+ * files, and for executing the application's computation section
+ * 
+ * <pre>
+ *          fileReceiveStarted(F1)
+ *          -- do gridftp get to stage input files --
+ *          fileReceiveFinished(F1)
+ *          computationStarted(C1)
+ *          -- call fortran code to process input files --
+ *          computationFinished(C1)
+ *          fileSendStarted(F2)
+ *          -- do gridftp put to save output files --
+ *          fileSendFinished(F2)
+ *          flush()
+ * </pre>
+ */
+public interface PerformanceNotifier {
+
+    /**
+     * called at the begining of a computational section (e.g. before invoking fortran code in jython script). This
+     * method returns a DurationObj which should be passed to the {@link #computationFinished} method. This object
+     * records the start timestamp of this computational section. A notification message is not sent until the
+     * {@link #computationFinished} method is called.
+     * 
+     * @return a DurationObj recording the start time of this computation
+     * 
+     */
+    public DurationObj computationStarted();
+
+    /**
+     * called at the end of a computational section (e.g. return from invoking fortran code in jython script). The
+     * DurationObj from {@link #computationStarted} should be passed to this method. A notification message is sent with
+     * the name and duration of this computation. A human readable name for this computation can be passed as part of
+     * the descriptionAndAnnotation.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that did this computation
+     * @param a
+     *            DurationObj recording the start time returned by the {@link #computationStarted} 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 passed {@link DurationObj} updated the end timestamp
+     */
+    public DurationObj computationFinished(WorkflowTrackingContext context, DurationObj compObj,
+            String... descriptionAndAnnotation);
+
+    /**
+     * called after a computational section (e.g. invoking fortran code in jython script) where the duration of
+     * computation was recorded by the application itself. This can be used instead of the two calls to
+     * {@link #computationStarted and {@link #computationFinished}. A notification message is sent with the duration of
+     * this computation. A human readable name for this computation can be passed as part of the
+     * descriptionAndAnnotation.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that did this computation
+     * @param durationMillis
+     *            the time taken for this computation in milliseconds
+     * @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 passed {@link DurationObj} updated the end timestamp
+     * 
+     */
+    public DurationObj computationDuration(WorkflowTrackingContext context, long durationMillis,
+            String... descriptionAndAnnotation);
+
+    /**
+     * called at the begining of sending a local file or directory to remote host. A {@link DataObj} created earlier
+     * using the {@link ProvenanceNotifier#dataProduced}, {@link ProvenanceNotifier#dataConsumed}, or
+     * {@link #dataReceiveStarted} should be passed, along with the remote URL. A {@link DataDurationObject} with the
+     * start timestamp of sending is returned. This should be passed to the {@link #dataSendFinish} method upon
+     * completion of the sending. A notification message is not sent until the {@link #dataSendFinished} method is
+     * called.
+     * 
+     * @param dataObj
+     *            the local {@link DataObj} that is being sent. This would have been created by calling
+     *            {@link ProvenanceNotifier#dataProduced}, {@link ProvenanceNotifier#dataConsumed}, or
+     *            {@link #dataReceiveStarted}
+     * @param remoteLocation
+     *            the remote URl to which this file is being copied
+     * 
+     * @return a {@link DataDurationObj} with the timestamp of send start and encapsulating the DataObj
+     * 
+     */
+    public DataDurationObj dataSendStarted(DataObj dataObj, URI remoteLocation);
+
+    /**
+     * Sends a notification about the locl file/directory that was sent to a remote URL along with its file/dir size and
+     * send duration.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that sent this file
+     * @param dataDurationObj
+     *            a {@link DataDurationObj} returned by the call to {@link #dataSendStarted}
+     * @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 passed {@link DataDurationObj} updated with the end timestamp
+     * 
+     */
+    public DataDurationObj dataSendFinished(WorkflowTrackingContext context, DataDurationObj dataObj,
+            String... descriptionAndAnnotation);
+
+    /**
+     * called after sending a local file or directory to remote host. Details of the local file and the remote URL
+     * should be passed. This method can be used to send a file transfer duration message when the duration is directly
+     * provided by the user. This is used in place of a call to {@link #dataSendStarted} and {@link #dataSendFinished}.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that sent this file
+     * @param dataId
+     *            the dataId for the file/dir being sent (optionally registered with nameresolver).
+     * @param localLocation
+     *            the local URL for the sent file, as an absolute path to the file/dir on the local host, in the form of
+     *            file://localhostName/path/to/file.txt
+     * @param remoteLocation
+     *            the remote URl to which this file is being copied
+     * @param sizeInBytes
+     *            the size of the transfered file/dir in bytes
+     * @param durationMillis
+     *            the time taken for this transfer to take place in milliseconds
+     * @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 a {@link DataDurationObj encapsulating a newly created {@link DataObj} and having the start/end
+     *         timestamps.
+     * 
+     */
+    public DataDurationObj dataSendDuration(WorkflowTrackingContext context, URI dataID, URI localLocation,
+            URI remoteLocation, int sizeInBytes, long durationMillis, String... descriptionAndAnnotation);
+
+    /**
+     * called at the begining of receiving a local file or directory from remote host. The UUID for this file/directory
+     * recorded with the naming service may be passed, along with the absolute path to the local file/directory, and URL
+     * to the remote file location. A {@link DataObj} containing the start timestamp and other file info passed is
+     * returned. This returned {@link DataObj} needs to be passed to the {@link #dataReceiveFinish} method upon which a
+     * notification message is sent. This method does not send a notification nor does it map the leadId with the
+     * resolver.
+     * 
+     * @param dataId
+     *            the dataId for the file/dir being received (optionally registered with nameresolver).
+     * @param remoteLocation
+     *            the remote URL from which this file is being copied
+     * @param localLocation
+     *            the local URL for the file being received, as an absolute path to the file/dir on the local host, in
+     *            the form of file://localhostName/path/to/file.txt
+     * 
+     * @return a DataDurationObj with the receive start timestamp, and also containing {@link DataObj} created using the
+     *         passed dataId, local path, and remote URL
+     * 
+     * 
+     */
+    public DataDurationObj dataReceiveStarted(URI dataID, URI remoteLocation, URI localLocation);
+
+    /**
+     * Sends a notification about the local file/directory that was received from a remote URL along with file/dir size
+     * and receive duration. This also appends the dataId to the local file AND the remote file mapping with the name
+     * resolver, or creates a mappings if the dataId was not passed.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that received this file
+     * @param dataDurationObj
+     *            the {@link DataDurationObj} returned by the call to {@link #dataReceiveStarted}
+     * @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 passed {@link DataDurationObj} updated with the end timestamp
+     * 
+     */
+    public DataDurationObj dataReceiveFinished(WorkflowTrackingContext context, DataDurationObj dataObj,
+            String... descriptionAndAnnotation);
+
+    /**
+     * called after receiving a local file or directory to remote host. Details of the local file and the remote URL
+     * should be passed. This method can be used to send a file transfer duration message when the duration is directly
+     * provided by the user. This is used in place of a call to {@link #dataReceiveStarted} and
+     * {@link #dataReceiveFinished}.
+     * 
+     * @param entity
+     *            identity of the workflow/service's invocation that sent this file
+     * @param dataId
+     *            the dataId for the file/dir being sent (optionally registered with nameresolver).
+     * @param remoteLocation
+     *            the remote URL from which this file is being copied
+     * @param localLocation
+     *            the local URL where the file/dir is received, as an absolute path to it on the local host, in the form
+     *            of file://localhostName/path/to/file.txt
+     * @param sizeInBytes
+     *            the size of the transfered file/dir in bytes
+     * @param durationMillis
+     *            the time taken for this transfer to take place in milliseconds
+     * @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 a {@link DataDurationObj encapsulating a newly created {@link DataObj} and having the start/end
+     *         timestamps.
+     * 
+     */
+    public DataDurationObj dataReceiveDuration(WorkflowTrackingContext context, URI dataID, URI remoteLocation,
+            URI localLocation, int sizeInBytes, long durationMillis, String... descriptionAndAnnotation);
+}

Added: incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,180 @@
+/*
+ *
+ * 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.tracking;
+
+import java.net.URI;
+import java.util.List;
+
+import org.apache.airavata.workflow.tracking.common.DataObj;
+import org.apache.airavata.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>
+ */
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,54 @@
+/*
+ *
+ * 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.tracking;
+
+import java.lang.reflect.Constructor;
+
+import org.apache.airavata.workflow.tracking.common.ConstructorProps;
+import org.apache.airavata.workflow.tracking.common.NotifierCreationException;
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+import org.apache.airavata.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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.tracking;
+
+import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send notifications related to resource broker and job status.r
+ */
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,235 @@
+/*
+ *
+ * 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.tracking;
+
+import java.net.URI;
+
+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.xmlbeans.XmlObject;
+
+/**
+ * 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>
+ */
+
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,331 @@
+/*
+ *
+ * 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.tracking;
+
+import java.net.URI;
+
+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.xmlbeans.XmlObject;
+
+/**
+ * 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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.tracking;
+
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/calder/CalderNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/calder/CalderNotifier.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/calder/CalderNotifier.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/calder/CalderNotifier.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,93 @@
+/*
+ *
+ * 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.tracking.calder;
+
+import org.apache.airavata.commons.LeadCrosscutParametersUtil;
+import org.apache.airavata.workflow.tracking.GenericNotifier;
+import org.apache.airavata.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>
+ */
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,45 @@
+/*
+ *
+ * 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.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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,185 @@
+/*
+ *
+ * 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.tracking.client;
+
+import java.rmi.RemoteException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.airavata.commons.WorkFlowUtils;
+import org.apache.airavata.workflow.tracking.impl.subscription.LeadNotificationHandler;
+import org.apache.airavata.workflow.tracking.impl.subscription.MessageBoxNotificationHandler;
+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;
+
+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 Subscription 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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,41 @@
+/*
+ *
+ * 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.tracking.client;
+
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,131 @@
+/*
+ *
+ * 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.tracking.client;
+
+import java.rmi.RemoteException;
+
+import org.apache.airavata.workflow.tracking.impl.subscription.MessageBoxNotificationHandler;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.log4j.Logger;
+
+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/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java
URL: http://svn.apache.org/viewvc/incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java?rev=1142475&view=auto
==============================================================================
--- incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java (added)
+++ incubator/airavata/ws-messaging/trunk/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java Sun Jul  3 18:32:59 2011
@@ -0,0 +1,82 @@
+/*
+ *
+ * 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.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;
+    }
+}