adding new files
git-svn-id: https://svn.apache.org/repos/asf/airavata/sandbox@1596046 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java b/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
new file mode 100644
index 0000000..4651df4
--- /dev/null
+++ b/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
@@ -0,0 +1,70 @@
+/*
+ *
+ * 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.gfac.local.handler;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+import org.xmlsoap.schemas.soap.encoding.*;
+
+import javax.mail.*;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import java.lang.String;
+import java.util.Map;
+import java.util.Properties;
+
+public class InputEmailHandler implements GFacHandler {
+
+ Properties props;
+
+ public void initProperties(Map<String, String> stringStringMap) throws GFacHandlerException {
+ // we get all the required properties for email configuration
+ props = new Properties();
+ props.putAll((Map<String, String>)stringStringMap.entrySet());
+ }
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ Session session = Session.getInstance(props,
+ new javax.mail.Authenticator() {
+ protected PasswordAuthentication getPasswordAuthentication() {
+ return new PasswordAuthentication((String) props.get("username")+"@gmail.com", (String) props.get("username"));
+ }
+ });
+
+ Message message = new MimeMessage(session);
+ try {
+ message.setFrom(new InternetAddress((String) props.get("username")));
+ message.setRecipients(Message.RecipientType.TO,
+ InternetAddress.parse((String) props.get("username")));
+ message.setSubject("GFAC Input Email");
+
+ Map<String, Object> parameters = jobExecutionContext.getInMessageContext().getParameters();
+ StringBuffer buffer = new StringBuffer();
+ for(String input:parameters.keySet()) {
+ buffer.append("Input Name: input: Input Value: " + parameters.get(input) + "\n");
+ }
+ Transport.send(message);
+ } catch (MessagingException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+}
diff --git a/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/OutputEmailHandler.java b/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/OutputEmailHandler.java
new file mode 100644
index 0000000..b8b32ed
--- /dev/null
+++ b/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/OutputEmailHandler.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.gfac.local.handler;
+
+import org.apache.airavata.gfac.core.context.JobExecutionContext;
+import org.apache.airavata.gfac.core.handler.GFacHandler;
+import org.apache.airavata.gfac.core.handler.GFacHandlerException;
+
+import java.util.Map;
+
+public class OutputEmailHandler implements GFacHandler {
+ public void initProperties(Map<String, String> stringStringMap) throws GFacHandlerException {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+}