airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r1502732 [3/8] - in /airavata/trunk: ./ jglobus-repo/ jglobus-repo/repository/ jglobus-repo/repository/org/ jglobus-repo/repository/org/jglobus/ jglobus-repo/repository/org/jglobus/axisg/ jglobus-repo/repository/org/jglobus/axisg/2.0.6-rc2/...
Date Sat, 13 Jul 2013 00:49:16 GMT
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/BESProvider.java Sat Jul 13 00:49:09 2013
@@ -63,7 +63,7 @@ import eu.emi.security.authn.x509.impl.C
 import eu.emi.security.authn.x509.impl.DirectoryCertChainValidator;
 import eu.emi.security.authn.x509.impl.PEMCredential;
 import eu.unicore.util.httpclient.DefaultClientConfiguration;
-
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 
 public class BESProvider implements GFacProvider {
@@ -211,9 +211,26 @@ public class BESProvider implements GFac
 			throws GFacProviderException {
 		secProperties = null;
 	}
-	
-	
-	protected void initSecurityProperties(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
+
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, JobExecutionContext jobExecutionContext)
+            throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId,
+                          JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+
+    protected void initSecurityProperties(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
 		
 		if (secProperties != null) return;
 		
@@ -231,15 +248,17 @@ public class BESProvider implements GFac
 		ByteArrayInputStream bis = null;
 		BufferedInputStream bufis = null;
 		try{
-			gss.getGlobusCredential().save(bufos);
+
+            // TODO verify whether this is correct
+			gss.getX509Credential().save(bufos);
 			bufos.flush();
 			
 			
 			
 			//TODO: to be supported by airavata gsscredential class
 			List<String> trustedCert = new ArrayList<String>();
-			trustedCert.add(gssContext.getMyProxyManager().getTrustedCertsLoc() + "/*.0");
-			trustedCert.add(gssContext.getMyProxyManager().getTrustedCertsLoc() + "/*.pem");
+			trustedCert.add(GSISecurityContext.getTrustedCertificatePath() + "/*.0");
+			trustedCert.add(GSISecurityContext.getTrustedCertificatePath() + "/*.pem");
 			
 			char[] c = null;
 			

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java Sat Jul 13 00:49:09 2013
@@ -60,6 +60,7 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.StringParameterType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 import java.io.File;
 import java.io.IOException;
@@ -245,6 +246,21 @@ public class EC2Provider implements GFac
         // Do nothing
     }
 
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
     /**
      * Creates the command to be executed in the remote shell.
      *

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java Sat Jul 13 00:49:09 2013
@@ -20,8 +20,9 @@
 */
 package org.apache.airavata.gfac.provider.impl;
 
-import java.util.Calendar;
-import java.util.Map;
+import java.net.MalformedURLException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.JobSubmissionFault;
@@ -40,6 +41,9 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.GlobusHostType;
 import org.globus.gram.GramException;
 import org.globus.gram.GramJob;
+import org.globus.gram.WaitingForCommitException;
+import org.globus.gram.internal.GRAMConstants;
+import org.globus.gram.internal.GRAMProtocolErrorConstants;
 import org.ietf.jgss.GSSCredential;
 import org.ietf.jgss.GSSException;
 import org.slf4j.Logger;
@@ -50,81 +54,82 @@ public class GramProvider implements GFa
 
     private GramJob job;
     private GramJobSubmissionListener listener;
+    private boolean twoPhase = true;
+
+    /**
+     * If normal job submission fail due to an authorisation failure or script failure we
+     * will re-attempt to submit the job. In-order to avoid any recursive loop during a continuous
+     * failure we track whether failure paths are tried or not. Following booleans keeps track whether
+     * we already tried a failure path or not.
+     */
+    /**
+     * To track job submissions during a authorisation failure while requesting job.
+     */
+    private boolean renewCredentialsAttempt = false;
+    /**
+     * To track job submission during a script error situation.
+     */
+    private boolean reSubmissionInProgress = false;
+    /**
+     * To track authorisation failures during status monitoring.
+     */
+    private boolean authorisationFailedAttempt = false;
+
+    private static final Map<String, GramJob> currentlyExecutingJobCache
+            = new ConcurrentHashMap<String, GramJob>();
+
+    private static ResourceBundle resources;
+
+    static {
+        try {
+            resources = ResourceBundle.getBundle("org.globus.gram.internal.errors",
+                    Locale.getDefault());
+        } catch (MissingResourceException mre) {
+            log.error("org.globus.gram.internal.gram.errors.properties not found", mre);
+        }
+    }
+
 
     // This method prepare the environment before the application invocation.
     public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException {
-        job = GramProviderUtils.setupEnvironment(jobExecutionContext);
+        job = GramProviderUtils.setupEnvironment(jobExecutionContext, twoPhase);
         listener = new GramJobSubmissionListener(job, jobExecutionContext);
         job.addListener(listener);
     }
 
     public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException{
         jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
-        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
-        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
+        GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().
+                getHostDescription().getType();
+        ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().
+                getApplicationDeploymentDescription().getType();
 
-        StringBuffer buf = new StringBuffer();
+        StringBuilder stringBuilder = new StringBuilder();
         try {
-            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();
+
+            GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.
+                    getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();
             job.setCredentials(gssCred);
             // We do not support multiple gatekeepers in XBaya GUI, so we simply pick the 0th element in the array
             String gateKeeper = host.getGlobusGateKeeperEndPointArray(0);
             log.info("Request to contact:" + gateKeeper);
 
-            buf.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
+            stringBuilder.append("Finished launching job, Host = ").append(host.getHostAddress()).append(" RSL = ")
                     .append(job.getRSL()).append(" working directory = ").append(app.getStaticWorkingDirectory())
                     .append(" temp directory = ").append(app.getScratchWorkingDirectory())
                     .append(" Globus GateKeeper Endpoint = ").append(gateKeeper);
 
-            /*
-            * The first boolean is to specify the job is a batch job - use true for interactive and false for batch.
-            * The second boolean is to specify to use the full proxy and not delegate a limited proxy.
-            */
-            job.request(gateKeeper, false, false);
-            log.info(buf.toString());
-            checkJobStatus(jobExecutionContext, host, gateKeeper);
-            
-            String gramJobid = job.getIDAsString();
-            String jobID = "JobID= " + gramJobid;
-            log.info(jobID);
-            jobExecutionContext.getNotifier().publish(new GramJobIDEvent(jobID));
-           
-            //WorkflowNodeGramData workflowNodeGramData = new WorkflowNodeGramData(experimentID, nodeID, job.getRSL(),hostName , job.getIDAsString());;
-            
-        	// for provider test
-    		saveApplicationJob(jobExecutionContext);
-    		
-            /*
-            * Wait until job is done
-            */
-            listener.waitFor();
+            log.info(stringBuilder.toString());
+
+            submitJobs(gateKeeper, jobExecutionContext, host);
 
-            checkJobStatus(jobExecutionContext, host, gateKeeper);
-            
-        } catch (GramException e) {
-            log.error(e.getMessage());
-            JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(),
-                    host.getGlobusGateKeeperEndPointArray(0), job.getRSL(), jobExecutionContext);
-            throw error;
-        }catch(JobSubmissionFault e){
-        	throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
-        } 
-        catch (GSSException e) {
-            log.error(e.getMessage());
-            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
-        } catch (InterruptedException e) {
-            log.error(e.getMessage());
-            throw new GFacProviderException("Thread", e, jobExecutionContext);
-        } catch (SecurityException e) {
-            log.error(e.getMessage());
-            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
         } finally {
             if (job != null) {
                 try {
                 	 /*
                      * Remove listener
                      */
-                     job.removeListener(listener);
+                    job.removeListener(listener);
                 } catch (Exception e) {
                 	 log.error(e.getMessage());
                 }
@@ -133,12 +138,191 @@ public class GramProvider implements GFa
 
     }
 
-	private void saveApplicationJob(JobExecutionContext jobExecutionContext) {
+    private void submitJobs(String gateKeeper,
+                            JobExecutionContext jobExecutionContext,
+                            GlobusHostType globusHostType) throws GFacException, GFacProviderException {
+
+        if (twoPhase) {
+            try {
+                /*
+                * The first boolean is to force communication through SSLv3
+                * The second boolean is to specify the job is a batch job - use true for interactive and false for
+                 * batch.
+                * The third boolean is to specify to use the full proxy and not delegate a limited proxy.
+                */
+                job.request(true, gateKeeper, false, false);
+
+                // Single boolean to track all authentication failures, therefore we need to re-initialize
+                // this here
+                renewCredentialsAttempt = false;
+
+            } catch (WaitingForCommitException e) {
+
+                saveApplicationJob(jobExecutionContext, ApplicationJobStatus.UN_SUBMITTED);
+
+                String jobStatusMessage = "Un-submitted JobID= " + job.getIDAsString();
+                log.info(jobStatusMessage);
+                jobExecutionContext.getNotifier().publish(new GramJobIDEvent(jobStatusMessage));
+
+                log.info("JobID = " + job.getIDAsString());
+
+
+                log.info("Two phase commit: sending COMMIT_REQUEST signal; Job id - " + job.getIDAsString());
+
+                try {
+                    job.signal(GramJob.SIGNAL_COMMIT_REQUEST);
+
+                } catch (GramException gramException) {
+                    throw new GFacException("Error while sending commit request. Job Id - "
+                            + job.getIDAsString(), gramException);
+                } catch (GSSException gssException) {
+
+                    // User credentials are invalid
+                    log.error("Error while submitting commit request - Credentials provided are invalid. Job Id - "
+                            + job.getIDAsString(), e);
+                    log.info("Attempting to renew credentials and re-submit commit signal...");
+
+                    renewCredentials(jobExecutionContext);
+
+                    try {
+                        job.signal(GramJob.SIGNAL_COMMIT_REQUEST);
+                    } catch (GramException e1) {
+                        throw new GFacException("Error while sending commit request. Job Id - "
+                                + job.getIDAsString(), e1);
+                    } catch (GSSException e1) {
+                        throw new GFacException("Error while sending commit request. Job Id - "
+                                + job.getIDAsString() + ". Credentials provided invalid", e1);
+                    }
+                }
+
+                jobStatusMessage = "Submitted JobID= " + job.getIDAsString();
+                log.info(jobStatusMessage);
+                jobExecutionContext.getNotifier().publish(new GramJobIDEvent(jobStatusMessage));
+
+            } catch (GSSException e) {
+                // Renew credentials and re-submit
+                reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
+
+            } catch (GramException e) {
+                throw new GFacException("An error occurred while submitting a job, job id = " + job.getIDAsString(), e);
+            }
+        } else {
+
+            /*
+            * The first boolean is to force communication through SSLv3
+            * The second boolean is to specify the job is a batch job - use true for interactive and false for
+             * batch.
+            * The third boolean is to specify to use the full proxy and not delegate a limited proxy.
+            */
+            try {
+
+                job.request(true, gateKeeper, false, false);
+                renewCredentialsAttempt = false;
+
+            } catch (GramException e) {
+                throw new GFacException("An error occurred while submitting a job, job id = " + job.getIDAsString(), e);
+            } catch (GSSException e) {
+
+                // Renew credentials and re-submit
+                reSubmitJob(gateKeeper, jobExecutionContext, globusHostType, e);
+            }
+
+            String jobStatusMessage = "Un-submitted JobID= " + job.getIDAsString();
+            log.info(jobStatusMessage);
+            jobExecutionContext.getNotifier().publish(new GramJobIDEvent(jobStatusMessage));
+
+        }
+
+        currentlyExecutingJobCache.put(job.getIDAsString(), job);
+
+        // for provider test
+        saveApplicationJob(jobExecutionContext, ApplicationJobStatus.SUBMITTED);
+
+        /*
+        * Wait until job is done
+        */
+        listener.waitFor();
+
+        checkJobStatus(jobExecutionContext, globusHostType, gateKeeper);
+
+    }
+
+    private void renewCredentials(JobExecutionContext jobExecutionContext) throws GFacException {
+
+        renewCredentials(this.job, jobExecutionContext);
+    }
+
+    private void renewCredentials(GramJob gramJob, JobExecutionContext jobExecutionContext) throws GFacException {
+
+        GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.
+                getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).renewCredentials();
+
+        try {
+            gramJob.renew(gssCred);
+        } catch (GramException e1) {
+            throw new GFacException("Unable to renew credentials. Job Id - "
+                    + gramJob.getIDAsString(), e1);
+        } catch (GSSException e1) {
+            throw new GFacException("Unable to renew credentials. Job Id - "
+                    + gramJob.getIDAsString(), e1);
+        }
+    }
+
+    private void reSubmitJob(String gateKeeper,
+                             JobExecutionContext jobExecutionContext,
+                             GlobusHostType globusHostType, Exception e) throws GFacException, GFacProviderException {
+
+        if (!renewCredentialsAttempt) {
+
+            renewCredentialsAttempt = true;
+
+            // User credentials are invalid
+            log.error("Error while submitting job - Credentials provided are invalid. Job Id - "
+                    + job.getIDAsString(), e);
+            log.info("Attempting to renew credentials and re-submit jobs...");
+
+            // Remove existing listener and register a new listener
+            job.removeListener(listener);
+            listener = new GramJobSubmissionListener(job, jobExecutionContext);
+
+            job.addListener(listener);
+
+            renewCredentials(jobExecutionContext);
+
+            submitJobs(gateKeeper, jobExecutionContext, globusHostType);
+
+        } else {
+            throw new GFacException("Error while submitting job - Credentials provided are invalid. Job Id - "
+                    + job.getIDAsString(), e);
+        }
+
+    }
+
+    private void reSubmitJob(String gateKeeper,
+                             JobExecutionContext jobExecutionContext,
+                             GlobusHostType globusHostType) throws GFacException, GFacProviderException {
+
+        // User credentials are invalid
+        log.info("Attempting to renew credentials and re-submit jobs...");
+
+        // Remove existing listener and register a new listener
+        job.removeListener(listener);
+        listener = new GramJobSubmissionListener(job, jobExecutionContext);
+
+        job.addListener(listener);
+
+        renewCredentials(jobExecutionContext);
+
+        submitJobs(gateKeeper, jobExecutionContext, globusHostType);
+
+    }
+
+	private void saveApplicationJob(JobExecutionContext jobExecutionContext, ApplicationJobStatus jobStatus) {
 		ApplicationJob appJob = GFacUtils.createApplicationJob(jobExecutionContext);
 		appJob.setJobId(job.getIDAsString());
 		appJob.setJobData(job.getRSL());
 		appJob.setSubmittedTime(Calendar.getInstance().getTime());
-		appJob.setStatus(ApplicationJobStatus.SUBMITTED);
+		appJob.setStatus(jobStatus);
 		appJob.setStatusUpdateTime(appJob.getSubmittedTime());
 		GFacUtils.recordApplicationJob(jobExecutionContext, appJob);
 	}
@@ -146,43 +330,186 @@ public class GramProvider implements GFa
     public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException {
     }
 
-    public void initProperties(Map<String, String> properties) throws GFacProviderException, GFacException {
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+
+        List<ApplicationJob> jobs = GFacUtils.getJobIds(jobExecutionContext, experimentId);
+
+        for (ApplicationJob job : jobs) {
+            cancelSingleJob(job.getJobId(), jobExecutionContext);
+        }
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId,
+                          JobExecutionContext jobExecutionContext) throws GFacException {
+        List<ApplicationJob> jobs = GFacUtils.getJobIds(jobExecutionContext, experimentId, workflowId);
+
+        for (ApplicationJob job : jobs) {
+            cancelSingleJob(job.getJobId(), jobExecutionContext);
+        }
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId,
+                          JobExecutionContext jobExecutionContext) throws GFacException {
+        List<ApplicationJob> jobs = GFacUtils.getJobIds(jobExecutionContext, experimentId, workflowId, nodeId);
+
+        for (ApplicationJob job : jobs) {
+            cancelSingleJob(job.getJobId(), jobExecutionContext);
+        }
+    }
+
+
+    private void cancelSingleJob(String jobId, JobExecutionContext context) throws GFacException {
+        // First check whether job id is in the cache
+        if (currentlyExecutingJobCache.containsKey(jobId)) {
+
+            synchronized (this) {
+                GramJob gramJob = currentlyExecutingJobCache.get(jobId);
+
+                // Even though we check using containsKey, at this point job could be null
+                if (gramJob != null && (gramJob.getStatus() != GRAMConstants.STATUS_DONE ||
+                        gramJob.getStatus() != GRAMConstants.STATUS_FAILED)) {
+                    cancelJob(gramJob, context);
+                }
+            }
+
+        } else {
+
+            GSSCredential gssCred = ((GSISecurityContext)context.
+                    getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();
+
+            GramJob gramJob = new GramJob(null);
+            try {
+                gramJob.setID(jobId);
+            } catch (MalformedURLException e) {
+                throw new GFacException("Invalid job id - " + jobId, e);
+            }
+            gramJob.setCredentials(gssCred);
+
+            synchronized (this) {
+                if (gramJob.getStatus() != GRAMConstants.STATUS_DONE ||
+                        gramJob.getStatus() != GRAMConstants.STATUS_FAILED) {
+                    cancelJob(gramJob, context);
+                }
+            }
+        }
+    }
+
+    private void cancelJob(GramJob gramJob, JobExecutionContext context) throws GFacException{
+
+        try {
+            gramJob.cancel();
+        } catch (GramException e) {
+            throw new GFacException("Error cancelling job, id - " + gramJob.getIDAsString(), e);
+        } catch (GSSException e) {
+
+            log.warn("Credentials invalid to cancel job. Attempting to renew credentials and re-try. " +
+                    "Job id - " + gramJob.getIDAsString());
+            renewCredentials(gramJob, context);
+
+            try {
+                gramJob.cancel();
+                gramJob.signal(GramJob.SIGNAL_COMMIT_END);
+            } catch (GramException e1) {
+                throw new GFacException("Error cancelling job, id - " + gramJob.getIDAsString(), e1);
+            } catch (GSSException e1) {
+                throw new GFacException("Error cancelling job, invalid credentials. Job id - "
+                        + gramJob.getIDAsString(), e);
+            }
+        }
+
+    }
+
+    public void initProperties(Map<String, String> properties) throws GFacException {
 
     }
 
     private void checkJobStatus(JobExecutionContext jobExecutionContext, GlobusHostType host, String gateKeeper)
             throws GFacProviderException {
-        int jobStatus = listener.getStatus();
+        int jobStatus = listener.getCurrentStatus();
 
         if (jobStatus == GramJob.STATUS_FAILED) {
-            String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Job Exit Code = "
-                    + listener.getError();
-            if (listener.getError() == 24) {
-                try {
-                    job.request(gateKeeper, false, false);
-                    listener.waitFor();
-                } catch (GramException e) {
-                    log.error(e.getMessage());
-                    JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(),
-                            host.getGlobusGateKeeperEndPointArray(0), job.getRSL(), jobExecutionContext);
-                    throw error;
-                } catch (GSSException e) {
-                    log.error(e.getMessage());
-                    throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
-                } catch (InterruptedException e) {
-                    log.error(e.getMessage());
-                    throw new GFacProviderException("Thread", e, jobExecutionContext);
-                } catch (GFacException e) {
-                    JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST", gateKeeper,
-                            job.getRSL(), jobExecutionContext);
-                    throw error;
-                }
-            }
-            JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST", gateKeeper,
-                            job.getRSL(), jobExecutionContext);
-                    throw error;
 
+            String errorMsg = "Job " + job.getIDAsString() + " on host " + host.getHostAddress() + " Job Exit Code = "
+                    + listener.getError() + " Error Description = " + getGramErrorString(listener.getError());
+
+            if (listener.getError() == GRAMProtocolErrorConstants.INVALID_SCRIPT_REPLY) {
+
+                // re-submitting without renewing
+                // TODO verify why we re-submit jobs when we get a invalid script reply
+                if (!reSubmissionInProgress) {
+                    reSubmissionInProgress = true;
+
+                    log.info("Invalid script reply received. Re-submitting job, id - " + job.getIDAsString());
+                    try {
+                        reSubmitJob(gateKeeper, jobExecutionContext, host);
+                    } catch (GFacException e) {
+                        throw new GFacProviderException
+                                ("Error during re-submission. Original job submission data - " + errorMsg,  e);
+                    }
+                    return;
+                }
+
+            } else if (listener.getError() == GRAMProtocolErrorConstants.ERROR_AUTHORIZATION) {
+
+                // re-submit with renewed credentials
+                if (!authorisationFailedAttempt) {
+                    authorisationFailedAttempt = true;
+                    log.info("Authorisation error contacting provider. Re-submitting job with renewed credentials.");
+
+                    try {
+                        renewCredentials(jobExecutionContext);
+                        reSubmitJob(gateKeeper, jobExecutionContext, host);
+                    } catch (GFacException e) {
+                        throw new GFacProviderException
+                                ("Error during re-submission. Original job submission data - " + errorMsg,  e);
+                    }
+
+                    return;
+                }
+
+            } else if (listener.getError() == GRAMProtocolErrorConstants.USER_CANCELLED) {
+
+                log.info("User successfully cancelled job id " + job.getIDAsString());
+                return;
+            }
+
+
+
+            log.error(errorMsg);
+
+            synchronized (this) {
+                currentlyExecutingJobCache.remove(job.getIDAsString());
+            }
+
+            throw new JobSubmissionFault(new Exception(errorMsg), host.getHostAddress(), gateKeeper,
+                            job.getRSL(), jobExecutionContext, getGramErrorString(listener.getError()),
+                    listener.getError());
+
+        } else if (jobStatus == GramJob.STATUS_DONE) {
+            log.info("Job " + job.getIDAsString() + " on host " + host.getHostAddress() + " is successfully executed.");
+
+            synchronized (this) {
+                currentlyExecutingJobCache.remove(job.getIDAsString());
+            }
+        }
+    }
+
+    private String getGramErrorString(int errorCode) {
+
+        if (resources != null) {
+            try {
+                return resources.getString(String.valueOf(errorCode));
+            } catch (MissingResourceException mre) {
+                log.warn("Error reading globus error descriptions.", mre);
+                return "Error code: " + errorCode;
+            }
+        } else {
+            return "Error code: " + errorCode;
         }
+
     }
 
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/HadoopProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/HadoopProvider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/HadoopProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/HadoopProvider.java Sat Jul 13 00:49:09 2013
@@ -49,6 +49,7 @@ import org.apache.hadoop.mapreduce.lib.i
 import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 /**
  * Executes hadoop job using the cluster configuration provided by handlers in
@@ -140,6 +141,21 @@ public class HadoopProvider implements G
         // TODO: How to handle cluster shutdown. Best way is to introduce inPath/outPath to handler.
     }
 
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
     public void initProperties(Map<String, String> properties) throws GFacProviderException, GFacException {
 
     }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java Sat Jul 13 00:49:09 2013
@@ -48,6 +48,7 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.xmlbeans.XmlException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 public class LocalProvider implements GFacProvider {
     private static final Logger log = LoggerFactory.getLogger(LocalProvider.class);
@@ -213,6 +214,21 @@ public class LocalProvider implements GF
         }
     }
 
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
     private void buildCommand(String executable, List<String> inputParameterList){
         cmdList.add(executable);
         cmdList.addAll(inputParameterList);

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java Sat Jul 13 00:49:09 2013
@@ -56,6 +56,7 @@ import org.apache.airavata.schemas.gfac.
 import org.apache.airavata.schemas.gfac.URIArrayType;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
 
 /**
  * Execute application using remote SSH
@@ -135,7 +136,22 @@ public class SSHProvider implements GFac
 	public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException {
 	}
 
-	private File createShellScript(JobExecutionContext context) throws IOException {
+    @Override
+    public void cancelJob(String experimentId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    @Override
+    public void cancelJob(String experimentId, String workflowId, String nodeId, JobExecutionContext jobExecutionContext) throws GFacException {
+        throw new NotImplementedException();
+    }
+
+    private File createShellScript(JobExecutionContext context) throws IOException {
 		ApplicationDeploymentDescriptionType app = context.getApplicationContext()
 				.getApplicationDeploymentDescription().getType();
 		String uniqueDir = app.getApplicationName().getStringValue() + System.currentTimeMillis()

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java Sat Jul 13 00:49:09 2013
@@ -22,8 +22,11 @@ package org.apache.airavata.gfac.utils;
 
 import org.apache.airavata.client.api.AiravataAPI;
 import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
+import org.apache.airavata.common.utils.DBUtil;
 import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.RequestData;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.deployment.classloaders.JarFileClassLoader;
 import org.apache.airavata.registry.api.workflow.ApplicationJob;
@@ -31,6 +34,7 @@ import org.apache.airavata.registry.api.
 import org.apache.airavata.schemas.gfac.*;
 import org.apache.axiom.om.OMElement;
 import org.apache.axis2.deployment.DeploymentException;
+import org.globus.gram.GramJob;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -418,41 +422,143 @@ public class GFacUtils {
 		appJob.setApplicationDescriptionId(jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType().getApplicationName().getStringValue());
 		return appJob;
 	}
-	
-	public static void updateApplicationJobStatusUpdateTime(JobExecutionContext context, String jobId, Date statusUpdateTime){
+
+    public static void updateApplicationJobStatusUpdateTime(JobExecutionContext context, String jobId, Date statusUpdateTime) {
         AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
-		if(airavataAPI != null){
-			try {
-				airavataAPI.getProvenanceManager().updateApplicationJobStatusUpdateTime(jobId, statusUpdateTime);
-			} catch (AiravataAPIInvocationException e) {
-				log.error("Error in updating application job status time "+statusUpdateTime.toString()+" for job Id "+jobId+"!!!", e);
-			}
+        try {
+            airavataAPI.getProvenanceManager().updateApplicationJobStatusUpdateTime(jobId, statusUpdateTime);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error in updating application job status time " + statusUpdateTime.toString() + " for job Id " + jobId + "!!!", e);
         }
-	}
-	
-	public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status, Date statusUpdateTime){
+    }
+
+    public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status, Date statusUpdateTime) {
         AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
-		if(airavataAPI != null){
-			try {
-				airavataAPI.getProvenanceManager().updateApplicationJobStatus(jobId, status, statusUpdateTime);
-			} catch (AiravataAPIInvocationException e) {
-				log.error("Error in updating application job status "+status.toString()+" for job Id "+jobId+"!!!", e);
-			}
+        try {
+            airavataAPI.getProvenanceManager().updateApplicationJobStatus(jobId, status, statusUpdateTime);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error in updating application job status " + status.toString() + " for job Id " + jobId + "!!!", e);
         }
-	}
-	
-	public static void recordApplicationJob(JobExecutionContext context, ApplicationJob job){
+    }
+
+    /**
+     * Gets the job ids given experiment id.
+     *
+     * @param context      The job execution context.
+     * @param experimentId The experiment id.
+     * @return List of job ids relevant to given experiment id.
+     */
+    public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId) {
+
         AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
-		if(airavataAPI != null){
-			try {
-				airavataAPI.getProvenanceManager().addApplicationJob(job);
-			} catch (AiravataAPIInvocationException e) {
-				log.error("Error in persisting application job data for application job "+job.getJobId()+"!!!", e);
-			}
+        try {
+            return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, null, null);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error retrieving application jobs for experiment id " + experimentId, e);
         }
-	}
-	
-	public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status){
-		updateApplicationJobStatus(context, jobId, status, Calendar.getInstance().getTime());
-	}
+
+        return new ArrayList<ApplicationJob>(0);
+    }
+
+    /**
+     * Gets the job ids given experiment id and workflow id.
+     *
+     * @param context      The job execution context.
+     * @param experimentId The experiment id.
+     * @param workflowId   The workflow id
+     * @return List of job ids relevant to given experiment id and workflow id.
+     */
+    public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId, String workflowId) {
+
+        AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+        try {
+            return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, null);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
+                    workflowId, e);
+        }
+
+        return new ArrayList<ApplicationJob>(0);
+    }
+
+    /**
+     * Gets the job ids given experiment id and workflow id.
+     *
+     * @param context      The job execution context.
+     * @param experimentId The experiment id.
+     * @param workflowId   The workflow id
+     * @return List of job ids relevant to given experiment id and workflow id.
+     */
+    public static List<ApplicationJob> getJobIds(JobExecutionContext context, String experimentId,
+                                                 String workflowId, String nodeId) {
+
+        AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+        try {
+            return airavataAPI.getProvenanceManager().getApplicationJobs(experimentId, workflowId, nodeId);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error retrieving application jobs for experiment id " + experimentId, " workflow id " +
+                    workflowId, e);
+        }
+
+        return new ArrayList<ApplicationJob>(0);
+    }
+
+    /*public static RequestData getRequestData(Properties configurationProperties) {
+
+        RequestData requestData = new RequestData();
+
+        requestData.setMyProxyServerUrl(configurationProperties.getProperty(Constants.MYPROXY_SERVER));
+        requestData.setMyProxyUserName(configurationProperties.getProperty(Constants.MYPROXY_USER));
+        requestData.setMyProxyPassword(configurationProperties.getProperty(Constants.MYPROXY_PASS));
+
+        int lifeTime;
+        String sLife = configurationProperties.getProperty(Constants.MYPROXY_LIFE);
+        if (sLife != null) {
+            lifeTime = Integer.parseInt(sLife);
+            requestData.setMyProxyLifeTime(lifeTime);
+        } else {
+            log.info("The configuration does not specify a default life time");
+        }
+
+
+
+    }
+*/
+
+
+    public static void recordApplicationJob(JobExecutionContext context, ApplicationJob job) {
+        AiravataAPI airavataAPI = context.getGFacConfiguration().getAiravataAPI();
+        try {
+            airavataAPI.getProvenanceManager().addApplicationJob(job);
+        } catch (AiravataAPIInvocationException e) {
+            log.error("Error in persisting application job data for application job " + job.getJobId() + "!!!", e);
+        }
+    }
+
+    public static void updateApplicationJobStatus(JobExecutionContext context, String jobId, ApplicationJobStatus status) {
+        updateApplicationJobStatus(context, jobId, status, Calendar.getInstance().getTime());
+    }
+
+    public static ApplicationJobStatus getApplicationJobStatus(int gramStatus){
+        switch(gramStatus){
+            case GramJob.STATUS_UNSUBMITTED:
+                return ApplicationJobStatus.UN_SUBMITTED;
+            case GramJob.STATUS_ACTIVE:
+                return ApplicationJobStatus.EXECUTING;
+            case GramJob.STATUS_DONE:
+                return ApplicationJobStatus.FINISHED;
+            case GramJob.STATUS_FAILED:
+                return ApplicationJobStatus.FAILED;
+            case GramJob.STATUS_PENDING:
+                return ApplicationJobStatus.PENDING;
+            case GramJob.STATUS_STAGE_IN:
+                return ApplicationJobStatus.INITIALIZE;
+            case GramJob.STATUS_STAGE_OUT:
+                return ApplicationJobStatus.FINALIZE;
+            case GramJob.STATUS_SUSPENDED:
+                return ApplicationJobStatus.SUSPENDED;
+            default:
+                return ApplicationJobStatus.UNKNOWN;
+        }
+    }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java Sat Jul 13 00:49:09 2013
@@ -20,30 +20,25 @@
 */
 package org.apache.airavata.gfac.utils;
 
-import java.util.Calendar;
-
-import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.notification.events.StatusChangeEvent;
-import org.apache.airavata.registry.api.workflow.ApplicationJob.ApplicationJobStatus;
-import org.globus.gram.GramException;
 import org.globus.gram.GramJob;
 import org.globus.gram.GramJobListener;
 import org.ietf.jgss.GSSCredential;
-import org.ietf.jgss.GSSException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class GramJobSubmissionListener implements GramJobListener{
     private final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
-    public static final String MYPROXY_SECURITY_CONTEXT = "myproxy";
-    private static final int JOB_PROXY_REMAINING_TIME_LIMIT = 900;
 
-    private static final long JOB_FINISH_WAIT_TIME = 60 * 1000l;
-    private boolean finished;
-    private int error;
-    private int status;
+    public static final int NO_ERROR = -42;
+    public static final int INITIAL_STATUS = -43;
+
+    private volatile boolean jobDone = false;
+    private volatile int error = NO_ERROR;
+    private int currentStatus = INITIAL_STATUS;
+
     private JobExecutionContext context;
     private GramJob job;
 
@@ -53,109 +48,91 @@ public class GramJobSubmissionListener i
     }
 
     /**
-     * This method is used to block the process until the status of the job is DONE or FAILED
-     *
-     * @throws InterruptedException
-     * @throws GSSException
-     * @throws GramException
-     * @throws SecurityException
+     * This method is used to block the process until the currentStatus of the job is DONE or FAILED
      */
-    public void waitFor() throws InterruptedException, GSSException, GramException, SecurityException,GFacException {
-        while (!isFinished()) {
-            int proxyExpTime = job.getCredentials().getRemainingLifetime();
-            if (proxyExpTime < JOB_PROXY_REMAINING_TIME_LIMIT) {
-                log.info("Job proxy expired. Trying to renew proxy");
-                GSSCredential gssCred = ((GSISecurityContext)context.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getGssCredentials();
-                job.renew(gssCred);
-                log.info("Myproxy renewed");
-            }
+    public void waitFor()  {
+        while (!isJobDone()) {
 
             synchronized (this) {
 
-                /*
-                 * job status is changed but method isn't invoked
-                 */
-                if (status != 0) {
-                    if (job.getStatus() != status) {
-                        log.info("Change job status manually");
-                        if (setStatus(job.getStatus(), job.getError())) {
-                            break;
-                        }
-                    } else {
-                    	GFacUtils.updateApplicationJobStatusUpdateTime(context, job.getIDAsString(), Calendar.getInstance().getTime());
-                        log.info("job " + job.getIDAsString() + " have same status: "
-                                + GramJob.getStatusAsString(status));
-                    }
-                } else {
-                    log.info("Status is zero");
-                }
-
-                wait(JOB_FINISH_WAIT_TIME);
+                try {
+                    wait();
+                } catch (InterruptedException e) {}
             }
         }
     }
 
-    private ApplicationJobStatus getApplicationJobStatus(int gramStatus){
-    	switch(gramStatus){
-    	case GramJob.STATUS_ACTIVE:
-    		return ApplicationJobStatus.EXECUTING;
-    	case GramJob.STATUS_DONE:
-    		return ApplicationJobStatus.FINISHED;
-    	case GramJob.STATUS_FAILED:
-    		return ApplicationJobStatus.FAILED;
-    	case GramJob.STATUS_PENDING:
-    		return ApplicationJobStatus.PENDING;
-    	case GramJob.STATUS_STAGE_IN:
-    		return ApplicationJobStatus.INITIALIZE;
-    	case GramJob.STATUS_STAGE_OUT:
-    		return ApplicationJobStatus.FINALIZE;
-    	case GramJob.STATUS_SUSPENDED:
-    		return ApplicationJobStatus.SUSPENDED;
-    	default:
-    		return ApplicationJobStatus.UNKNOWN;
-    	}
-    }
+
     
-    private synchronized boolean isFinished() {
-        return this.finished;
+    private synchronized boolean isJobDone() {
+        return this.jobDone;
     }
 
-    private synchronized boolean setStatus(int status, int error) {
-		GFacUtils.updateApplicationJobStatus(context,job.getIDAsString(), getApplicationJobStatus(status));
-        this.status = status;
+    private void setStatus(int status, int error) {
+		GFacUtils.updateApplicationJobStatus(context,job.getIDAsString(),
+                GFacUtils.getApplicationJobStatus(status));
+        this.currentStatus = status;
         this.error = error;
 
-        switch (this.status) {
+        switch (this.currentStatus) {
         case GramJob.STATUS_FAILED:
             log.info("Job Error Code: " + error);
-            this.finished = true;
+            this.jobDone = true;
+            notifyAll();
         case GramJob.STATUS_DONE:
-            this.finished = true;
+            this.jobDone = true;
+            notifyAll();
         }
 
-        return this.finished;
     }
 
     public synchronized void statusChanged(GramJob job) {
+
+        int jobStatus = job.getStatus();
         String jobStatusMessage = "Status of job " + job.getIDAsString() + "is " + job.getStatusAsString();
         /*
-         * Notify status change
+         * Notify currentStatus change
          */
         this.context.getNotifier().publish(new StatusChangeEvent(jobStatusMessage));
 
         /*
-         * Set new status if it is finished, notify all wait object
+         * Set new currentStatus if it is jobDone, notify all wait object
          */
-        if (setStatus(job.getStatus(), job.getError())) {
-            notifyAll();
+        if (currentStatus != jobStatus) {
+            currentStatus = jobStatus;
+
+            setStatus(job.getStatus(), job.getError());
+
+            // Test to see whether we need to renew credentials
+            renewCredentials(job);
+        }
+    }
+
+    private void renewCredentials(GramJob job) {
+
+        try {
+
+            int proxyExpTime = job.getCredentials().getRemainingLifetime();
+            if (proxyExpTime < GSISecurityContext.CREDENTIAL_RENEWING_THRESH_HOLD) {
+                log.info("Job proxy expired. Trying to renew proxy");
+                GSSCredential gssCred = ((GSISecurityContext)context.
+                        getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).renewCredentials();
+                job.renew(gssCred);
+                log.info("MyProxy credentials are renewed .");
+            }
+
+        } catch (Exception e) {
+            log.error("An error occurred while trying to renew credentials. Job id " + job.getIDAsString());
         }
+
+
     }
 
     public synchronized int getError() {
         return error;
     }
 
-    public synchronized int getStatus() {
-        return status;
+    public synchronized int getCurrentStatus() {
+        return currentStatus;
     }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java Sat Jul 13 00:49:09 2013
@@ -31,12 +31,16 @@ import org.slf4j.LoggerFactory;
 public class GramProviderUtils {
     private static final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
 
-    public static GramJob setupEnvironment(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+    public static GramJob setupEnvironment(JobExecutionContext jobExecutionContext, boolean enableTwoPhase) throws GFacProviderException {
         log.debug("Searching for Gate Keeper");
         try {
             GramAttributes jobAttr = GramRSLGenerator.configureRemoteJob(jobExecutionContext);
             String rsl = jobAttr.toRSL();
 
+            if (enableTwoPhase) {
+                rsl = rsl + "(twoPhase=yes)";
+            }
+
             log.debug("RSL = " + rsl);
             GramJob job = new GramJob(rsl);
             return job;

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/AbstractBESTest.java Sat Jul 13 00:49:09 2013
@@ -25,10 +25,15 @@ import java.net.URL;
 import java.util.Date;
 import java.util.UUID;
 
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
 import org.apache.airavata.commons.gfac.type.ApplicationDescription;
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
 import org.apache.airavata.gfac.GFacConfiguration;
+import org.apache.airavata.gfac.RequestData;
 import org.apache.airavata.gfac.context.ApplicationContext;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
@@ -36,13 +41,15 @@ import org.apache.airavata.gfac.context.
 import org.apache.airavata.schemas.gfac.JobTypeType;
 import org.apache.airavata.schemas.gfac.UnicoreHostType;
 import org.apache.log4j.PropertyConfigurator;
+import org.junit.BeforeClass;
 
-public abstract class AbstractBESTest {
+public abstract class AbstractBESTest extends GFacBaseTestCase {
 
 	protected JobExecutionContext jobExecutionContext;
 
 	public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
 
+
 	// public static final String[] hostArray = new String[] {
 	// "https://deisa-unic.fz-juelich.de:9111/FZJ_JUROPA/services/BESFactory?res=default_bes_factory"
 	// };
@@ -124,10 +131,4 @@ public abstract class AbstractBESTest {
 
 	protected abstract MessageContext getOutMessageContext();
 
-	private GSISecurityContext getSecurityContext() {
-		GSISecurityContext context = new GSISecurityContext("myproxy.teragrid.org", "******", "*******", 3600,
-                "/Users/raminder/.globus/certificates");
-		return context;
-	}
-
 }

Added: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestCase.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestCase.java?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestCase.java (added)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GFacBaseTestCase.java Sat Jul 13 00:49:09 2013
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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.core.gfac.services.impl;
+
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.impl.CredentialReaderImpl;
+import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.gfac.context.security.GSISecurityContext;
+import org.junit.BeforeClass;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/11/13
+ * Time: 1:31 AM
+ */
+
+public class GFacBaseTestCase extends DatabaseTestCases {
+
+    @BeforeClass
+    public static void setUpDatabase() throws Exception {
+        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
+
+        waitTillServerStarts();
+
+        /*
+         * String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + "        GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + "        CREDENTIAL BLOB NOT NULL,\n" +
+         * "        PRIVATE_KEY BLOB NOT NULL,\n" + "        NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
+         * "        NOT_AFTER VARCHAR(256) NOT NULL,\n" + "        LIFETIME INTEGER NOT NULL,\n" +
+         * "        REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
+         * "        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
+         */
+
+        String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n"
+                + "        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
+                + "        TOKEN_ID VARCHAR(256) NOT NULL,\n"
+                + // Actual token used to identify the credential
+                "        CREDENTIAL BLOB NOT NULL,\n" + "        PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
+                + "        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n"
+                + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
+
+        String dropTable = "drop table CREDENTIALS";
+
+        try {
+            executeSQL(dropTable);
+        } catch (Exception e) {
+        }
+
+        executeSQL(createTable);
+
+    }
+
+    public GSISecurityContext getSecurityContext() throws Exception {
+        GSISecurityContext.setUpTrustedCertificatePath("/Users/raminder/.globus/certificates");
+        RequestData requestData = new RequestData();
+        requestData.setMyProxyServerUrl("myproxy.teragrid.org");
+        requestData.setMyProxyUserName("******");
+        requestData.setMyProxyPassword("*******");
+        requestData.setMyProxyLifeTime(3600);
+        CredentialReader credentialReader = new CredentialReaderImpl(getDbUtil());
+        return new GSISecurityContext(credentialReader, requestData);
+    }
+
+}

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java Sat Jul 13 00:49:09 2013
@@ -53,7 +53,7 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 
-public class GramProviderTest {
+public class GramProviderTest extends GFacBaseTestCase {
     private JobExecutionContext jobExecutionContext;
 
 
@@ -71,6 +71,7 @@ public class GramProviderTest {
     @Before
     public void setUp() throws Exception {
         URL resource = GramProviderTest.class.getClassLoader().getResource("gfac-config.xml");
+        assert resource != null;
         System.out.println(resource.getFile());
         GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
 //        gFacConfiguration.setMyProxyLifeCycle(3600);
@@ -209,11 +210,6 @@ public class GramProviderTest {
 
     }
 
-	private GSISecurityContext getSecurityContext() {
-		GSISecurityContext context = new GSISecurityContext("myproxy.teragrid.org", "xxxx", "xxxxxx", 3600, "~/.globus/certificates");
-		return context;
-	}
-
     @Test
     public void testGramProvider() throws GFacException {
         GFacAPI gFacAPI = new GFacAPI();

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/JSDLGeneratorTest.java Sat Jul 13 00:49:09 2013
@@ -58,7 +58,7 @@ import org.junit.Before;
 import org.junit.Test;
 import org.ogf.schemas.jsdl.JobDefinitionDocument;
 
-public class JSDLGeneratorTest {
+public class JSDLGeneratorTest extends GFacBaseTestCase {
 
     public static final String[] hostArray = new String[] { "https://zam1161v01.zam.kfa-juelich.de:8002/INTEROP1/services/BESFactory?res=default_bes_factory" };
     public static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2811";
@@ -269,12 +269,6 @@ public class JSDLGeneratorTest {
         return om1;
     }
 
-    private GSISecurityContext getSecurityContext() {
-        GSISecurityContext context = new GSISecurityContext("myproxy.teragrid.org", "******", "*********", 3600,
-                "**********");
-        return context;
-    }
-
     @Before
     public void initJobContext() throws Exception {
         PropertyConfigurator.configure("src/test/resources/logging.properties");

Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java?rev=1502732&r1=1502731&r2=1502732&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java Sat Jul 13 00:49:09 2013
@@ -53,14 +53,14 @@ import org.apache.airavata.schemas.gfac.
 import org.junit.Before;
 import org.junit.Test;
 
-public class ParamChemTest {
+public class ParamChemTest extends GFacBaseTestCase {
     private JobExecutionContext jobExecutionContext;
 
     @Before
     public void setUp() throws Exception {
 
         GFacConfiguration gFacConfiguration = new GFacConfiguration(null);
-        GSISecurityContext context = new GSISecurityContext("myproxy.teragrid.org", "*****", "*****", 3600, "./certificates");
+        GSISecurityContext context = getSecurityContext();
 
         //have to set InFlwo Handlers and outFlowHandlers
         gFacConfiguration.setInHandlers(Arrays.asList(new GFacHandlerConfig[]{new GFacHandlerConfig(null,"org.apache.airavata.gfac.handler.GramDirectorySetupHandler"), new GFacHandlerConfig(null,"org.apache.airavata.gfac.handler.GridFTPInputHandler")}));

Added: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTest.java?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTest.java (added)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/context/security/GSISecurityContextTest.java Sat Jul 13 00:49:09 2013
@@ -0,0 +1,157 @@
+/*
+ *
+ * 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.context.security;
+
+import junit.framework.Assert;
+import org.apache.airavata.common.utils.AiravataUtils;
+import org.apache.airavata.common.utils.DatabaseTestCases;
+import org.apache.airavata.common.utils.DerbyUtil;
+import org.apache.airavata.credential.store.store.CredentialReader;
+import org.apache.airavata.credential.store.store.CredentialReaderFactory;
+import org.apache.airavata.gfac.RequestData;
+import org.apache.log4j.Logger;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import java.io.File;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/12/13
+ * Time: 12:58 PM
+ */
+
+@Test(enabled=false)
+public class GSISecurityContextTest extends DatabaseTestCases {
+
+    private static String userName;
+    private static String password;
+
+    private static final Logger log = Logger.getLogger(GSISecurityContextTest.class);
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+        AiravataUtils.setExecutionAsServer();
+
+        userName = System.getProperty("myproxy.user");
+        password = System.getProperty("myproxy.password");
+
+        if (userName == null || password == null || userName.trim().equals("") || password.trim().equals("")) {
+            log.error("===== Please set myproxy.user and myproxy.password system properties. =======");
+            Assert.fail("Please set myproxy.user and myproxy.password system properties.");
+        }
+
+        log.info("Using my proxy user name - " + userName);
+
+        setUpDatabase();
+
+    }
+
+    public static void setUpDatabase() throws Exception {
+        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
+
+        waitTillServerStarts();
+
+        /*
+         * String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + "        GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + "        CREDENTIAL BLOB NOT NULL,\n" +
+         * "        PRIVATE_KEY BLOB NOT NULL,\n" + "        NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
+         * "        NOT_AFTER VARCHAR(256) NOT NULL,\n" + "        LIFETIME INTEGER NOT NULL,\n" +
+         * "        REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
+         * "        REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
+         * "        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
+         */
+
+        String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n"
+                + "        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
+                + "        TOKEN_ID VARCHAR(256) NOT NULL,\n"
+                + // Actual token used to identify the credential
+                "        CREDENTIAL BLOB NOT NULL,\n" + "        PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
+                + "        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n"
+                + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
+
+        String dropTable = "drop table CREDENTIALS";
+
+        try {
+            executeSQL(dropTable);
+        } catch (Exception e) {
+        }
+
+        executeSQL(createTable);
+
+    }
+
+    @AfterClass
+    public static void shutDownDatabase() throws Exception {
+        DerbyUtil.stopDerbyServer();
+    }
+
+    @Test
+    public void testGetTrustedCertificatePath() throws Exception {
+
+        File f = new File(GSISecurityContext.getTrustedCertificatePath());
+        Assert.assertTrue(f.exists());
+    }
+
+    @Test
+    public void testGetGssCredentials() throws Exception {
+
+        RequestData requestData = new RequestData();
+
+        requestData.setMyProxyUserName(userName);
+        requestData.setMyProxyPassword(password);
+
+        CredentialReader credentialReader = CredentialReaderFactory.createCredentialStoreReader(getDbUtil());
+
+        GSISecurityContext gsiSecurityContext = new GSISecurityContext(credentialReader, requestData);
+
+        Assert.assertNotNull(gsiSecurityContext.getGssCredentials());
+
+
+    }
+
+    @Test
+    public void testRenewCredentials() throws Exception {
+
+    }
+
+    @Test
+    public void testGetCredentialsFromStore() throws Exception {
+
+    }
+
+    @Test
+    public void testGetDefaultCredentials() throws Exception {
+
+    }
+
+    @Test
+    public void testGetProxyCredentials() throws Exception {
+
+    }
+
+    @Test
+    public void testRenewCredentialsAsATrustedHost() throws Exception {
+
+    }
+}

Added: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTest.java?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTest.java (added)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/gfac/provider/impl/GramProviderTest.java Sat Jul 13 00:49:09 2013
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.provider.impl;
+
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * User: AmilaJ (amilaj@apache.org)
+ * Date: 7/12/13
+ * Time: 11:17 AM
+ */
+
+public class GramProviderTest {
+    @BeforeMethod
+    public void setUp() throws Exception {
+
+    }
+
+    @AfterMethod
+    public void tearDown() throws Exception {
+
+    }
+
+    @Test
+    public void testExecute() throws Exception {
+        System.out.println("======================================================================================");
+        System.out.println("Executing test .......................................................................");
+
+    }
+
+    @Test
+    public void testCancelJob() throws Exception {
+
+    }
+}

Added: airavata/trunk/modules/gfac-core/src/test/resources/airavata-server.properties
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/resources/airavata-server.properties?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/resources/airavata-server.properties (added)
+++ airavata/trunk/modules/gfac-core/src/test/resources/airavata-server.properties Sat Jul 13 00:49:09 2013
@@ -0,0 +1,224 @@
+#
+#
+# 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.
+#
+
+###########################################################################
+#
+#  This properties file provides configuration for all Airavata Services: 
+#  Registry, Workflow Interpreter, GFac, Message Broker, Message Box
+#
+###########################################################################
+
+###########################################################################
+# Airavata Embedded-Tomcat Server Configuration
+###########################################################################
+# By default, tomcat runs on port 80. If the port is changed, it will be  
+#  have to be specified with port properties. This will be picked up by 
+#  the registry service to register the service end-points.
+
+port=8080
+
+# Axis2 server automatically picks up IP address from axis configuration, 
+#  but some DHCP enables machines do not report correct ip addresses,  
+#  in which case, the IP address can be manually specified. 
+
+#ip=192.2.33.12
+
+
+#This property will enable https and stops http, during the url registration, https urls will be stored and
+# http urls will not get registered, because currently airavata supports only one url for each service
+#enable.https=false
+
+###########################################################################
+# Airavata Registry Configuration
+###########################################################################
+system.gateway=default
+system.user=admin
+system.password=admin
+#for derby [AiravataJPARegistry]
+registry.jdbc.driver=org.apache.derby.jdbc.ClientDriver
+registry.jdbc.url=jdbc:derby://localhost:1527/persistent_data;create=true;user=airavata;password=airavata
+# MySql database configuration
+#registry.jdbc.driver=com.mysql.jdbc.Driver
+#registry.jdbc.url=jdbc:mysql://localhost:3306/persistent_data
+registry.jdbc.user=airavata
+registry.jdbc.password=airavata
+start.derby.server.mode=true
+default.registry.user=admin
+default.registry.password=admin
+default.registry.password.hash.method=SHA
+default.registry.gateway=default
+validationQuery=SELECT 1 from Configuration
+jpa.connection.properties=MaxActive=10,MaxIdle=5,MinIdle=2,MaxWait=60000,testWhileIdle=true,testOnBorrow=true
+#for rest [RegistryClient]
+#registry.jdbc.url=http://localhost:9080/airavata-services
+
+#user defined registry accessor classes
+#class.provenance.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.configuration.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.descriptor.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.project.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.user.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.published.workflow.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+
+###########################################################################
+# Airavata Workflow Interpreter Configurations
+###########################################################################
+
+runInThread=true
+provenance=true
+provenanceWriterThreadPoolSize=20
+gfac.embedded=true
+
+#
+# Security Configuration used by Airavata Generic Factory Service
+#  to interact with Computational Resources.
+#
+
+###########################################################################
+# Airavata GFac MyProxy GSI credentials to access Grid Resources.
+###########################################################################
+
+myproxy.server=myproxy.teragrid.org
+myproxy.user=username
+myproxy.pass=password
+myproxy.life=3600
+# XSEDE Trusted certificates can be downloaded from https://software.xsede.org/security/xsede-certs.tar.gz
+trusted.cert.location=modules/gfac-core/src/test/resources/certificates
+
+# SSH PKI key pair is SSH based authentication is used.
+#ssh.key=/home/user/.ssh/id_rsa
+#ssh.keypass=
+#ssh.username=usernameAtHost
+
+###########################################################################
+# Airavata Message Broker Basic Configurations.
+#  the Advanced section provides detailed custom configuration properties.
+###########################################################################
+
+# Default derby database configuration
+broker.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+broker.jdbc.url=jdbc:derby:wsmg;create=true;user=airavata;password=airavata
+
+# Note: This database will only be used  if 'broker.storage.type=persistent' 
+#       is set in advanced properties below.
+# MySql database configuration
+#broker.jdbc.driver=com.mysql.jdbc.Driver
+#broker.jdbc.url=jdbc:mysql://localhost:3306/wsmg?user=airavata&password=airavata
+
+###########################################################################
+# Airavata Message Box Basic Configurations, 
+#  the Advanced section provides detailed custom configuration properties.
+###########################################################################  
+
+# Default derby database
+msgBox.jdbc.driver=org.apache.derby.jdbc.EmbeddedDriver
+msgBox.jdbc.url=jdbc:derby:wsmg;create=true;user=airavata;password=airavata
+
+# MySql database configuration
+#msgBox.jdbc.driver=com.mysql.jdbc.Driver
+#msgBox.jdbc.url=jdbc:mysql://localhost:3306/wsmg?user=airavata&password=airavata
+
+###########################################################################
+# Advance configuration to change service implementations
+###########################################################################
+
+#Update the server context root path if airavata server is deployed under a different context root other than axis2
+server.context-root=axis2
+
+#
+# Class which implemented HostScheduler interface. It will determine the which host to submit the request
+#
+host.scheduler=org.apache.airavata.gfac.scheduler.impl.SimpleHostScheduler
+
+#
+# Data Service Plugins classes
+#
+datachain.classes= org.apache.airavata.core.gfac.extension.data.RegistryDataService
+
+#
+# Pre execution Plugins classes. For example, GridFTP Input Staging
+#
+prechain.classes= org.apache.airavata.core.gfac.extension.pre.GridFtpInputStaging
+prechain.classes= org.apache.airavata.core.gfac.extension.pre.HttpInputStaging
+
+#
+# Post execution Plugins classes. For example, GridFTP Output Staging
+#
+postchain.classes= org.apache.airavata.core.gfac.extension.post.GridFtpOutputStaging
+postchain.classes= org.apache.airavata.core.gfac.extension.post.OutputRegister
+
+#
+# Advanced Message Broker Configurations
+#
+
+#socket time out in milliseconds for sending messages. (defaults is 20000)
+broker.socket.timeout=60000
+
+broker.storage.type=persistent
+#broker.storage.type=memory
+
+#specifies wether delivery component should be started or not.
+broker.start.delivery.thread=true
+
+#fixed thread pool based delivery
+#broker.delivery.method=pcrew
+
+#dynamic thread pool based delivery
+#broker.delivery.method=parallel
+
+#single thread delivery
+broker.delivery.method=serial
+
+#number of message delivery failures before a url become black listed (default is 2)
+#broker.msg.delivery.retries=2
+
+#time period (in seconds) a url will be kept blacklisted (default is 5 seconds) 
+#consumer.expiration.time.gap=5 
+
+#maximum number of messages to be send to a one consumer/url at time. 
+#applicable if 'broker.delivery.method' is 'pcrew' . (default is 10)
+
+#sending.batch.size=10
+
+#size of the thread pool. only applicable if 'broker.delivery.method' is 'pcrew'. (default is 4)
+#sending.thread.pool.size=4
+
+#
+# Advanced Message Box Configurations
+# 
+msgBox.usedatabase=true
+messagePreservationDays=2
+messagePreservationHours=0
+messagePreservationMinutes=0
+messagePerservationIntervalDays=0
+messagePerservationIntervalHours=1
+messagePerservationIntervalMinutes=0
+
+###---------------------------REGISTRY API IMPLEMENTATION---------------------------###
+
+class.registry.accessor=org.apache.airavata.persistance.registry.jpa.impl.AiravataJPARegistry
+#class.registry.accessor=org.apache.airavata.rest.client.RegistryClient
+
+###---------------------------Computational Middleware Configurations---------------------------###
+
+#enable.application.job.status.history=true
+#http://localhost:8080/axis2/services/RegistryService?wsdl
+registry.service.wsdl=http://localhost:${port}/${server.context-root}/services/RegistryService?wsdl
+

Added: airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.0
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.0?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.0 (added)
+++ airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.0 Sat Jul 13 00:49:09 2013
@@ -0,0 +1,24 @@
+-----BEGIN CERTIFICATE-----
+MIIEADCCAuigAwIBAgIBITANBgkqhkiG9w0BAQUFADB1MRMwEQYKCZImiZPyLGQB
+GRYDbmV0MRIwEAYKCZImiZPyLGQBGRYCRVMxDjAMBgNVBAoTBUVTbmV0MSAwHgYD
+VQQLExdDZXJ0aWZpY2F0ZSBBdXRob3JpdGllczEYMBYGA1UEAxMPRVNuZXQgUm9v
+dCBDQSAxMB4XDTAyMTAwODA3MDAwMFoXDTIyMTAyNjA3MDAwMFowdTETMBEGCgmS
+JomT8ixkARkWA25ldDESMBAGCgmSJomT8ixkARkWAkVTMQ4wDAYDVQQKEwVFU25l
+dDEgMB4GA1UECxMXQ2VydGlmaWNhdGUgQXV0aG9yaXRpZXMxGDAWBgNVBAMTD0VT
+bmV0IFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALKF
+PX1QK86g62z/KX0pRAtRnS8VXmrLUDaFMwZyKEeueWxkrymyvnuDo4hCDPrIfEzI
+cAWnJyE1ev4aWw3l3Qm75GDUiyV401Op598iPT5bbCMlHJcYBANwRNKnvtZ8DcoU
+9Ba75tqUQHV1TRx6Nkw1AQ5gNMQSuZ5wCsDREGs+Be3JRa06RJf8k5gw5odqBjCT
+kGmIwCcx1qEuLGXOcQoM+yEKZvD485MiPKaEKYJBRDHi0h+vvj1j8ge9SJ8Jy6ML
+4B+2QNLb7fTjSutMF5qGJKlCgHw6dNLHuW2glS1KZ3Dt1iXkO6SdowclsKvpFhW9
+fDIftu/TOcMLOJi5fgUCAwEAAaOBmjCBlzARBglghkgBhvhCAQEEBAMCAAcwIQYD
+VR0RBBowGIEWRVNuZXQtUm9vdC1DQS0xQGVzLm5ldDAPBgNVHRMBAf8EBTADAQH/
+MB0GA1UdDgQWBBS8XU1IL/g1lFmrXIlLPtGyOhQB6jAfBgNVHSMEGDAWgBS8XU1I
+L/g1lFmrXIlLPtGyOhQB6jAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEFBQAD
+ggEBAA7Gy/hGi6nKiwm2fAXvQNU7Oe86VGz92VPICxjCyCCMW3uYuFAJVTjB6wRM
+UH/fw01I+pC9CZ+RUIhxWqFKJiz+Wf3jkq+25rPQ2Ve5FTesB/urUncwqZKRaOk5
+StSW5XQjCIfKk7W6q6BJk3nMAm67btSoRdE9NfsefEpHbJJ+dtjRgyJx+QX7sOft
+IsqHMWmEj7QTAjoCJvrSTXavHKosQ5s+aPySbZ6R6MCBzTsUzJk1fbTvrzJnzi0s
+H4eyZ17WxRj8BxnyN6BHM/0ger2b/c6vrfrW67/J6A0ebClbdunFdsYxPtcH49yo
+ugTqyKEVEeH7hhVkOH0bGf4Q0Vc=
+-----END CERTIFICATE-----

Added: airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.crl_url
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.crl_url?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.crl_url (added)
+++ airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.crl_url Sat Jul 13 00:49:09 2013
@@ -0,0 +1 @@
+http://crl.es.net/d1b603c3/d1b603c3.crl

Added: airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.signing_policy
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.signing_policy?rev=1502732&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.signing_policy (added)
+++ airavata/trunk/modules/gfac-core/src/test/resources/certificates/0119347c.signing_policy Sat Jul 13 00:49:09 2013
@@ -0,0 +1,56 @@
+# $Id: d1b603c3.signing_policy,v 1.5 2006/04/20 20:23:16 helm Exp $
+#
+# This file is parsed from start to finish with a given CA and subject
+# name.
+# subject names may include the following wildcard characters:
+#    *    Matches any number of characters.
+#    ?    Matches any single character.
+#
+# CA names must be specified (no wildcards). Names containing whitespaces
+# must be included in single quotes, e.g. 'Certification Authority'. 
+# Names must not contain new line symbols. 
+# The value of condition attribute is represented as a set of regular 
+# expressions. Each regular expression must be included in double quotes.  
+#
+# This policy file dictates the following policy:
+#
+#  The ESnet root CA signs certificates of various entities.
+#
+# Format:
+#------------------------------------------------------------------------
+#  token type  | def.authority |                value              
+#--------------|---------------|-----------------------------------------
+# EACL entry #1|
+
+ access_id_CA      X509         '/DC=net/DC=ES/O=ESnet/OU=Certificate Authorities/CN=ESnet Root CA 1'
+ 
+ pos_rights        globus        CA:sign
+ 
+ cond_subjects     globus     	'"/DC=org/DC=DOEGrids/OU=Certificate Authorities/*" "/DC=net/DC=ES/*" "/DC=org/DC=fusiongrid/OU=Certificate Authorities/*"'
+
+#
+# End DOE SG CA Policy
+# 
+# $Log: d1b603c3.signing_policy,v $
+# Revision 1.5  2006/04/20 20:23:16  helm
+# Added fusion grid subdir from mrt, removed misleading doc
+#
+# Revision 1.4  2006/04/20 20:17:22  helm
+# revision change
+#
+# Revision 1.2  2003/05/27 16:29:35  helm
+# Change statement of policy
+#
+# Revision 1.1  2003/05/22 22:38:22  helm
+# *** empty log message ***
+#
+# Revision 1.3  2003/05/03 01:31:42  dhiva
+# Fixed the Subject Name of the ESnet Root CA
+# Modified the access_id_CA and included /O=ESnet
+#
+# Revision 1.2  2003/05/03 01:18:09  dhiva
+# $Id: d1b603c3.signing_policy,v 1.5 2006/04/20 20:23:16 helm Exp $ included for all these files
+#
+# Revision 1.1  2003/05/03 01:15:06  dhiva
+# Globus Support Files for pki1.doegrids.org CA
+#



Mime
View raw message