| 
      
      
      From: <ha...@us...> - 2006-10-31 20:42:47
       | 
| Revision: 1195
          http://svn.sourceforge.net/cogkit/?rev=1195&view=rev
Author:   hategan
Date:     2006-10-31 12:42:43 -0800 (Tue, 31 Oct 2006)
Log Message:
-----------
use GRAMConstants instead of ints; better logging/exceptions
Modified Paths:
--------------
    trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java
    trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java	2006-10-31 20:40:48 UTC (rev 1194)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java	2006-10-31 20:42:43 UTC (rev 1195)
@@ -27,6 +27,7 @@
 import org.globus.gram.GramException;
 import org.globus.gram.GramJob;
 import org.globus.gram.GramJobListener;
+import org.globus.gram.internal.GRAMConstants;
 import org.globus.io.gass.server.GassServer;
 import org.globus.io.gass.server.JobOutputListener;
 import org.globus.io.gass.server.JobOutputStream;
@@ -433,10 +434,10 @@
     public void statusChanged(GramJob job) {
         int status = job.getStatus();
         switch (status) {
-            case 2:
+            case GRAMConstants.STATUS_ACTIVE:
                 this.task.setStatus(Status.ACTIVE);
                 break;
-            case 4:
+            case GRAMConstants.STATUS_FAILED:
                 Status newStatus = new StatusImpl();
                 Status oldStatus = this.task.getStatus();
                 newStatus.setPrevStatusCode(oldStatus.getStatusCode());
@@ -446,13 +447,13 @@
                 newStatus.setException(e);
                 this.task.setStatus(newStatus);
                 break;
-            case 8:
+            case GRAMConstants.STATUS_DONE:
                 this.task.setStatus(Status.COMPLETED);
                 break;
-            case 16:
+            case GRAMConstants.STATUS_SUSPENDED:
                 this.task.setStatus(Status.SUSPENDED);
                 break;
-            case 32:
+            case GRAMConstants.STATUS_UNSUBMITTED:
                 this.task.setStatus(Status.UNSUBMITTED);
                 break;
             default:
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java	2006-10-31 20:40:48 UTC (rev 1194)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/old/FileResourceImpl.java	2006-10-31 20:42:43 UTC (rev 1195)
@@ -279,12 +279,16 @@
     /** Equivalent to mkdir */
     public void createDirectory(String directory) throws GeneralException {
         try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("createDirectory(" + directory + ")");
+            }
             gridFTPClient.makeDir(directory);
         } catch (Exception e) {
-            throw new GeneralException("Cannot create the directory", e);
+            throw new GeneralException("Cannot create directory " + directory,
+                    e);
         }
     }
-    
+
     public void createDirectories(String directory) throws GeneralException {
         FileResourceUtil.createDirectories(this, directory);
     }
@@ -684,6 +688,9 @@
     public boolean exists(String filename) throws FileNotFoundException,
             GeneralException {
         try {
+            if (logger.isDebugEnabled()) {
+                logger.debug("exists(" + filename + ")");
+            }
             return gridFTPClient.exists(filename);
         } catch (IOException ie) {
             throw new FileNotFoundException("File " + filename
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <ha...@us...> - 2008-02-12 17:21:37
       | 
| Revision: 1888
          http://cogkit.svn.sourceforge.net/cogkit/?rev=1888&view=rev
Author:   hategan
Date:     2008-02-12 09:21:34 -0800 (Tue, 12 Feb 2008)
Log Message:
-----------
updated gt2 provider
Modified Paths:
--------------
    trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java
    trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/FileResourceImpl.java
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java	2008-02-12 17:20:25 UTC (rev 1887)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/execution/gt2/JobSubmissionTaskHandler.java	2008-02-12 17:21:34 UTC (rev 1888)
@@ -67,7 +67,11 @@
             throw new TaskSubmissionException(
                     "JobSubmissionTaskHandler cannot handle two active jobs simultaneously");
         }
+        if (this.task.getStatus().getStatusCode() != Status.UNSUBMITTED) {
+            throw new TaskSubmissionException("This task is already submitted");
+        }
         this.task = task;
+        this.task.setStatus(Status.SUBMITTING);
         this.securityContext = getSecurityContext(task);
         this.credential = (GSSCredential) securityContext.getCredentials();
         String rsl;
@@ -137,17 +141,16 @@
         try {
             // check if the task has not been canceled after it was
             // submitted for execution
-            if (this.task.getStatus().getStatusCode() == Status.UNSUBMITTED) {
-                this.gramJob.request(server, spec.isBatchJob(), limitedDeleg);
-                if (logger.isDebugEnabled()) {
-                    logger.debug("Submitted job with Globus ID: "
-                            + this.gramJob.getIDAsString());
-                }
-                this.task.setStatus(Status.SUBMITTED);
-                if (spec.isBatchJob()) {
-                    this.task.setStatus(Status.COMPLETED);
-                }
+
+            this.gramJob.request(server, spec.isBatchJob(), limitedDeleg);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Submitted job with Globus ID: "
+                        + this.gramJob.getIDAsString());
             }
+            this.task.setStatus(Status.SUBMITTED);
+            if (spec.isBatchJob()) {
+                this.task.setStatus(Status.COMPLETED);
+            }
         }
         catch (GramException ge) {
             cleanup();
@@ -159,10 +162,11 @@
                     gsse);
         }
     }
-    
+
     private boolean isLimitedDelegation(SecurityContext sc) {
         if (sc instanceof GlobusSecurityContextImpl) {
-            return ((GlobusSecurityContextImpl) securityContext).getDelegation() != Delegation.FULL_DELEGATION; 
+            return ((GlobusSecurityContextImpl) securityContext)
+                    .getDelegation() != Delegation.FULL_DELEGATION;
         }
         else {
             return true;
@@ -432,8 +436,7 @@
         String gassURL = null;
 
         try {
-            this.gassServer = GassServerFactory
-                    .getGassServer(this.credential);
+            this.gassServer = GassServerFactory.getGassServer(this.credential);
             this.gassServer.registerDefaultDeactivator();
         }
         catch (Exception e) {
@@ -513,14 +516,16 @@
     public void outputClosed() {
     }
 
-    private SecurityContext getSecurityContext(Task task) throws InvalidSecurityContextException {
+    private SecurityContext getSecurityContext(Task task)
+            throws InvalidSecurityContextException {
         SecurityContext sc = task.getService(0).getSecurityContext();
         if (sc == null) {
             // create default credentials
             sc = new GlobusSecurityContextImpl();
             GSSManager manager = ExtendedGSSManager.getInstance();
             try {
-                sc.setCredentials(manager.createCredential(GSSCredential.INITIATE_AND_ACCEPT));
+                sc.setCredentials(manager
+                        .createCredential(GSSCredential.INITIATE_AND_ACCEPT));
             }
             catch (GSSException e) {
                 throw new InvalidSecurityContextException(e);
Modified: trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/FileResourceImpl.java
===================================================================
--- trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/FileResourceImpl.java	2008-02-12 17:20:25 UTC (rev 1887)
+++ trunk/current/src/cog/modules/provider-gt2/src/org/globus/cog/abstraction/impl/file/gridftp/FileResourceImpl.java	2008-02-12 17:21:34 UTC (rev 1888)
@@ -24,7 +24,6 @@
 import org.globus.cog.abstraction.interfaces.GridFile;
 import org.globus.cog.abstraction.interfaces.SecurityContext;
 import org.globus.cog.abstraction.interfaces.ServiceContact;
-import org.globus.ftp.GridFTPSession;
 import org.globus.ftp.MlsxEntry;
 import org.globus.ftp.exception.ClientException;
 import org.globus.ftp.exception.ServerException;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |