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/gfac-storm Commit: 42f77edb854d4c3c79191ee13112dcc562a93593 Parents: cab1571 Author: Chathuri Wimalasena <[email protected]> Authored: Tue Jan 27 14:27:07 2015 -0500 Committer: Chathuri Wimalasena <[email protected]> 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); - -}
