airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1596263 - in /airavata/sandbox/gfac-sample/local-handler-sample: build.xml src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
Date Tue, 20 May 2014 14:22:44 GMT
Author: lahiru
Date: Tue May 20 14:22:44 2014
New Revision: 1596263

URL: http://svn.apache.org/r1596263
Log:
adding ant

Added:
    airavata/sandbox/gfac-sample/local-handler-sample/build.xml
Modified:
    airavata/sandbox/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java

Added: airavata/sandbox/gfac-sample/local-handler-sample/build.xml
URL: http://svn.apache.org/viewvc/airavata/sandbox/gfac-sample/local-handler-sample/build.xml?rev=1596263&view=auto
==============================================================================
--- airavata/sandbox/gfac-sample/local-handler-sample/build.xml (added)
+++ airavata/sandbox/gfac-sample/local-handler-sample/build.xml Tue May 20 14:22:44 2014
@@ -0,0 +1,47 @@
+<project name="gfacHandlerSample" default="dist" basedir=".">
+    <description>
+        gfac handler sample
+    </description>
+    <!-- set global properties for this build -->
+    <property name="src" location="src"/>
+    <property name="build" location="build"/>
+    <property name="dist" location="dist"/>
+    <property name="airavata.home"
+              value="/Users/lahirugunathilake/work/airavata/git/airavata/modules/distribution/server/target/apache-airavata-server-0.12-SNAPSHOT"/>
+
+    <path id="javac.classpath">
+        <pathelement path="${build}"/>
+        <fileset dir="${airavata.home}/lib">
+            <include name="airavata-gfac-core-0.12-SNAPSHOT.jar"/>
+        </fileset>
+    </path>
+
+
+    <target name="init">
+        <!-- Create the time stamp -->
+        <tstamp/>
+        <!-- Create the build directory structure used by compile -->
+        <mkdir dir="${build}"/>
+    </target>
+
+    <target name="compile" depends="init"
+            description="compile the source ">
+        <!-- Compile the java code from ${src} into ${build} -->
+        <javac srcdir="${src}" destdir="${build}">
+            <classpath refid="javac.classpath"/>
+        </javac>
+    </target>
+
+    <target name="dist" depends="compile"
+            description="generate the distribution">
+        <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
+        <jar jarfile="${dist}/lib/airavata-gfac-handler-sample-${DSTAMP}.jar" basedir="${build}"/>
+    </target>
+
+    <target name="clean"
+            description="clean up">
+        <!-- Delete the ${build} and ${dist} directory trees -->
+        <delete dir="${build}"/>
+        <delete dir="${dist}"/>
+    </target>
+</project>

Modified: airavata/sandbox/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java?rev=1596263&r1=1596262&r2=1596263&view=diff
==============================================================================
--- airavata/sandbox/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
(original)
+++ airavata/sandbox/gfac-sample/local-handler-sample/src/main/java/org/apache/airavata/gfac/local/handler/InputEmailHandler.java
Tue May 20 14:22:44 2014
@@ -23,8 +23,6 @@ package org.apache.airavata.gfac.local.h
 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;
@@ -33,38 +31,35 @@ import java.util.Map;
 import java.util.Properties;
 
 public class InputEmailHandler implements GFacHandler {
+    private Properties props;
 
-    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 initProperties(Properties properties) throws GFacHandlerException {
+        props = properties;
     }
 
     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"));
+                        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.
+        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.
+        }
     }
 }



Mime
View raw message