You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ch...@apache.org on 2015/01/27 20:27:13 UTC
[1/5] airavata git commit: retiring workflow tracking schema -
AIRAVATA-1557
Repository: airavata
Updated Branches:
refs/heads/master cab157157 -> 42f77edb8
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/MessageUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/MessageUtil.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/MessageUtil.java
deleted file mode 100644
index 8e61445..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/MessageUtil.java
+++ /dev/null
@@ -1,562 +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.util;
-
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ApplicationAudit;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ComputationDuration;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.DataConsumed;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.DataProduced;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.DataReceiveDuration;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.DataSendDuration;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.InvokingService;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.InvokingServiceFailed;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.InvokingServiceSucceeded;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.JobStatus;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.LogDebug;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.LogException;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.LogInfo;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.LogWarning;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.PublishURL;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ReceivedFault;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ReceivedResult;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ResourceMapping;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.SendingFault;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.SendingResponseFailed;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.SendingResponseSucceeded;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.SendingResult;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ServiceInitialized;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ServiceInvoked;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.ServiceTerminated;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.WorkflowInitialized;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.WorkflowInvoked;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.WorkflowPaused;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.WorkflowResumed;
-import static org.apache.airavata.workflow.tracking.client.NotificationType.WorkflowTerminated;
-
-import java.net.URI;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-
-import org.apache.airavata.commons.LeadContextHeader;
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.airavata.workflow.tracking.common.AnnotationConsts;
-import org.apache.airavata.workflow.tracking.common.AnnotationProps;
-import org.apache.airavata.workflow.tracking.common.ConstructorConsts;
-import org.apache.airavata.workflow.tracking.common.ConstructorProps;
-import org.apache.airavata.workflow.tracking.types.*;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.xmlbeans.XmlAnySimpleType;
-import org.apache.xmlbeans.XmlCalendar;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-
-/**
- * Utility library to extract standard fields from LEAD message
- */
-public class MessageUtil {
-
- public static final String WFT_NS = "http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking";
- public static final QName ANNO_QNAME = new QName(WFT_NS, "annotation");
-
- /**
- * Returns the type of the LEAD Message as a Enum type. This byte ID can be used to quickly check the type of lead
- * message using an if..then statement or a switch statement
- *
- * @param message
- * a LEAD Message Xml Document
- *
- * @return An Enum of type <code> org.apache.airavata.workflow.tracking.util.NOtificationType</code>
- *
- */
- public static final NotificationType getType(XmlObject message) {
-
- if (message instanceof ServiceInitializedDocument)
- return ServiceInitialized;
- if (message instanceof WorkflowInitializedDocument)
- return WorkflowInitialized;
- if (message instanceof ServiceTerminatedDocument)
- return ServiceTerminated;
- if (message instanceof WorkflowTerminatedDocument)
- return WorkflowTerminated;
- if (message instanceof InvokingServiceDocument)
- return InvokingService;
- if (message instanceof WorkflowInvokedDocument)
- return WorkflowInvoked;
- if (message instanceof ServiceInvokedDocument)
- return ServiceInvoked;
- if (message instanceof WorkflowPausedDocument)
- return WorkflowPaused;
- if (message instanceof WorkflowResumedDocument)
- return WorkflowResumed;
- if (message instanceof InvokingServiceSucceededDocument)
- return InvokingServiceSucceeded;
- if (message instanceof InvokingServiceFailedDocument)
- return InvokingServiceFailed;
- if (message instanceof SendingResultDocument)
- return SendingResult;
- if (message instanceof SendingFaultDocument)
- return SendingFault;
- if (message instanceof ReceivedResultDocument)
- return ReceivedResult;
- if (message instanceof ReceivedFaultDocument)
- return ReceivedFault;
- if (message instanceof SendingResponseSucceededDocument)
- return SendingResponseSucceeded;
- if (message instanceof SendingResponseFailedDocument)
- return SendingResponseFailed;
- if (message instanceof DataConsumedDocument)
- return DataConsumed;
- if (message instanceof DataProducedDocument)
- return DataProduced;
- if (message instanceof ApplicationAuditDocument)
- return ApplicationAudit;
- if (message instanceof ComputationDurationDocument)
- return ComputationDuration;
- if (message instanceof DataSendDurationDocument)
- return DataSendDuration;
- if (message instanceof DataReceiveDurationDocument)
- return DataReceiveDuration;
- if (message instanceof PublishURLDocument)
- return PublishURL;
- if (message instanceof LogInfoDocument)
- return LogInfo;
- if (message instanceof LogExceptionDocument)
- return LogException;
- if (message instanceof LogWarningDocument)
- return LogWarning;
- if (message instanceof LogDebugDocument)
- return LogDebug;
- if (message instanceof ResourceMappingDocument)
- return ResourceMapping;
- if (message instanceof JobStatusDocument)
- return JobStatus;
-
- // default
- return NotificationType.Unknown;
- }
-
- public static ActivityTime getActivityTime(XmlObject activity) throws ParseException {
- Date clockTime = getActivityTimestamp(activity);
- int logicalTime = getActivityWorkflowTimestep(activity);
- return new ActivityTime(logicalTime, clockTime);
- }
-
- public static final QName TIMESTAMP_QNAME = new QName(WFT_NS, "timestamp");
- public static final QName NOTIFICATION_SRC_QNAME = new QName(WFT_NS, "notificationSource");
- public static final QName WF_TIMESTEP_QNAME = new QName(WFT_NS, "workflowTimestep");
-
- public static Date getActivityTimestamp(XmlObject activity) throws ParseException {
- // $ACTIVITY_XML/*/timestamp
- XmlCursor xc = activity.newCursor();
- // ./
- // xc.toStartDoc();
- // ./*
- xc.toNextToken();
- // ./*/timestamp
- xc.toChild(TIMESTAMP_QNAME);
- System.out.println(xc.xmlText());
- XmlCalendar calendar = new XmlCalendar(xc.getTextValue());
- // return getDateFormat().parse(xc.getTextValue()); // fixme: this
- // supports only one date format
- return calendar.getTime();
- }
-
- static SimpleDateFormat getDateFormat() {
- return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
- }
-
- public static int getActivityWorkflowTimestep(XmlObject activity) {
- // $ACTIVITY_XML/*/notificationSource/@workflowTimestep
- XmlCursor xc = activity.newCursor();
- // ./
- // xc.toStartDoc();
- // ./*
- xc.toNextToken();
- // ./*/notificationSource
- xc.toChild(NOTIFICATION_SRC_QNAME);
- // ./*/notificationSource/@*
- boolean hasAttr = xc.toFirstAttribute();
- while (hasAttr && !WF_TIMESTEP_QNAME.equals(xc.getName())) {
- hasAttr = xc.toNextAttribute();
- }
- if (hasAttr) {
- // ./*/notificationSource/@workflowTimestep
- return Integer.parseInt(xc.getTextValue());
- } else {
- return -1;
- }
- }
-
- public static List<XmlObject> getAnnotations(XmlObject message, AnnotationConsts annoElementQName) {
- // locate the wft:annotation element
- final String ANNO_XPATH = "declare namespace wft='" + ANNO_QNAME.getNamespaceURI() + "' .//wft:"
- + ANNO_QNAME.getLocalPart();
- XmlObject[] annoObj = message.selectPath(ANNO_XPATH);
- // for(XmlObject obj : annoObj){ System.out.println(obj); }
- // if no result, return nothing
- if (annoObj == null || annoObj.length == 0)
- return new ArrayList<XmlObject>(0);
- // if more than one 'annotation' element, select only first. FIXME?
- // Throw exception?
- final String ANNO_ELEMENT_XPATH = "declare namespace ann='" + annoElementQName.getQName().getNamespaceURI()
- + "' .//ann:" + annoElementQName.getQName().getLocalPart();
- XmlObject[] annoElements = annoObj[0].selectPath(ANNO_ELEMENT_XPATH);
- // for(XmlObject obj : annoElements){ System.out.println(obj); }
- return Arrays.asList(annoElements);
- }
-
- public static List<String> getSimpleAnnotations(XmlObject message, AnnotationConsts annoElementQName)
- throws XmlException {
- List<XmlObject> simpleXmlElements = getAnnotations(message, annoElementQName);
- List<String> simpleElements = new ArrayList<String>(simpleXmlElements.size());
- for (XmlObject obj : simpleXmlElements) {
- simpleElements.add((XmlAnySimpleType.Factory.parse(obj.xmlText())).stringValue());
- }
- return simpleElements;
- }
-
- public static Map<QName, XmlObject> getAllAnnotations(XmlObject message) throws XmlException {
- // locate the wft:annotation element
- final String ANNO_XPATH = "declare namespace wft='" + ANNO_QNAME.getNamespaceURI() + "' .//wft:"
- + ANNO_QNAME.getLocalPart();
- XmlObject[] annoObj = message.selectPath(ANNO_XPATH);
- // for(XmlObject obj : annoObj){ System.out.println(obj); }
- // if no result, return nothing
- if (annoObj == null || annoObj.length == 0)
- return new HashMap<QName, XmlObject>();
- // if more than one 'annotation' element, select only first. FIXME?
- // Throw exception?
- final String ANNO_ELEMENT_XPATH = "*";
- XmlObject[] annoElements = annoObj[0].selectPath(ANNO_ELEMENT_XPATH);
- // for(XmlObject obj : annoElements){ System.out.println(obj); }
- Map<QName, XmlObject> annoMap = new HashMap<QName, XmlObject>();
- for (XmlObject annoFrag : annoElements) {
- XmlObject annoElt = XmlObject.Factory.parse(annoFrag.xmlText(new XmlOptions().setSaveOuter()));
- // System.out.println(annoElt);
- XmlCursor xc = annoElt.newCursor();
- xc.toNextToken();
- // System.out.println(xc.getName());
- // System.out.println(xc.getObject());
- annoMap.put(xc.getName(), xc.getObject());
- }
- return annoMap;
- }
-
- public static Map<QName, String> getSimpleAnnotations(XmlObject message) throws XmlException {
- Map<QName, XmlObject> simpleXmlElements = getAllAnnotations(message);
- Map<QName, String> simpleElements = new HashMap<QName, String>(simpleXmlElements.size());
- for (Map.Entry<QName, XmlObject> obj : simpleXmlElements.entrySet()) {
- simpleElements.put(obj.getKey(), (XmlAnySimpleType.Factory.parse(obj.getValue().xmlText())).stringValue());
- }
- return simpleElements;
- }
-
- /**
- * Constructs a conttructorProps from LeadContextHeader.
- *
- * This methods sets annotations available in LeadContextHeader. You still need to set additional annotations if any
- * before calling NotifierFactory.createNotifier().
- *
- * @param leadContext
- * @return The constructor props created.
- */
- public static ConstructorProps createConstructorPropsFromLeadContext(LeadContextHeader leadContext) {
- EndpointReference sinkEpr = leadContext.getEventSink();
- ConstructorProps props = ConstructorProps.newProps(ConstructorConsts.BROKER_EPR, sinkEpr.getAddress());
-
- AnnotationProps annotationProps = AnnotationProps.newProps();
- String experimentId = leadContext.getExperimentId();
- if (experimentId != null) {
- annotationProps.set(AnnotationConsts.ExperimentID, experimentId);
- }
- URI workflowTemplateId = leadContext.getWorkflowTemplateId();
- if (workflowTemplateId != null) {
- annotationProps.set(AnnotationConsts.AbstractWorkflowID, workflowTemplateId.toString());
- }
- String userDn = leadContext.getUserDn();
- if (userDn != null) {
- annotationProps.set(AnnotationConsts.UserDN, userDn);
- }
- props.set(ConstructorConsts.ANNOTATIONS, annotationProps);
- return props;
- }
-
- public static void testAnno(String[] args) throws XmlException {
- String test1 = "<wor:dataProduced xmlns:wor='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>"
- + "<wor:notificationSource wor:serviceID='urn:qname:http://org.apache.airavata/lead:Terrain' wor:workflowID='tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46' wor:workflowTimestep='6' wor:workflowNodeID='Terrain_Preprocessor'/>"
- + "<wor:timestamp>2007-02-14T15:44:46.509-05:00</wor:timestamp>"
- + "<wor:dataProduct>"
- + "<wor:id>gsiftp://bigred.iu.teragrid.org//N/gpfsbr/tg-drlead/workDirs/Terrain_Wed_Feb_14_15_44_42_EST_2007_b017e36f-146e-4852-89de-e26b00d82d77/inputData/arpstrn.input</wor:id>"
- + "<wor:location>gsiftp://bigred.iu.teragrid.org//N/gpfsbr/tg-drlead/workDirs/Terrain_Wed_Feb_14_15_44_42_EST_2007_b017e36f-146e-4852-89de-e26b00d82d77/inputData/arpstrn.input</wor:location>"
- + "<wor:sizeInBytes>-1</wor:sizeInBytes>"
- + "<wor:timestamp>2007-02-14T15:44:46.508-05:00</wor:timestamp>"
- + "<wor:description>gsiftp://bigred.iu.teragrid.org//N/gpfsbr/tg-drlead/workDirs/Terrain_Wed_Feb_14_15_44_42_EST_2007_b017e36f-146e-4852-89de-e26b00d82d77/inputData/arpstrn.input</wor:description>"
- + "<wor:annotation>"
- + "<dataProductType xmlns='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>LEADNameListFile</dataProductType>"
- + "</wor:annotation>" + "</wor:dataProduct>" + "</wor:dataProduced>";
- String test2 = "<wor:serviceInvoked xmlns:wor='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>"
- + " <wor:notificationSource wor:serviceID='urn:qname:http://org.apache.airavata/lead:Terrain' wor:workflowID='tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46' wor:workflowTimestep='6' wor:workflowNodeID='Terrain_Preprocessor'/>"
- + " <wor:timestamp>2007-02-14T15:44:42.784-05:00</wor:timestamp>"
- + " <wor:description>Service Invoked</wor:description>"
- + " <wor:annotation>"
- + " <typedSOAPRequest xmlns='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>"
- + " <S:Envelope xmlns:wsa='http://www.w3.org/2005/08/addressing' xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'>"
- + " <S:Header>"
- + " <lh:context xmlns:lh='http://lead.extreme.indiana.edu/namespaces/2005/10/lead-context-header'>"
- + " <lh:experiment-id>urn:uuid:3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:experiment-id>"
- + " <lh:event-sink-epr>"
- + " <wsa:Address>http://tyr11.cs.indiana.edu:12346/topic/3f422b0b-912f-49c1-8bb6-0c5612d160bf</wsa:Address>"
- + " </lh:event-sink-epr>"
- + " <lh:user-dn>/O=LEAD Project/OU=portal.leadproject.org/OU=cs.indiana.edu/CN=marcus/EMAIL=machrist@cs.indiana.edu</lh:user-dn>"
- + " <lh:resource-catalog-url>https://everest.extreme.indiana.edu:22443/resource_catalog?wsdl</lh:resource-catalog-url>"
- + " <lh:gfac-url>https://tyr09.cs.indiana.edu:23443?wsdl</lh:gfac-url>"
- + " <lh:mylead-agent-url>https://bitternut.cs.indiana.edu:10243/myleadagent?wsdl</lh:mylead-agent-url>"
- + " <lh:OUTPUT_DATA_DIRECTORY>gsiftp://chinkapin.cs.indiana.edu//data/data-output/3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:OUTPUT_DATA_DIRECTORY>"
- + " <lh:OPENDAP_DIRECTORY>opendap://chinkapin.cs.indiana.edu:8080/thredds/dodsC/data/data-output/3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:OPENDAP_DIRECTORY>"
- + " <lh:OUTPUT_DATA_FILES_SUFFIX>.nc</lh:OUTPUT_DATA_FILES_SUFFIX>"
- + " <lh:workflow-instance-id>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46</lh:workflow-instance-id>"
- + " <lh:resource-broker-url>http://152.54.1.30:3333/resourcebroker?wsdl</lh:resource-broker-url>"
- + " <lh:workflow-time-step>6</lh:workflow-time-step>"
- + " <lh:workflow-node-id>Terrain_Preprocessor</lh:workflow-node-id>"
- + " <lh:service-instance-id>http://tempuri.org/no-service-id</lh:service-instance-id>"
- + " </lh:context>"
- + " <wsa:MessageID>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46/outgoing/Terrain_PreprocessorPartner/1</wsa:MessageID>"
- + " <wsa:ReplyTo>"
- + " <wsa:Address>http://tyr10.cs.indiana.edu:7080/gpel/728/ADASInitializedWRFForecasting/instance46/incoming/Terrain_PreprocessorPartner.atom</wsa:Address>"
- + " </wsa:ReplyTo>"
- + " <wsa:Action/>"
- + " <wsa:To>https://tyr11.cs.indiana.edu:12554/</wsa:To>"
- + " <wsa:FaultTo>"
- + " <wsa:Address>http://tyr10.cs.indiana.edu:7080/gpel/728/ADASInitializedWRFForecasting/instance46/incoming/Terrain_PreprocessorPartner.atom</wsa:Address>"
- + " </wsa:FaultTo>"
- + " <wsa:RelatesTo>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46/outgoing/Terrain_PreprocessorPartner/1</wsa:RelatesTo>"
- + " </S:Header>"
- + " <S:Body>"
- + " <terrain_preprocessortypens:Preprocessor_InputParams xmlns:terrain_preprocessortypens='http://org.apache.airavata/lead/Terrain/xsd'>"
- + " <CrossCuttingConfigurations n1:leadType='LeadCrosscutParameters' xmlns:n1='http://org.apache.airavata/namespaces/2004/01/gFac'>"
- + " <lcp:nx xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>53</lcp:nx>"
- + " <lcp:ny xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>53</lcp:ny>"
- + " <lcp:dx xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>20000</lcp:dx>"
- + " <lcp:dy xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>20000</lcp:dy>"
- + " <lcp:fcst_time xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>12.0</lcp:fcst_time>"
- + " <lcp:start_date xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>2007/02/13</lcp:start_date>"
- + " <lcp:start_hour xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>18</lcp:start_hour>"
- + " <lcp:ctrlat xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>39.97712</lcp:ctrlat>"
- + " <lcp:ctrlon xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-86.484375</lcp:ctrlon>"
- + " <lcp:westbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-90.97595</lcp:westbc>"
- + " <lcp:eastbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-81.9928</lcp:eastbc>"
- + " <lcp:northbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>43.34412</lcp:northbc>"
- + " <lcp:southbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>36.434242</lcp:southbc>"
- + " </CrossCuttingConfigurations>"
- + " </terrain_preprocessortypens:Preprocessor_InputParams>"
- + " </S:Body>"
- + " </S:Envelope>"
- + " </typedSOAPRequest>"
- + " </wor:annotation>"
- + " <wor:request>"
- + " <wor:header>"
- + " <S:Header xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'>"
- + " <lh:context xmlns:lh='http://lead.extreme.indiana.edu/namespaces/2005/10/lead-context-header'>"
- + " <lh:experiment-id>urn:uuid:3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:experiment-id>"
- + " <lh:event-sink-epr>"
- + " <wsa:Address xmlns:wsa='http://www.w3.org/2005/08/addressing'>http://tyr11.cs.indiana.edu:12346/topic/3f422b0b-912f-49c1-8bb6-0c5612d160bf</wsa:Address>"
- + " </lh:event-sink-epr>"
- + " <lh:user-dn>/O=LEAD Project/OU=portal.leadproject.org/OU=cs.indiana.edu/CN=marcus/EMAIL=machrist@cs.indiana.edu</lh:user-dn>"
- + " <lh:resource-catalog-url>https://everest.extreme.indiana.edu:22443/resource_catalog?wsdl</lh:resource-catalog-url>"
- + " <lh:gfac-url>https://tyr09.cs.indiana.edu:23443?wsdl</lh:gfac-url>"
- + " <lh:mylead-agent-url>https://bitternut.cs.indiana.edu:10243/myleadagent?wsdl</lh:mylead-agent-url>"
- + " <lh:OUTPUT_DATA_DIRECTORY>gsiftp://chinkapin.cs.indiana.edu//data/data-output/3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:OUTPUT_DATA_DIRECTORY>"
- + " <lh:OPENDAP_DIRECTORY>opendap://chinkapin.cs.indiana.edu:8080/thredds/dodsC/data/data-output/3f422b0b-912f-49c1-8bb6-0c5612d160bf</lh:OPENDAP_DIRECTORY>"
- + " <lh:OUTPUT_DATA_FILES_SUFFIX>.nc</lh:OUTPUT_DATA_FILES_SUFFIX>"
- + " <lh:workflow-instance-id>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46</lh:workflow-instance-id>"
- + " <lh:resource-broker-url>http://152.54.1.30:3333/resourcebroker?wsdl</lh:resource-broker-url>"
- + " <lh:workflow-time-step>6</lh:workflow-time-step>"
- + " <lh:workflow-node-id>Terrain_Preprocessor</lh:workflow-node-id>"
- + " <lh:service-instance-id>http://tempuri.org/no-service-id</lh:service-instance-id>"
- + " </lh:context>"
- + " <wsa:MessageID xmlns:wsa='http://www.w3.org/2005/08/addressing'>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46/outgoing/Terrain_PreprocessorPartner/1</wsa:MessageID>"
- + " <wsa:ReplyTo xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
- + " <wsa:Address>http://tyr10.cs.indiana.edu:7080/gpel/728/ADASInitializedWRFForecasting/instance46/incoming/Terrain_PreprocessorPartner.atom</wsa:Address>"
- + " </wsa:ReplyTo>"
- + " <wsa:Action xmlns:wsa='http://www.w3.org/2005/08/addressing'/>"
- + " <wsa:To xmlns:wsa='http://www.w3.org/2005/08/addressing'>https://tyr11.cs.indiana.edu:12554/</wsa:To>"
- + " <wsa:FaultTo xmlns:wsa='http://www.w3.org/2005/08/addressing'>"
- + " <wsa:Address>http://tyr10.cs.indiana.edu:7080/gpel/728/ADASInitializedWRFForecasting/instance46/incoming/Terrain_PreprocessorPartner.atom</wsa:Address>"
- + " </wsa:FaultTo>"
- + " <wsa:RelatesTo xmlns:wsa='http://www.w3.org/2005/08/addressing'>tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46/outgoing/Terrain_PreprocessorPartner/1</wsa:RelatesTo>"
- + " </S:Header>"
- + " </wor:header>"
- + " <wor:body>"
- + " <S:Body xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'>"
- + " <terrain_preprocessortypens:Preprocessor_InputParams xmlns:terrain_preprocessortypens='http://org.apache.airavata/lead/Terrain/xsd'>"
- + " <CrossCuttingConfigurations>"
- + " <lcp:nx xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>53</lcp:nx>"
- + " <lcp:ny xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>53</lcp:ny>"
- + " <lcp:dx xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>20000</lcp:dx>"
- + " <lcp:dy xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>20000</lcp:dy>"
- + " <lcp:fcst_time xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>12.0</lcp:fcst_time>"
- + " <lcp:start_date xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>2007/02/13</lcp:start_date>"
- + " <lcp:start_hour xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>18</lcp:start_hour>"
- + " <lcp:ctrlat xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>39.97712</lcp:ctrlat>"
- + " <lcp:ctrlon xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-86.484375</lcp:ctrlon>"
- + " <lcp:westbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-90.97595</lcp:westbc>"
- + " <lcp:eastbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>-81.9928</lcp:eastbc>"
- + " <lcp:northbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>43.34412</lcp:northbc>"
- + " <lcp:southbc xmlns:lcp='http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/'>36.434242</lcp:southbc>"
- + " </CrossCuttingConfigurations>"
- + " </terrain_preprocessortypens:Preprocessor_InputParams>"
- + " </S:Body>"
- + " </wor:body>"
- + " </wor:request>"
- + " <wor:initiator wor:serviceID='tag:gpel.leadproject.org,2006:728/ADASInitializedWRFForecasting/instance46' wor:workflowTimestep='-1'/>"
- + "</wor:serviceInvoked>";
-
- XmlObject test1Obj = XmlObject.Factory.parse(test1);
- List<String> result1 = getSimpleAnnotations(test1Obj, AnnotationConsts.DataProductType);
- for (String obj : result1) {
- System.out.println(obj);
- }
-
- XmlObject test2Obj = XmlObject.Factory.parse(test2);
- List<XmlObject> result2 = getAnnotations(test2Obj, AnnotationConsts.TypedSOAPRequest);
- for (XmlObject obj : result2) {
- System.out.println(obj);
- final String ANNO_XPATH = "declare namespace S='http://schemas.xmlsoap.org/soap/envelope/'"
- + " ./S:Envelope/S:Body/*";
- XmlObject[] out = obj.selectPath(ANNO_XPATH);
- for (XmlObject xo : out) {
- System.out.println("====");
- System.out.println(xo);
- System.out.println("----");
- class Param {
- String paramName, paramType, paramValue;
-
- public Param(String paramName_, String paramType_, String paramValue_) {
- paramName = paramName_;
- paramType = paramType_;
- paramValue = paramValue_;
- }
-
- public String toString() {
- return paramName + "<" + paramType + ">=[" + paramValue + "]";
- }
- }
- List<Param> paramList = new ArrayList<Param>();
-
- XmlCursor xc = xo.newCursor();
- boolean exists = xc.toFirstChild();
- while (exists) {
- String paramName = xc.getName().getLocalPart();
- String paramType = xc.getAttributeText(new QName(
- "http://org.apache.airavata/namespaces/2004/01/gFac", "leadType"));
- String paramValue;
- if ("LeadCrosscutParameters".equals(paramType)) {
- XmlObject paramObj = xc.getObject();
- XmlCursor xc2 = paramObj.newCursor();
- boolean exists2 = xc2.toFirstChild();
- while (exists2) {
- String paramName2 = xc2.getName().getLocalPart();
- String paramValue2 = xc2.getTextValue();
- // get type from param name
- String paramType2; // default
- if ("nx".equals(paramName2) || "ny".equals(paramName2) || "dx".equals(paramName2)
- || "dx".equals(paramName2) || "ctrlat".equals(paramName2)
- || "ctrlon".equals(paramName2) || "westbc".equals(paramName2)
- || "eastbc".equals(paramName2) || "northbc".equals(paramName2)
- || "southbc".equals(paramName2)
- // TODO: add more
- ) {
-
- paramType2 = "Numeric";
- } else {
- // default string
- paramType2 = "String";
- }
-
- paramList.add(new Param(paramName + ":" + paramName2, paramType2, paramValue2));
- exists2 = xc2.toNextSibling();
- }
- } else if ("Integer".equals(paramType)) {
- paramValue = xc.getTextValue();
- paramType = "Numeric";
- paramList.add(new Param(paramName, paramType, paramValue));
- } else if ("Nominal".equals(paramType)) {
- paramValue = xc.getTextValue();
- paramType = "Nominal";
- paramList.add(new Param(paramName, paramType, paramValue));
- } else {
- // default
- paramValue = xc.getTextValue();
- paramType = "String";
- paramList.add(new Param(paramName, paramType, paramValue));
- }
- exists = xc.toNextSibling();
- }
- // return paramList;
-
- for (Param p : paramList) {
- System.out.println(p);
- }
- }
- }
- }
-
- public static void testTimestamp(String[] args) throws Exception {
- final String ACTIVITY = "<wor:serviceInvoked infoModelVersion='2.6' xmlns:wor='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'><wor:notificationSource wor:serviceID='urn:qname:http://org.apache.airavata/lead:FactoryService_Fri_Jun_22_21_21_24_EDT_2007_311971' wor:workflowID='tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI/instance5' wor:workflowTimestep='6' wor:workflowNodeID='GFac:AlignWarpService_Run'/><wor:timestamp>2007-06-23T11:16:35.404-04:00</wor:timestamp><wor:description>Service Invoked</wor:description><wor:annotation><n1:typedSOAPRequest xmlns:n1='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'><S:Envelope xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:wsa='http://www.w3.org/2005/08/addressing' xmlns:wsp='http://schemas.xmlsoap.org/ws/2002/12/policy' xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'><S:Header><lh:context xmlns:lh='http://lead.extreme.i
ndiana.edu/namespaces/2005/10/lead-context-header'><lh:experiment-id>xbaya-experiment</lh:experiment-id><lh:event-sink-epr><wsa:Address>http://tyr10.cs.indiana.edu:12346/topic/second-provenance-challenge-20070623T111715</wsa:Address></lh:event-sink-epr><lh:user-dn>/O=LEAD Project/OU=Indiana University Extreme Lab/OU=linbox1.extreme.indiana.edu/OU=extreme.indiana.edu/CN=ysimmhan/EMAIL=ysimmhan@cs.indiana.edu</lh:user-dn><lh:resource-catalog-url>https://everest.extreme.indiana.edu:20443/resource_catalog?wsdl</lh:resource-catalog-url><lh:gfac-url>https://tyr12.cs.indiana.edu:23443/?wsdl</lh:gfac-url><lh:mylead-agent-url>https://tyr03.cs.indiana.edu:20243/myleadagent?wsdl</lh:mylead-agent-url><lh:workflow-template-id>tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI</lh:workflow-template-id><lh:workflow-instance-id>tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI/instance5</lh:workflow-instance-id><lh:workflow-time-step>6</lh:workflow-time-step><lh:workflow-node-id>GFac
:AlignWarpService_Run</lh:workflow-node-id><lh:service-instance-id>http://tempuri.org/no-service-id</lh:service-instance-id></lh:context><wsa:To>https://tyr12.cs.indiana.edu:23443/</wsa:To><wsa:Action>http://org.apache.airavata/lead/FactoryService/CreateService</wsa:Action></S:Header><S:Body><n1:CreateService_InputParams xmlns:n1='http://org.apache.airavata/lead/FactoryService/xsd'><serviceQName n2:leadType='String' xmlns:n2='http://org.apache.airavata/namespaces/2004/01/gFac'>{http://org.apache.airavata/karma/challenge2}AlignWarpService</serviceQName><security n3:leadType='String' xmlns:n3='http://org.apache.airavata/namespaces/2004/01/gFac'>None</security><registryUrl n4:leadType='String' xmlns:n4='http://org.apache.airavata/namespaces/2004/01/gFac'/><host n5:leadType='String' xmlns:n5='http://org.apache.airavata/namespaces/2004/01/gFac'/><appHost n6:leadType='String' xmlns:n6='http://org.apache.airavata/namespaces/2004/01/gFac'/></n1:CreateService_InputParams></S:Body></S:Envelop
e></n1:typedSOAPRequest><n1:experimentID xmlns:n1='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>xbaya-experiment</n1:experimentID><n1:userDN xmlns:n1='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>/O=LEAD Project/OU=Indiana University Extreme Lab/OU=linbox1.extreme.indiana.edu/OU=extreme.indiana.edu/CN=ysimmhan/EMAIL=ysimmhan@cs.indiana.edu</n1:userDN><experimentID xmlns='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>xbaya-experiment</experimentID></wor:annotation><wor:request><wor:header><S:Header xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'><lh:context xmlns:lh='http://lead.extreme.indiana.edu/namespaces/2005/10/lead-context-header'><lh:experiment-id>xbaya-experiment</lh:experiment-id><lh:event-sink-epr><wsa:Address xmlns:wsa='http://www.w3.org/2005/08/addressing'>http://tyr10.cs.indiana.edu:12346/topic/second-provenance-challenge-20070623T111715</wsa:Address></lh:event-sink-epr><lh:user-dn>/O=LEAD Pro
ject/OU=Indiana University Extreme Lab/OU=linbox1.extreme.indiana.edu/OU=extreme.indiana.edu/CN=ysimmhan/EMAIL=ysimmhan@cs.indiana.edu</lh:user-dn><lh:resource-catalog-url>https://everest.extreme.indiana.edu:20443/resource_catalog?wsdl</lh:resource-catalog-url><lh:gfac-url>https://tyr12.cs.indiana.edu:23443/?wsdl</lh:gfac-url><lh:mylead-agent-url>https://tyr03.cs.indiana.edu:20243/myleadagent?wsdl</lh:mylead-agent-url><lh:workflow-template-id>tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI</lh:workflow-template-id><lh:workflow-instance-id>tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI/instance5</lh:workflow-instance-id><lh:workflow-time-step>6</lh:workflow-time-step><lh:workflow-node-id>GFac:AlignWarpService_Run</lh:workflow-node-id><lh:service-instance-id>http://tempuri.org/no-service-id</lh:service-instance-id></lh:context><wsa:To xmlns:wsa='http://www.w3.org/2005/08/addressing'>https://tyr12.cs.indiana.edu:23443/</wsa:To><wsa:Action xmlns:wsa='http://www.w3.o
rg/2005/08/addressing'>http://org.apache.airavata/lead/FactoryService/CreateService</wsa:Action></S:Header></wor:header><wor:body><S:Body xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'><n1:CreateService_InputParams xmlns:n1='http://org.apache.airavata/lead/FactoryService/xsd'><serviceQName>{http://org.apache.airavata/karma/challenge2}AlignWarpService</serviceQName><security>None</security><registryUrl/><host/><appHost/></n1:CreateService_InputParams></S:Body></wor:body></wor:request><wor:initiator wor:serviceID='tag:gpel.leadproject.org,2006:76M/Challenge2WorkflowPartI/instance5' wor:workflowTimestep='-1'/></wor:serviceInvoked>";
- XmlObject activity = XmlObject.Factory.parse(ACTIVITY);
- System.out.println(getActivityTimestamp(activity));
- System.out.println(getActivityWorkflowTimestep(activity));
- }
-
- public static void main(String[] args) throws XmlException, ParseException {
- final String ACTIVITY = "<wor:dataConsumed xmlns:wor='http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking'>"
- + "<wor:notificationSource wor:serviceID='urn:qname:http://org.apache.airavata/karma/challenge2:AlignWarpService_Wed_Feb_21_12_09_49_EST_2007_67130' wor:workflowID='tag:gpel.leadproject.org,2006:72L/Challenge2WorkflowPartI/instance2' wor:workflowTimestep='6' wor:workflowNodeID='AlignWarpService_Run'/>"
- + "<wor:timestamp>2007-02-21T12:10:33.772-05:00</wor:timestamp>"
- + "<wor:dataProduct>"
- + "<wor:id>urn:leadproject-org:data:3d847d61-696e-4742-b98b-51f39aa2c679</wor:id>"
- + "<wor:location>gsiftp://tyr15.cs.indiana.edu//san/extreme/tmp/service_logs/development/AlignWarp_Wed_Feb_21_12_09_57_EST_2007_17/inputData/anatomy1.img</wor:location>"
- + "<wor:sizeInBytes>-1</wor:sizeInBytes>"
- + "<wor:timestamp>2007-02-21T12:10:33.771-05:00</wor:timestamp>"
- + "<wor:description>gsiftp://tyr15.cs.indiana.edu//san/extreme/tmp/service_logs/development/AlignWarp_Wed_Feb_21_12_09_57_EST_2007_17/inputData/anatomy1.img</wor:description>"
- + "<wor:annotation>"
- + "<type xmlns='http://org.apache.airavata/namespaces/2004/01/gFac'>DataID</type>"
- + "<center xmlns='http://twiki.ipaw.info/bin/view/Challenge/SecondProvenanceChallenge'>UChicago</center>"
- + "</wor:annotation>" + "</wor:dataProduct>" + "</wor:dataConsumed>";
-
- XmlObject activity = XmlObject.Factory.parse(ACTIVITY);
- Map<QName, String> annos = getSimpleAnnotations(activity);
- for (Map.Entry<QName, String> anno : annos.entrySet()) {
- System.out.println(anno);
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/Timer.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/Timer.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/Timer.java
deleted file mode 100644
index 47bed09..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/Timer.java
+++ /dev/null
@@ -1,104 +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.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * calculates simple timing information for instrumenting code
- */
-public class Timer {
-
- private static final Logger logger = LoggerFactory.getLogger(Timer.class);
-
- private long start, end, total = 0, deltaStart, delta = 0;
- private final String msg;
- private boolean ended = false, started = false, paused = false, terminated = false;
-
- Timer(String msg_) {
- msg = msg_;
- start = System.currentTimeMillis();
- }
-
- public static Timer init(String msg_) {
- return new Timer(msg_);
- }
-
- public static Timer initAndStart(String msg_) {
-
- Timer tp = new Timer(msg_);
- tp.start();
- return tp;
- }
-
- public void start() {
-
- assert started == false && terminated == false;
- started = true;
- ended = false;
- start = System.currentTimeMillis();
- }
-
- public boolean startOrContinue() {
-
- if (started)
- return false; // continued...not started fresh
- start();
- return true; // started fresh
- }
-
- public long end(String msg_) {
-
- assert started == true && terminated == false;
- end = System.currentTimeMillis();
- total += (end - start - delta);
- logger.debug("\n!T!ENDOne \t" + msg_ + " \t" + (end - start - delta) + "\t millis of \t" + total);
- ended = true;
- return end - start;
- }
-
- public long end() {
- return end(msg);
- }
-
- public long endAll() {
-
- logger.debug("\n!T!ENDAll \t" + msg + " \t" + total);
- terminated = true;
- return total;
- }
-
- public void pause() {
-
- assert started == true && terminated == false;
- deltaStart = System.currentTimeMillis();
- paused = true;
- }
-
- public void resume() {
-
- assert paused == true && terminated == false;
- paused = false;
- delta = System.currentTimeMillis() - deltaStart;
- }
-};
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/XmlBeanUtils.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/XmlBeanUtils.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/XmlBeanUtils.java
deleted file mode 100644
index d65004d..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/XmlBeanUtils.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.util;
-
-import org.apache.airavata.workflow.tracking.types.BaseNotificationType;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-
-public class XmlBeanUtils {
-
- public static BaseNotificationType extractBaseNotificationType(XmlObject xmldata) {
- XmlCursor c = xmldata.newCursor();
- c.toNextToken();
- BaseNotificationType type = (BaseNotificationType) c.getObject();
- c.dispose();
- return type;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/resources/log4j.properties b/modules/commons/workflow-tracking/src/main/resources/log4j.properties
deleted file mode 100644
index 598ee12..0000000
--- a/modules/commons/workflow-tracking/src/main/resources/log4j.properties
+++ /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.
-#
-#
-
-#------------------------------------------------------------------------------
-#
-# The following properties set the logging levels and log appender. The
-# log4j.rootCategory variable defines the default log level and one or more
-# appenders. For the console, use 'S'. For the daily rolling file, use 'R'.
-# For an HTML formatted log, use 'H'.
-#
-# To override the default (rootCategory) log level, define a property of the
-# form (see below for available values):
-#
-# log4j.logger. =
-#
-# Available logger names:
-# TODO
-#
-# Possible Log Levels:
-# FATAL, ERROR, WARN, INFO, DEBUG
-#
-#------------------------------------------------------------------------------
-log4j.rootCategory=FATAL,S
-
-
-log4j.logger.com.dappit.Dapper.parser=ERROR
-log4j.logger.org.w3c.tidy=FATAL
-
-#------------------------------------------------------------------------------
-#
-# The following properties configure the console (stdout) appender.
-# See http://logging.apache.org/log4j/docs/api/index.html for details.
-#
-#------------------------------------------------------------------------------
-log4j.appender.S = org.apache.log4j.ConsoleAppender
-log4j.appender.S.layout = org.apache.log4j.PatternLayout
-log4j.appender.S.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
-log4j.appender.S.Threshold=ERROR
-
-#------------------------------------------------------------------------------
-#
-# The following properties configure the Daily Rolling File appender.
-# See http://logging.apache.org/log4j/docs/api/index.html for details.
-#
-#------------------------------------------------------------------------------
-log4j.appender.R = org.apache.log4j.DailyRollingFileAppender
-log4j.appender.R.File = logs/workflow.log
-log4j.appender.R.Append = true
-log4j.appender.R.DatePattern = '.'yyy-MM-dd
-log4j.appender.R.layout = org.apache.log4j.PatternLayout
-log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
-
-#------------------------------------------------------------------------------
-#
-# The following properties configure the Rolling File appender in HTML.
-# See http://logging.apache.org/log4j/docs/api/index.html for details.
-#
-#------------------------------------------------------------------------------
-log4j.appender.H = org.apache.log4j.RollingFileAppender
-log4j.appender.H.File = logs/workflow.html
-log4j.appender.H.MaxFileSize = 100KB
-log4j.appender.H.Append = false
-log4j.appender.H.layout = org.apache.log4j.HTMLLayout
-log4j.appender.S.Threshold=FATAL
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsd
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsd b/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsd
deleted file mode 100644
index f4bdf96..0000000
--- a/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsd
+++ /dev/null
@@ -1,594 +0,0 @@
-<?xml version='1.0' encoding='utf-8' ?>
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theĆ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<schema targetNamespace="http://airavata.apache.org/schemas/wft/2011/08" xmlns:wft="http://airavata.apache.org/schemas/wft/2011/08"
- xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified">
-
- <annotation>
- <documentation>
- *) Workflows and services can be abstract (template) or concrete (instance).
- Unless otherwise noted, we always refer to the concrete instance of the workflow/service below
- *) All workflows are also services.
- *) Services may be part of zero or more workflows
- *) When Services execute in the context of a workflow,
- an invocation of the service is associated with the workflowID of the workflow whose context
- in which it is being invoked (also called parent workflow),
- the timestep of this invocation in the parent workflow,
- and the node ID that uniquely identifies this service within the parent workflow instance.
- *) Workflows can also be invoked in the context of another parent workflow.
- *) Workflow ID always refers to the "parent workflow ID". When refering to the invocation of a workflow,
- its instance ID is called the Service ID.
- *) Workflows that are not invoked from another workflow do not have a context of execution
- (parent workflow is not present => Workflow ID is NULL)
- *) Schema design notes
- - This schema uses the "Venetian Blind" schema design pattern
- - It uses Upper Camel Case for schema types and lower camel case for
- element and attribute names
- </documentation>
- </annotation>
-
- <simpleType name="ServiceIDType">
- <annotation>
- <documentation>
- ID to uniquely identify the service instance.
- This is usually formed from the targetnamespace and porttype name of the service's WSDL.
- This ID may refer to the instance ID for a service or for a workflow.
- </documentation>
- </annotation>
- <restriction base="anyURI" />
- </simpleType>
-
- <simpleType name="WorkflowNodeIDType">
- <annotation>
- <documentation>
- String that identifies uniquely a node in workflow graph.
- The node ID is unique in the scope of a workflow ID.
- </documentation>
- </annotation>
- <restriction base="string" />
- </simpleType>
-
- <simpleType name="WorkflowTimestepType">
- <annotation>
- <documentation>
- The timestep within workflow execution at which this invocation is made.
- This is a logical time that monotonically increments for each invocation in a workflow.
- </documentation>
- </annotation>
- <restriction base="int" />
- </simpleType>
-
- <simpleType name="DataProductIDType">
- <annotation>
- <documentation>
- Unique logical ID for a data product in the form of a UUID.
- Physical URL for the data products can be resolved using this ID.
- </documentation>
- </annotation>
- <restriction base="anyURI" />
- </simpleType>
-
- <simpleType name="ExperimentIDType">
- <annotation>
- <documentation>
- String that identifies uniquely a node in workflow graph.
- The node ID is unique in the scope of a workflow ID.
- </documentation>
- </annotation>
- <restriction base="string" />
- </simpleType>
-
- <!-- ========================================================================================== -->
-
- <complexType name="BaseIDType">
- <attribute name="workflowID" type="wft:ServiceIDType" use="optional">
- <annotation>
- <documentation>
- The workflow context within which this service is executing.
- If this service is itself a workflow and not executing as part of another workflow
- (i.e. this is the root of the invocation trace) then the workflow ID is absent.
- Otherwise, this is the service ID of the workflow instance.
- </documentation>
- </annotation>
- </attribute>
-
- <attribute name="serviceID" type="wft:ServiceIDType" use="required">
- <annotation>
- <documentation>
- ID to uniquely identify a service instance. The service instance can
- be part of zero or more workflow.
- This is formed from the targetnamespace of the service's CWSDL.
- </documentation>
- </annotation>
- </attribute>
-
- <attribute name="experimentID" type="wft:ExperimentIDType" use="required">
- <annotation>
- <documentation>
- ID to uniquely identify a workflow invocation.
- </documentation>
- </annotation>
- </attribute>
-
- <attribute name="workflowNodeID" type="wft:WorkflowNodeIDType" use="optional">
- <annotation>
- <documentation>
- Distinct ID of a node within a Workflow graph. unique within the workflowID,
- not necessarily the order of execution.
- </documentation>
- </annotation>
- </attribute>
-
- <attribute name="workflowTimestep" type="wft:WorkflowTimestepType" use="optional">
- <annotation>
- <documentation>
- The timestep within workflow execution at which this invocation is made.
- 32bit integer. Timestep is a numerically ordered monotonically increasing sequence
- within wf execution that allows relative ordering of invocations.
- It is unique within the workflowID for each invocation in the workflow.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
-
- <!-- base type for all notifications -->
- <complexType name="BaseNotificationType">
- <annotation>
- <documentation>This is the base type for all notification activities that are produced</documentation>
- </annotation>
- <sequence>
-
- <element name="notificationSource" type="wft:BaseIDType">
- <annotation>
- <documentation>
- This identifies the entity/invocation context from which this notifcation is being sent.
- </documentation>
- </annotation>
- </element>
-
- <element name="timestamp" type="dateTime" />
-
- <element name="description" type="string" minOccurs="0">
- <annotation>
- <documentation>Optional human friendly description of this notification.</documentation>
- </annotation>
- </element>
-
- <element name="annotation" type="anyType" minOccurs="0">
- <annotation>
- <documentation>Optional additional metadata for this notification. See common.AnnotationConsts file.
- </documentation>
- </annotation>
- </element>
-
- </sequence>
-
- <attribute name="infoModelVersion" form="unqualified" type="NMTOKEN" use="required">
- <!-- we set form as unqualified to allow WS-Messenger YFilter to match it -->
- <!-- NMToken := (Letter | Digit | '.' | '-' | '_' | ':')+ -->
- <annotation>
- <documentation>
- String identifying notification schema version (used for verifying compatible schema and filtering).
- </documentation>
- </annotation>
- </attribute>
-
- </complexType>
-
-
- <complexType name="MessageType">
- <sequence>
- <element name="header" type="anyType" minOccurs="0" /> <!-- e.g. soap:header -->
- <element name="body" type="anyType" minOccurs="0" /> <!-- e.g. soap:body --> <!-- fixme: change to message -->
- </sequence>
- </complexType>
-
- <complexType name="FaultMessageType">
- <complexContent>
- <extension base="wft:MessageType" />
- </complexContent>
- </complexType>
-
- <complexType name="InvocationMessageType">
- <complexContent>
- <extension base="wft:MessageType" />
- </complexContent>
- </complexType>
-
-
- <complexType name="FailureMessageType">
- <sequence>
- <element name="trace" type="anyType" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- </complexType>
-
-
- <!-- ========================================================================================== -->
- <!-- workflow provenance types -->
- <!-- ========================================================================================== -->
-
- <!-- sent when the service is first created and is ready to accept invocations -->
- <element name="serviceInitialized" type="wft:BaseNotificationType" />
-
- <!-- sent when the service is terminated and will not accept any further invocations -->
- <element name="serviceTerminated" type="wft:BaseNotificationType" />
-
- <!-- sent when the workflow is first created and is ready to accept invocations -->
- <!--element name="workflowInitialized" type="wft:BaseNotificationType" -->
- <element name="workflowInitialized">
- <complexType>
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="initialPriority" type="string" minOccurs="0" />
- <element name="workflowTemplateId" type="wft:ServiceIDType" minOccurs="0" />
- <element name="workflowCreatorDn" type="string" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <!-- sent when the workflow is terminated and will not accept any further invocations -->
- <element name="workflowTerminated" type="wft:BaseNotificationType" />
-
- <!-- sent when the workflow execution is paused: invocations will be accepted but no new messages will be sent by the workflow -->
- <element name="workflowPaused" type="wft:BaseNotificationType" />
-
- <!-- sent when the workflow execution is resumed -->
- <element name="workflowResumed" type="wft:BaseNotificationType" />
-
- <!-- workflow priority tracking -->
- <element name="workflowPriorityChanged">
- <complexType>
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="newPriority" type="string" />
- <element name="oldPriority" type="string" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <!-- ========================================================================================== -->
-
- <complexType name="InvocationRequestType" abstract="true">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="request" type="wft:InvocationMessageType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="RequestInitiatorType">
- <complexContent>
- <extension base="wft:InvocationRequestType">
- <sequence>
- <!-- used by wf (client) to set service info, when invoking service -->
- <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="RequestReceiverType">
- <complexContent>
- <extension base="wft:InvocationRequestType">
- <sequence>
- <!-- used by service to set workflow(client) info, when invoked by workflow (client) -->
- <element name="initiator" type="wft:BaseIDType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
-
- <!-- ========================================================================================== -->
-
- <complexType name="AcknowledgementType" abstract="true">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="receiver" type="wft:BaseIDType" minOccurs="0" /> <!-- target of the action that succeeded -->
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="AcknowledgeSuccessType">
- <complexContent>
- <extension base="wft:AcknowledgementType" />
- </complexContent>
- </complexType>
-
- <complexType name="AcknowledgeFailureType">
- <complexContent>
- <extension base="wft:AcknowledgementType">
- <sequence>
- <element name="failure" type="wft:FailureMessageType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <!-- ========================================================================================== -->
-
- <!-- sent by workflow when a service is invoked by it. -->
- <element name="invokingService" type="wft:RequestInitiatorType" />
-
-
- <!-- sent by workflow when it is invoked. -->
- <element name="workflowInvoked" type="wft:RequestReceiverType" />
-
- <!-- sent by service when it is invoked. -->
- <element name="serviceInvoked" type="wft:RequestReceiverType" />
-
-
- <!-- sent by workflow when it invoked a service successfully. -->
- <element name="invokingServiceSucceeded" type="wft:AcknowledgeSuccessType" />
-
- <!-- sent by workflow when it failed to invoke a service successfully. -->
- <element name="invokingServiceFailed" type="wft:AcknowledgeFailureType" />
-
-
- <!-- ========================================================================================== -->
-
- <complexType name="InvocationResultType" abstract="true">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="result" type="wft:InvocationMessageType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="InvocationFaultType" abstract="true">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="fault" type="wft:FaultMessageType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="ResultReceiverType">
- <complexContent>
- <extension base="wft:InvocationResultType">
- <sequence>
- <!-- used by wf (client) to set service info, when receiving result from service -->
- <element name="responder" type="wft:BaseIDType" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="FaultReceiverType">
- <complexContent>
- <extension base="wft:InvocationFaultType">
- <sequence>
- <!-- used by wf (client) to set service info, when receiving result from service -->
- <element name="responder" type="wft:BaseIDType" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="ResultResponderType">
- <complexContent>
- <extension base="wft:InvocationResultType">
- <sequence>
- <!-- used by service to set workflow(client) info, when returning result to workflow (client) -->
- <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="FaultResponderType">
- <complexContent>
- <extension base="wft:InvocationFaultType">
- <sequence>
- <!-- used by service to set workflow(client) info, when returning result to workflow (client) -->
- <element name="receiver" type="wft:BaseIDType" minOccurs="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <!-- ========================================================================================== -->
-
- <!-- sent by service when it returns the result for an invocation. -->
- <element name="sendingResult" type="wft:ResultResponderType" /> <!-- add workflowSendingResult -->
-
- <!-- sent by service when it returns a fault for an invocation. -->
- <element name="sendingFault" type="wft:FaultResponderType" /> <!-- add workflowSendingFault -->
-
-
- <!-- sent by workflow when it receives the result for an invocation. -->
- <element name="receivedResult" type="wft:ResultReceiverType" /> <!-- add workflowReceivedResult -->
-
- <!-- sent by workflow when it receives a fault for an invocation. -->
- <element name="receivedFault" type="wft:FaultReceiverType" /> <!-- add workflowFaultResult -->
-
-
- <!-- sent by service when it has successfully sent the result for an invocation. -->
- <element name="sendingResponseSucceeded" type="wft:AcknowledgeSuccessType" />
-
- <!-- sent by service when it has successfully sent a fault for an invocation. -->
- <element name="sendingResponseFailed" type="wft:AcknowledgeFailureType" />
-
- <!-- ========================================================================================== -->
-
-
- <!-- ========================================================================================== -->
- <!-- data provenance types -->
- <!-- ========================================================================================== -->
-
- <!-- general complex data types -->
- <complexType name="DataProductType">
- <sequence>
- <element name="id" type="wft:DataProductIDType" />
- <element name="location" type="anyURI" minOccurs="0" maxOccurs="unbounded" />
- <element name="sizeInBytes" type="long" minOccurs="0" />
- <element name="timestamp" type="dateTime" minOccurs="0" /> <!-- context sensitive. time at which data product was produced or consumed. -->
- <element name="description" type="string" minOccurs="0">
- <annotation>
- <documentation>Optional human friendly description of this data product.</documentation>
- </annotation>
- </element>
- <element name="annotation" type="anyType" minOccurs="0">
- <annotation>
- <documentation>Optional additional metadata for this data product.</documentation>
- </annotation>
- </element>
- </sequence>
- </complexType>
-
- <complexType name="DataProductNotificationType">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="dataProduct" type="wft:DataProductType" minOccurs="0" maxOccurs="unbounded" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <!-- sent when a file is used by the jython app. -->
- <element name="dataConsumed" type="wft:DataProductNotificationType" />
-
- <!-- sent when a file is generated by the jython app. -->
- <element name="dataProduced" type="wft:DataProductNotificationType" />
-
-
- <!-- ========================================================================================== -->
- <!-- performance audit types -->
- <!-- ========================================================================================== -->
-
-
- <!-- sent when the application launches a GRAM job, to facilitate -->
- <!-- auditing and accounting of TeraGrid jobs -->
- <!-- SJ The type name needed Type added at the end -->
- <complexType name="ApplicationAuditType">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="name" type="string" />
- <element name="jobHandle" type="anyURI" />
- <element name="host" type="string" />
- <element name="queueName" type="string" minOccurs="0" />
- <element name="jobId" type="string" minOccurs="0" />
- <element name="distinguishedName" type="string" />
- <element name="projectId" type="string" minOccurs="0" />
- <element name="rsl" type="string" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="applicationAudit" type="wft:ApplicationAuditType" />
-
-
- <!-- sent at the end of a computational block in the jython app -->
- <!-- with the time in milliseconds taken for that computational block -->
- <element name="computationDuration">
- <complexType>
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="durationInMillis" type="long" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <!-- sent at the end of sending a file to remote location (thro' gridftp?) by the jython app -->
- <!-- with the time in milliseconds taken to send that file -->
- <!-- TODO: later add support for time for multiple files in a single notification? -->
- <complexType name="DataTransferDurationType">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="id" type="wft:DataProductIDType" />
- <element name="source" type="anyURI" />
- <element name="target" type="anyURI" />
- <element name="sizeInBytes" type="long" minOccurs="0" default="-1" />
- <element name="durationInMillis" type="long" default="-1" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="dataSendDuration" type="wft:DataTransferDurationType" />
- <element name="dataReceiveDuration" type="wft:DataTransferDurationType" />
-
- <!-- ========================================================================================== -->
- <!-- generic log message types -->
- <!-- ========================================================================================== -->
-
-
- <!-- sent when an interesting file is created by the jython app that can be viewed thro' a URL -->
- <!-- used to display as a link on the portal -->
- <element name="publishURL">
- <complexType>
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="title" type="string" minOccurs="0" />
- <element name="location" type="anyURI" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
- </element>
-
- <!-- generic log message at different levels of importance that can be produced by the jython app -->
- <element name="logInfo" type="wft:BaseNotificationType" />
- <element name="logException" type="wft:BaseNotificationType" />
- <element name="logWarning" type="wft:BaseNotificationType" />
- <element name="logDebug" type="wft:BaseNotificationType" />
-
-
- <!-- ========================================================================================== -->
- <!-- resource broker message types -->
- <!-- ========================================================================================== -->
-
- <complexType name="ResourceMappingType">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="mappedResource" type="string" />
- <element name="retryStatusCount" type="int" default="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <complexType name="JobStatusType">
- <complexContent>
- <extension base="wft:BaseNotificationType">
- <sequence>
- <element name="jobStatus" type="string" />
- <element name="retryCount" type="int" default="0" />
- </sequence>
- </extension>
- </complexContent>
- </complexType>
-
- <element name="resourceMapping" type="wft:ResourceMappingType" />
- <element name="jobStatus" type="wft:JobStatusType" />
-
-</schema>
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsdconfig
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsdconfig b/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsdconfig
deleted file mode 100755
index bb1101b..0000000
--- a/modules/commons/workflow-tracking/src/main/resources/schemas/workflow_tracking_types.xsdconfig
+++ /dev/null
@@ -1,21 +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. -->
-
-<!-- An xsdconfig file must begin with a "config" element in the
- http://www.bea.com/2002/09/xbean/config namespace. Also, be sure
- to declare any namespaces used to qualify types in your schema (here,
- the namespace corresponding to the pol prefix. -->
-<xb:config xmlns:xb="http://www.bea.com/2002/09/xbean/config">
-
- <!-- Use the "namespace" element to map a namespace to the Java package
- name that should be generated. -->
- <xb:namespace uri="http://airavata.apache.org/schemas/wft/2011/08">
- <xb:package>org.apache.airavata.workflow.tracking.types</xb:package>
- </xb:namespace>
-
-</xb:config>
[4/5] airavata git commit: retiring workflow tracking schema -
AIRAVATA-1557
Posted by ch...@apache.org.
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);
- }
-}
[3/5] airavata git commit: retiring workflow tracking schema -
AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierException.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierException.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierException.java
deleted file mode 100644
index a0e194c..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.common;
-
-public class NotifierException extends RuntimeException {
- public NotifierException(String msg) {
- super(msg);
- }
-
- public NotifierException(Throwable ex) {
- super(ex);
- }
-
- public NotifierException(String msg, Throwable ex) {
- super(msg, ex);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierVersion.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierVersion.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierVersion.java
deleted file mode 100644
index 51ca5f6..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/NotifierVersion.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.common;
-
-/**
- * One place to put and check required version number.
- */
-public class NotifierVersion {
-
- private final static String TYPES_VERSION = "2.6";
- private final static String IMPL_VERSION = "2.8.0";
-
- public static String getTypesVersion() {
- return TYPES_VERSION;
- }
-
- public static String getImplVersion() {
- return IMPL_VERSION;
- }
-
- /**
- * Print version when exxecuted from command line.
- */
- public static void main(String[] args) {
- String IMPL_OPT = "-impl";
- String TYPE_OPT = "-types";
- if (IMPL_OPT.equals(args[0])) {
- System.out.println(IMPL_VERSION);
- } else if (TYPE_OPT.equals(args[0])) {
- System.out.println(TYPES_VERSION);
- } else {
- System.out.println(NotifierVersion.class.getName() + " Error: " + TYPE_OPT + " or " + IMPL_OPT
- + " is required");
- System.exit(-1);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/WorkflowTrackingContext.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/WorkflowTrackingContext.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/WorkflowTrackingContext.java
deleted file mode 100644
index bf35162..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/common/WorkflowTrackingContext.java
+++ /dev/null
@@ -1,91 +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.Properties;
-
-import org.apache.axis2.addressing.EndpointReference;
-
-public class WorkflowTrackingContext {
- private EndpointReference brokerEpr;
- private String globalAnnotations;
- private InvocationEntity myself;
- private String publisherImpl;
- private boolean enableAsyncPublishing;
- private String topic;
-
- public void setGlobalAnnotations(Properties globalAnnotations) {
- StringBuffer buf = new StringBuffer();
- if (globalAnnotations != null) {
- for (Object key : globalAnnotations.keySet()) {
- buf.append("<").append(key).append(">").append(globalAnnotations.get(key)).append("</").append(key)
- .append(">");
- }
- }
- this.globalAnnotations = buf.toString();
- }
-
- public String getGlobalAnnotations() {
- return globalAnnotations;
- }
-
- public InvocationEntity getMyself() {
- return myself;
- }
-
- public void setMyself(InvocationEntity myself) {
- this.myself = myself;
- }
-
- public EndpointReference getBrokerEpr() {
- return brokerEpr;
- }
-
- public void setBrokerEpr(EndpointReference brokerEpr) {
- this.brokerEpr = brokerEpr;
- }
-
- public String getTopic() {
- return topic;
- }
-
- public void setTopic(String topic) {
- this.topic = topic;
- }
-
- 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/impl/GenericNotifierImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/GenericNotifierImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/GenericNotifierImpl.java
deleted file mode 100644
index 478b826..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/GenericNotifierImpl.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl;
-
-import org.apache.airavata.workflow.tracking.AbstractNotifier;
-import org.apache.airavata.workflow.tracking.GenericNotifier;
-import org.apache.airavata.workflow.tracking.WorkflowTrackingException;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.impl.state.InvocationContextImpl;
-import org.apache.airavata.workflow.tracking.types.BaseNotificationType;
-import org.apache.airavata.workflow.tracking.types.LogDebugDocument;
-import org.apache.airavata.workflow.tracking.types.LogExceptionDocument;
-import org.apache.airavata.workflow.tracking.types.LogInfoDocument;
-import org.apache.airavata.workflow.tracking.types.LogWarningDocument;
-import org.apache.airavata.workflow.tracking.types.PublishURLDocument;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * DOES NOT SUPPORT MULTI_THREADING -- PUBLISHER QUEUE, DATA CONSUMED/PRODUCED BATCHING
- *
- * The constructor of this class uses the following properties from CONSTS: BROKER_URL, TOPIC, WORKFLOW_ID, NODE_ID,
- * TIMESTEP, SERVICE_ID, ASYNC_PUB_MODE
- */
-public class GenericNotifierImpl extends AbstractNotifier implements GenericNotifier {
-
- // private AnnotationProps globalAnnotations;
-
- protected static final Logger logger = LoggerFactory.getLogger(GenericNotifierImpl.class);
-
- public GenericNotifierImpl() throws WorkflowTrackingException {
- super();
- }
-
- public InvocationContext createInitialContext(WorkflowTrackingContext context) {
- if (context.getMyself() == null) {
- throw new RuntimeException("Local entity passed to createInitialContext was NULL");
- }
- return new InvocationContextImpl(context.getMyself(), null);
- }
-
- public InvocationContext createInvocationContext(WorkflowTrackingContext context, InvocationEntity remoteEntity) {
-
- if (context.getMyself() == null) {
- throw new RuntimeException("Local entity passed to createInitialContext was NULL");
- }
-
- if (remoteEntity == null) {
- throw new RuntimeException("Remote entity passed to createInitialContext was NULL");
- }
-
- return new InvocationContextImpl(context.getMyself(), remoteEntity);
- }
-
- public void debug(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
- LogDebugDocument logMsg = LogDebugDocument.Factory.newInstance();
-
- // add timestamp and notification source; add description, and
- // annotation if present
- sendNotification(context, logMsg, descriptionAndAnnotation, null);
- }
-
- public void exception(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
- LogExceptionDocument logMsg = LogExceptionDocument.Factory.newInstance();
- BaseNotificationType log = logMsg.addNewLogException();
- sendNotification(context, logMsg, descriptionAndAnnotation, null);
- }
-
- public void info(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
- LogInfoDocument logMsg = LogInfoDocument.Factory.newInstance();
- BaseNotificationType log = logMsg.addNewLogInfo();
- // add timestamp and notification source; add description, and
- // annotation if present
- // publish activity
- sendNotification(context, logMsg, descriptionAndAnnotation, null);
- }
-
- public void publishURL(WorkflowTrackingContext context, String title, String url,
- String... descriptionAndAnnotation) {
- PublishURLDocument pubMsg = PublishURLDocument.Factory.newInstance();
- PublishURLDocument.PublishURL pub = pubMsg.addNewPublishURL();
- pub.setTitle(title);
- pub.setLocation(url);
- sendNotification(context, pubMsg, descriptionAndAnnotation, null);
- }
-
- public void warning(WorkflowTrackingContext context, String... descriptionAndAnnotation) {
- LogWarningDocument logMsg = LogWarningDocument.Factory.newInstance();
- BaseNotificationType log = logMsg.addNewLogWarning();
- sendNotification(context, logMsg, descriptionAndAnnotation, null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/NotifierImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/NotifierImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/NotifierImpl.java
deleted file mode 100644
index f7c3c4a..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/NotifierImpl.java
+++ /dev/null
@@ -1,335 +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.impl;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.airavata.commons.LeadCrosscutParametersUtil;
-import org.apache.airavata.workflow.tracking.Notifier;
-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;
-import org.apache.airavata.workflow.tracking.impl.state.DataDurationImpl;
-import org.apache.airavata.workflow.tracking.impl.state.DataObjImpl;
-import org.apache.airavata.workflow.tracking.impl.state.DurationImpl;
-import org.apache.airavata.workflow.tracking.types.*;
-
-/**
- * DOES NOT SUPPORT MULTI_THREADING -- PUBLISHER QUEUE, DATA CONSUMED/PRODUCED BATCHING * Utility to create and send
- * Lead notification messages for an application (script/web service). Since it extends WorkflowNotifierImpl, it can
- * also send workflow related notifications.
- *
- * The constructor of this class uses the following properties from CONSTS: BROKER_URL, TOPIC, WORKFLOW_ID, NODE_ID,
- * TIMESTEP, SERVICE_ID, SERVICE_WSDL, IN_XML_MESSAGE, NAME_RESOLVER_URL, FILE_ACCESS_PROTOCOL, DISABLE_NAME_RESOLVER,
- * BATCH_PROVENANCE_MSGS, ASYNC_PUB_MODE
- *
- */
-public class NotifierImpl extends ProvenanceNotifierImpl implements Notifier {
-
- private static final String WFT_NS = "http://lead.extreme.indiana.edu/namespaces/2006/06/workflow_tracking";
-
- private static final HashMap<String, String> NS_MAP = new HashMap<String, String>();
- static {
- NS_MAP.put("", WFT_NS);
- }
-
- // public NotifierImpl(ConstructorProps props) throws XMLStreamException, IOException {
- // super( props);
- // }
-
- /**
- * @param batchProvMessages
- * whether provenance messages should be batched and sent as one message
- * @param publisher
- * a NotificationPublisher used to send the notifications
- *
- */
- public NotifierImpl() {
- }
-
- // //////////////////////////////////////////////////////////////////////////////////////////////
- //
- // AUDIT NOTIFIER
- //
- // //////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * {@inheritDoc}
- *
- */
- public void resourceMapping(WorkflowTrackingContext context, String mappedResource, int retryStatusCount,
- String... descriptionAndAnnotation) {
-
- ResourceMappingDocument mapMsg = ResourceMappingDocument.Factory.newInstance();
- ResourceMappingType map = mapMsg.addNewResourceMapping();
- map.setMappedResource(mappedResource);
- map.setRetryStatusCount(retryStatusCount);
-
- sendNotification(context, mapMsg, descriptionAndAnnotation, "[Resource mapping done for" + mappedResource + "]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void jobStatus(WorkflowTrackingContext context, String status, int retryCount,
- String... descriptionAndAnnotation) {
-
- JobStatusDocument jobMsg = JobStatusDocument.Factory.newInstance();
- JobStatusType job = jobMsg.addNewJobStatus();
- job.setJobStatus(status);
- job.setRetryCount(retryCount);
-
- sendNotification(context, jobMsg, descriptionAndAnnotation, "[Job status is " + status + "]");
- }
-
- // //////////////////////////////////////////////////////////////////////////////////////////////
- //
- // AUDIT NOTIFIER
- //
- // //////////////////////////////////////////////////////////////////////////////////////////////
-
- /**
- * {@inheritDoc}
- *
- */
- public void appAudit(WorkflowTrackingContext context, String name, URI jobHandle, String host, String queueName,
- String jobId, String dName, String projectId, String rsl, String... descriptionAndAnnotation) {
- final ApplicationAuditDocument appAuditMsg = ApplicationAuditDocument.Factory.newInstance();
- final ApplicationAuditType appAudit = appAuditMsg.addNewApplicationAudit();
- appAudit.setJobHandle(jobHandle.toString());
- appAudit.setName(name);
- appAudit.setHost(host);
- appAudit.setQueueName(queueName); // queueName is an optional element
- appAudit.setJobId(jobId); // jobId is an optional element
- appAudit.setDistinguishedName(dName);
- appAudit.setProjectId(projectId); // projectId is an optional element
- appAudit.setRsl(rsl);
-
- sendNotification(context, appAuditMsg, descriptionAndAnnotation, "[Audit msg for '" + name + "' at host "
- + host + " for DN " + dName + "]" // default
- );
- }
-
- // //////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PERFORMANCE NOTIFIER
- //
- // //////////////////////////////////////////////////////////////////////////////////////////////
- /**
- * {@inheritDoc}
- *
- */
- public DurationObj computationStarted() {
-
- return new DurationImpl();
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DurationObj computationFinished(WorkflowTrackingContext context, DurationObj compObj,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (compObj == null)
- throw new RuntimeException("Comp duration object passed was NULL.");
-
- // mark computation end
- compObj.markEndTimeMillis();
-
- // create activity
- ComputationDurationDocument activity = ComputationDurationDocument.Factory.newInstance();
- ComputationDurationDocument.ComputationDuration activityType = activity.addNewComputationDuration();
-
- activityType.setDurationInMillis(compObj.getDurationMillis());
-
- sendNotification(context, activity, descriptionAndAnnotation,
- "[Computation Time taken = " + compObj.getDurationMillis() + " ms]");
-
- return compObj;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DurationObj computationDuration(WorkflowTrackingContext context, long durationMillis,
- String... descriptionAndAnnotation) {
-
- DurationObj compObj = new DurationImpl(durationMillis);
- return computationFinished(context, compObj, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataSendStarted(DataObj dataObj, URI remoteLocation) {
-
- return new DataDurationImpl(dataObj, remoteLocation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataSendFinished(WorkflowTrackingContext context, DataDurationObj dataDurationObj,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (dataDurationObj == null)
- throw new RuntimeException("Data duration object passed was NULL.");
-
- DataObj dataObj = null;
- if ((dataObj = dataDurationObj.getDataObj()) == null)
- throw new RuntimeException("Data duration object's DataObje was NULL.");
- if (dataObj.getId() == null)
- throw new RuntimeException("Data object's ID was NULL.");
- if (dataObj.getLocalLocation() == null)
- throw new RuntimeException("Local file URL passed in DataDurationObj.getDataObj was NULL.");
- if (dataDurationObj.getRemoteLocation() == null)
- throw new RuntimeException("Remote file URL passed in DataDurationObj was NULL.");
-
- // mark computation end
- dataDurationObj.markEndTimeMillis();
-
- // create activity
- DataSendDurationDocument activity = DataSendDurationDocument.Factory.newInstance();
- DataTransferDurationType activityType = activity.addNewDataSendDuration();
-
- activityType.setId(dataObj.getId().toString());
- activityType.setDurationInMillis(dataDurationObj.getDurationMillis());
- activityType.setSizeInBytes(dataObj.getSizeInBytes());
-
- activityType.setSource(dataObj.getLocalLocation().toString());
-
- activityType.setTarget(dataDurationObj.getRemoteLocation().toString());
-
- sendNotification(context, activity, descriptionAndAnnotation, "[Data at " + dataObj.getLocalLocation()
- + " was sent to " + dataDurationObj.getRemoteLocation() + "]");
-
- return dataDurationObj;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataSendDuration(WorkflowTrackingContext context, URI dataID, URI localLocation,
- URI remoteLocation, int sizeInBytes, long durationMillis, String... descriptionAndAnnotation) {
-
- List<URI> locations = new ArrayList<URI>(2);
- locations.add(localLocation);
- locations.add(remoteLocation);
-
- DataObj dataObj = new DataObjImpl(dataID, locations, sizeInBytes);
- DataDurationObj dataDurationObj = new DataDurationImpl(dataObj, remoteLocation, durationMillis);
-
- return dataSendFinished(context, dataDurationObj, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataReceiveStarted(URI dataID, URI remoteLocation, URI localLocation) {
-
- List<URI> locations = new ArrayList<URI>(2);
- locations.add(localLocation);
- locations.add(remoteLocation);
-
- DataObj dataObj = new DataObjImpl(dataID, locations);
- DataDurationObj dataDurationObj = new DataDurationImpl(dataObj, remoteLocation);
-
- return dataDurationObj;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataReceiveFinished(WorkflowTrackingContext context, DataDurationObj dataDurationObj,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (dataDurationObj == null)
- throw new RuntimeException("Data duration object passed was NULL.");
-
- DataObj dataObj = null;
- if ((dataObj = dataDurationObj.getDataObj()) == null)
- throw new RuntimeException("Data duration object's DataObj was NULL.");
- if (dataObj.getId() == null)
- throw new RuntimeException("Data object's ID was NULL.");
- if (dataObj.getLocalLocation() == null)
- throw new RuntimeException("Local file URL passed in DataDurationObj.getDataObj was NULL.");
- if (dataDurationObj.getRemoteLocation() == null)
- throw new RuntimeException("Remote file URL passed in DataDurationObj was NULL.");
-
- // mark computation end
- dataDurationObj.markEndTimeMillis();
-
- // create activity
- DataReceiveDurationDocument activity = DataReceiveDurationDocument.Factory.newInstance();
- DataTransferDurationType activityType = activity.addNewDataReceiveDuration();
-
- activityType.setId(dataObj.getId().toString());
- activityType.setDurationInMillis(dataDurationObj.getDurationMillis());
- activityType.setSizeInBytes(dataObj.getSizeInBytes());
-
- activityType.setSource(dataObj.getLocalLocation().toString());
-
- activityType.setTarget(dataDurationObj.getRemoteLocation().toString());
-
- sendNotification(context, activity, descriptionAndAnnotation,
- "[Data from " + dataDurationObj.getRemoteLocation() + " was received at " + dataObj.getLocalLocation()
- + "]");
-
- return dataDurationObj;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataDurationObj dataReceiveDuration(WorkflowTrackingContext context, URI dataID, URI remoteLocation,
- URI localLocation, int sizeInBytes, long durationMillis, String... descriptionAndAnnotation) {
-
- List<URI> locations = new ArrayList<URI>(2);
- locations.add(localLocation);
- locations.add(remoteLocation);
-
- DataObj dataObj = new DataObjImpl(dataID, locations, sizeInBytes);
- DataDurationObj dataDurationObj = new DataDurationImpl(dataObj, remoteLocation, durationMillis);
-
- return dataReceiveFinished(context, dataDurationObj, descriptionAndAnnotation);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/ProvenanceNotifierImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/ProvenanceNotifierImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/ProvenanceNotifierImpl.java
deleted file mode 100644
index d118345..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/ProvenanceNotifierImpl.java
+++ /dev/null
@@ -1,824 +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.impl;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.List;
-
-import org.apache.airavata.workflow.tracking.ProvenanceNotifier;
-import org.apache.airavata.workflow.tracking.common.DataObj;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.impl.state.DataObjImpl;
-import org.apache.airavata.workflow.tracking.impl.state.InvocationContextImpl;
-import org.apache.airavata.workflow.tracking.impl.state.InvocationEntityImpl;
-import org.apache.airavata.workflow.tracking.types.AcknowledgeFailureType;
-import org.apache.airavata.workflow.tracking.types.AcknowledgeSuccessType;
-import org.apache.airavata.workflow.tracking.types.BaseNotificationType;
-import org.apache.airavata.workflow.tracking.types.DataConsumedDocument;
-import org.apache.airavata.workflow.tracking.types.DataProducedDocument;
-import org.apache.airavata.workflow.tracking.types.DataProductNotificationType;
-import org.apache.airavata.workflow.tracking.types.DataProductType;
-import org.apache.airavata.workflow.tracking.types.FaultMessageType;
-import org.apache.airavata.workflow.tracking.types.FaultReceiverType;
-import org.apache.airavata.workflow.tracking.types.FaultResponderType;
-import org.apache.airavata.workflow.tracking.types.InvocationMessageType;
-import org.apache.airavata.workflow.tracking.types.InvokingServiceDocument;
-import org.apache.airavata.workflow.tracking.types.InvokingServiceFailedDocument;
-import org.apache.airavata.workflow.tracking.types.InvokingServiceSucceededDocument;
-import org.apache.airavata.workflow.tracking.types.ReceivedFaultDocument;
-import org.apache.airavata.workflow.tracking.types.ReceivedResultDocument;
-import org.apache.airavata.workflow.tracking.types.RequestInitiatorType;
-import org.apache.airavata.workflow.tracking.types.RequestReceiverType;
-import org.apache.airavata.workflow.tracking.types.ResultReceiverType;
-import org.apache.airavata.workflow.tracking.types.ResultResponderType;
-import org.apache.airavata.workflow.tracking.types.SendingFaultDocument;
-import org.apache.airavata.workflow.tracking.types.SendingResponseFailedDocument;
-import org.apache.airavata.workflow.tracking.types.SendingResponseSucceededDocument;
-import org.apache.airavata.workflow.tracking.types.SendingResultDocument;
-import org.apache.airavata.workflow.tracking.types.ServiceInitializedDocument;
-import org.apache.airavata.workflow.tracking.types.ServiceInvokedDocument;
-import org.apache.airavata.workflow.tracking.types.ServiceTerminatedDocument;
-import org.apache.airavata.workflow.tracking.types.WorkflowInitializedDocument;
-import org.apache.airavata.workflow.tracking.types.WorkflowInvokedDocument;
-import org.apache.airavata.workflow.tracking.types.WorkflowTerminatedDocument;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlString;
-
-/**
- * DOES NOT SUPPORT MULTI_THREADING -- PUBLISHER QUEUE, DATA CONSUMED/PRODUCED BATCHING
- *
- * Utility to create and send Lead notification messages using new notification schema from a Workflow Engine
- *
- * The constructor of this class uses the following properties from CONSTS: BROKER_URL, TOPIC, WORKFLOW_ID, NODE_ID,
- * TIMESTEP, SERVICE_ID, ASYNC_PUB_MODE
- */
-public class ProvenanceNotifierImpl extends GenericNotifierImpl implements ProvenanceNotifier {
-
- private DataConsumedDocument dataConsumedBatchActivity;
- private DataProducedDocument dataProducedBatchActivity;
-
- // public ProvenanceNotifierImpl(ConstructorProps props) throws XMLStreamException, IOException {
- // super(props);
- // DATA_BATCHED = Boolean.parseBoolean((String)props.get(ENABLE_BATCH_PROVENANCE));
- // }
-
- public ProvenanceNotifierImpl() {
- super();
- }
-
- /**
- * this method allows us to override the default timestamp with a user supplied one
- *
- * @param msg
- * a BaseNotificationType
- * @param entity
- * an InvocationEntity
- *
- */
- // @Override
- // protected void setIDAndTimestamp(WorkfloBaseNotificationType msg, InvocationEntity entity) {
- // if(activityTimestamp == null)
- // super.setIDAndTimestamp(msg, entity);
- // else
- // super.setIDAndTimestamp(msg, entity, activityTimestamp);
- // }
-
- // protected void setIDAndTimestamp(BaseNotificationType msg, URI serviceID) {
- // setIDAndTimestamp(msg, createEntity(serviceID));
- // }
-
- protected InvocationEntity createEntity(URI serviceID) {
-
- return new InvocationEntityImpl(serviceID);
- }
-
- // /////////////////////////////////////////////////////////////////////////////
- // //
- // WORKFLOW NOTIFIER //
- // //
- // /////////////////////////////////////////////////////////////////////////////
-
- /**
- * {@inheritDoc}
- *
- */
- public void workflowInitialized(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
- WorkflowInitializedDocument activity = WorkflowInitializedDocument.Factory.newInstance();
- activity.addNewWorkflowInitialized();
- // add timestamp and notification source; add description, and annotation if present
- sendNotification(context, activity, descriptionAndAnnotation, "[Workflow is initialized; ready to be invoked]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void workflowTerminated(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
- WorkflowTerminatedDocument activity = WorkflowTerminatedDocument.Factory.newInstance();
- BaseNotificationType activityType = activity.addNewWorkflowTerminated();
- sendNotification(context, activity, descriptionAndAnnotation,
- "[Workflow is terminated; cannot be invoked anymore]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext workflowInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
- String... descriptionAndAnnotation) {
- return workflowInvoked(context, initiator, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext workflowInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
- XmlObject header, XmlObject body, String... descriptionAndAnnotation) {
-
- WorkflowInvokedDocument activity = WorkflowInvokedDocument.Factory.newInstance();
- RequestReceiverType activityType = activity.addNewWorkflowInvoked();
-
- // create the invocation context; set the initiator to the remote entity
- InvocationContextImpl invocationContext = new InvocationContextImpl(context.getMyself(), initiator);
- if (initiator != null) {
- activityType.addNewInitiator().set(initiator.toBaseIDType());
- } else {
- logger.warn("Possible Error in context that was passed. "
- + "There was no remote invoker defined for workflow invoked (initiator=NULL)");
- }
-
- // add header and body fields
- if (header != null || body != null) {
- InvocationMessageType request = activityType.addNewRequest();
- if (header != null)
- request.addNewHeader().set(header);
- if (body != null)
- request.addNewBody().set(body);
- }
- sendNotification(context, activity, descriptionAndAnnotation, "[Workflow is invoked]");
- return invocationContext;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext invokingService(WorkflowTrackingContext context, InvocationEntity receiver,
- String... descriptionAndAnnotation) {
- return invokingService(context, receiver, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext invokingService(WorkflowTrackingContext context, InvocationEntity receiver,
- XmlObject header, XmlObject body, String... descriptionAndAnnotation) {
-
- InvokingServiceDocument activity = InvokingServiceDocument.Factory.newInstance();
- RequestInitiatorType activityType = activity.addNewInvokingService();
-
- // create the invocation context; set the receiver to the remote entity
- InvocationContextImpl invocationContext = new InvocationContextImpl(context.getMyself(), receiver);
- activityType.addNewReceiver().set(receiver.toBaseIDType());
-
- // add header and body fields
- if (header != null || body != null) {
- InvocationMessageType request = activityType.addNewRequest();
- if (header != null)
- request.addNewHeader().set(header);
- if (body != null)
- request.addNewBody().set(body);
- }
- sendNotification(context, activity, descriptionAndAnnotation, "[Service is invoked]");
- return invocationContext;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void invokingServiceSucceeded(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- InvokingServiceSucceededDocument activity = InvokingServiceSucceededDocument.Factory.newInstance();
- AcknowledgeSuccessType activityType = activity.addNewInvokingServiceSucceeded();
-
- // set the remote entity as receiver
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. "
- + "there was no remote entity defined (requestReceiver=NULL)");
- }
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Service finished successfully]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void invokingServiceFailed(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- invokingServiceFailed(wtcontext, context, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void invokingServiceFailed(WorkflowTrackingContext wtcontext, InvocationContext context, Throwable trace,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
- final InvokingServiceFailedDocument activity = InvokingServiceFailedDocument.Factory.newInstance();
- final AcknowledgeFailureType activityType = activity.addNewInvokingServiceFailed();
-
- // set the remote entity as receiver
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. "
- + "there was no remote entity defined (requestReceiver=NULL)");
- }
-
- // set stack trace if present
- if (trace != null) {
- final StringWriter sw = new StringWriter();
- trace.printStackTrace(new PrintWriter(sw));
-
- XmlString traceXmlStr = XmlString.Factory.newInstance();
- traceXmlStr.setStringValue(sw.toString());
- activityType.addNewFailure().addNewTrace().set(traceXmlStr);
- }
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Service failed]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void receivedResult(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- receivedResult(wtcontext, context, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void receivedResult(WorkflowTrackingContext wtcontext, InvocationContext context, XmlObject header,
- XmlObject body, String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- ReceivedResultDocument activity = ReceivedResultDocument.Factory.newInstance();
- ResultReceiverType activityType = activity.addNewReceivedResult();
-
- // set the responder to the remote entity
- if (context.getRemoteEntity() != null) {
- activityType.addNewResponder().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. " + "There was no remote entity defined (responder=NULL)");
- }
-
- // add header and body fields
- if (header != null || body != null) {
- InvocationMessageType result = activityType.addNewResult();
- if (header != null)
- result.addNewHeader().set(header);
- if (body != null)
- result.addNewBody().set(body);
- }
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Service failed]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void receivedFault(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- receivedFault(wtcontext, context, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void receivedFault(WorkflowTrackingContext wtcontext, InvocationContext context, XmlObject header,
- XmlObject faultBody, String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- ReceivedFaultDocument activity = ReceivedFaultDocument.Factory.newInstance();
- FaultReceiverType activityType = activity.addNewReceivedFault();
-
- // set the responder to the remote entity
- if (context.getRemoteEntity() != null) {
- activityType.addNewResponder().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. " + "There was no remote entity defined (responder=NULL)");
- }
-
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Fault is received for invocation ]");
- }
-
- // /////////////////////////////////////////////////////////////////////////////
- // //
- // SERVICE NOTIFIER //
- // //
- // /////////////////////////////////////////////////////////////////////////////
- /**
- * {@inheritDoc}
- *
- */
- public void serviceInitialized(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
-
- ServiceInitializedDocument activity = ServiceInitializedDocument.Factory.newInstance();
- activity.addNewServiceInitialized();
- sendNotification(context, activity, descriptionAndAnnotation, "[Service is initialized; ready to be invoked]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void serviceTerminated(WorkflowTrackingContext context, URI serviceID, String... descriptionAndAnnotation) {
-
- ServiceTerminatedDocument activity = ServiceTerminatedDocument.Factory.newInstance();
- activity.addNewServiceTerminated();
- sendNotification(context, activity, descriptionAndAnnotation,
- "[Service is terminated; cannot be invoked anymore]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext serviceInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
- String... descriptionAndAnnotation) {
- return serviceInvoked(context, initiator, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public InvocationContext serviceInvoked(WorkflowTrackingContext context, InvocationEntity initiator,
- XmlObject header, XmlObject body, String... descriptionAndAnnotation) {
-
- ServiceInvokedDocument activity = ServiceInvokedDocument.Factory.newInstance();
- RequestReceiverType activityType = activity.addNewServiceInvoked();
-
- // create the invocation context; set the initiator to the remote entity
- InvocationContextImpl invocationContext = new InvocationContextImpl(context.getMyself(), initiator);
- if (initiator != null) {
- activityType.addNewInitiator().set(initiator.toBaseIDType());
- } else {
- logger.warn("Possible Error in context that was passed. "
- + "There was no remote invoker defined (initiator=NULL)");
- }
-
- // add header and body fields
- if (header != null || body != null) {
- InvocationMessageType request = activityType.addNewRequest();
- if (header != null)
- request.addNewHeader().set(header);
- if (body != null)
- request.addNewBody().set(body);
- }
-
- sendNotification(context, activity, descriptionAndAnnotation, "[Service is invoked]");
-
- return invocationContext;
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingResult(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- sendingResult(wtcontext, context, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingResult(WorkflowTrackingContext wtcontext, InvocationContext context, XmlObject header,
- XmlObject body, String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- SendingResultDocument activity = SendingResultDocument.Factory.newInstance();
- ResultResponderType activityType = activity.addNewSendingResult();
-
- // set the receiver to the remote entity
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Possible Error in context that was passed. "
- + "There was no remote entity defined (responseReceiver=NULL)");
- }
-
- // add header and body fields
- if (header != null || body != null) {
- InvocationMessageType result = activityType.addNewResult();
- if (header != null)
- result.addNewHeader().set(header);
- if (body != null)
- result.addNewBody().set(body);
- }
-
- sendNotification(wtcontext, activity, descriptionAndAnnotation,
- "[Trying to send successful result of invocation]");
- }
-
- /**
- * {@inheritDoc}
- *
- *
- */
- public void sendingFault(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- sendingFault(wtcontext, context, null, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingFault(WorkflowTrackingContext wtcontext, InvocationContext context, XmlObject header,
- XmlObject faultBody, String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- SendingFaultDocument activity = SendingFaultDocument.Factory.newInstance();
- FaultResponderType activityType = activity.addNewSendingFault();
-
- // set the receiver to the remote entity
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. "
- + "There was no remote entity defined (responseReceiver=NULL)");
- }
-
- // add header and body fields
- if (header != null || faultBody != null) {
- FaultMessageType result = activityType.addNewFault();
- if (header != null)
- result.addNewHeader().set(header);
- if (faultBody != null)
- result.addNewBody().set(faultBody);
- }
-
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Trying to sending fault from invocation]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingResponseSucceeded(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- SendingResponseSucceededDocument activity = SendingResponseSucceededDocument.Factory.newInstance();
- AcknowledgeSuccessType activityType = activity.addNewSendingResponseSucceeded();
-
- // set the remote entity as receiver
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. "
- + "there was no remote entity defined (responseReceiver=NULL)");
- }
-
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Successfully sent response of invocation]");
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingResponseFailed(WorkflowTrackingContext wtcontext, InvocationContext context,
- String... descriptionAndAnnotation) {
-
- sendingResponseFailed(wtcontext, context, null, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void sendingResponseFailed(WorkflowTrackingContext wtcontext, InvocationContext context, Throwable trace,
- String... descriptionAndAnnotation) {
-
- if (context == null)
- throw new RuntimeException("Context passed was NULL.");
-
- SendingResponseFailedDocument activity = SendingResponseFailedDocument.Factory.newInstance();
- AcknowledgeFailureType activityType = activity.addNewSendingResponseFailed();
-
- // set the remote entity as receiver
- if (context.getRemoteEntity() != null) {
- activityType.addNewReceiver().set(context.getRemoteEntity().toBaseIDType());
- } else {
- logger.warn("Error in context that was passed. "
- + "there was no remote entity defined (responseReceiver=NULL)");
- }
-
- // set stack trace if present
- if (trace != null) {
- final StringWriter sw = new StringWriter();
- trace.printStackTrace(new PrintWriter(sw));
-
- XmlString traceXmlStr = XmlString.Factory.newInstance();
- traceXmlStr.setStringValue(sw.toString());
- activityType.addNewFailure().addNewTrace().set(traceXmlStr);
- }
-
- sendNotification(wtcontext, activity, descriptionAndAnnotation, "[Unable to send result of invocation]");
- }
-
- // /////////////////////////////////////////////////////////////////////////////
- // //
- // DATA PROVENANCE //
- // //
- // /////////////////////////////////////////////////////////////////////////////
-
- /**
- * {@inheritDoc}
- *
- */
- public DataObj dataConsumed(WorkflowTrackingContext context, URI dataId, List<URI> locations,
- String... descriptionAndAnnotation) {
-
- DataObj dataObj = new DataObjImpl(dataId, locations);
- return dataConsumed(context, dataObj, descriptionAndAnnotation);
- }
-
- public DataObj dataConsumed(WorkflowTrackingContext context, URI dataId, List<URI> locations, int sizeInBytes,
- String... descriptionAndAnnotation) {
-
- DataObj dataObj = new DataObjImpl(dataId, locations, sizeInBytes);
- return dataConsumed(context, dataObj, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataObj dataConsumed(WorkflowTrackingContext context, DataObj dataObj, String... descriptionAndAnnotation) {
- InvocationEntity entity = context.getMyself();
- if (entity == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (dataObj == null)
- throw new RuntimeException("Data object passed was NULL.");
- if (dataObj.getId() == null)
- throw new RuntimeException("Data object's ID was NULL.");
-
- DataConsumedDocument activity = DataConsumedDocument.Factory.newInstance();
- DataProductNotificationType activityType = activity.addNewDataConsumed();
-
- // set the data product to the consumed data
- DataProductType dataProduct = activityType.addNewDataProduct();
- // set data ID and size
- dataProduct.setId(dataObj.getId().toString());
- dataProduct.setSizeInBytes(dataObj.getSizeInBytes());
- // set data URLs
- List<URI> locations = dataObj.getLocations();
- for (URI location : locations) {
- dataProduct.addLocation(location.toString());
- }
- // set data timestampp
- final Calendar cal = new GregorianCalendar();
- cal.setTime(activityTimestamp != null ? activityTimestamp : new Date());
- dataProduct.setTimestamp(cal);
-
- sendNotification(context, activity, descriptionAndAnnotation, "[consumed: ID=<" + dataObj.getId().toString()
- + ">; URL=<#" + locations.size() + "><" + (locations.size() > 0 ? locations.get(0) : "") + ">]");
-
- return dataObj;
- }
-
- // /**
- // * Adds the file/directory was used by this invocation to the current dataConsuemd
- // * notification batch. If the notification batch did not exist, it is created. The notification
- // * is not sent until {@link #flush()} is called.
- // *
- // * @param entity 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 data object passed to this method with file/dir size filled in if not
- // * already when passed.
- // *
- // */
- // protected DataObj dataConsumedBatched(WorkflowTrackingContext context, InvocationEntity entity, DataObj dataObj,
- // String...descriptionAndAnnotation) {
- //
- // if(entity == null) throw new RuntimeException("Local entity passed was NULL.");
- // if(dataObj == null) throw new RuntimeException("Data object passed was NULL.");
- // if(dataObj.getId() == null) throw new RuntimeException("Data object's ID was NULL.");
- //
- // if (dataConsumedBatchActivity == null) {
- //
- // // create initial consumed notification container
- // dataConsumedBatchActivity = DataConsumedDocument.Factory.newInstance();
- // DataProductNotificationType activityType = dataConsumedBatchActivity.addNewDataConsumed();
- //
- //
- // }
- //
- // // get existing consumed notification container
- // DataProductNotificationType activityType = dataConsumedBatchActivity.addNewDataConsumed();
- //
- // // add nre data product to the consumed data
- // DataProductType dataProduct = activityType.addNewDataProduct();
- // // set data ID and size
- // dataProduct.setId(dataObj.getId().toString());
- // dataProduct.setSizeInBytes(dataObj.getSizeInBytes());
- // // set data URLs
- // List<URI> locations = dataObj.getLocations();
- // for(URI location : locations){
- // dataProduct.addLocation(location.toString());
- // }
- // // set data timestampp
- // final Calendar cal = new GregorianCalendar();
- // cal.setTime(activityTimestamp != null ? activityTimestamp : new Date());
- // dataProduct.setTimestamp(cal);
- //
- // sendNotification(context, activityType, descriptionAndAnnotation,
- // "[consumed: ID=<" + dataObj.getId().toString() +
- // ">; URL=<#" + locations.size() + "><" +
- // (locations.size() > 0 ? locations.get(0) : "") +
- // ">]"
- // );
- //
- // return dataObj;
- // }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataObj dataProduced(WorkflowTrackingContext context, URI dataId, List<URI> locations,
- String... descriptionAndAnnotation) {
-
- DataObj dataObj = new DataObjImpl(dataId, locations);
- return dataProduced(context, dataObj, descriptionAndAnnotation);
- }
-
- public DataObj dataProduced(WorkflowTrackingContext context, URI dataId, List<URI> locations, int sizeInBytes,
- String... descriptionAndAnnotation) {
-
- DataObj dataObj = new DataObjImpl(dataId, locations, sizeInBytes);
- return dataProduced(context, dataObj, descriptionAndAnnotation);
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public DataObj dataProduced(WorkflowTrackingContext context, DataObj dataObj, String... descriptionAndAnnotation) {
- InvocationEntity entity = context.getMyself();
- if (entity == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (dataObj == null)
- throw new RuntimeException("Data object passed was NULL.");
- if (dataObj.getId() == null)
- throw new RuntimeException("Data object's ID was NULL.");
-
- DataProducedDocument activity = DataProducedDocument.Factory.newInstance();
- DataProductNotificationType activityType = activity.addNewDataProduced();
-
- // set the data product to the produced data
- DataProductType dataProduct = activityType.addNewDataProduct();
- // set data ID and size
- dataProduct.setId(dataObj.getId().toString());
- dataProduct.setSizeInBytes(dataObj.getSizeInBytes());
- // set data URLs
- List<URI> locations = dataObj.getLocations();
- for (URI location : locations) {
- dataProduct.addLocation(location.toString());
- }
- // set data timestampp
- final Calendar cal = new GregorianCalendar();
- cal.setTime(activityTimestamp != null ? activityTimestamp : new Date());
- dataProduct.setTimestamp(cal);
-
- sendNotification(context, activity, descriptionAndAnnotation, "[produced: ID=<" + dataObj.getId().toString()
- + ">; URL=<#" + locations.size() + "><" + (locations.size() > 0 ? locations.get(0) : "") + ">]");
-
- return dataObj;
- }
-
- /**
- * Adds the file/directory was used by this invocation to the current dataProduced notification batch. If the
- * notification batch did not exist, it is created. The notification is not sent untill {@link #flush()} is called.
- *
- * @param entity
- * identity of the workflow/service's invocation that produced 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 data object passed to this method with file/dir size filled in if not already when passed.
- *
- */
- protected DataObj dataProducedBatched(WorkflowTrackingContext context, InvocationEntity entity, DataObj dataObj,
- String... descriptionAndAnnotation) {
-
- if (entity == null)
- throw new RuntimeException("Local entity passed was NULL.");
- if (dataObj == null)
- throw new RuntimeException("Data object passed was NULL.");
- if (dataObj.getId() == null)
- throw new RuntimeException("Data object's ID was NULL.");
-
- if (dataProducedBatchActivity == null) {
-
- // create initial produced notification container
- dataProducedBatchActivity = DataProducedDocument.Factory.newInstance();
- }
-
- // get existing produced notification container
- DataProductNotificationType activityType = dataProducedBatchActivity.addNewDataProduced();
-
- // add new data product to the produced data
- DataProductType dataProduct = activityType.addNewDataProduct();
- // set data ID and size
- dataProduct.setId(dataObj.getId().toString());
- dataProduct.setSizeInBytes(dataObj.getSizeInBytes());
- // set data URLs
- List<URI> locations = dataObj.getLocations();
- for (URI location : locations) {
- dataProduct.addLocation(location.toString());
- }
- // set data timestamp
- final Calendar cal = new GregorianCalendar();
- cal.setTime(activityTimestamp != null ? activityTimestamp : new Date());
- dataProduct.setTimestamp(cal);
-
- // add description, and annotation to DATA PRODUCT if present
- sendNotification(context, dataProducedBatchActivity, descriptionAndAnnotation, "[produced: ID=<"
- + dataObj.getId().toString() + ">; URL=<#" + locations.size() + "><"
- + (locations.size() > 0 ? locations.get(0) : "") + ">]");
-
- return dataObj;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/AbstractPublisher.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/AbstractPublisher.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/AbstractPublisher.java
deleted file mode 100644
index f1abcc2..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/AbstractPublisher.java
+++ /dev/null
@@ -1,214 +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.impl.publish;
-
-import java.util.concurrent.locks.Condition;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.apache.airavata.workflow.tracking.util.LinkedMessageQueue;
-import org.apache.airavata.workflow.tracking.util.Timer;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Abstract method to publish messages in sync or async mode. In async mode, the messages are kept in an in-memory queue
- * and published. Calling flush() blocks till all messages are sent and the queue is empty. In sync mode, the call
- * blocks till the message is transmitted.
- */
-public abstract class AbstractPublisher implements Runnable, NotificationPublisher {
-
- protected static final Logger logger = LoggerFactory.getLogger(AbstractPublisher.class);
- protected static final boolean IS_LOG_FINEST = logger.isDebugEnabled();
- private final LinkedMessageQueue<BrokerEntry> messageQueue;
- protected static final boolean IS_TIMER = Boolean.getBoolean("ENABLE_TIMER");
- protected static final Timer notifTP = Timer.init("PubNotif");
-
- private boolean finished = false;
- private final Lock LOCK = new ReentrantLock();
- private final Condition CONDITION = LOCK.newCondition();
- private static int PUB_ID = 0;
-
- private final boolean IS_DEFAULT_MODE_ASYNC;
-
- private boolean deleted = false;
-
- private boolean deleteNow = false;
-
- private final Thread pubThread;
-
- protected AbstractPublisher(int capacity, boolean defaultAsync) {
-
- messageQueue = new LinkedMessageQueue<BrokerEntry>(capacity);
- IS_DEFAULT_MODE_ASYNC = defaultAsync;
- deleted = false;
- pubThread = new Thread(this, "PUBLISHER #" + PUB_ID++);
- pubThread.setDaemon(true);
- pubThread.start();
- }
-
- // public abstract void publishSync(String leadMessage);
- public final void delete() {
- deleted = true;
- messageQueue.setCanStop(true);
- deleteNow = true;
- }
-
- public final boolean isDeleted() {
- return deleted;
- }
-
- public final void publish(String leadMessage) {
-
- if (IS_DEFAULT_MODE_ASYNC) {
- publishAsync(leadMessage);
- } else {
- publishSync(leadMessage);
- }
- }
-
- public final void publish(XmlObject xmlMessage) {
-
- if (IS_DEFAULT_MODE_ASYNC) {
- publishAsync(xmlMessage);
- } else {
- publishSync(xmlMessage.xmlText());
- }
- }
-
- public final void publishAsync(String leadMessage) {
-
- if (IS_LOG_FINEST) {
- logger.debug("ASYNC: adding to queue, notification: " + leadMessage);
- }
- final BrokerEntry brokerEntry = new BrokerEntry(leadMessage);
- try {
- messageQueue.put(brokerEntry);
- } catch (InterruptedException e) {
- throw new RuntimeException("Publisher interrupted. Is it being deleted!?");
- }
- }
-
- public final void publishAsync(XmlObject xmlMessage) {
-
- if (IS_LOG_FINEST) {
- logger.debug("ASYNC: adding to queue, notification: " + xmlMessage);
- }
-
- final BrokerEntry brokerEntry = new BrokerEntry(xmlMessage);
- try {
- messageQueue.put(brokerEntry);
- } catch (InterruptedException e) {
- throw new RuntimeException("Publisher interrupted. Is it being deleted!?");
- }
- }
-
- public final void publishSync(XmlObject xmlMessage) {
-
- if (IS_LOG_FINEST) {
- logger.debug("SYNC: sending notification: " + xmlMessage);
- }
- publishSync(xmlMessage.xmlText());
- }
-
- public final void flush() {
-
- finished = true;
- LOCK.lock();
- while (messageQueue.size() > 0) {
- try {
- // wait to be signalled that all messages were sent...
- CONDITION.await();
- } catch (InterruptedException e) {
- throw new RuntimeException("Publisher interrupted. Is it being deleted!?");
- }
- }
- finished = false;
- CONDITION.signal(); // send ack...
- LOCK.unlock();
- return;
- }
-
- public final void run() {
-
- BrokerEntry brokerEntry = null;
- while (deleteNow) {
-
- try {
- // get the head from queue, but dont remove it yet
- // block for message to arrive only if not finished;
- // if finished, dont block...just quit
- brokerEntry = finished ? messageQueue.peek() : messageQueue.get();
- if(deleteNow){
- break;
- }
- if (brokerEntry == null) {
-
- // the queue has been flushed
- if (finished) {
- LOCK.lock();
- CONDITION.signal(); // signal flushed queue...
- try {
- CONDITION.await(); // and wait for ack.
- } catch (InterruptedException e) {
- throw e;
- }
- LOCK.unlock();
- } else { /* ignore...this should not happen */
- }
-
- // go back to to start and wait for new message in flushed queue...
- continue;
-
- } else {
-
- if (IS_LOG_FINEST) {
- logger.debug("ASYNC: sending notification: " + brokerEntry.getMessage());
- }
-
- // publish message
- publishSync(brokerEntry.getMessage());
-
- // remove the published head from queue
- messageQueue.poll();
- }
-
- } catch (InterruptedException e) {
- if (deleted)
- break;
- else
- logger.error("Interrupted when queue size: " + messageQueue.size() + ". deleted == false", e);
- } catch (RuntimeException e) {
-
- logger.error("Runtime Error: " + e.getMessage());
- if (logger.isDebugEnabled()) {
- logger.debug("Runtime Error at message: "
- + (brokerEntry != null ? brokerEntry.getMessage() : "NULL") + "; queue size: "
- + messageQueue.size(), e);
- }
- // fixme: we should remove the entry from queue if it cannot be sent...
- // otherwise, if broker is down, this may cause an infinite loop!!!
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/BrokerEntry.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/BrokerEntry.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/BrokerEntry.java
deleted file mode 100644
index 9966fb9..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/BrokerEntry.java
+++ /dev/null
@@ -1,51 +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.impl.publish;
-
-import org.apache.xmlbeans.XmlObject;
-
-final class BrokerEntry {
-
- public BrokerEntry(String message) {
- this.message = message;
- this.xml = null;
- }
-
- public BrokerEntry(XmlObject xml) {
- this.xml = xml;
- this.message = null;
- }
-
- public final String getMessage() {
- if (message == null)
- return xml.xmlText();
- else
- return message;
- }
-
- public final XmlObject getXmlObject() {
- return xml;
- }
-
- private final String message;
- private final XmlObject xml;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/LoopbackPublisher.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/LoopbackPublisher.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/LoopbackPublisher.java
deleted file mode 100644
index cbe61c1..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/LoopbackPublisher.java
+++ /dev/null
@@ -1,163 +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.impl.publish;
-
-import java.io.PrintStream;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-
-import org.apache.airavata.workflow.tracking.client.Callback;
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.airavata.workflow.tracking.common.ConstructorConsts;
-import org.apache.airavata.workflow.tracking.common.ConstructorProps;
-import org.apache.airavata.workflow.tracking.types.BaseIDType;
-import org.apache.airavata.workflow.tracking.types.BaseNotificationType;
-import org.apache.airavata.workflow.tracking.types.LogInfoDocument;
-import org.apache.airavata.workflow.tracking.types.PublishURLDocument;
-import org.apache.airavata.workflow.tracking.util.MessageUtil;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-
-/**
- * acts as a workflow tracking NotificationPublisher that calls a workflow tracking callback listener without having to
- * pass though a real notification broker. Default listener prints to stdout
- */
-public class LoopbackPublisher extends AbstractPublisher implements NotificationPublisher {
-
- private Callback listener;
- private String topic;
- private static int globalCount = 0;
-
- public LoopbackPublisher(Callback listener_, String topic_) {
- super(10, false); // capacity, async
- topic = topic_;
- listener = listener_;
- if (listener == null) {
- listener = new Callback() {
- int count = 0;
-
- public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) {
-
- System.out
- .printf("----\nReceived Message [L:%d/G:%d] on topic [%s] of type [%s] with payload:\n[%s]\n====\n",
- count, globalCount, topic, notificationType, messageObj);
- count++;
- globalCount++;
- }
- };
- }
- }
-
- public LoopbackPublisher(final PrintStream out_, String topic_) {
- this(new Callback() {
- int count = 0;
-
- public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) {
-
- out_.printf(
- "----\nReceived Message [L:%d/G:%d] on topic [%s] of type [%s] with payload:\n[%s]\n====\n",
- count, globalCount, topic, notificationType, messageObj);
- count++;
- globalCount++;
- }
- }, topic_);
- }
-
- public LoopbackPublisher(String topic_) {
- this(System.out, topic_);
- }
-
- public LoopbackPublisher(ConstructorProps props) {
- this((Callback) props.get(ConstructorConsts.CALLBACK_LISTENER), (String) props.get(ConstructorConsts.TOPIC));
- }
-
- /**
- * Method publishSync
- *
- * @param message
- * a String message that should be a valid XML String (serialized XML document)
- *
- */
- public void publishSync(String message) {
-
- try {
- XmlObject xmlMessage = XmlObject.Factory.parse(message);
- NotificationType type = MessageUtil.getType(xmlMessage);
- listener.deliverMessage(topic, type, xmlMessage);
- } catch (XmlException e) {
- logger.error("Error parsing workflow tracking message : [" + message + "]\n" + "as an XML Object", e);
- }
- }
-
- public static void main(String args[]) {
-
- LoopbackPublisher publisher = new LoopbackPublisher(new Callback() {
- int count = 0;
-
- public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) {
-
- System.out.printf("----\nReceived Message [%d] on topic [%s] of type [%s] with payload:\n[%s]\n====\n",
- count++, topic, notificationType, messageObj);
- }
- }, "testTopic");
-
- // create & publish log message
- {
- LogInfoDocument logMsg = LogInfoDocument.Factory.newInstance();
- BaseNotificationType log = logMsg.addNewLogInfo();
- // add timestamp
- final Calendar cal = new GregorianCalendar();
- cal.setTime(new Date());
- log.setTimestamp(cal);
- // add notification source
- BaseIDType baseID = BaseIDType.Factory.newInstance();
- baseID.setServiceID("http://tempuri.org/test_service");
- log.addNewNotificationSource().set(baseID);
- // add description
- log.setDescription("A test message");
-
- // publish message as XML Object
- publisher.publish(logMsg);
- }
- // create & publish publishURl message
- {
- // create publish URL message
- PublishURLDocument pubMsg = PublishURLDocument.Factory.newInstance();
- PublishURLDocument.PublishURL pub = pubMsg.addNewPublishURL();
- // add timestamp
- final Calendar cal = new GregorianCalendar();
- cal.setTime(new Date());
- pub.setTimestamp(cal);
- // add notification source
- BaseIDType baseID = BaseIDType.Factory.newInstance();
- baseID.setServiceID("http://tempuri.org/test_service");
- pub.addNewNotificationSource().set(baseID);
- pub.setTitle("Some URL's Title");
- pub.setLocation("http://tempuri.org/published_url");
-
- // publish message as XML string
- publisher.publish(pubMsg.xmlText());
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/NotificationPublisher.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/NotificationPublisher.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/NotificationPublisher.java
deleted file mode 100644
index e41f275..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/NotificationPublisher.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.publish;
-
-import org.apache.xmlbeans.XmlObject;
-
-public interface NotificationPublisher {
-
- public void publish(String leadMessage);
-
- public void publish(XmlObject xmlMessage);
-
- public void publishSync(String leadMessage);
-
- public void publishSync(XmlObject xmlMessage);
-
- public void publishAsync(String leadMessage);
-
- public void publishAsync(XmlObject xmlMessage);
-
- public void flush();
-
- public void delete();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/WSMPublisher.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/WSMPublisher.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/WSMPublisher.java
deleted file mode 100644
index a8cffb2..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/publish/WSMPublisher.java
+++ /dev/null
@@ -1,119 +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.impl.publish;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Properties;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.commons.WorkFlowUtils;
-import org.apache.airavata.workflow.tracking.WorkflowTrackingException;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.wsmg.client.MsgBrokerClientException;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-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;
-
-/**
- * Publish WS-Eventing messages using WS-Messenger client API
- *
- */
-public class WSMPublisher extends AbstractPublisher implements NotificationPublisher {
-
- protected final WseMsgBrokerClient broker;
- protected final EndpointReference brokerEpr;
- protected Properties configs = new Properties();
-
- private Logger log = LoggerFactory.getLogger(WSMPublisher.class);
-
- public WSMPublisher(WorkflowTrackingContext context) {
- this(10, context.isEnableAsyncPublishing(), context.getBrokerEpr());
- }
-
- public WSMPublisher(int capacity, boolean defaultAsync, String brokerLoc, String topic) throws IOException {
- super(capacity, defaultAsync);
- broker = new WseMsgBrokerClient();
- brokerEpr = broker.createEndpointReference(brokerLoc, topic);
- broker.init(brokerEpr.getAddress());
- }
-
- public WSMPublisher(int capacity, boolean defaultAsync, EndpointReference brokerEpr_)
- throws WorkflowTrackingException {
- super(capacity, defaultAsync);
- try {
- brokerEpr = brokerEpr_;
- broker = new WseMsgBrokerClient();
- broker.init(brokerEpr_.getAddress());
- } catch (Exception e) {
- throw new WorkflowTrackingException(e);
- }
- }
-
- public WSMPublisher(int capacity, boolean defaultAsync, String brokerEpr_) throws IOException {
-
- this(capacity, defaultAsync, brokerEpr_, false);
-
- }
-
- public WSMPublisher(int capacity, boolean defaultAsync, String brokerEpr_, boolean isXmlEpr) throws IOException {
- super(capacity, defaultAsync);
- if (!isXmlEpr) {
- brokerEpr = new EndpointReference(brokerEpr_);// EndpointReferenceHelper.fro(brokerEpr_);
-
- } else {
- brokerEpr = EndpointReferenceHelper.fromString(brokerEpr_);
- }
-
- broker = new WseMsgBrokerClient();
- broker.init(brokerEpr.getAddress());
- }
-
- /**
- * Method publishSync
- *
- * @param leadMessage
- * a String
- *
- */
- public void publishSync(String leadMessage) {
- if (isDeleted())
- throw new RuntimeException("Publisher has been deleted!");
- if (IS_LOG_FINEST) {
- logger.debug("publishing notification to messenger broker: " + leadMessage);
- }
- try {
- OMElement msg = WorkFlowUtils.reader2OMElement(new StringReader(leadMessage));
- broker.publish(null, msg);
-
- } catch (MsgBrokerClientException e) {
- log.error("unablet to publish the lead message", e);
- } catch (XMLStreamException e) {
- log.error("unable to parse the load message - " + leadMessage, e);
- }
- }
-
-}
[5/5] airavata git commit: retiring workflow tracking schema -
AIRAVATA-1557
Posted by ch...@apache.org.
retiring workflow tracking schema - AIRAVATA-1557
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/42f77edb
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/42f77edb
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/42f77edb
Branch: refs/heads/master
Commit: 42f77edb854d4c3c79191ee13112dcc562a93593
Parents: cab1571
Author: Chathuri Wimalasena <ka...@gmail.com>
Authored: Tue Jan 27 14:27:07 2015 -0500
Committer: Chathuri Wimalasena <ka...@gmail.com>
Committed: Tue Jan 27 14:27:07 2015 -0500
----------------------------------------------------------------------
modules/commons/workflow-tracking/pom.xml | 96 ---
.../airavata/commons/LeadContextHeader.java | 330 --------
.../commons/LeadCrosscutParametersUtil.java | 310 -------
.../apache/airavata/commons/WorkFlowUtils.java | 72 --
.../org/apache/airavata/commons/XBeansUtil.java | 50 --
.../workflow/tracking/AbstractNotifier.java | 184 -----
.../workflow/tracking/AuditNotifier.java | 68 --
.../workflow/tracking/GenericNotifier.java | 212 -----
.../airavata/workflow/tracking/Notifier.java | 72 --
.../workflow/tracking/NotifierFactory.java | 66 --
.../workflow/tracking/PerformanceNotifier.java | 245 ------
.../workflow/tracking/ProvenanceNotifier.java | 180 ----
.../workflow/tracking/PublisherFactory.java | 54 --
.../workflow/tracking/ResourceNotifier.java | 61 --
.../workflow/tracking/ServiceNotifier.java | 235 ------
.../workflow/tracking/WorkflowNotifier.java | 331 --------
.../tracking/WorkflowTrackingException.java | 46 --
.../workflow/tracking/client/Callback.java | 45 -
.../client/LeadNotificationManager.java | 188 -----
.../tracking/client/NotificationType.java | 41 -
.../workflow/tracking/client/Subscription.java | 135 ---
.../tracking/common/AnnotationConsts.java | 82 --
.../tracking/common/AnnotationProps.java | 310 -------
.../tracking/common/ConstructorConsts.java | 55 --
.../tracking/common/ConstructorProps.java | 68 --
.../tracking/common/DataDurationObj.java | 35 -
.../workflow/tracking/common/DataObj.java | 42 -
.../workflow/tracking/common/DurationObj.java | 38 -
.../tracking/common/InvocationContext.java | 28 -
.../tracking/common/InvocationEntity.java | 39 -
.../tracking/common/NotifierConfig.java | 54 --
.../common/NotifierCreationException.java | 32 -
.../tracking/common/NotifierException.java | 36 -
.../tracking/common/NotifierVersion.java | 56 --
.../common/WorkflowTrackingContext.java | 91 --
.../tracking/impl/GenericNotifierImpl.java | 114 ---
.../workflow/tracking/impl/NotifierImpl.java | 335 --------
.../tracking/impl/ProvenanceNotifierImpl.java | 824 -------------------
.../impl/publish/AbstractPublisher.java | 214 -----
.../tracking/impl/publish/BrokerEntry.java | 51 --
.../impl/publish/LoopbackPublisher.java | 163 ----
.../impl/publish/NotificationPublisher.java | 43 -
.../tracking/impl/publish/WSMPublisher.java | 119 ---
.../tracking/impl/state/DataDurationImpl.java | 58 --
.../tracking/impl/state/DataObjImpl.java | 105 ---
.../tracking/impl/state/DurationImpl.java | 73 --
.../impl/state/InvocationContextImpl.java | 40 -
.../impl/state/InvocationEntityImpl.java | 126 ---
.../subscription/LeadNotificationHandler.java | 147 ----
.../MessageBoxNotificationHandler.java | 265 ------
.../samples/listener/CallbackHandler.java | 60 --
.../tracking/samples/listener/Listener.java | 96 ---
.../simple_listener/CallbackHandler.java | 41 -
.../samples/simple_listener/SimpleListener.java | 63 --
.../workflow/tracking/util/ActivityTime.java | 78 --
.../tracking/util/LinkedMessageQueue.java | 181 ----
.../workflow/tracking/util/MessageUtil.java | 562 -------------
.../airavata/workflow/tracking/util/Timer.java | 104 ---
.../workflow/tracking/util/XmlBeanUtils.java | 38 -
.../src/main/resources/log4j.properties | 82 --
.../schemas/workflow_tracking_types.xsd | 594 -------------
.../schemas/workflow_tracking_types.xsdconfig | 21 -
62 files changed, 8584 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/pom.xml
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/pom.xml b/modules/commons/workflow-tracking/pom.xml
deleted file mode 100644
index 06a1831..0000000
--- a/modules/commons/workflow-tracking/pom.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under
- the Apache License, Version 2.0 (theĆ "License"); you may not use this file except in compliance with the License. You may
- obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to
- in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY ~ KIND, either express or implied. See the License for the specific language governing permissions and limitations under
- the License. -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.airavata</groupId>
- <artifactId>commons</artifactId>
- <version>0.15-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>airavata-workflow-tracking</artifactId>
- <packaging>jar</packaging>
- <name>Airavata Workflow Tracking</name>
- <url>http://airavata.apache.org/</url>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <version>1.7</version>
- <executions>
- <execution>
- <id>add-source</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>add-source</goal>
- </goals>
- <configuration>
- <sources>
- <source>${basedir}/target/generated-sources/xmlbeans</source>
- </sources>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>xmlbeans-maven-plugin</artifactId>
- <version>2.3.3</version>
- <executions>
- <execution>
- <id>generateBindings</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>xmlbeans</goal>
- </goals>
- </execution>
- </executions>
- <inherited>true</inherited>
- <configuration>
- <schemaDirectory>src/main/resources/schemas</schemaDirectory>
- <outputJar>target/airavata-workflowtrackingtypes-${project.version}.jar</outputJar>
- <xmlConfigs>
- <xmlConfig implementation="java.io.File">src/main/resources/schemas/workflow_tracking_types.xsdconfig</xmlConfig>
- </xmlConfigs>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-messenger-client</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <!-- Testing -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- </properties>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadContextHeader.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadContextHeader.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadContextHeader.java
deleted file mode 100644
index a58ec3f..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadContextHeader.java
+++ /dev/null
@@ -1,330 +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.commons;
-
-import java.net.URI;
-import java.util.Iterator;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LeadContextHeader {
-
- OMElement target;
- private static final Logger log = LoggerFactory.getLogger(LeadContextHeader.class);
-
- public LeadContextHeader(String experimentId, String userDn) {
- this.target = factory.createOMElement(new QName(NS.getNamespaceURI(), TYPE.getLocalPart()));
- setExperimentId(experimentId);
- setUserDn(userDn);
- }
-
- public LeadContextHeader(OMElement target) {
- this.target = target;
- }
-
- public void setExperimentId(String experimentId) {
- setStringValue(NS, "experiment-id", experimentId);
- }
-
- public EndpointReference getEventSink() {
- try {
- return lookupEpr(NS, "event-sink-epr");
- } catch (AxisFault e) {
- log.error(e.getMessage(), e);
- return null;
- }
- }
-
- private EndpointReference lookupEpr(OMNamespace ns2, String localPart) throws AxisFault {
- OMElement element = target.getFirstChildWithName(new QName(ns2.getNamespaceURI(), localPart));
- return EndpointReferenceHelper.fromOM(element);
- }
-
- private void setStringValue(OMNamespace ns2, String name, String value) {
-
- QName childQName = new QName(ns2.getNamespaceURI(), name);
-
- Iterator iterator = target.getChildrenWithName(childQName);
-
- boolean haschildren = false;
-
- while (iterator.hasNext()) {
- haschildren = true;
-
- OMElement currentChild = (OMElement) iterator.next();
- currentChild.setText(value);
- }
-
- if (!haschildren) {
-
- OMElement child = factory.createOMElement(childQName, target);
- child.setText(value);
- }
-
- }
-
- public String getExperimentId() {
- return getString(NS, "experiment-id");
- }
-
- private String getString(OMNamespace ns2, String localpart) {
-
- String ret = null;
- OMElement child = target.getFirstChildWithName(new QName(ns2.getNamespaceURI(), localpart));
-
- if (child != null) {
- ret = child.getText();
- }
-
- return ret;
- }
-
- public void setWorkflowId(URI workflowId) {
- setWorkflowInstanceId(workflowId);
- }
-
- public URI getWorkflowId() {
- return getWorkflowInstanceId();
- }
-
- public void setWorkflowInstanceId(URI workflowId) {
- setUriValue(NS, "workflow-instance-id", workflowId);
- }
-
- private void setUriValue(OMNamespace ns2, String localpart, URI value) {
- String s = value.toASCIIString();
- setStringValue(NS, localpart, s);
- }
-
- public URI getWorkflowInstanceId() {
- return lookupUriValue(NS, "workflow-instance-id");
- }
-
- private URI lookupUriValue(OMNamespace ns2, String localpart) {
-
- String svalue = getString(NS, localpart);
- if (svalue == null) {
- return null;
- } else {
- URI uri = URI.create(svalue);
- return uri;
- }
-
- }
-
- public void setWorkflowTemplateId(URI workflowId) {
- setUriValue(NS, "workflow-template-id", workflowId);
- }
-
- public URI getWorkflowTemplateId() {
- return lookupUriValue(NS, "workflow-template-id");
- }
-
- public void setNodeId(String nodeId) {
- setStringValue(NS, "workflow-node-id", nodeId);
- }
-
- public String getNodeId() {
- return getString(NS, "workflow-node-id");
- }
-
- public void setTimeStep(String timeStep) {
- setStringValue(NS, "workflow-time-step", timeStep);
- }
-
- public String getTimeStep() {
- return getString(NS, "workflow-time-step");
- }
-
- public void setServiceId(String serviceId) {
- setStringValue(NS, "service-instance-id", serviceId);
- }
-
- public String getServiceId() {
- return getString(NS, "service-instance-id");
- }
-
- public void setServiceInstanceId(URI serviceId) {
- setUriValue(NS, "service-instance-id", serviceId);
- }
-
- public URI getServiceInstanceId() {
- return lookupUriValue(NS, "service-instance-id");
- }
-
- public void setGfacUrl(URI url) {
- setUriValue(NS, "gfac-url", url);
- }
-
- public void setEventSinkEpr(EndpointReference epr) {
- setUriValue(NS, "event-sink-epr", URI.create(epr.getAddress()));
- }
-
- public URI getGfacUrl() {
- return lookupUriValue(NS, "gfac-url");
- }
-
- public void setDscUrl(URI url) {
- setUriValue(NS, "dsc-url", url);
- }
-
- public URI getDscUrl() {
- return lookupUriValue(NS, "dsc-url");
- }
-
- public void setMyleadAgentUrl(URI url) {
- setUriValue(NS, "mylead-agent-url", url);
- }
-
- public URI getMyleadAgentUrl() {
- return lookupUriValue(NS, "mylead-agent-url");
- }
-
- public void setResourceCatalogUrl(URI value) {
- setUriValue(NS, "resource-catalog-url", value);
- }
-
- public URI getResourceCatalogUrl() {
- return lookupUriValue(NS, "resource-catalog-url");
- }
-
- public void setResourceBrokerUrl(URI value) {
- setUriValue(NS, "resource-broker-url", value);
- }
-
- public URI getResourceBrokerUrl() {
- return lookupUriValue(NS, "resource-broker-url");
- }
-
- public void setResourceScheduler(String value) {
- setStringValue(NS, "resource-scheduler", value);
- }
-
- public String getResourceScheduler() {
- return getString(NS, "resource-scheduler");
- }
-
- public void setUserDn(String userDn) {
- setStringValue(NS, "user-dn", userDn);
- }
-
- public String getUserDn() {
- return getString(NS, "user-dn");
- }
-
- public void setUrgency(String urgency) {
- setStringValue(NS, "URGENCY", urgency);
- }
-
- public String getUrgency() {
- return lookupStringValue(NS, "URGENCY");
- }
-
- private String lookupStringValue(OMNamespace ns2, String localpart) {
-
- return getString(ns2, localpart);
-
- }
-
- public void setOutPutDataDir(String outPutDataDir) {
- setStringValue(NS, "OUTPUT_DATA_DIRECTORY", outPutDataDir);
- }
-
- public String getOutPutDataDir() {
- return lookupStringValue(NS, "OUTPUT_DATA_DIRECTORY");
- }
-
- public void setOpenDapPrfix(String opendapPrefix) {
- setStringValue(NS, "OPENDAP_DIRECTORY", opendapPrefix);
- }
-
- public String getOpenDapPrfix() {
- return lookupStringValue(NS, "OPENDAP_DIRECTORY");
- }
-
- public void setForceFileStagingToWorkDir(String forceFileStagingToWorkDir) {
- setStringValue(NS, "ForceFileStagingToWorkDir", forceFileStagingToWorkDir);
- }
-
- public String getForceFileStagingToWorkDir() {
- return lookupStringValue(NS, "ForceFileStagingToWorkDir");
- }
-
- public void setOutputDataFilesSuffix(String outputDataFilesSuffix) {
- setStringValue(NS, "OUTPUT_DATA_FILES_SUFFIX", outputDataFilesSuffix);
- }
-
- public String getOutputDataFilesSuffix() {
- return lookupStringValue(NS, "OUTPUT_DATA_FILES_SUFFIX");
- }
-
- private static final Logger logger = LoggerFactory.getLogger(LeadContextHeader.class);
- private static final OMFactory factory;
- public static final String GFAC_NAMESPACE = "http://org.apache.airavata/namespaces/2004/01/gFac";
- public static final QName TYPE;
- public static final QName MAPPINGLISTTYPE;
- public static final OMNamespace NS;
- public static final OMNamespace MAPPINGLISTNS;
- public static final String EXPERIMENT_ID = "experiment-id";
- public static final String WORKFLOW_INSTANCE_ID = "workflow-instance-id";
- public static final String WORKFLOW_TEMPLATE_ID = "workflow-template-id";
- public static final String NODE_ID = "workflow-node-id";
- public static final String TIME_STEP = "workflow-time-step";
- public static final String SERVICE_INSTANCE_ID = "service-instance-id";
- public static final String GFAC_URL = "gfac-url";
- public static final String DSC_URL = "dsc-url";
- public static final String MYLEAD_AGENT_URL = "mylead-agent-url";
- public static final String RESOURCE_CATALOG_URL = "resource-catalog-url";
- public static final String RESOURCE_BROKER_URL = "resource-broker-url";
- public static final String RESOURCE_SCHEDULER = "resource-scheduler";
- public static final String LEAD_RESOURCE_SCHEDULER_ENUM = "LEAD";
- public static final String VGRADS_RESOURCE_SCHEDULER_ENUM = "VGRADS";
- public static final String SPRUCE_RESOURCE_SCHEDULER_ENUM = "SPRUCE";
- public static final String EVENT_SINK_EPR = "event-sink-epr";
- public static final String ERROR_SINK_EPR = "error-sink-epr";
- public static final String USER_DN = "user-dn";
- public static final String URGENCY = "URGENCY";
- public static final String OUTPUT_DATA_DIRECTORY = "OUTPUT_DATA_DIRECTORY";
- public static final String OPENDAP_DIRECTORY = "OPENDAP_DIRECTORY";
- public static final String FORCE_FILESTAGING_TO_WORKING_DIR = "ForceFileStagingToWorkDir";
- public static final String OUTPUT_DATA_FILES_SUFFIX = "OUTPUT_DATA_FILES_SUFFIX";
-
- static {
- factory = OMAbstractFactory.getOMFactory();
- TYPE = new QName("http://lead.extreme.indiana.edu/namespaces/2005/10/lead-context-header", "context");
- NS = factory.createOMNamespace(TYPE.getNamespaceURI(), "lh");
-
- MAPPINGLISTTYPE = new QName("http://lead.extreme.indiana.edu/namespaces/2006/lead-resource-mapping/",
- "resource-mappings");
- MAPPINGLISTNS = factory.createOMNamespace(MAPPINGLISTTYPE.getNamespaceURI(), "lrm");
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadCrosscutParametersUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadCrosscutParametersUtil.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadCrosscutParametersUtil.java
deleted file mode 100644
index 3bf898b..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/LeadCrosscutParametersUtil.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.commons;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class LeadCrosscutParametersUtil {
- public LeadCrosscutParametersUtil(XmlObject xmlObjectToWrap) throws XMLStreamException {
- this(XBeansUtil.xmlObjectToOMElement(xmlObjectToWrap));
- }
-
- public LeadCrosscutParametersUtil(OMElement elementToWrap) {
- this.target = elementToWrap;
- if (elementToWrap == null) {
- logger.error("illegal argument null found");
- throw new IllegalArgumentException("null");
- } else
- return;
- }
-
- public LeadCrosscutParametersUtil(QName topElQName) {
- this.target = factory.createOMElement(new QName(topElQName.getNamespaceURI(), topElQName.getLocalPart()));
- this.target.declareNamespace(TYPE_NS);
- }
-
- public LeadCrosscutParametersUtil() {
- this(new QName("xml-fragment"));
- }
-
- public LeadCrosscutParametersUtil(Properties props) {
- this();
- for (Iterator<OMElement> it = target.getChildElements(); it.hasNext();) {
- OMElement child = it.next();
- child.detach();
- }
-
- String key;
- String value;
- for (Iterator i = props.keySet().iterator(); i.hasNext(); setString(key, value)) {
- key = (String) i.next();
- value = props.getProperty(key);
- }
- setFromProperties(props);
- }
-
- public void setFromProperties(Properties props) {
- for (Iterator it = target.getChildElements(); it.hasNext();) {
- OMElement child = (OMElement) it.next();
- child.detach();
- }
- String key;
- String value;
- for (Iterator i = props.keySet().iterator(); i.hasNext(); setString(key, value)) {
- key = (String) i.next();
- value = props.getProperty(key);
- }
-
- }
-
- public void setString(String name, String value) {
- Iterator<OMElement> el = target.getChildrenWithLocalName(name);
- if (value == null) {
- throw new IllegalArgumentException();
- } else {
- while (el.hasNext())
- el.next().setText(value);
- return;
- }
- }
-
- public OMNamespace parameterNs() {
- return TYPE_NS;
- }
-
- public Float getCenterLatitude() {
- return getFloat("ctrlat");
- }
-
- public void setCenterLatitude(float value) {
- setFloat("ctrlat", value);
- }
-
- public Float getCenterLongitude() {
- return getFloat("ctrlon");
- }
-
- public void setCenterLongitude(float value) {
- setFloat("ctrlon", value);
- }
-
- public Float getForecastTimeInHours() {
- return getFloat("fcst_time");
- }
-
- public void setForecastTimeInHours(float value) {
- setFloat("fcst_time", value);
- }
-
- public String getForecastStartDate() {
- return target.getFirstChildWithName(new QName(null, "start_date")).getText();
- }
-
- public void setForecastStartDate(String startDate) {
- setString("start_date", startDate);
- }
-
- public Integer getForecastStartHour() {
- return getInt("start_hour");
- }
-
- public void setForecastStartHour(int startHour) {
- setInt("start_hour", startHour);
- }
-
- public Float getWestBc() {
- return getFloat("westbc");
- }
-
- public float requireWestBc() {
- return requireFloat("westbc");
- }
-
- public void setWestBc(float value) {
- setFloat("westbc", value);
- }
-
- public Float getEastBc() {
- return getFloat("eastbc");
- }
-
- public float requireEastBc() {
- return requireFloat("eastbc");
- }
-
- public void setEastBc(float value) {
- setFloat("eastbc", value);
- }
-
- public Float getSouthBc() {
- return getFloat("southbc");
- }
-
- public float requireSouthBc() {
- return requireFloat("southbc");
- }
-
- public void setSouthBc(float value) {
- setFloat("southbc", value);
- }
-
- public Float getNorthBc() {
- return getFloat("northbc");
- }
-
- public float requireNorthBc() {
- return requireFloat("northbc");
- }
-
- public void setNorthBc(float value) {
- setFloat("northbc", value);
- }
-
- public Integer getDx() {
- return getInt("dx");
- }
-
- public void setDx(int value) {
- setInt("dx", value);
- }
-
- public Integer getDy() {
- return getInt("dy");
- }
-
- public void setDy(int value) {
- setInt("dy", value);
- }
-
- public Integer getDz() {
- return getInt("dz");
- }
-
- public void setDz(int value) {
- setInt("dz", value);
- }
-
- public Integer getNx() {
- return getInt("nx");
- }
-
- public void setNx(int value) {
- setInt("nx", value);
- }
-
- public Integer getNy() {
- return getInt("ny");
- }
-
- public void setNy(int value) {
- setInt("ny", value);
- }
-
- public Integer getNz() {
- return getInt("nz");
- }
-
- public void setNz(int value) {
- setInt("nz", value);
- }
-
- public String getString(String name) {
- OMElement el = target.getFirstChildWithName(new QName(null, name));
- if (el == null)
- return null;
- else
- return el.getText();
- }
-
- public Integer getInt(String name) {
- String s = getString(name);
- if (s == null)
- return null;
- else
- return new Integer(s);
- }
-
- public Float getFloat(String name) {
- String s = getString(name);
- if (s == null)
- return null;
- else
- return new Float(s);
- }
-
- public void setFloat(String name, float value) {
- setString(name, Float.toString(value));
- }
-
- public void setInt(String name, int value) {
- setString(name, Integer.toString(value));
- }
-
- public float requireFloat(String name) {
- String s = getString(name);
- if (s == null)
- throw new IllegalArgumentException((new StringBuilder()).append("missing parameter ").append(name)
- .toString());
- else
- return Float.parseFloat(s);
- }
-
- private static final Logger logger = LoggerFactory.getLogger(LeadCrosscutParametersUtil.class);
- public static final String FORECAST_TIME = "fcst_time";
- public static final String START_DATE = "start_date";
- public static final String START_HOUR = "start_hour";
- public static final String CENTER_LONGITUDE = "ctrlon";
- public static final String CENTER_LATITUDE = "ctrlat";
- public static final String DX = "dx";
- public static final String DY = "dy";
- public static final String DZ = "dz";
- public static final String NX = "nx";
- public static final String NY = "ny";
- public static final String NZ = "nz";
- public static final String WEST_BC = "westbc";
- public static final String EAST_BC = "eastbc";
- public static final String SOUTH_BC = "southbc";
- public static final String NORTH_BC = "northbc";
- private static final QName COMPLEX_TYPE;
- public static final OMNamespace TYPE_NS;
- private OMElement target;
- private static OMFactory factory = OMAbstractFactory.getOMFactory();
-
- static {
-
- COMPLEX_TYPE = new QName("http://lead.extreme.indiana.edu/namespaces/2006/lead-crosscut-parameters/",
- "LeadCrosscutParameters");
- TYPE_NS = factory.createOMNamespace(COMPLEX_TYPE.getNamespaceURI(), "lcp");
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/WorkFlowUtils.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/WorkFlowUtils.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/WorkFlowUtils.java
deleted file mode 100644
index 8c2fb9c..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/WorkFlowUtils.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.commons;
-
-import java.io.Reader;
-import java.io.StringReader;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.impl.builder.StAXOMBuilder;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder;
-
-public class WorkFlowUtils {
- public static String getSoapBodyContent(String wholeMessage) throws XMLStreamException {
- SOAPEnvelope messageEl = reader2SOAPEnvilope(new StringReader(wholeMessage));
- OMElement messageBodyContent = messageEl.getBody().getFirstElement();
- return messageBodyContent.toStringWithConsume();
- }
-
- public static String formatURLString(String url) {
-
- if (url == null) {
- throw new IllegalArgumentException("url can't be null");
- }
-
- if (url.indexOf("//") < 0) {
- url = "http://" + url; // use default http
- }
- return url;
- }
-
- public static SOAPEnvelope reader2SOAPEnvilope(Reader reader) throws XMLStreamException {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
-
- StAXSOAPModelBuilder builder = new StAXSOAPModelBuilder(inflow);
- SOAPEnvelope omEnvelope = builder.getSOAPEnvelope();
- return omEnvelope;
- }
-
- public static OMElement reader2OMElement(Reader reader) throws XMLStreamException {
- XMLInputFactory inputFactory = XMLInputFactory.newInstance();
- XMLStreamReader inflow = inputFactory.createXMLStreamReader(reader);
-
- StAXOMBuilder builder = new StAXOMBuilder(inflow);
- OMElement omElement = builder.getDocumentElement();
- return omElement;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/XBeansUtil.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/XBeansUtil.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/XBeansUtil.java
deleted file mode 100644
index 8bbc501..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/commons/XBeansUtil.java
+++ /dev/null
@@ -1,50 +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.commons;
-
-import java.io.StringReader;
-
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.xmlbeans.XmlObject;
-import org.apache.xmlbeans.XmlOptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class XBeansUtil {
-
- Logger logger = LoggerFactory.getLogger(XBeansUtil.class);
-
- public XBeansUtil() {
- }
-
- public static OMElement xmlObjectToOMElement(XmlObject responseXmlObj) throws XMLStreamException {
- String responseXml;
- XmlOptions opts = new XmlOptions();
- opts.setSaveOuter();
- responseXml = responseXmlObj.xmlText(opts);
- OMElement outgoingMsg = org.apache.airavata.commons.WorkFlowUtils
- .reader2OMElement(new StringReader(responseXml));
- return outgoingMsg;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AbstractNotifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AbstractNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AbstractNotifier.java
deleted file mode 100644
index a305c58..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AbstractNotifier.java
+++ /dev/null
@@ -1,184 +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.io.IOException;
-import java.net.URI;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.NotifierVersion;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.impl.publish.NotificationPublisher;
-import org.apache.airavata.workflow.tracking.impl.publish.WSMPublisher;
-import org.apache.airavata.workflow.tracking.impl.state.InvocationEntityImpl;
-import org.apache.airavata.workflow.tracking.types.BaseNotificationType;
-import org.apache.airavata.workflow.tracking.util.XmlBeanUtils;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractNotifier {
- protected static final Logger log = LoggerFactory.getLogger(AbstractNotifier.class);
- private Map<EndpointReference, NotificationPublisher> publishermap = new ConcurrentHashMap<EndpointReference, NotificationPublisher>();
-
- protected Date activityTimestamp = null;
-
- public AbstractNotifier() {
-
- }
-
- public WorkflowTrackingContext createTrackingContext(Properties golbalProperties, String epr, URI workflowID,
- URI serviceID, String workflowNodeID, Integer workflowTimestep) {
- WorkflowTrackingContext workflowTrackingContext = new WorkflowTrackingContext();
- workflowTrackingContext.setGlobalAnnotations(golbalProperties);
- workflowTrackingContext.setBrokerEpr(new EndpointReference(epr));
- workflowTrackingContext.setMyself(createEntity(workflowID, serviceID, workflowNodeID, workflowTimestep));
- return workflowTrackingContext;
- }
-
- public InvocationEntity createEntity(URI workflowID, URI serviceID, String workflowNodeID, Integer workflowTimestep) {
- InvocationEntityImpl invocationEntityImpl = new InvocationEntityImpl(workflowID, serviceID, workflowNodeID,
- workflowTimestep);
- return invocationEntityImpl;
- }
-
- public void setActivityTimestamp(Date timestamp) {
- activityTimestamp = timestamp;
- }
-
- protected void setIDAndTimestamp(WorkflowTrackingContext context, BaseNotificationType msg,
- InvocationEntity entity, Date timestamp) {
- // add version for information model
- msg.setInfoModelVersion(NotifierVersion.getTypesVersion());
-
- msg.addNewNotificationSource().set(entity.toBaseIDType());
- final Calendar cal = new GregorianCalendar();
- cal.setTime(timestamp);
- msg.setTimestamp(cal);
- }
-
- /**
- * Method setDescAndAnno
- *
- * @param msg
- * a BaseNotificationType
- * @param descriptionAndAnnotationa
- * first string is the description. subsequent strings refer to annotations. each should be a valid xml
- * fragment that are concatenated into one xml document, which is the annotation.
- * @param defaultDescription
- * this description used if the user does not pass a message
- *
- */
- protected void setDescAndAnno(WorkflowTrackingContext context, BaseNotificationType msg,
- String[] descriptionAndAnnotation, String defaultDescription) throws WorkflowTrackingException {
- try {
- String description;
- if (descriptionAndAnnotation != null && descriptionAndAnnotation.length > 0) {
- description = descriptionAndAnnotation[0];
- } else {
- description = defaultDescription;
- }
-
- final StringBuffer anno = new StringBuffer("<xml-fragment>"); // fixme?
- if (descriptionAndAnnotation != null) {
- for (int i = 1; i < descriptionAndAnnotation.length; i++) {
- anno.append(descriptionAndAnnotation[i]);
- }
- }
-
- if (context.getGlobalAnnotations() != null) {
- anno.append(context.getGlobalAnnotations());
- }
- anno.append("</xml-fragment>"); // fixme?
- XmlObject annotations = XmlObject.Factory.parse(anno.toString());
-
- msg.setDescription(description);
- msg.setAnnotation(annotations);
- } catch (XmlException e) {
- throw new WorkflowTrackingException(e);
- }
- }
-
- protected void sendNotification(WorkflowTrackingContext context, XmlObject xmldata,
- String[] descriptionAndAnnotation, String defaultDesc) {
- BaseNotificationType xmlMessage = XmlBeanUtils.extractBaseNotificationType(xmldata);
- NotificationPublisher publisher = publishermap.get(context.getBrokerEpr());
- try {
- if (publisher == null) {
- // if a publisher class name has been defined to override the default WSM publisher, use it
- if (context.getPublisherImpl() != null) {
- publisher = PublisherFactory.createSomePublisher(context.getPublisherImpl(), context);
- } else {
- if (context.getTopic() == null) {
- publisher = new WSMPublisher(100, context.isEnableAsyncPublishing(), context.getBrokerEpr()
- .getAddress(), false);
- } else {
- publisher = new WSMPublisher(100, context.isEnableAsyncPublishing(), context.getBrokerEpr()
- .getAddress(), context.getTopic());
- }
- }
- publishermap.put(context.getBrokerEpr(), publisher);
- }
-
- setIDAndTimestamp(context, xmlMessage, context.getMyself(), activityTimestamp != null ? activityTimestamp
- : new Date());
- setDescAndAnno(context, xmlMessage, descriptionAndAnnotation, defaultDesc);
- xmlMessage.getNotificationSource().setExperimentID(context.getTopic());
- // System.out.println(xmldata);
- if (log.isDebugEnabled()) {
- log.debug(xmldata.toString());
- }
- publisher.publish(xmldata);
- } catch (RuntimeException e) {
- throw new WorkflowTrackingException(e);
- } catch (IOException e) {
- throw new WorkflowTrackingException(e);
- }
- }
-
- public void flush() {
- // TODO do we need to only plush specific publisher? For now left as it is.
- for (NotificationPublisher publisher : publishermap.values()) {
- publisher.flush();
- }
- }
-
- /**
- * {@inheritDoc}
- *
- */
- public void delete() {
- for (NotificationPublisher publisher : publishermap.values()) {
- publisher.flush();
- publisher.delete();
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AuditNotifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AuditNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AuditNotifier.java
deleted file mode 100644
index 1e7bbe5..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/AuditNotifier.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;
-
-import java.net.URI;
-
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-
-/**
- * Utility to create and send notifications related to accounting and auditing. Enough information is sent in these
- * notifications for accounting information to be looked up and applied at a later time.
- *
- * @version $Revision: 1.3 $
- * @author
- */
-public interface AuditNotifier {
-
- /**
- * Send an applicationAudit message. This should be sent shortly after submitting a GRAM job to a batch scheduler
- * with an allocation policy. Arguments listed below as <i>not required by schema</i> may be passed in as <b>
- * <code>null</code></b>.
- *
- * @param entity
- * identity of the workflow/service's invocation that initiated this job
- * @param name
- * human readable name of application
- * @param jobHandle
- * a URI handle to the GRAM job
- * @param host
- * hostname of the resource job is submitted to
- * @param queueName
- * name of the queue submitted to (not required by schema)
- * @param jobId
- * id of the job in the remote batch system (not required by schema)
- * @param dName
- * distinguished name of the identity under which job is submitted
- * @param projectId
- * project id that this job should be charged to (not required by schema)
- * @param rsl
- * RSL string used when submitting this job
- * @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.
- *
- */
- void appAudit(WorkflowTrackingContext context, String name, URI jobHandle, String host, String queueName,
- String jobId, String dName, String projectId, String rsl, 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/GenericNotifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/GenericNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/GenericNotifier.java
deleted file mode 100644
index 2a730d3..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/GenericNotifier.java
+++ /dev/null
@@ -1,212 +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 java.util.Properties;
-
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-
-/**
- * Utility to create and send generic Lead notification messages. Common messages to send log, debug, information, and
- * exception messages are present.
- *
- * <pre>
- * info(...)
- * publishURL(...)
- * debug(...)
- * warning(...)
- * exception(...)
- * flush()
- * </pre>
- *
- * @version $Revision: 1.5 $
- * @author
- */
-public interface GenericNotifier {
-
- /**
- * This is the context used across all notifiers
- *
- * @param golbalProperties
- * @param epr
- * @return
- */
- public WorkflowTrackingContext createTrackingContext(Properties golbalProperties, String epr, URI workflowID,
- URI serviceID, String workflowNodeID, Integer workflowTimestep);
-
- /**
- * Method createInitialContext. This is called when this invocation was not initiated by any external entity. This
- * is usually used by the very first initiator of the workflow, which could be some external stand-alone service,
- * the workflow engine itself, a portal, etc. In all other cases, the InvocationContext is created by calling the
- * serviceInvoked or workflowInvoked methods.
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @return an InvocationContext
- *
- */
- public InvocationContext createInitialContext(WorkflowTrackingContext context);
-
- /**
- * Method createInvocationContext. The invocation context is usually created when service/workflowInvoked is called.
- * But it may not be possible to retain this object during the lifecycle of an invocation. For e.g., when a workflow
- * invokes another service, the invocationcontext object created then may not be corelatable with the response
- * message for the invocation. In such cases, the InvocationContext needs to be regenerated using the information
- * available about the Local and remote Entities.
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @param remoteEntity
- * an InvocationEntity representing the remote entity
- *
- * @return an InvocationContext
- *
- */
- public InvocationContext createInvocationContext(WorkflowTrackingContext context, InvocationEntity remoteEntity);
-
- /**
- * Method createEntity. Creates an object representing a certain entity that is the initiator, receiver, or
- * responder to an invocation. This object is created for the entity that is invoked and its remote invokee, and/or
- * for the entity and the remote entity it invokes.
- *
- *
- * @param workflowID
- * an URI
- * @param serviceID
- * an URI
- * @param workflowNodeID
- * a String
- * @param workflowTimestep
- * an int
- *
- * @return an InvocationEntity
- *
- */
- public InvocationEntity createEntity(URI workflowID, URI serviceID, String workflowNodeID, Integer workflowTimestep);
-
- /**
- * Send a Log message with level INFO
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @param entity
- * identity of this workflow/service's invocation
- * @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 info(WorkflowTrackingContext context, String... descriptionAndAnnotation);
-
- /**
- * Send a log message with level EXCEPTION.
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @param entity
- * identity of this workflow/service's invocation
- * @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 exception(WorkflowTrackingContext context, String... descriptionAndAnnotation);
-
- /**
- * send a log message with level WARNING.
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @param entity
- * identity of this workflow/service's invocation
- * @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 warning(WorkflowTrackingContext context, String... descriptionAndAnnotation);
-
- /**
- * Send a log message with level DEBUG
- *
- * @param entity
- * identity of this workflow/service's invocation
- * @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 debug(WorkflowTrackingContext context, String... descriptionAndAnnotation);
-
- /**
- * Publishes a notification with the URL and title for a file/directory that is of interest to the user in the
- * context of this workflow/service execution
- *
- * @param context
- * current workflow tracking context, this includes in parameter localEntity an InvocationEntity
- * representing this entity
- * @param entity
- * identity of this workflow/service's invocation
- * @param title
- * the caption to be displayed (e.g. as a html link) for this URL
- * @param url
- * the URL location of the file/directory of interest
- * @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 publishURL(WorkflowTrackingContext context, String title, String url,
- String... descriptionAndAnnotation);
-
- /**
- * Method flush. Blocks till all pending notifications have been sent. This method *has* to be called to ensure that
- * the messages have been sent to the notification broker when asynchronous and/or batch mode of publication is
- * used. This method can be called multiple times.
- *
- * @param context
- * current workflow tracking context.
- *
- */
- public void flush();
-
- /**
- * terminates all activitis of this notifier...notifier cannot be used after this call.
- *
- * @param context
- * current workflow tracking context.
- */
- public void delete();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/Notifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/Notifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/Notifier.java
deleted file mode 100644
index c4ef43d..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/Notifier.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking;
-
-/**
- * Convenience interface that groups all methods used to send Lead notification messages. This extends the application
- * and workflow notifier interfaces.
- *
- * A typical sequence of usage of this interface would be as follows:
- *
- * <pre>
- * WORKFLOW (Using Workflow Notifier Interface)::
- * workflowStarted(W1)
- * invokeServiceStarted(S1)
- * -- invoke service --
- * -- service invokes application --
- * APPLICATION (Using Application 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 Workflow Notifier Interface):
- * -- return from service invocation --
- * invokeServiceFinishedSuccess(S1) | invokeServiceFinishedFailed(S1, ERR)
- * invokeServiceStarted(S2)
- * -- invoke service --
- * ...
- * workflowFinishedSuccess(W1) | workflowFinishedFailer(W1, ERR)
- * flush()
- * </pre>
- *
- * @version $Revision: 1.6 $
- * @author
- */
-public interface Notifier extends ProvenanceNotifier, PerformanceNotifier, AuditNotifier, ResourceNotifier {
-
- // public static final String WORKFLOW_ID = "workflow_tracking.workflow_id";
- // public static final String NODE_ID = "workflow_tracking.node_id";
- // public static final String TIMESTEP = "workflow_tracking.timestep";
- // public static final String SERVICE_ID = "workflow_tracking.service_id";
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/NotifierFactory.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/NotifierFactory.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/NotifierFactory.java
deleted file mode 100644
index 00b4dcd..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/NotifierFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking;
-
-import org.apache.airavata.workflow.tracking.impl.GenericNotifierImpl;
-import org.apache.airavata.workflow.tracking.impl.NotifierImpl;
-import org.apache.airavata.workflow.tracking.impl.ProvenanceNotifierImpl;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Create a Notifier instance.
- *
- * This code was inspired by the listener agent factory in xmessages
- */
-public class NotifierFactory {
- private static final Logger logger = LoggerFactory.getLogger(NotifierFactory.class);
-
- public static Notifier createNotifier() {
- return new NotifierImpl();
- }
-
- public static GenericNotifier createGenericNotifier() {
- return new GenericNotifierImpl();
- }
-
- public static WorkflowNotifier createWorkflowNotifier() {
- return new ProvenanceNotifierImpl();
- }
-
- public static ServiceNotifier createServiceNotifier() {
- return new ProvenanceNotifierImpl();
- }
-
- public static ProvenanceNotifier createProvenanceNotifier() {
- return new ProvenanceNotifierImpl();
- }
-
- public static PerformanceNotifier createPerformanceNotifier() {
- return new NotifierImpl();
- }
-
- public static AuditNotifier createAuditNotifier() {
- return new NotifierImpl();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java
deleted file mode 100644
index 123e3a5..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/PerformanceNotifier.java
+++ /dev/null
@@ -1,245 +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.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);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java
deleted file mode 100644
index e63971a..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/ProvenanceNotifier.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.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);
-
-}
[2/5] airavata git commit: retiring workflow tracking schema -
AIRAVATA-1557
Posted by ch...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataDurationImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataDurationImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataDurationImpl.java
deleted file mode 100644
index 225b593..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataDurationImpl.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.state;
-
-import java.net.URI;
-
-import org.apache.airavata.workflow.tracking.common.DataDurationObj;
-import org.apache.airavata.workflow.tracking.common.DataObj;
-
-public class DataDurationImpl extends DurationImpl implements DataDurationObj {
-
- protected DataObj dataObj;
- protected URI remoteLocation;
-
- public DataDurationImpl(DataObj dataObj_, URI remoteLocation_) {
-
- super(); // set start time to now
- dataObj = dataObj_;
- remoteLocation = remoteLocation_;
- }
-
- public DataDurationImpl(DataObj dataObj_, URI remoteLocation_, long fixedDuration) {
-
- super(fixedDuration); // set duration to passed value
- dataObj = dataObj_;
- remoteLocation = remoteLocation_;
- }
-
- public DataObj getDataObj() {
-
- return dataObj;
- }
-
- public URI getRemoteLocation() {
-
- return remoteLocation;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataObjImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataObjImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataObjImpl.java
deleted file mode 100644
index 89722bb..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DataObjImpl.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.state;
-
-import java.io.File;
-import java.net.URI;
-import java.util.List;
-
-import org.apache.airavata.workflow.tracking.common.DataObj;
-
-public class DataObjImpl implements DataObj {
-
- protected URI dataId;
- protected List<URI> locations;
- protected long sizeInBytes = -1;
-
- public DataObjImpl(URI dataId_, List<URI> location_) {
-
- dataId = dataId_;
- if (dataId == null || dataId.toString().length() == 0)
- throw new RuntimeException("Data ID cannot be NULL or empty");
-
- locations = location_;
- }
-
- public DataObjImpl(URI dataId_, List<URI> location_, long sizeInBytes_) {
-
- this(dataId_, location_);
- sizeInBytes = sizeInBytes_;
- }
-
- public URI getId() {
-
- return dataId;
- }
-
- public URI getLocalLocation() {
-
- return locations != null && locations.size() > 0 ? locations.get(0) : null;
- }
-
- public List<URI> getLocations() {
-
- return locations;
- }
-
- public long getSizeInBytes() {
-
- // skip getting bytes if already calculated or not possible to calculate
- if (sizeInBytes >= 0 || locations == null || locations.size() == 0)
- return sizeInBytes;
-
- // check if the location is a local file. If so, we calculate the size.
- URI location = locations.get(0);
- String scheme = location.getScheme();
- String authority = location.getAuthority();
- if ((scheme == null && authority == null) || "file".equals(scheme)) {
- sizeInBytes = getFileSize(new File(location.getPath()));
- }
- return sizeInBytes;
- }
-
- protected static final long getFileSize(File file) {
- if (file.isDirectory()) {
- return getDirSize(file, 0, true);
- } else {
- return file.length();
- }
- }
-
- private static final long getDirSize(File dir, long size, boolean recurse) {
- File[] files = dir.listFiles();
- if (files == null)
- return size;
- for (int i = 0; i < files.length; i++) {
- if (files[i].isDirectory()) {
- if (recurse)
- size += getDirSize(files[i], size, recurse);
- } else {
- size += files[i].length();
- }
- }
- return size;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DurationImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DurationImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DurationImpl.java
deleted file mode 100644
index c45e533..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/DurationImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.state;
-
-import org.apache.airavata.workflow.tracking.common.DurationObj;
-
-/**
- * Convinience class to record the state of computation related notifications.
- */
-public class DurationImpl implements DurationObj {
-
- protected long startTimeMillis = Long.MAX_VALUE;
- protected long endTimeMillis = Long.MIN_VALUE;
- protected long fixedDuration = Long.MIN_VALUE;
- protected boolean isFixedDuration = false;
-
- public DurationImpl() {
- startTimeMillis = System.currentTimeMillis();
- }
-
- public DurationImpl(long fixedDuration_) {
- isFixedDuration = true;
- fixedDuration = fixedDuration_;
- }
-
- public long markStartTimeMillis() {
-
- this.startTimeMillis = System.currentTimeMillis();
- return startTimeMillis;
- }
-
- public long getStartTimeMillis() {
-
- return startTimeMillis;
- }
-
- public long markEndTimeMillis() {
-
- this.endTimeMillis = System.currentTimeMillis();
- return endTimeMillis;
- }
-
- public long getEndTimeMillis() {
-
- return endTimeMillis;
- }
-
- public long getDurationMillis() {
-
- if (isFixedDuration)
- return fixedDuration;
- return endTimeMillis - startTimeMillis;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationContextImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationContextImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationContextImpl.java
deleted file mode 100644
index c2bad60..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationContextImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.state;
-
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-
-public class InvocationContextImpl extends InvocationEntityImpl implements InvocationContext {
-
- InvocationEntity remoteEntity;
-
- public InvocationContextImpl(InvocationEntity localEntity_, InvocationEntity remoteEntity_) {
- super(localEntity_);
- remoteEntity = remoteEntity_;
- }
-
- public InvocationEntity getRemoteEntity() {
-
- return remoteEntity;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationEntityImpl.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationEntityImpl.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationEntityImpl.java
deleted file mode 100644
index ded569a..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/state/InvocationEntityImpl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.state;
-
-import java.net.URI;
-
-import org.apache.airavata.workflow.tracking.common.InvocationEntity;
-import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
-import org.apache.airavata.workflow.tracking.types.BaseIDType;
-
-public class InvocationEntityImpl implements InvocationEntity {
-
- protected URI workflowID;
- protected URI serviceID;
- protected String workflowNodeID;
- protected Integer workflowTimestep;
-
- /**
- * Constructor used when only service ID is available (i.e. entity not in the context of an invocation)
- *
- * @param serviceID_
- * an URI
- *
- */
- public InvocationEntityImpl(URI serviceID_) {
-
- if (serviceID_ == null)
- throw new RuntimeException("ServiceID passed was null!");
-
- serviceID = serviceID_;
-
- workflowID = null;
- workflowNodeID = null;
- workflowTimestep = null;
- }
-
- /**
- * Constructor used when all IDs are potentially available (i.e. entity in the context of an invocation)
- *
- * @param workflowID_
- * an URI
- * @param serviceID_
- * an URI
- * @param workflowNodeID_
- * a String
- * @param workflowTimestep_
- * an int
- *
- */
- public InvocationEntityImpl(URI workflowID_, URI serviceID_, String workflowNodeID_, Integer workflowTimestep_) {
-
- if (serviceID_ == null)
- throw new RuntimeException("ServiceID passed was null!");
-
- workflowID = workflowID_;
- serviceID = serviceID_;
- workflowNodeID = workflowNodeID_;
- workflowTimestep = workflowTimestep_;
- }
-
- /**
- * Copy Constructor
- *
- * @param source
- * an InvocationEntity
- *
- */
- protected InvocationEntityImpl(InvocationEntity source) {
- this(source.getWorkflowID(), source.getServiceID(), source.getWorkflowNodeID(), source.getWorkflowTimestep());
- }
-
- public String getWorkflowNodeID() {
-
- return workflowNodeID;
- }
-
- public URI getServiceID() {
-
- return serviceID;
- }
-
- public Integer getWorkflowTimestep() {
-
- return workflowTimestep;
- }
-
- public URI getWorkflowID() {
-
- return workflowID;
- }
-
- public BaseIDType toBaseIDType() {
-
- BaseIDType baseID = BaseIDType.Factory.newInstance();
- if (serviceID != null)
- baseID.setServiceID(serviceID.toString());
- if (workflowID != null)
- baseID.setWorkflowID(workflowID.toString());
- if (workflowTimestep != null)
- baseID.setWorkflowTimestep(workflowTimestep);
- if (workflowNodeID != null)
- baseID.setWorkflowNodeID(workflowNodeID);
-
- return baseID;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/LeadNotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/LeadNotificationHandler.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/LeadNotificationHandler.java
deleted file mode 100644
index 1ed60a8..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/LeadNotificationHandler.java
+++ /dev/null
@@ -1,147 +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.impl.subscription;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-
-import org.apache.airavata.workflow.tracking.client.Callback;
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.airavata.workflow.tracking.client.Subscription;
-import org.apache.airavata.workflow.tracking.util.MessageUtil;
-import org.apache.airavata.wsmg.client.ConsumerNotificationHandler;
-import org.apache.airavata.wsmg.client.ConsumerServer;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPHeader;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Utility for clients to subscribe and receive Lead notifications using new message schema. The agent implements the
- * LeadNotificationHandler.Callback interface and starts the notification handler with the broker location, the topic,
- * and an option to pull the messages (to get around firewalls) by providing a message box url. The deliverMessage
- * method in the Callback interface in invoked when a message with the nes LEAD message type arrives. If a
- * LeadEvent/NCSAEvent arrives, it is silently dropped after being logged. Check the main() method for sample usage.
- */
-public class LeadNotificationHandler implements ConsumerNotificationHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(LeadNotificationHandler.class);
-
- private String topic;
-
- private String brokerLoc;
-
- private Callback callback;
-
- private int consumerServerPort;
-
- public LeadNotificationHandler(String brokerLoc, String topic, Callback callback, int port) {
- if (port == 0)
- this.consumerServerPort = 2222;
- else
- this.consumerServerPort = port;
- this.brokerLoc = brokerLoc;
- this.topic = topic;
- this.callback = callback;
-
- }
-
- /**
- * NON API Method. Use LeadNotificationManager.CreateSubscription() method to create a subscription
- *
- * @param topic
- * @param callback
- * @return
- * @throws Exception
- */
- public Subscription createSubscription() throws Exception {
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- wseClient.init(brokerLoc);
- logger.debug("Starting Subscription for topic [" + topic + "]at the broker location:" + brokerLoc);
- ConsumerServer xs = new ConsumerServer(consumerServerPort, this);
- xs.start();
- String subscriptionId = wseClient.subscribe(xs.getConsumerServiceEPRs()[0], topic, null);
- logger.debug("The consumer server started on EPR" + xs.getConsumerServiceEPRs()[0]);
- Subscription subscription = new Subscription(xs, subscriptionId, topic, callback, brokerLoc);
- return subscription;
- }
-
- /**
- * NONAPI method Method handleNotification. Called by the message broker when a message arrives at the subscribed
- * topic. Should NOT be called locally. This method will call the Callback interface's deliverMessage when a valid
- * Lead Message is received.
- *
- * @param messageBody
- * the soap message body containing the notification message
- *
- */
-
- public void handleNotification(SOAPEnvelope envelope) {
- OMElement messageContent = envelope.getBody().getFirstElement();
- SOAPHeader soapHeader = envelope.getHeader();
- OMElement topicEl = soapHeader.getFirstChildWithName(new QName(null, "Topic"));
- XmlObject messageObj = null;
-
- if (topicEl != null) {
- if (topicEl.getChildElements().hasNext()) {
- OMElement widgetTopicOMEl = (OMElement) topicEl.getChildElements().next();
- String widgetTopicString = null;
- try {
- widgetTopicString = widgetTopicOMEl.toStringWithConsume();
- } catch (XMLStreamException e) {
- logger.error(e.getMessage(), e);
- }
- String[] topicSubstrings = widgetTopicString.split(":");
- if (topicSubstrings.length > 1) {
- topic = topicSubstrings[1];
- }
- }
- }
-
- if (topic != null) {
- try {
- try {
- messageObj = XmlObject.Factory.parse(messageContent.toStringWithConsume());
- } catch (XMLStreamException e) {
- logger.error("error parsing message content: " + messageContent, e);
- }
- XmlCursor xc = messageObj.newCursor();
- xc.toNextToken();
-
- xc.dispose();
- } catch (XmlException e) {
- logger.error("error parsing message content: " + messageContent, e);
- }
- NotificationType type = MessageUtil.getType(messageObj);
- this.callback.deliverMessage(topic, type, messageObj);
-
- } else {
- logger.warn("Notification came without a Notification Topic:" + envelope);
- }
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
deleted file mode 100644
index e452467..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/impl/subscription/MessageBoxNotificationHandler.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.impl.subscription;
-
-import java.rmi.RemoteException;
-
-import org.apache.airavata.workflow.tracking.WorkflowTrackingException;
-import org.apache.airavata.workflow.tracking.client.Callback;
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.airavata.workflow.tracking.client.Subscription;
-import org.apache.airavata.workflow.tracking.util.MessageUtil;
-import org.apache.airavata.wsmg.client.MsgBrokerClientException;
-import org.apache.airavata.wsmg.client.NotificationHandler;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.airavata.wsmg.client.msgbox.MessagePuller;
-import org.apache.airavata.wsmg.client.msgbox.MsgboxHandler;
-import org.apache.airavata.wsmg.commons.MsgBoxQNameConstants;
-import org.apache.airavata.wsmg.commons.WsmgCommonConstants;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.addressing.EndpointReferenceHelper;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlException;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MessageBoxNotificationHandler implements NotificationHandler {
-
- private static final Logger logger = LoggerFactory.getLogger(MessageBoxNotificationHandler.class);
-
- private String messageBoxUrl;
-
- private String brokerURL;
-
- private String subscriptionId;
-
- private MessagePuller messagePuller;
-
- private Callback callback;
-
- private String topic;
-
- public MessageBoxNotificationHandler(String messageBoxUrl, String brokerURL) {
- if (messageBoxUrl == null || "".equals(messageBoxUrl)) {
- logger.error("Invalid messagebox Location :" + messageBoxUrl);
- throw new WorkflowTrackingException("BrokerLocation should be not null messaboxUrl:" + messageBoxUrl);
- }
-
- if (brokerURL == null || "".equals(brokerURL)) {
- logger.error("Invalid broker Location :" + brokerURL);
- throw new WorkflowTrackingException("BrokerLocation should be not null brokerurl:" + brokerURL);
- }
- this.messageBoxUrl = messageBoxUrl;
- this.brokerURL = brokerURL;
-
- }
-
- public void handleNotification(String message) {
- XmlObject messageObj = null;
-
- try {
- messageObj = XmlObject.Factory.parse(message);
- XmlCursor xc = messageObj.newCursor();
- xc.toNextToken();
-
- xc.dispose();
- } catch (XmlException e) {
- logger.error("error parsing message content: " + message, e);
- }
- NotificationType type = MessageUtil.getType(messageObj);
- this.callback.deliverMessage(this.topic, type, messageObj);
-
- }
-
- public void destroy(EndpointReference msgBoxEpr) throws RemoteException {
- if (this.messagePuller != null) {
- messagePuller.stopPulling();
-
- if (logger.isDebugEnabled())
- logger.debug("\n\nStopping the Messagebox for topic" + this.topic);
- }
-
- try {
- WseMsgBrokerClient client = new WseMsgBrokerClient();
- client.init(this.brokerURL.toString());
- client.unSubscribe(this.subscriptionId);
-
- MsgboxHandler msgboxHandler = new MsgboxHandler();
-
- logger.debug("Unsubscribing the messagebox that was destroyed," + " SubscriptionID:" + this.subscriptionId);
-
- msgboxHandler.deleteMsgBox(msgBoxEpr, 2000L);
-
- } catch (MsgBrokerClientException e) {
- logger.error("unable to unsubscribe", e);
- }
-
- }
-
- public Subscription renewMessageboxSubscription(String epr, String subscriptionId, String topic, String xpath,
- boolean subscribePermanatly) throws MsgBrokerClientException {
-
- this.subscriptionId = subscriptionId;
- this.topic = topic;
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- EndpointReference endpointReference = null;
- try {
- endpointReference = EndpointReferenceHelper.fromString(epr);
- } catch (AxisFault f) {
- throw new MsgBrokerClientException("unable to convert end point reference", f);
- }
- subscriptionId = subscribeToBroker(endpointReference.getAddress(), topic, xpath, wseClient, subscribePermanatly);
- Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
- subscription.setMessageBoxEpr(endpointReference);
- return subscription;
- }
-
- public Subscription renewMessageboxSubscription(EndpointReference endpointReference, String subscriptionId,
- String topic, String xpath, boolean subscribePermanatly) throws MsgBrokerClientException {
-
- this.subscriptionId = subscriptionId;
- this.topic = topic;
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- logger.debug("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
-
- subscriptionId = subscribeToBroker(endpointReference.getAddress(), topic, xpath, wseClient, subscribePermanatly);
- Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
- subscription.setMessageBoxEpr(endpointReference);
- return subscription;
- }
-
- public Subscription startListeningToPreviousMessageBox(EndpointReference msgBoxAddr, String subscriptionId,
- String topic, String xpath, Callback callback, boolean subscribePermanatly) throws MsgBrokerClientException {
- this.callback = callback;
- this.subscriptionId = subscriptionId;
- this.topic = topic;
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- MsgboxHandler msgboxHandler = new MsgboxHandler();
-
- messagePuller = msgboxHandler.startPullingFromExistingMsgBox(msgBoxAddr, this, 500L, 1000L);
- if (logger.isDebugEnabled())
- logger.debug("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
- String msgBoxEventSink = msgBoxAddr.getAddress();
-
- String formattedEventSink = null;
-
- if (msgBoxEventSink.contains("clientid")) {
- formattedEventSink = msgBoxEventSink;
- } else {
- if (msgBoxAddr.getAllReferenceParameters() == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, no reference parameters found");
- String msgBoxId = msgBoxAddr.getAllReferenceParameters().get(MsgBoxQNameConstants.MSG_BOXID_QNAME)
- .getText();
- if (msgBoxId == null)
- throw new MsgBrokerClientException("Invalid Message Box EPR, reference parameter MsgBoxAddr is missing");
- String format = msgBoxEventSink.endsWith("/") ? "%sclientid/%s" : "%s/clientid/%s";
-
- formattedEventSink = String.format(format, msgBoxEventSink, msgBoxId);
-
- }
-
- subscriptionId = subscribeToBroker(formattedEventSink, topic, xpath, wseClient, subscribePermanatly);
- Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
- subscription.setMessageBoxEpr(msgBoxAddr);
- return subscription;
-
- }
-
- private String subscribeToBroker(String eventSink, String topic, String xpath, WseMsgBrokerClient wseClient,
- boolean subscribePermanatly) throws MsgBrokerClientException {
- String subId = null;
-
- wseClient.init(brokerURL);
- if (subscribePermanatly) {
-
- subId = wseClient.subscribe(new EndpointReference(eventSink), topic, xpath, -1);
- } else {
- subId = wseClient.subscribe(eventSink, topic, xpath);
- }
- return subId;
- }
-
- private String subToBrokerWithMsgBoxSink(EndpointReference msgBoxEpr, String topic, String xpath,
- WseMsgBrokerClient wseClient, boolean subscribePermanatly) throws MsgBrokerClientException {
- String subId;
- wseClient.init(brokerURL);
-
- if (subscribePermanatly) {
-
- subId = wseClient.subscribeMsgBox(msgBoxEpr, topic, xpath, -1);
- } else {
- subId = wseClient.subscribeMsgBox(msgBoxEpr, topic, xpath,
- WsmgCommonConstants.DEFAULT_SUBSCRIPTION_EXPIRATION_TIME);
- }
- return subId;
- }
-
- public Subscription createSubscription(String topic, String xpath, Callback callback, boolean subscribePermananly)
- throws Exception {
- this.topic = topic;
- this.callback = callback;
-
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- MsgboxHandler msgboxHandler = new MsgboxHandler();
- EndpointReference msgBoxAddr = msgboxHandler.createPullMsgBox(this.messageBoxUrl, 12000l);
-
- String messageBoxAddress = msgBoxAddr.getAddress();
- if (logger.isDebugEnabled())
- logger.debug("\n\nCreated Messagebox at address :" + messageBoxAddress);
-
- subscriptionId = subToBrokerWithMsgBoxSink(msgBoxAddr, topic, xpath, wseClient, subscribePermananly);
- messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 1500L, 30000l);
- if (logger.isDebugEnabled())
- logger.debug("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
-
- Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
- subscription.setMessageBoxEpr(msgBoxAddr);
- subscription.setBrokerURL(this.brokerURL);
- return subscription;
- }
-
- public Subscription createMsgBoxSubscription(String topic2, String xpath, Callback callback2,
- boolean subscribePermanatly) throws MsgBrokerClientException {
-
- this.topic = topic2;
- this.callback = callback2;
-
- WseMsgBrokerClient wseClient = new WseMsgBrokerClient();
- MsgboxHandler msgboxHandler = new MsgboxHandler();
- EndpointReference msgBoxAddr = msgboxHandler.createPullMsgBox(this.messageBoxUrl, 12000l);
- if (logger.isDebugEnabled())
- logger.debug("\n\nCreated Messagebox at address :" + msgBoxAddr.getAddress());
-
- subscriptionId = subToBrokerWithMsgBoxSink(msgBoxAddr, topic, xpath, wseClient, subscribePermanatly);
- messagePuller = msgboxHandler.startPullingEventsFromMsgBox(msgBoxAddr, this, 500L, 30000l);
- if (logger.isDebugEnabled())
- logger.debug("\n\nCreate Subscription for topic" + topic + " [Messagebox]\n\n");
- Subscription subscription = new Subscription(this, subscriptionId, topic, callback, this.brokerURL);
- subscription.setMessageBoxEpr(msgBoxAddr);
- subscription.setBrokerURL(this.brokerURL);
- return subscription;
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/CallbackHandler.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/CallbackHandler.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/CallbackHandler.java
deleted file mode 100644
index ef58654..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/CallbackHandler.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Lanka Software Foundation (LSF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The LSF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.airavata.workflow.tracking.samples.listener;
-
-import java.rmi.RemoteException;
-
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.airavata.workflow.tracking.client.Subscription;
-import org.apache.xmlbeans.XmlObject;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CallbackHandler implements org.apache.airavata.workflow.tracking.client.Callback {
-
- private Subscription subscription;
- private static final Logger log = LoggerFactory.getLogger(CallbackHandler.class);
-
-
- /*
- * This methods will be callbacked when the particular subcription receives a notification (non-Javadoc)
- *
- * @see org.apache.airavata.workflow.tracking.client.Callback#deliverMessage(java.lang.String,
- * org.apache.airavata.workflow.tracking.client.NotificationType, org.apache.xmlbeans.XmlObject)
- */
- public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) {
- System.out.println("Received a notification of type[" + notificationType + "] for the topic[" + topic);
- System.out.println("The notification message is:");
- System.out.println(messageObj.toString());
- if (subscription != null && Listener.finalNotification.equals(messageObj.toString())) {
- try {
- subscription.destroy();
- } catch (RemoteException e) {
- log.error(e.getMessage(), e);
- }
- System.out.println("Ending the subscription and exiting");
- System.exit(0);
- }
- }
-
- public void setSubscription(Subscription subscription) {
- this.subscription = subscription;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/Listener.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/Listener.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/Listener.java
deleted file mode 100644
index 4e519c6..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/listener/Listener.java
+++ /dev/null
@@ -1,96 +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.samples.listener;
-
-import java.io.StringReader;
-
-import org.apache.airavata.commons.WorkFlowUtils;
-import org.apache.airavata.workflow.tracking.client.LeadNotificationManager;
-import org.apache.airavata.workflow.tracking.client.Subscription;
-import org.apache.airavata.wsmg.client.WseMsgBrokerClient;
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axis2.addressing.EndpointReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class Listener {
-
- private static OMFactory factory = OMAbstractFactory.getOMFactory();
- private static final Logger log = LoggerFactory.getLogger(Listener.class);
-
- public static final String finalNotification = "<end>This is the last Notification. end your subscription when you receive this</end>";
-
- /**
- * @param args
- */
- public static void main(String[] args) {
-
- String brokerLocation = args.length > 0 ? args[0] : "localhost:8080/axis2/services/EventingService";
- String topic = "pickTheTOpicThatWorkflowPublishTheEventsFrom";
-
- Subscription subscription = null;
- // Create a sbscription
- try {
- // create a callback
- CallbackHandler callback = new CallbackHandler();
- // create the subscription
- subscription = LeadNotificationManager.createSubscription(brokerLocation, topic, callback, 2222);
- // set the subscription in the callback so we could destroy the
- // subscription within the callback
- callback.setSubscription(subscription);
- } catch (Exception e) {
- // Falied to create subscription
- log.error("Failed to create Subscription", e);
- // do what you want to do instead of rethrowing. e.g. like retrying
- throw new RuntimeException(e);
- }
-
- // Subscription is created and now we listen. Now the workflow should
- // publish notification with
- // that particular topic.
- // Inthis sample we emulate it by manually publishing notifications
-
- // created a publisher
-
- WseMsgBrokerClient publisher = new WseMsgBrokerClient();
- EndpointReference endpointRef = publisher.createEndpointReference(brokerLocation, topic);
- publisher.init(endpointRef.getAddress());
-
- try {
-
- OMElement finalNotificationEl = WorkFlowUtils.reader2OMElement(new StringReader(finalNotification));
-
- OMElement testNotification = factory.createOMElement("Test", null);
-
- testNotification.setText("test event for workflow tracking sample");
-
- publisher.publish(null, testNotification);
- publisher.publish(null, finalNotificationEl);
- } catch (Exception e) {
- log.error("Failed to publish", e);
- }
-
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/CallbackHandler.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/CallbackHandler.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/CallbackHandler.java
deleted file mode 100644
index 3d63843..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/CallbackHandler.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.samples.simple_listener;
-
-import org.apache.airavata.workflow.tracking.client.NotificationType;
-import org.apache.xmlbeans.XmlObject;
-
-public class CallbackHandler implements org.apache.airavata.workflow.tracking.client.Callback {
-
- /*
- * This methods will be callbacked when the particular subcription receives a notification (non-Javadoc)
- *
- * @see org.apache.airavata.workflow.tracking.client.Callback#deliverMessage(java.lang.String,
- * org.apache.airavata.workflow.tracking.client.NotificationType, org.apache.xmlbeans.XmlObject)
- */
- public void deliverMessage(String topic, NotificationType notificationType, XmlObject messageObj) {
- System.out.println("Received a notification of type[" + notificationType + "] for the topic[" + topic);
- System.out.println("The notification message is:");
- System.out.println(messageObj.toString());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/SimpleListener.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/SimpleListener.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/SimpleListener.java
deleted file mode 100644
index e876559..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/samples/simple_listener/SimpleListener.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-
-package org.apache.airavata.workflow.tracking.samples.simple_listener;
-
-import java.rmi.RemoteException;
-
-import org.apache.airavata.workflow.tracking.client.LeadNotificationManager;
-import org.apache.airavata.workflow.tracking.client.Subscription;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SimpleListener {
-
- private static final Logger log = LoggerFactory.getLogger(SimpleListener.class);
- /**
- * @param args
- * @throws RemoteException
- */
- public static void main(String[] args) throws RemoteException {
-
- String brokerLocation = args.length > 0 ? args[0] : "http://localhost:8080/axis2/services/EventingService";
- // "rainier.extreme.indiana.edu:12346";
- String topic = "pickTheTOpicThatWorkflowPublishTheEventsFrom";
-
- System.out.println(LeadNotificationManager.getBrokerPublishEPR(brokerLocation, topic));
- Subscription subscription = null;
- // Create a sbscription
- try {
- subscription = LeadNotificationManager.createSubscription(brokerLocation, topic,
- new org.apache.airavata.workflow.tracking.samples.simple_listener.CallbackHandler(), 2222);
- } catch (Exception e) {
- // Falied to create subscription
- log.error("Failed to publish", e);
- // do what you want to do instead of rethrowing. e.g. like retrying
- throw new RuntimeException(e);
- }
-
- System.out.println(subscription.getBrokerPublishEPR());
- subscription.destroy();
- System.out.println("Subscription cleared");
- System.exit(0);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/ActivityTime.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/ActivityTime.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/ActivityTime.java
deleted file mode 100644
index 734108b..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/ActivityTime.java
+++ /dev/null
@@ -1,78 +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.util;
-
-import java.util.Date;
-
-public class ActivityTime implements Comparable {
-
- private Date clockTime;
- private int logicalTime;
-
- public ActivityTime(int logicalTime_, Date clockTime_) {
- logicalTime = logicalTime_;
- clockTime = clockTime_;
- }
-
- public Date getClockTime() {
- return clockTime;
- }
-
- public int getLogicalTime() {
- return logicalTime;
- }
-
- public int compareTo(Object o) {
- if (o == null)
- throw new NullPointerException();
- if (!ActivityTime.class.isAssignableFrom(o.getClass())) {
- throw new ClassCastException("cannot assign " + o.getClass() + " to " + ActivityTime.class);
- }
- // start comparison
- ActivityTime other = (ActivityTime) o;
- // compare logical time first if they are both positive
- if (this.logicalTime >= 0 && other.logicalTime >= 0) {
- if (this.logicalTime > other.logicalTime)
- return +1;
- if (this.logicalTime < other.logicalTime)
- return -1;
- assert this.logicalTime == other.logicalTime;
- }
- // both logical times are equal or not set
- // compare wallclock time
- return this.clockTime.compareTo(other.clockTime);
- }
-
- @Override
- public boolean equals(Object o) {
- if (o != null) {
- return compareTo(o) == 0;
- } else {
- return false;
- }
- }
-
- @Override
- public String toString() {
- return "WF Timestep[" + logicalTime + "] Timestamp[" + clockTime + "]";
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/42f77edb/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/LinkedMessageQueue.java
----------------------------------------------------------------------
diff --git a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/LinkedMessageQueue.java b/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/LinkedMessageQueue.java
deleted file mode 100644
index d25196f..0000000
--- a/modules/commons/workflow-tracking/src/main/java/org/apache/airavata/workflow/tracking/util/LinkedMessageQueue.java
+++ /dev/null
@@ -1,181 +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.util;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * similar to linkedblocking queue but Non-concurrent version. can have only one thread putting elements into queue and
- * another thread getting elements from queue. has added method get that does a block-peek that is missing in
- * linkedblocking queue. implemented using a linked list.
- */
-public class LinkedMessageQueue<E> implements Iterable {
-
- private final LinkedList<E> list;
- private final AtomicInteger count;
- private final int capacity;
-
- private final Object takeLock = new Object();
- private final Object putLock = new Object();
-
- private boolean canStop = false;
-
- public LinkedMessageQueue() {
- this(Integer.MAX_VALUE); // default capacity is MAX_INT
- }
-
- public LinkedMessageQueue(int maxSize) {
- list = new LinkedList<E>();
- count = new AtomicInteger(0);
- capacity = maxSize;
- }
-
- /*** add, offer, and put are called by application thread adding to notification queue ***/
-
- /** add to tail of queue if not full; throw exceptionif unable to add */
- public final void add(E entry) {
-
- if (count.get() >= capacity) {
- throw new IllegalStateException("Cannot add element. queue is full.");
- }
-
- list.add(entry);
- count.incrementAndGet();
-
- synchronized (putLock) {
- putLock.notify();
- }
- }
-
- /** add to tail of queue if possible; return false if unable to add */
- public final boolean offer(E entry) {
-
- if (count.get() >= capacity) {
- return false;
- }
-
- list.add(entry);
- count.incrementAndGet();
-
- synchronized (putLock) {
- putLock.notify();
- }
- return true;
- }
-
- /** add to tail of queue, blocking if necessary */
- public final void put(E entry) throws InterruptedException {
-
- if (count.get() >= capacity) { // do initial check before checking & waiting
- synchronized (takeLock) {
- while (count.get() >= capacity) {
- takeLock.wait();
- }
- }
- }
-
- list.add(entry);
- count.incrementAndGet();
-
- synchronized (putLock) {
- putLock.notify();
- }
- }
-
- /*** poll, get, peek, and take are called by publisher thread removing from notification queue ***/
-
- /** return & remove head of queue; do not block & return null if none available */
- public final E poll() {
-
- if (count.get() <= 0)
- return null;
-
- count.decrementAndGet();
- E entry = list.removeFirst();
-
- synchronized (takeLock) {
- takeLock.notify();
- }
- return entry;
- }
-
- /** return (but dont remove) head of queue; block if empty */
- public final E get() throws InterruptedException {
-
- if (count.get() <= 0) { // do initial check before checking & waiting
- while (count.get() <= 0 && !canStop) {
- synchronized (putLock) {
- putLock.wait(1);
- }
- return null;
- }
- }
-
- return list.getFirst();
- }
-
- /** return (but dont remove) head of queue; return null if empty */
- public final E peek() {
-
- if (count.get() <= 0)
- return null;
- else
- return list.getFirst();
- }
-
- /** return & remove head of queue; block if empty */
- public final E take() throws InterruptedException {
-
- if (count.get() <= 0) { // do initial check before checking & waiting
- synchronized (putLock) {
- while (count.get() <= 0) {
- putLock.wait();
- }
- }
- }
-
- count.decrementAndGet();
- final E entry = list.removeFirst();
-
- synchronized (takeLock) {
- takeLock.notify();
- }
- return entry;
- }
-
- /** return number of entries in queue */
- public final int size() {
-
- return count.get();
- }
-
- public final Iterator<E> iterator() {
-
- return list.iterator();
- }
-
- public void setCanStop(boolean canStop) {
- this.canStop = canStop;
- }
-}