Removing all file transfer components and creating a light weight job submission...
authorSuresh Marru <smarru@apache.org>
Sun, 11 Nov 2012 16:24:48 +0000 (16:24 +0000)
committerSuresh Marru <smarru@apache.org>
Sun, 11 Nov 2012 16:24:48 +0000 (16:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/airavata/sandbox@1408042 13f79535-47bb-0310-9956-ffa450edef68

14 files changed:
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/CancelJob.java
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/JobStatus.java
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/JobSubmission.java
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/ExectionContext.java
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/FileTransfer.java [deleted file]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/JobSubmittionListener.java [deleted file]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/security/CertificateManager.java [moved from grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/context/CertificateManager.java with 98% similarity]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/security/MyProxyCredentials.java [moved from grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/context/MyProxyCredentials.java with 99% similarity]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/security/SecurityContext.java [moved from grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/context/ApplicationContext.java with 94% similarity]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFTPContactInfo.java [deleted file]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFtp.java [deleted file]
grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/ServiceConstants.java
grid-tools/gram-client/src/main/resources/airavata-gram-client.properties
grid-tools/gram-client/testFileTransfer.sh [deleted file]

index f0fc096..bdfea5a 100644 (file)
@@ -21,8 +21,8 @@
 
 package org.apache.airavata.jobsubmission;
 
-import org.apache.airavata.jobsubmission.context.ApplicationContext;
 import org.apache.airavata.jobsubmission.gram.ExectionContext;
+import org.apache.airavata.jobsubmission.security.SecurityContext;
 import org.apache.log4j.Logger;
 import org.globus.gram.GramJob;
 import org.ietf.jgss.GSSCredential;
@@ -40,7 +40,7 @@ public class CancelJob {
        }
 public static void main(String[] args) {
        try {
-               ApplicationContext context = new ApplicationContext();
+               SecurityContext context = new SecurityContext();
                context.login();
                CancelJob job = new CancelJob();
                String jobURL = "https://lslogin2.lonestar.tacc.utexas.edu:50385/16073824805448638521/14062883951572193460/";
index cb78995..40a2d96 100644 (file)
@@ -21,7 +21,7 @@
 
 package org.apache.airavata.jobsubmission;
 
-import org.apache.airavata.jobsubmission.context.ApplicationContext;
+import org.apache.airavata.jobsubmission.security.SecurityContext;
 import org.globus.gram.GramJob;
 
 public class JobStatus {
@@ -31,7 +31,7 @@ public class JobStatus {
      */
     public static void main(String[] args) {
         try {
-            ApplicationContext context = new ApplicationContext();
+            SecurityContext context = new SecurityContext();
             context.login();
 
             String rsl = "";
index 1221476..d6f8e22 100644 (file)
@@ -21,9 +21,9 @@
 
 package org.apache.airavata.jobsubmission;
 
-import org.apache.airavata.jobsubmission.context.ApplicationContext;
 import org.apache.airavata.jobsubmission.gram.ExectionContext;
 import org.apache.airavata.jobsubmission.gram.GramJobSubmission;
+import org.apache.airavata.jobsubmission.security.SecurityContext;
 import org.apache.log4j.Logger;
 import org.ietf.jgss.GSSCredential;
 
@@ -31,12 +31,12 @@ public class JobSubmission {
 
     private static final Logger log = Logger.getLogger(JobSubmission.class);
     private static ExectionContext contextExectionContext;
-    private static ApplicationContext context;
+    private static SecurityContext context;
     private static String newline = System.getProperty("line.separator");
 
-    public static synchronized ApplicationContext getContext() throws Exception {
+    public static synchronized SecurityContext getContext() throws Exception {
         if (context == null) {
-            context = new ApplicationContext();
+            context = new SecurityContext();
             try {
                 context.login();
             } catch (Exception e) {
@@ -80,7 +80,7 @@ public class JobSubmission {
 
     public static void main(String[] args) {
         try {
-            ApplicationContext context = new ApplicationContext();
+            SecurityContext context = new SecurityContext();
             context.login();
 
             StringBuffer jobstatus = new StringBuffer();
index e1ff3fd..a07c148 100644 (file)
@@ -33,11 +33,8 @@ public class ExectionContext {
     private String testingHost;
     
     private String lonestarGRAM;
-    private String lonestarGridFTP;
     private String rangerGRAM;
-    private String rangerGridFTP;
     private String trestlesGRAM;
-    private String trestlesGridFTP;
     
     private String workingDir;
     private String tmpDir;
@@ -60,10 +57,6 @@ public class ExectionContext {
     private Integer hostCount;
     private String jobType;
     private String arguments;
-    private String gridFTPServerSource;
-    private String sourcedataLocation;
-    private String gridFTPServerDest;
-    private String destdataLocation;
 
     public static final String PROPERTY_FILE = "airavata-gram-client.properties";
 
@@ -82,11 +75,8 @@ public class ExectionContext {
             String testinghost = properties.getProperty(ServiceConstants.TESTINGHOST);
             
             String lonestargram = properties.getProperty(ServiceConstants.LONESTARGRAMEPR);
-            String lonestargridftp = properties.getProperty(ServiceConstants.LONESTARGRIDFTPEPR);
             String rangergram = properties.getProperty(ServiceConstants.RANGERGRAMEPR);
-            String rangergridftp = properties.getProperty(ServiceConstants.RANGERGRIDFTPEPR);
             String trestlesgram = properties.getProperty(ServiceConstants.TRESTLESGRAMEPR);
-            String trestlesgridftp = properties.getProperty(ServiceConstants.TRESTLESGRIDFTPEPR);
 
             String exec = properties.getProperty(ServiceConstants.EXECUTABLE);
             String args = properties.getProperty(ServiceConstants.ARGUMENTS);
@@ -96,10 +86,6 @@ public class ExectionContext {
             String mwt = properties.getProperty(ServiceConstants.MAX_WALL_TIME);
             String pc = properties.getProperty(ServiceConstants.PCOUNT);
             String hc = properties.getProperty(ServiceConstants.HOSTCOUNT);
-            String gridFTPServerSource = properties.getProperty(ServiceConstants.GRIDFTPSERVERSOURCE);
-            String gridFTPSourcePath = properties.getProperty(ServiceConstants.GRIDFTPSOURCEPATH);
-            String gridFTPServerDest = properties.getProperty(ServiceConstants.GRIDFTPSERVERDEST);
-            String gridFTPDestPath = properties.getProperty(ServiceConstants.GRIDFTPDESTPATH);
 
             if (testinghost != null) {
                 this.testingHost = testinghost;
@@ -108,21 +94,12 @@ public class ExectionContext {
             if (lonestargram != null) {
                 this.lonestarGRAM = lonestargram;
             }
-            if (lonestargridftp != null) {
-                this.lonestarGridFTP = lonestargridftp;
-            }
             if (rangergram != null) {
                 this.rangerGRAM = rangergram;
             }
-            if (rangergridftp != null) {
-                this.rangerGridFTP= rangergridftp;
-            }
             if (trestlesgram != null) {
                 this.trestlesGRAM = trestlesgram;
             }
-            if (trestlesgridftp != null) {
-                this.trestlesGridFTP = trestlesgridftp;
-            }
             
             if (exec != null) {
                 this.executable = exec;
@@ -160,18 +137,6 @@ public class ExectionContext {
                     this.hostCount = 1;
                 }
             }
-            if (gridFTPServerSource != null && !gridFTPServerSource.isEmpty()) {
-                this.gridFTPServerSource = gridFTPServerSource;
-            }
-            if (gridFTPSourcePath != null && !gridFTPSourcePath.isEmpty()) {
-                this.sourcedataLocation = gridFTPSourcePath;
-            }
-            if (gridFTPServerDest != null && !gridFTPServerDest.isEmpty()) {
-                this.gridFTPServerDest = gridFTPServerDest;
-            }
-            if (gridFTPDestPath != null && !gridFTPDestPath.isEmpty()) {
-                this.destdataLocation = gridFTPDestPath;
-            }
 
         }
     }
@@ -192,14 +157,6 @@ public class ExectionContext {
         this.lonestarGRAM = lonestarGRAM;
     }
 
-    public String getLonestarGridFTP() {
-        return lonestarGridFTP;
-    }
-
-    public void setLonestarGridFTP(String lonestarGridFTP) {
-        this.lonestarGridFTP = lonestarGridFTP;
-    }
-
     public String getRangerGRAM() {
         return rangerGRAM;
     }
@@ -208,14 +165,6 @@ public class ExectionContext {
         this.rangerGRAM = rangerGRAM;
     }
 
-    public String getRangerGridFTP() {
-        return rangerGridFTP;
-    }
-
-    public void setRangerGridFTP(String rangerGridFTP) {
-        this.rangerGridFTP = rangerGridFTP;
-    }
-
     public String getTrestlesGRAM() {
         return trestlesGRAM;
     }
@@ -224,14 +173,6 @@ public class ExectionContext {
         this.trestlesGRAM = trestlesGRAM;
     }
 
-    public String getTrestlesGridFTP() {
-        return trestlesGridFTP;
-    }
-
-    public void setTrestlesGridFTP(String trestlesGridFTP) {
-        this.trestlesGridFTP = trestlesGridFTP;
-    }
-
     /**
      * @return the workingDir
      */
@@ -518,36 +459,4 @@ public class ExectionContext {
     public String getArguments() {
         return arguments;
     }
-
-    public String getGridFTPServerSource() {
-        return gridFTPServerSource;
-    }
-
-    public void setGridFTPServerSource(String gridFTPServerSource) {
-        this.gridFTPServerSource = gridFTPServerSource;
-    }
-
-    public String getSourcedataLocation() {
-        return sourcedataLocation;
-    }
-
-    public void setSourcedataLocation(String sourcedataLocation) {
-        this.sourcedataLocation = sourcedataLocation;
-    }
-
-    public String getGridFTPServerDest() {
-        return gridFTPServerDest;
-    }
-
-    public void setGridFTPServerDest(String gridFTPServerDest) {
-        this.gridFTPServerDest = gridFTPServerDest;
-    }
-
-    public String getDestdataLocation() {
-        return destdataLocation;
-    }
-
-    public void setDestdataLocation(String destdataLocation) {
-        this.destdataLocation = destdataLocation;
-    }
 }
diff --git a/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/FileTransfer.java b/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/FileTransfer.java
deleted file mode 100644 (file)
index cd50bc9..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- *
- * 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.jobsubmission.gram;
-
-import java.net.URI;
-
-import org.apache.airavata.jobsubmission.context.ApplicationContext;
-import org.apache.airavata.jobsubmission.utils.GridFtp;
-import org.apache.log4j.BasicConfigurator;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.ietf.jgss.GSSCredential;
-
-public class FileTransfer {
-
-    public void makeDir(GSSCredential gssCred, URI destURI) throws Exception {
-        GridFtp ftp = new GridFtp();
-        ftp.makeDir(destURI, gssCred);
-    }
-
-    public void transferData(GSSCredential gssCred, URI srcURI, URI destURI) throws Exception {
-        GridFtp ftp = new GridFtp();
-        ftp.transfer(srcURI, destURI, gssCred, true);
-    }
-
-    public void transferData(GSSCredential gssCred, String sourceERP, String remoteSrcFile, String targetERP,
-            String remoteDestFile) throws Exception {
-        GridFtp ftp = new GridFtp();
-        URI srcURI = GridFtp.createGsiftpURI(sourceERP, remoteSrcFile);
-        URI destURI = GridFtp.createGsiftpURI(targetERP, remoteDestFile);
-        ftp.transfer(srcURI, destURI, gssCred, true);
-    }
-
-    public static void main(String[] args) {
-        try {
-            BasicConfigurator.configure();
-            Logger logger = Logger.getLogger("GridFTPClient");
-            Level lev = Level.toLevel("DEBUG");
-            logger.setLevel(lev);
-            ApplicationContext context = new ApplicationContext();
-            context.login();
-            ExectionContext contextExectionContext = new ExectionContext();
-            FileTransfer fileTransfer = new FileTransfer();
-
-            String sourceERP = contextExectionContext.getGridFTPServerSource();
-            String remoteSrcFile = contextExectionContext.getSourcedataLocation();
-            String targeterp = contextExectionContext.getGridFTPServerDest();
-            String remoteDestFile = contextExectionContext.getDestdataLocation();
-            URI srcURI = GridFtp.createGsiftpURI(sourceERP, remoteSrcFile);
-            URI destURI = GridFtp.createGsiftpURI(targeterp, remoteDestFile);
-            URI dirLocation = GridFtp.createGsiftpURI(targeterp,
-                    remoteDestFile.substring(0, remoteDestFile.lastIndexOf("/")));
-            GSSCredential gssCredential = context.getGssCredential();
-            System.out.println(dirLocation);
-            fileTransfer.makeDir(gssCredential, dirLocation);
-            fileTransfer.transferData(gssCredential, srcURI, destURI);
-
-        } catch (Exception e) {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-
-    }
-}
\ No newline at end of file
diff --git a/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/JobSubmittionListener.java b/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/gram/JobSubmittionListener.java
deleted file mode 100644 (file)
index 91e6038..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *
- * 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.jobsubmission.gram;
-
-import org.apache.log4j.Logger;
-import org.globus.gram.GramJob;
-import org.globus.gram.GramJobListener;
-
-public class JobSubmittionListener implements GramJobListener {
-
-    private static final String DELIMITER = "#";
-    private boolean finished;
-    private int error;
-    private int status;
-    private StringBuffer buffer;
-
-    private GramJob job;
-
-    private static final Logger log = Logger.getLogger(JobSubmittionListener.class);
-
-    public JobSubmittionListener(GramJob job, StringBuffer buffer) {
-        this.buffer = buffer;
-        this.job = job;
-    }
-
-    // waits for DONE or FAILED status
-    public void waitFor() throws InterruptedException {
-        while (!finished) {
-
-            // job status is changed but method isn't invoked
-            if (status != 0) {
-                if (job.getStatus() != status) {
-                    log.info("invoke method manually");
-                    statusChanged(job);
-                } else {
-                    log.info("job " + job.getIDAsString() + " have same status: " + GramJob.getStatusAsString(status));
-                }
-            } else {
-                log.info("Status is zero");
-            }
-
-            synchronized (this) {
-                wait(60 * 1000l);
-            }
-        }
-    }
-
-    public synchronized void statusChanged(GramJob job) {
-        log.debug("Listener: statusChanged triggered");
-        int jobStatus = job.getStatus();
-        String jobId = job.getIDAsString();
-        String statusString = job.getStatusAsString();
-        log.info("Job Status: " + statusString + "(" + jobStatus + ")");
-        buffer.append(formatJobStatus(jobId, statusString));
-        log.debug(formatJobStatus(jobId, statusString));
-
-        status = jobStatus;
-        if (jobStatus == GramJob.STATUS_DONE) {
-            finished = true;
-        } else if (jobStatus == GramJob.STATUS_FAILED) {
-            finished = true;
-            error = job.getError();
-            log.info("Job Error Code: " + error);
-            buffer.append(DELIMITER + error);
-        }
-        buffer.append("\n");
-
-        // notify wait thread to wake up if done
-        if (finished) {
-            notify();
-        }
-    }
-
-    public static String formatJobStatus(String jobid, String jobstatus) {
-        return System.currentTimeMillis() + DELIMITER + jobid + DELIMITER + jobstatus;
-    }
-
-    public int getError() {
-        return error;
-    }
-
-    public int getStatus() {
-        return status;
-    }
-
-    public void wakeup() {
-        try {
-            notify();
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-}
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.jobsubmission.context;
+package org.apache.airavata.jobsubmission.security;
 
 import java.io.File;
 import java.io.InputStream;
@@ -31,7 +31,7 @@ import org.apache.log4j.Logger;
 import org.globus.myproxy.MyProxy;
 import org.ietf.jgss.GSSCredential;
 
-public class ApplicationContext {
+public class SecurityContext {
 
     /**
         * 
@@ -42,7 +42,7 @@ public class ApplicationContext {
     protected GSSCredential gssCredential;
 
     private MyProxyCredentials credentials;
-    private static final Logger log = Logger.getLogger(ApplicationContext.class);
+    private static final Logger log = Logger.getLogger(SecurityContext.class);
 
     /**
      * 
@@ -51,7 +51,7 @@ public class ApplicationContext {
      * @throws GfacGUIException
      */
 
-    public ApplicationContext() throws Exception {
+    public SecurityContext() throws Exception {
         log.setLevel(org.apache.log4j.Level.INFO);
         loadConfiguration();
 
@@ -59,7 +59,7 @@ public class ApplicationContext {
 
     public static void main(String[] args) {
         try {
-            ApplicationContext context = new ApplicationContext();
+            SecurityContext context = new SecurityContext();
             context.login();
         } catch (Exception e) {
             e.printStackTrace();
@@ -76,7 +76,7 @@ public class ApplicationContext {
 
     public static String getProperty(String name) {
         try {
-            ApplicationContext context = new ApplicationContext();
+            SecurityContext context = new SecurityContext();
             return context.getProperties().getProperty(name);
         } catch (Exception e) {
             e.printStackTrace();
diff --git a/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFTPContactInfo.java b/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFTPContactInfo.java
deleted file mode 100644 (file)
index 4d762eb..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * 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.jobsubmission.utils;
-
-/**
- * Class represents GridFTP Endpoint
- * 
- */
-public class GridFTPContactInfo {
-    public static final int DEFAULT_GSI_FTP_PORT = 2811;
-    public String hostName;
-    public int port;
-
-    public GridFTPContactInfo(String hostName, int port) {
-        if (port <= 0 || port == 80) {
-            port = DEFAULT_GSI_FTP_PORT;
-        }
-        this.hostName = hostName;
-        this.port = port;
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (obj instanceof GridFTPContactInfo) {
-            return hostName.equals(((GridFTPContactInfo) obj).hostName) && port == ((GridFTPContactInfo) obj).port;
-        } else {
-            return false;
-        }
-    }
-
-    @Override
-    public int hashCode() {
-        return hostName.hashCode();
-    }
-
-    @Override
-    public String toString() {
-        StringBuffer buf = new StringBuffer();
-        buf.append(hostName).append(":").append(port);
-        return buf.toString();
-    }
-}
diff --git a/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFtp.java b/grid-tools/gram-client/src/main/java/org/apache/airavata/jobsubmission/utils/GridFtp.java
deleted file mode 100644 (file)
index de01783..0000000
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- *
- * 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.jobsubmission.utils;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import org.apache.log4j.Logger;
-import org.globus.ftp.DataChannelAuthentication;
-import org.globus.ftp.DataSourceStream;
-import org.globus.ftp.GridFTPClient;
-import org.globus.ftp.HostPort;
-import org.globus.ftp.Marker;
-import org.globus.ftp.MarkerListener;
-import org.globus.ftp.Session;
-import org.globus.ftp.exception.ClientException;
-import org.globus.ftp.exception.ServerException;
-import org.globus.gsi.gssapi.auth.HostAuthorization;
-import org.ietf.jgss.GSSCredential;
-
-/**
- * GridFTP tools
- */
-public class GridFtp {
-
-    public static final String GSIFTP_SCHEME = "gsiftp";
-    private static final Logger log = Logger.getLogger(GridFtp.class);
-
-    /**
-     * Make directory at remote location
-     * 
-     * @param destURI
-     * @param gssCred
-     * @throws ServerException
-     * @throws IOException
-     */
-    public void makeDir(URI destURI, GSSCredential gssCred) throws Exception {
-        GridFTPClient destClient = null;
-        GridFTPContactInfo destHost = new GridFTPContactInfo(destURI.getHost(), destURI.getPort());
-        try {
-
-            String destPath = destURI.getPath();
-            log.info(("Creating Directory = " + destHost + "=" + destPath));
-
-            destClient = new GridFTPClient(destHost.hostName, destHost.port);
-
-            int tryCount = 0;
-            while (true) {
-                try {
-                    destClient.setAuthorization(new HostAuthorization("host"));
-                    destClient.authenticate(gssCred);
-                    destClient.setDataChannelAuthentication(DataChannelAuthentication.SELF);
-
-                    if (!destClient.exists(destPath)) {
-                        destClient.makeDir(destPath);
-                    }
-                    break;
-                } catch (ServerException e) {
-                    tryCount++;
-                    if (tryCount >= 3) {
-                        throw new Exception(e.getMessage(), e);
-                    }
-                    Thread.sleep(10000);
-                } catch (IOException e) {
-                    tryCount++;
-                    if (tryCount >= 3) {
-                        throw new Exception(e.getMessage(), e);
-                    }
-                    Thread.sleep(10000);
-                }
-            }
-        } catch (ServerException e) {
-            throw new Exception("Cannot Create GridFTP Client to:" + destHost.toString(), e);
-        } catch (IOException e) {
-            throw new Exception("Cannot Create GridFTP Client to:" + destHost.toString(), e);
-        } catch (InterruptedException e) {
-            throw new Exception("Internal Error cannot sleep", e);
-        } finally {
-            if (destClient != null) {
-                try {
-                    destClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection");
-                }
-            }
-        }
-    }
-
-    /**
-     * Upload file from stream
-     * 
-     * @param destURI
-     * @param gsCredential
-     * @param localFile
-     * @throws GfacException
-     */
-    public void updateFile(URI destURI, GSSCredential gsCredential, InputStream io) throws Exception {
-        GridFTPClient ftpClient = null;
-        GridFTPContactInfo contactInfo = new GridFTPContactInfo(destURI.getHost(), destURI.getPort());
-
-        try {
-
-            String remoteFile = destURI.getPath();
-            log.info("The remote file is " + remoteFile);
-
-            log.info("Setup GridFTP Client");
-
-            ftpClient = new GridFTPClient(contactInfo.hostName, contactInfo.port);
-            ftpClient.setAuthorization(new HostAuthorization("host"));
-            ftpClient.authenticate(gsCredential);
-            ftpClient.setDataChannelAuthentication(DataChannelAuthentication.SELF);
-
-            log.info("Uploading file");
-
-            ftpClient.put(remoteFile, new DataSourceStream(io), new MarkerListener() {
-                public void markerArrived(Marker marker) {
-                }
-            });
-
-            log.info("Upload file to:" + remoteFile + " is done");
-
-        } catch (ServerException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } catch (IOException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } catch (ClientException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } finally {
-            if (ftpClient != null) {
-                try {
-                    ftpClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection");
-                }
-            }
-        }
-    }
-
-    /**
-     * Upload file to remote location
-     * 
-     * @param destURI
-     * @param gsCredential
-     * @param localFile
-     * @throws GfacException
-     */
-    public void updateFile(URI destURI, GSSCredential gsCredential, File localFile) throws Exception {
-        GridFTPClient ftpClient = null;
-        GridFTPContactInfo contactInfo = new GridFTPContactInfo(destURI.getHost(), destURI.getPort());
-        try {
-
-            String remoteFile = destURI.getPath();
-
-            log.info("The local temp file is " + localFile);
-            log.info("the remote file is " + remoteFile);
-
-            log.info("Setup GridFTP Client");
-
-            ftpClient = new GridFTPClient(contactInfo.hostName, contactInfo.port);
-            ftpClient.setAuthorization(new HostAuthorization("host"));
-            ftpClient.authenticate(gsCredential);
-            ftpClient.setDataChannelAuthentication(DataChannelAuthentication.SELF);
-
-            log.info("Uploading file");
-
-            ftpClient.put(localFile, remoteFile, false);
-
-            log.info("Upload file to:" + remoteFile + " is done");
-
-        } catch (ServerException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } catch (IOException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } catch (ClientException e) {
-            throw new Exception("Cannot upload file to GridFTP:" + contactInfo.toString(), e);
-        } finally {
-            if (ftpClient != null) {
-                try {
-                    ftpClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection");
-                }
-            }
-        }
-    }
-
-    /**
-     * Download File from remote location
-     * 
-     * @param destURI
-     * @param gsCredential
-     * @param localFile
-     * @throws GfacException
-     */
-    public void downloadFile(URI destURI, GSSCredential gsCredential, File localFile) throws Exception {
-        GridFTPClient ftpClient = null;
-        GridFTPContactInfo contactInfo = new GridFTPContactInfo(destURI.getHost(), destURI.getPort());
-        try {
-            String remoteFile = destURI.getPath();
-
-            log.info("The local temp file is " + localFile);
-            log.info("the remote file is " + remoteFile);
-
-            log.info("Setup GridFTP Client");
-
-            ftpClient = new GridFTPClient(contactInfo.hostName, contactInfo.port);
-            ftpClient.setAuthorization(new HostAuthorization("host"));
-            ftpClient.authenticate(gsCredential);
-            ftpClient.setDataChannelAuthentication(DataChannelAuthentication.SELF);
-
-            log.info("Downloading file");
-
-            ftpClient.get(remoteFile, localFile);
-
-            log.info("Download file to:" + remoteFile + " is done");
-
-        } catch (ServerException e) {
-            throw new Exception("Cannot download file from GridFTP:" + contactInfo.toString(), e);
-        } catch (IOException e) {
-            throw new Exception("Cannot download file from GridFTP:" + contactInfo.toString(), e);
-        } catch (ClientException e) {
-            throw new Exception("Cannot download file from GridFTP:" + contactInfo.toString(), e);
-        } finally {
-            if (ftpClient != null) {
-                try {
-                    ftpClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection");
-                }
-            }
-        }
-    }
-
-    /**
-     * Stream remote file
-     * 
-     * @param destURI
-     * @param gsCredential
-     * @param localFile
-     * @return
-     * @throws GfacException
-     */
-    public String readRemoteFile(URI destURI, GSSCredential gsCredential, File localFile) throws Exception {
-        BufferedReader instream = null;
-        File localTempfile = null;
-        try {
-
-            if (localFile == null) {
-                localTempfile = File.createTempFile("stderr", "err");
-            } else {
-                localTempfile = localFile;
-            }
-
-            log.info("Loca temporary file:" + localTempfile);
-
-            downloadFile(destURI, gsCredential, localTempfile);
-
-            instream = new BufferedReader(new FileReader(localTempfile));
-            StringBuffer buff = new StringBuffer();
-            String temp = null;
-            while ((temp = instream.readLine()) != null) {
-                buff.append(temp);
-                buff.append(System.getProperty("line.separator"));
-            }
-
-            log.info("finish read file:" + localTempfile);
-
-            return buff.toString();
-        } catch (FileNotFoundException e) {
-            throw new Exception("Cannot read localfile file:" + localTempfile, e);
-        } catch (IOException e) {
-            throw new Exception("Cannot read localfile file:" + localTempfile, e);
-        } finally {
-            if (instream != null) {
-                try {
-                    instream.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection");
-                }
-            }
-        }
-    }
-
-    /**
-     * Transfer data from one GridFTp Endpoint to another GridFTP Endpoint
-     * 
-     * @param srchost
-     * @param desthost
-     * @param gssCred
-     * @param srcActive
-     * @throws ServerException
-     * @throws ClientException
-     * @throws IOException
-     */
-    public void transfer(URI srchost, URI desthost, GSSCredential gssCred, boolean srcActive) throws Exception {
-        GridFTPClient destClient = null;
-        GridFTPClient srcClient = null;
-
-        try {
-            destClient = new GridFTPClient(desthost.getHost(), desthost.getPort());
-            destClient.setAuthorization(new HostAuthorization("host"));
-            destClient.authenticate(gssCred);
-            destClient.setType(Session.TYPE_IMAGE);
-
-            srcClient = new GridFTPClient(srchost.getHost(), srchost.getPort());
-            srcClient.setAuthorization(new HostAuthorization("host"));
-            srcClient.authenticate(gssCred);
-            srcClient.setType(Session.TYPE_IMAGE);
-
-            if (srcActive) {
-                log.info("Set src active");
-                HostPort hp = destClient.setPassive();
-                srcClient.setActive(hp);
-            } else {
-                log.info("Set dst active");
-                HostPort hp = srcClient.setPassive();
-                destClient.setActive(hp);
-            }
-
-            log.info("Start transfer file from GridFTP:" + srchost.toString() + " to " + desthost.toString());
-
-            /**
-             * Transfer a file. The transfer() function blocks until the transfer is complete.
-             */
-            srcClient.transfer(srchost.getPath(), destClient, desthost.getPath(), false, null);
-            if (srcClient.getSize(srchost.getPath()) == destClient.getSize(desthost.getPath())) {
-                log.info("CHECK SUM OK");
-            } else {
-                log.info("****CHECK SUM FAILED****");
-            }
-
-        } catch (ServerException e) {
-            throw new Exception("Cannot transfer file from GridFTP:" + srchost.toString() + " to "
-                    + desthost.toString(), e);
-        } catch (IOException e) {
-            throw new Exception("Cannot transfer file from GridFTP:" + srchost.toString() + " to "
-                    + desthost.toString(), e);
-        } catch (ClientException e) {
-            throw new Exception("Cannot transfer file from GridFTP:" + srchost.toString() + " to "
-                    + desthost.toString(), e);
-        } finally {
-            if (destClient != null) {
-                try {
-                    destClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection at Desitnation:" + desthost.toString());
-                }
-            }
-            if (srcClient != null) {
-                try {
-                    srcClient.close();
-                } catch (Exception e) {
-                    log.info("Cannot close GridFTP client connection at Source:" + srchost.toString());
-                }
-            }
-        }
-    }
-
-    public static URI createGsiftpURI(String host, String localPath) throws URISyntaxException {
-        StringBuffer buf = new StringBuffer();
-        if (!host.startsWith("gsiftp://"))
-            buf.append("gsiftp://");
-        buf.append(host);
-        if (!host.endsWith("/"))
-            buf.append("/");
-        buf.append(localPath);
-        return new URI(buf.toString());
-    }
-}
index df35cab..f9e6db1 100644 (file)
@@ -34,11 +34,8 @@ public class ServiceConstants {
        public static final String TESTINGHOST = "testing.host";
        
     public static final String LONESTARGRAMEPR = "lonestar.gram.endpoint";
-    public static final String LONESTARGRIDFTPEPR = "lonestar.gridftp.endpoint";
     public static final String RANGERGRAMEPR = "ranger.gram.endpoint";
-    public static final String RANGERGRIDFTPEPR = "ranger.gridftp.endpoint";
     public static final String TRESTLESGRAMEPR = "trestles.gram.endpoint";
-    public static final String TRESTLESGRIDFTPEPR = "trestles.gridftp.endpoint";
        
        public static final String EXECUTABLE = "executable";
        public static final String ARGUMENTS = "arguments";
@@ -48,10 +45,5 @@ public class ServiceConstants {
        public static final String JOB_TYPE = "jobtype";
        public static final String PCOUNT = "processors";
        public static final String HOSTCOUNT = "hosts";
-       
-       public static final String GRIDFTPSERVERSOURCE = "gridftpserverSource";
-       public static final String GRIDFTPSOURCEPATH = "gridftpSourcePath";
-       public static final String GRIDFTPSERVERDEST = "gridftpserverDest";
-       public static final String GRIDFTPDESTPATH = "gridftpDestPath";
 
 }
index 506fdcd..3c96143 100644 (file)
@@ -12,15 +12,12 @@ testing.host=trestles
 \r
 ## TACC Lonestar         \r
 lonestar.gram.endpoint=gridftp1.ls4.tacc.utexas.edu:2119/jobmanager-sge\r
-lonestar.gridftp.endpoint=gsiftp://gridftp1.ls4.tacc.utexas.edu:2811/\r
 \r
 ## TACC Ranger        \r
 ranger.gram.endpoint=gatekeeper.ranger.tacc.teragrid.org:2119/jobmanager-sge\r
-ranger.gridftp.endpoint=gsiftp://gridftp.ranger.tacc.teragrid.org:2811/\r
 \r
 ## SDSC Trestles        \r
 trestles.gram.endpoint=trestles-login2.sdsc.edu:2119/jobmanager-pbstest2\r
-trestles.gridftp.endpoint=gsiftp://trestles.sdsc.edu:2811/\r
 \r
 executable=/bin/hostname\r
 arguments=30\r
@@ -29,9 +26,4 @@ project_number=TG-STA110014S
 jobtype=single\r
 maxwalltime=1\r
 processors=1\r
-hosts=1\r
-gridftpserverSource=gsiftp://gridftp.ranger.tacc.teragrid.org:2812/\r
-gridftpSourcePath=/share/home/01314/ultrasca/qwtplot3d-0.2.6.tgz\r
-gridftpserverDest=gsiftp://trestles-dm1.sdsc.edu:2811/\r
-gsiftp://trestles.sdsc.edu:2811/\r
-gridftpDestPath=/oasis/projects/nsf/uot111/us3/jobs/US-SOMO_Thu_May_10_14_46_38_EST_2012_57f53af6-7e8d-44a4-acb2-144d59475d54/qwtplot3d-0.2.6.tgz
\ No newline at end of file
+hosts=1
\ No newline at end of file
diff --git a/grid-tools/gram-client/testFileTransfer.sh b/grid-tools/gram-client/testFileTransfer.sh
deleted file mode 100644 (file)
index dbaab5c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-for i in target/lib/*.jar
-do
-  CLASSPATH=$CLASSPATH:$i
-done
-
-CLASSPATH=$CLASSPATH:target/GRAM5-Lite-1.0.jar:./config
-
-echo $CLASSPATH
-
-$JAVA_HOME/bin/java -classpath $CLASSPATH org.apache.airavata.jobsubmission.gram.FileTransfer $*