http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java deleted file mode 100644 index 63c9063..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PublisherFactory.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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); - } - } -}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java deleted file mode 100644 index b97feaf..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ResourceNotifier.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -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); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java deleted file mode 100644 index 79bb0f8..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ServiceNotifier.java +++ /dev/null @@ -1,235 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java deleted file mode 100644 index 1ee4cbd..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowNotifier.java +++ /dev/null @@ -1,331 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java deleted file mode 100644 index af8ed51..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/WorkflowTrackingException.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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 - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java deleted file mode 100644 index 0a2b248..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Callback.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java deleted file mode 100644 index 1a3422a..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/LeadNotificationManager.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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.airavata.wsmg.client.protocol.WSEProtocolClient; -import org.apache.airavata.wsmg.commons.NameSpaceConstants; -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.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LeadNotificationManager { - - private final static Logger logger = LoggerFactory.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 = WSEProtocolClient.createEndpointReference(brokerURL, topic); - - String ret = null; - - try { - OMElement eprCrEl = EndpointReferenceHelper.toOM(OMAbstractFactory.getOMFactory(), encodedEpr, new QName( - "EndpointReference"), NameSpaceConstants.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; - */ - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java deleted file mode 100644 index 1ee6fba..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/NotificationType.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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 -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java deleted file mode 100644 index cab6f12..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/client/Subscription.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.client; - -import java.rmi.RemoteException; - -import org.apache.airavata.workflow.tracking.impl.subscription.MessageBoxNotificationHandler; -import org.apache.airavata.wsmg.client.ConsumerServer; -import org.apache.airavata.wsmg.client.MsgBrokerClientException; -import org.apache.airavata.wsmg.client.WseMsgBrokerClient; -import org.apache.axis2.addressing.EndpointReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class Subscription { - - private static final Logger logger = LoggerFactory.getLogger(Subscription.class); - - private String subscriptionID; - - private String topic; - - 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); - } - } 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; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java deleted file mode 100644 index 9789f3a..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationConsts.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationProps.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationProps.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationProps.java deleted file mode 100644 index b0579bf..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/AnnotationProps.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.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. - * - */ -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('>'); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorConsts.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorConsts.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorConsts.java deleted file mode 100644 index f37b307..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorConsts.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import org.apache.airavata.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); - */ -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_; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorProps.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorProps.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorProps.java deleted file mode 100644 index a0a6d4f..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/ConstructorProps.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import java.util.HashMap; -import java.util.Map; - -/** - * simple helper class to set properties as a chain. Extends Properties, so can be passed as constructor to notifier - * factory. can also load an external propetirs file that conforms to Java Properties file schema at - * http://java.sun.com/dtd/properties.dtd. - * - * 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); - */ -public class ConstructorProps { - - private Map<ConstructorConsts, Object> localMap; - - public ConstructorProps() { - localMap = new HashMap<ConstructorConsts, Object>(); - } - - public static ConstructorProps newProps() { - return new ConstructorProps(); - } - - public static ConstructorProps newProps(ConstructorConsts key, Object value) { - return newProps().set(key, value); - } - - public ConstructorProps set(ConstructorConsts key, Object value) { - if (!key.checkValueType(value.getClass())) - throw new ClassCastException("passed value class type: " + value.getClass() + " != expected class type: " - + key.getValueType() + " for key: " + key); - localMap.put(key, value); - return this; - } - - public Object get(ConstructorConsts key) { - return localMap.get(key); - } - - public Object get(ConstructorConsts key, Object defaultValue) { - Object value = localMap.get(key); - return value == null ? defaultValue : value; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataDurationObj.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataDurationObj.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataDurationObj.java deleted file mode 100644 index 7a6542b..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataDurationObj.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import java.net.URI; - -/** - * Convinience class to record notification related information about a file/directory. - * - */ -public interface DataDurationObj extends DurationObj { - - public DataObj getDataObj(); - - public URI getRemoteLocation(); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataObj.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataObj.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataObj.java deleted file mode 100644 index 32ca95e..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DataObj.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import java.net.URI; -import java.util.List; - -/** - * Convinience class to record notification related information about a file/directory. - * - * - */ -public interface DataObj { - - public URI getId(); - - public URI getLocalLocation(); - - public List<URI> getLocations(); - - public long getSizeInBytes(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DurationObj.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DurationObj.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DurationObj.java deleted file mode 100644 index 1f5a14c..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/DurationObj.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -/** - * Convinience class to record the state of computation related notifications. - */ -public interface DurationObj { - - public long markStartTimeMillis(); - - public long getStartTimeMillis(); - - public long markEndTimeMillis(); - - public long getEndTimeMillis(); - - public long getDurationMillis(); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationContext.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationContext.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationContext.java deleted file mode 100644 index 95aa511..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationContext.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -public interface InvocationContext extends InvocationEntity { - - public InvocationEntity getRemoteEntity(); - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationEntity.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationEntity.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationEntity.java deleted file mode 100644 index 4d2e8fa..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/InvocationEntity.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import org.apache.airavata.workflow.tracking.types.BaseIDType; - -import java.net.URI; - -public interface InvocationEntity { - - public String getWorkflowNodeID(); - - public URI getServiceID(); - - public Integer getWorkflowTimestep(); - - public URI getWorkflowID(); - - public BaseIDType toBaseIDType(); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierConfig.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierConfig.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierConfig.java deleted file mode 100644 index 32de5b2..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierConfig.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -import org.apache.axis2.addressing.EndpointReference; - -public class NotifierConfig { - private EndpointReference bokerEpr; - private String publisherImpl; - private boolean enableAsyncPublishing; - - public EndpointReference getBokerEpr() { - return bokerEpr; - } - - public void setBokerEpr(EndpointReference bokerEpr) { - this.bokerEpr = bokerEpr; - } - - public String getPublisherImpl() { - return publisherImpl; - } - - public void setPublisherImpl(String publisherImpl) { - this.publisherImpl = publisherImpl; - } - - public boolean isEnableAsyncPublishing() { - return enableAsyncPublishing; - } - - public void setEnableAsyncPublishing(boolean enableAsyncPublishing) { - this.enableAsyncPublishing = enableAsyncPublishing; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierCreationException.java ---------------------------------------------------------------------- diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierCreationException.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierCreationException.java deleted file mode 100644 index 33b8295..0000000 --- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierCreationException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -package org.apache.airavata.workflow.tracking.common; - -public class NotifierCreationException extends NotifierException { - public NotifierCreationException(String msg) { - super(msg); - } - - public NotifierCreationException(Throwable ex) { - super(ex); - } -}
