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

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

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/MessengerServlet.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/MessengerServlet.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/MessengerServlet.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/MessengerServlet.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,168 @@
+/*
+ * 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 wsmg.messenger;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.axis2.AxisFault;
+import org.apache.log4j.Logger;
+
+import wsmg.commons.WsmgCommonConstants;
+import wsmg.commons.WsmgVersion;
+import wsmg.commons.storage.WsmgPersistantStorage;
+import wsmg.config.ConfigurationManager;
+import wsmg.config.WSMGParameter;
+import wsmg.messenger.strategy.SendingStrategy;
+import wsmg.messenger.strategy.impl.FixedParallelSender;
+import wsmg.messenger.strategy.impl.ParallelSender;
+import wsmg.messenger.strategy.impl.SerialSender;
+import wsmg.util.RunTimeStatistics;
+
+public class MessengerServlet extends HttpServlet {
+
+	Logger logger = Logger.getLogger(MessengerServlet.class);
+
+	private static final long serialVersionUID = -7175511030332798604L;
+
+	private SendingStrategy sender = null;
+
+	public MessengerServlet() {
+	}
+
+	public void init(ServletConfig config) throws ServletException {
+		logger.info("Starting messenger servlet");
+		System.out.println(String.format(
+				"Starting messenger: version: %s , %s", WsmgVersion
+						.getImplementationVersion(),
+				WSMGParameter.versionSetUpNote));
+		RunTimeStatistics.setStartUpTime();
+		ConfigurationManager brokerConfig = initConfigurations(config);
+		initStorage(brokerConfig);
+		initDiliveryMethod(brokerConfig);
+
+	}
+
+	private void initDiliveryMethod(ConfigurationManager config) {
+		logger.info("starting dilivery thread");
+
+		String deliveryMethod = config.getConfig(
+				WsmgCommonConstants.CONFIG_DELIVERY_METHOD,
+				WsmgCommonConstants.DELIVERY_METHOD_SERIAL);
+		SendingStrategy method = null;
+
+		ConsumerUrlManager urlManager = new ConsumerUrlManager(config);
+
+		String initedmethod = null;
+
+		if (WsmgCommonConstants.DELIVERY_METHOD_PARALLEL
+				.equalsIgnoreCase(deliveryMethod)) {
+
+			method = new ParallelSender(config, urlManager);
+			initedmethod = WsmgCommonConstants.DELIVERY_METHOD_PARALLEL;
+
+		} else if (WsmgCommonConstants.DELIVERY_METHOD_THREAD_CREW
+				.equalsIgnoreCase(deliveryMethod)) {
+			method = new FixedParallelSender(config, urlManager);
+			initedmethod = WsmgCommonConstants.DELIVERY_METHOD_THREAD_CREW;
+
+		} else {
+			method = new SerialSender(config, urlManager);
+			initedmethod = WsmgCommonConstants.DELIVERY_METHOD_SERIAL;
+		}
+
+		method.start();
+		logger.info(initedmethod + " sending method inited");
+	}
+
+	public void destroy() {
+		sender.shutdown();
+		logger.info("stoping wsmg-messenger");
+	}
+
+	public ServletConfig getServletConfig() {
+		return null;
+	}
+
+	public String getServletInfo() {
+		return null;
+	}
+
+	protected void doGet(HttpServletRequest request,
+			HttpServletResponse response) throws ServletException, IOException {
+		sendMessengerStats(response);
+
+	}
+
+	private void sendMessengerStats(HttpServletResponse response)
+			throws IOException {
+		PrintWriter out = response.getWriter();
+		response.setContentType("text/html");
+
+		out.write("<html><head><title>Delivery thread"
+				+ " of WS-Messenger</title></head>");
+		out.write("<body bgcolor='white'><h1>"
+				+ "Delivery thread of WS-Messenger is running</h1>");
+		out.write(RunTimeStatistics.getHtmlString());
+		out.write("</body>");
+		out.flush();
+	}
+
+	protected void doPost(HttpServletRequest request,
+			HttpServletResponse response) throws ServletException, IOException {
+		sendMessengerStats(response);
+	}
+
+	private ConfigurationManager initConfigurations(ServletConfig config) {
+		ConfigurationManager configMan = new ConfigurationManager(
+				WsmgCommonConstants.BROKER_CONFIGURATION_FILE_NAME);
+		return configMan;
+	}
+
+	private void initStorage(ConfigurationManager configMan) {
+
+		String type = configMan.getConfig(
+				WsmgCommonConstants.CONFIG_STORAGE_TYPE,
+				WsmgCommonConstants.CONFIG_STORAGE_TYPE);
+
+		if (WsmgCommonConstants.STORAGE_TYPE_IN_MEMORY.equalsIgnoreCase(type)) {
+			logger.fatal("invalid storage type specified: " + type);
+			throw new RuntimeException("invalid storage type specified: "
+					+ type);
+		}
+
+		try {
+			WSMGParameter.OUT_GOING_QUEUE = new WsmgPersistantStorage(
+					WsmgCommonConstants.TABLE_NAME_EXPIRABLE_SUBCRIPTIONS,
+					WsmgCommonConstants.TABLE_NAME_NON_EXPIRABLE_SUBCRIPTIONS,
+					configMan);
+
+		} catch (AxisFault af) {
+			logger.fatal("failed to initialize storage", af);
+			throw new RuntimeException("unable to initialize storage", af);
+		}
+
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/util/MessengerLogFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/util/MessengerLogFactory.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/util/MessengerLogFactory.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/util/MessengerLogFactory.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,75 @@
+/*
+ * 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 wsmg.messenger.util;
+
+import javax.servlet.ServletConfig;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+import org.apache.log4j.xml.DOMConfigurator;
+
+public final class MessengerLogFactory {
+
+	private static final String WSMG_MESSENGER_LOGGER = "wsmg.messenger.logger";
+
+	private static final String LOG4J_PROPERTIES_NAME = "log4jconfigpath";
+
+	private Logger log = Logger.getLogger(WSMG_MESSENGER_LOGGER);
+
+	private static MessengerLogFactory instance = new MessengerLogFactory();
+
+	private MessengerLogFactory() {
+
+	}
+
+	public static MessengerLogFactory getIntance() {
+		return instance;
+
+	}
+
+	public Logger getLogger() {
+		return log;
+	}
+
+	public void init(ServletConfig config) {
+
+		System.out.println("configuring log4j");
+
+		String prefix = config.getServletContext().getRealPath("/");
+		String file = config.getInitParameter(LOG4J_PROPERTIES_NAME);
+
+		if (file != null) {
+			System.out.println("log4j config file: " + file);
+			if (file.endsWith(".xml")) {
+				System.out.println("configuring dom");
+				DOMConfigurator.configure(prefix + file);
+			} else {
+				PropertyConfigurator.configure(prefix + file);
+			}
+		} else {
+			System.out
+					.println("Warning :- logging configuration doesn't exist -"
+							+ " using basic configuration");
+			BasicConfigurator.configure();
+		}
+
+	}
+}

Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/java/wsmg/messenger/util/MessengerLogFactory.java
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/log4jconfig.xml_
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/log4jconfig.xml_?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/log4jconfig.xml_ (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/log4jconfig.xml_ Sun Jul  3 00:29:24 2011
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+    <!--
+    <appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.SimpleLayout"/>
+    </appender>
+    --> 
+    
+<!--  
+    <appender name="Fileout" class="org.apache.log4j.DailyRollingFileAppender">
+        <param name="DatePattern" value="'_'yyyy-MM-dd"/>
+        <param name="File" value="D:/JBuilder2007_Workspace/workspace/Bill_SMS/logs/Bill_SMS.Log"/>
+        <param name="Append" value="true"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
+        </layout>
+    </appender>
+    -->
+    
+    
+    <appender name="Fileout" class="org.apache.log4j.RollingFileAppender">
+        <param name="File" value="${catalina.home}/logs/messenger.log"/>
+		<param name="MaxFileSize" value="100MB"/>
+		<param name="MaxBackupIndex" value="10"/>
+        <param name="Append" value="true"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d [%t] %p - %m%n"/>
+        </layout>
+    </appender>
+    
+    <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+      <param name="Target" value="System.out"/>
+      <param name="Threshold" value="INFO"/> 
+
+      <layout class="org.apache.log4j.PatternLayout">
+         <!-- The default pattern: Date Priority [Category] Message\n -->
+         <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/>
+      </layout>
+   </appender>
+    
+    <logger name="wsmg.messenger.logger" additivity="false" >
+        <level value="info"/>
+        <appender-ref ref="Fileout"/>
+		<appender-ref ref="CONSOLE"/>
+    </logger>
+    
+    <root>
+        <priority value ="Level.OFF" />
+    </root>
+    
+</log4j:configuration>

Propchange: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/log4jconfig.xml_
------------------------------------------------------------------------------
    svn:executable = *

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/wsmg.broker.properties.sample
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/wsmg.broker.properties.sample?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/wsmg.broker.properties.sample (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/resources/wsmg.broker.properties.sample Sun Jul  3 00:29:24 2011
@@ -0,0 +1,6 @@
+broker.jdbc.driver=com.mysql.jdbc.Driver
+broker.jdbc.url=jdbc:mysql://localhost:3306/wsmg?user=wsmg&password=wsmg
+broker.start.delivery.thread=true
+broker.socket.timeout=30000
+broker.storage.type=memory
+axis2.repository=/home/ramith/Documents/axis2-1.5
\ No newline at end of file

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/webapp/WEB-INF/web.xml?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/messenger/src/main/webapp/WEB-INF/web.xml Sun Jul  3 00:29:24 2011
@@ -0,0 +1,30 @@
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
+ "http://java.sun.com/dtd/web-app_2_3.dtd" >
+
+<web-app>
+	<display-name>OGCE WS Messenger</display-name>
+	<servlet>
+		<icon></icon>
+		<servlet-name>messenger</servlet-name>
+		<description>OGCE WS Messenger</description>
+		<servlet-class>wsmg.messenger.MessengerServlet</servlet-class>		
+		<init-param>
+			<param-name>log4jconfigpath</param-name>
+			<param-value>WEB-INF/classes/log4jconfig.xml</param-value>
+		</init-param>
+		<init-param>
+			<param-name>configuration.file.name</param-name>
+			<param-value>wsmg.broker.properties</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+
+
+	<servlet-mapping>
+		<servlet-name>messenger</servlet-name>
+		<url-pattern>/*</url-pattern>
+	</servlet-mapping>
+
+
+</web-app>

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/pom.xml
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/pom.xml?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/pom.xml (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/pom.xml Sun Jul  3 00:29:24 2011
@@ -0,0 +1,138 @@
+<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>
+		<artifactId>ws-messenger</artifactId>
+		<groupId>org.ogce.ws-messenger</groupId>
+		<version>1.1.1</version>
+	</parent>
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>org.ogce.workflow-tracking</groupId>
+	<artifactId>workflow_tracking</artifactId>
+	<packaging>jar</packaging>
+	<name>workflow-tracking</name>
+	<url>http://maven.apache.org</url>
+	<build>
+		<pluginManagement>
+			<plugins>
+				<plugin>
+					<groupId>org.apache.maven.plugins</groupId>
+					<artifactId>maven-compiler-plugin</artifactId>
+					<version>2.0.2</version>
+					<configuration>
+						<source>1.5</source>
+						<target>1.5</target>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+		<plugins>
+			<plugin>
+				<groupId>org.codehaus.mojo</groupId>
+				<artifactId>build-helper-maven-plugin</artifactId>
+				<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>
+					<outputJar>target/workflow_tracking_types-${pom.version}.jar</outputJar>
+					<xmlConfigs>
+						<xmlConfig implementation="java.io.File">src/main/xsdconfig/notification_types_ng.xsdconfig</xmlConfig>
+						<xmlConfig implementation="java.io.File">src/main/xsdconfig/calder_notification_types.xsdconfig</xmlConfig>
+					</xmlConfigs>
+				</configuration>
+			</plugin>
+		</plugins>
+	</build>
+	<repositories>
+		<repository>
+			<id>ibiblio mvn2</id>
+			<name>ibiblio Repository m2</name>
+			<url>http://mirrors.ibiblio.org/pub/mirrors/maven2
+			</url>
+		</repository>
+		<repository>
+			<id>ibiblio mvn 1</id>
+			<name>ibiblio Repository</name>
+			<url>http://mirrors.ibiblio.org/pub/mirrors/maven
+			</url>
+		</repository>
+		<repository>
+			<id>java.net mvn 1</id>
+			<name>java.net Maven Repository 1</name>
+			<url>http://download.java.net/maven/1</url>
+			<layout>legacy</layout>
+		</repository>
+		<repository>
+			<id>java.net mvn2</id>
+			<name>java repo maven 2</name>
+			<url>http://download.java.net/maven/2</url>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.axis2</groupId>
+			<artifactId>axis2</artifactId>
+			<version>1.5</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ogce.msgbox</groupId>
+			<artifactId>msgbox</artifactId>
+			<version>1.1.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.ogce.broker</groupId>
+			<artifactId>broker</artifactId>
+			<version>1.1.1</version>
+			<scope>provided</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.xmlbeans</groupId>
+			<artifactId>xmlbeans</artifactId>
+			<version>2.4.0</version>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.4</version>
+			<type>jar</type>
+			<scope>test</scope>
+		</dependency>
+	</dependencies>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
+		<axis2.version>1.5</axis2.version>
+	</properties>
+</project>

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadContextHeader.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadContextHeader.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadContextHeader.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadContextHeader.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,332 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.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.apache.log4j.Logger;
+
+public class LeadContextHeader {
+
+	OMElement target;
+
+	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) {
+			e.printStackTrace();
+			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 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 org.apache.log4j.Logger logger = Logger
+			.getLogger(LeadContextHeader.class);
+	private static final OMFactory factory;
+	public static final String GFAC_NAMESPACE = "http://www.extreme.indiana.edu/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");
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadCrosscutParametersUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadCrosscutParametersUtil.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadCrosscutParametersUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/LeadCrosscutParametersUtil.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,313 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.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.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+
+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 org.apache.log4j.Logger logger = Logger
+			.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");
+	}
+}

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

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/XBeansUtil.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/XBeansUtil.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/XBeansUtil.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/commons/XBeansUtil.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.commons;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.log4j.Logger;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+
+public class XBeansUtil {
+
+	org.apache.log4j.Logger logger = Logger.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 = edu.indiana.extreme.lead.commons.WorkFlowUtils
+				.reader2OMElement(new StringReader(responseXml));
+		return outgoingMsg;
+	}
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AbstractNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AbstractNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AbstractNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AbstractNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,160 @@
+package edu.indiana.extreme.lead.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.axis2.addressing.EndpointReference;
+import org.apache.axis2.util.XMLPrettyPrinter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.NotifierConfig;
+import edu.indiana.extreme.lead.workflow_tracking.common.NotifierVersion;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+import edu.indiana.extreme.lead.workflow_tracking.impl.publish.NotificationPublisher;
+import edu.indiana.extreme.lead.workflow_tracking.impl.publish.WSMPublisher;
+import edu.indiana.extreme.lead.workflow_tracking.impl.state.InvocationEntityImpl;
+import edu.indiana.extreme.lead.workflow_tracking.types.BaseNotificationType;
+import edu.indiana.extreme.lead.workflow_tracking.util.XmlBeanUtils;
+
+public abstract class AbstractNotifier {
+    protected static final Log log = LogFactory.getLog(AbstractNotifier.class.toString());
+    private Map<EndpointReference, NotificationPublisher> publishermap = new ConcurrentHashMap<EndpointReference, NotificationPublisher>();
+    
+    protected Date activityTimestamp = null;
+    
+    public AbstractNotifier(){
+    
+    }
+    
+    public WorkflowTrackingContext createTrackingContext(Properties golbalProperties, EndpointReference epr, URI workflowID,
+            URI serviceID,
+            String workflowNodeID,
+            Integer workflowTimestep){
+        WorkflowTrackingContext workflowTrackingContext = new WorkflowTrackingContext();
+        workflowTrackingContext.setGlobalAnnotations(golbalProperties);
+        workflowTrackingContext.setBrokerEpr(epr);
+        workflowTrackingContext.setMyself(createEntity(workflowTrackingContext, workflowID, serviceID, workflowNodeID, workflowTimestep));
+        return workflowTrackingContext;
+    }
+    
+    public InvocationEntity createEntity(WorkflowTrackingContext context,
+            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());
+        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{
+                publisher =  new WSMPublisher(100, context.isEnableAsyncPublishing(),context.getBrokerEpr());
+            }
+            publishermap.put(context.getBrokerEpr(), publisher);
+        }
+        
+        
+        try {
+            setIDAndTimestamp(context, xmlMessage, context.getMyself(), activityTimestamp != null? activityTimestamp: new Date());
+            setDescAndAnno(context, xmlMessage, descriptionAndAnnotation, defaultDesc);
+            //System.out.println(xmldata);
+            if(log.isDebugEnabled()){
+                log.debug(xmldata.toString());    
+            }
+            publisher.publish(xmldata);
+        } catch (RuntimeException 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();
+        }
+    }
+ 
+}

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AuditNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AuditNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AuditNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/AuditNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URI;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send notifications related to 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);
+}
+
+
+
+
+
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/GenericNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/GenericNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/GenericNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/GenericNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,205 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.apache.axis2.addressing.EndpointReference;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationContext;
+import edu.indiana.extreme.lead.workflow_tracking.common.InvocationEntity;
+import edu.indiana.extreme.lead.workflow_tracking.common.WorkflowTrackingContext;
+
+/**
+ * Utility to create and send 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, EndpointReference 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    context     current workflow tracking context, this includes 
+     *                        in parameter  localEntity an InvocationEntity representing this entity
+     * @param    workflowID          an URI
+     * @param    serviceID           an URI
+     * @param    workflowNodeID      a  String
+     * @param    workflowTimestep    an int
+     *
+     * @return   an InvocationEntity
+     *
+     */
+    public InvocationEntity createEntity(WorkflowTrackingContext context, 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();
+}
+
+
+
+
+
+
+
+

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

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/NotifierFactory.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/NotifierFactory.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/NotifierFactory.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/NotifierFactory.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import org.apache.log4j.Logger;
+
+import edu.indiana.extreme.lead.workflow_tracking.calder.CalderNotifier;
+import edu.indiana.extreme.lead.workflow_tracking.common.ConstructorProps;
+import edu.indiana.extreme.lead.workflow_tracking.impl.GenericNotifierImpl;
+import edu.indiana.extreme.lead.workflow_tracking.impl.NotifierImpl;
+import edu.indiana.extreme.lead.workflow_tracking.impl.ProvenanceNotifierImpl;
+
+/**
+ * Create a Notifier instance. 
+ *
+ * This code was inspired by the listener agent factory in xmessages
+ *
+ * @version $Revision: 1.9 $
+ * @author Yogesh L. Simmhan [mailto:ysimmhan_AT_cs_DOT_indiana_DOT_edu], Srinath Perera
+ */
+public class NotifierFactory {
+	private final static org.apache.log4j.Logger logger = Logger.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();
+    }
+
+    public static CalderNotifier createCalderNotifier() {
+        return  new NotifierImpl();
+    }
+
+}
+
+

Added: incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PerformanceNotifier.java
URL: http://svn.apache.org/viewvc/incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PerformanceNotifier.java?rev=1142350&view=auto
==============================================================================
--- incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PerformanceNotifier.java (added)
+++ incubator/airavata/donations/ogce-donation/modules/ws-messaging/workflow-tracking/src/main/java/edu/indiana/extreme/lead/workflow_tracking/PerformanceNotifier.java Sun Jul  3 00:29:24 2011
@@ -0,0 +1,249 @@
+/*
+ * Licensed to the Lanka Software Foundation (LSF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The LSF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+
+package edu.indiana.extreme.lead.workflow_tracking;
+
+import java.net.URI;
+
+import edu.indiana.extreme.lead.workflow_tracking.common.DataDurationObj;
+import edu.indiana.extreme.lead.workflow_tracking.common.DataObj;
+import edu.indiana.extreme.lead.workflow_tracking.common.DurationObj;
+import edu.indiana.extreme.lead.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>
+ *
+ * @version $Revision: 1.3 $
+ * @author Yogesh L. Simmhan [mailto:ysimmhan_AT_cs_DOT_indiana_DOT_edu]
+ */
+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);
+}
+
+