airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From patanac...@apache.org
Subject svn commit: r1170358 - in /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac: provider/ provider/impl/ scheduler/impl/ utils/
Date Tue, 13 Sep 2011 21:24:21 GMT
Author: patanachai
Date: Tue Sep 13 21:24:20 2011
New Revision: 1170358

URL: http://svn.apache.org/viewvc?rev=1170358&view=rev
Log:
Code cleanup and change package name of Providers

Added:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
      - copied, changed from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/LocalProvider.java
      - copied, changed from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/SSHProvider.java
      - copied, changed from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java
Modified:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java

Copied: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
(from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java?p2=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java&p1=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java&r1=1170323&r2=1170358&rev=1170358&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/GramProvider.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
Tue Sep 13 21:24:20 2011
@@ -19,15 +19,14 @@
  *
  */
 
-package org.apache.airavata.core.gfac.provider;
+package org.apache.airavata.core.gfac.provider.impl;
 
 import java.io.File;
+import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Map;
 
-import javax.xml.namespace.QName;
-
 import org.apache.airavata.commons.gfac.type.app.ShellApplicationDeployment;
 import org.apache.airavata.commons.gfac.type.host.GlobusHost;
 import org.apache.airavata.commons.gfac.type.parameter.AbstractParameter;
@@ -38,6 +37,7 @@ import org.apache.airavata.core.gfac.exc
 import org.apache.airavata.core.gfac.exception.SecurityException;
 import org.apache.airavata.core.gfac.exception.ToolsException;
 import org.apache.airavata.core.gfac.external.GridFtp;
+import org.apache.airavata.core.gfac.provider.AbstractProvider;
 import org.apache.airavata.core.gfac.provider.utils.GramRSLGenerator;
 import org.apache.airavata.core.gfac.provider.utils.JobSubmissionListener;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
@@ -109,11 +109,9 @@ public class GramProvider extends Abstra
         }
         log.info("Using Globus GateKeeper " + gateKeeper);
 
-        String rsl = "";
-
         try {
             GramAttributes jobAttr = GramRSLGenerator.configureRemoteJob(invocationContext);
-            rsl = jobAttr.toRSL();
+            String rsl = jobAttr.toRSL();
 
             log.info("RSL = " + rsl);
 
@@ -250,10 +248,9 @@ public class GramProvider extends Abstra
             }
 
             // Get the Stdouts and StdErrs
-            QName x = QName.valueOf(context.getServiceName());
-            String timeStampedServiceName = GfacUtils.createServiceDirName(x);
-            File localStdOutFile = new File(logDir, timeStampedServiceName + ".stdout");
-            File localStdErrFile = new File(logDir, timeStampedServiceName + ".stderr");
+            String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName());
+            File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
+            File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");
 
             String stdout = ftp.readRemoteFile(stdoutURI, gssCred, localStdOutFile);
             String stderr = ftp.readRemoteFile(stderrURI, gssCred, localStdErrFile);
@@ -262,6 +259,8 @@ public class GramProvider extends Abstra
 
         } catch (URISyntaxException e) {
             throw new ProviderException("URI is malformatted:" + e.getMessage(), e);
+        } catch (IOException e) {
+            throw new ProviderException(e.getMessage(), e);            
         } catch (SecurityException e) {
             throw new ProviderException(e.getMessage(), e);
         } catch (ToolsException e) {

Copied: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/LocalProvider.java
(from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/LocalProvider.java?p2=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/LocalProvider.java&p1=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java&r1=1170323&r2=1170358&rev=1170358&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/LocalProvider.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/LocalProvider.java
Tue Sep 13 21:24:20 2011
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.core.gfac.provider;
+package org.apache.airavata.core.gfac.provider.impl;
 
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
@@ -38,6 +38,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.parameter.AbstractParameter;
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
 import org.apache.airavata.core.gfac.exception.ProviderException;
+import org.apache.airavata.core.gfac.provider.AbstractProvider;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
 import org.apache.airavata.core.gfac.utils.InputUtils;

Copied: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/SSHProvider.java
(from r1170323, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/SSHProvider.java?p2=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/SSHProvider.java&p1=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java&r1=1170323&r2=1170358&rev=1170358&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/SSHProvider.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/SSHProvider.java
Tue Sep 13 21:24:20 2011
@@ -19,7 +19,7 @@
  *
  */
 
-package org.apache.airavata.core.gfac.provider;
+package org.apache.airavata.core.gfac.provider.impl;
 
 import java.io.File;
 import java.io.IOException;
@@ -30,21 +30,21 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
-import javax.xml.namespace.QName;
-
 import net.schmizz.sshj.SSHClient;
 import net.schmizz.sshj.connection.ConnectionException;
 import net.schmizz.sshj.connection.channel.direct.Session;
 import net.schmizz.sshj.connection.channel.direct.Session.Command;
+import net.schmizz.sshj.transport.TransportException;
 import net.schmizz.sshj.userauth.keyprovider.KeyProvider;
 import net.schmizz.sshj.xfer.scp.SCPFileTransfer;
 
-import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.commons.gfac.type.app.ShellApplicationDeployment;
 import org.apache.airavata.commons.gfac.type.parameter.AbstractParameter;
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
 import org.apache.airavata.core.gfac.context.security.impl.SSHSecurityContextImpl;
+import org.apache.airavata.core.gfac.exception.GfacException;
 import org.apache.airavata.core.gfac.exception.ProviderException;
+import org.apache.airavata.core.gfac.provider.AbstractProvider;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
 import org.apache.airavata.core.gfac.utils.InputUtils;
@@ -60,11 +60,23 @@ public class SSHProvider extends Abstrac
     private static final int COMMAND_EXECUTION_TIMEOUT = 5;
     private SSHSecurityContextImpl sshContext;
     private String command;
+    private SSHClient ssh;
+
+    public SSHProvider() {
+        ssh = new SSHClient();
+    }
 
-    private void initSSHSecurity(InvocationContext context, SSHClient ssh) throws IOException
{
+    private Session getSession(InvocationContext context) throws IOException {
         try {
+
+            /*
+             * if it is connected, create a session
+             * Note: one client can have multiple session (on one channel)
+             */
+            if (ssh.isConnected())
+                return ssh.startSession();
             
-            if(sshContext == null){
+            if (sshContext == null) {
                 sshContext = ((SSHSecurityContextImpl) context.getSecurityContext(SSH_SECURITY_CONTEXT));
             }
 
@@ -73,59 +85,55 @@ public class SSHProvider extends Abstrac
             ssh.loadKnownHosts();
             ssh.authPublickey(sshContext.getUsername(), pkey);
 
+            ssh.connect(context.getExecutionDescription().getHost().getName());         
  
+            return ssh.startSession();
+
         } catch (NullPointerException ne) {
             throw new SecurityException("Cannot load security context for SSH", ne);
         }
-
+    }
+    
+    private void closeSession(Session session){
+        if (session != null) {
+            try {
+                session.close();
+            } catch (Exception e) {
+                log.warn("Cannot Close SSH Session");
+            }
+        }
     }
 
-    // TODO: This method has a try/catch embedded in 'finally' method. Is there
-    // a way
-    // TODO: to force cleanup on failed connections?
     public void makeDirectory(InvocationContext context) throws ProviderException {
-        HostDescription host = context.getExecutionDescription().getHost();
         ShellApplicationDeployment app = (ShellApplicationDeployment) context.getExecutionDescription().getApp();
 
-        SSHClient ssh = new SSHClient();
+        Session session = null;
         try {
+            session = getSession(context);
 
-            initSSHSecurity(context, ssh);
-            ssh.connect(host.getName());
-
-            final Session session = ssh.startSession();
-            try {
-                StringBuilder commandString = new StringBuilder();
-                // TODO: Is "|" what you want here?
-                commandString.append("mkdir -p ");
-                commandString.append(app.getTmpDir());
-                commandString.append(" | ");
-                commandString.append("mkdir -p ");
-                commandString.append(app.getWorkingDir());
-                commandString.append(" | ");
-                commandString.append("mkdir -p ");
-                commandString.append(app.getInputDir());
-                commandString.append(" | ");
-                commandString.append("mkdir -p ");
-                commandString.append(app.getOutputDir());
-                Command cmd = session.exec(commandString.toString());
-                cmd.join(COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
-            } catch (ConnectionException e) {
-                throw e;
-            } finally {
-                try {
-                    session.close();
-                } catch (Exception e) {
-                    log.warn("Cannot Close SSH Session");
-                }
-            }
+            StringBuilder commandString = new StringBuilder();
+            
+            commandString.append("mkdir -p ");
+            commandString.append(app.getTmpDir());
+            commandString.append(" ; ");
+            commandString.append("mkdir -p ");
+            commandString.append(app.getWorkingDir());
+            commandString.append(" ; ");
+            commandString.append("mkdir -p ");
+            commandString.append(app.getInputDir());
+            commandString.append(" ; ");
+            commandString.append("mkdir -p ");
+            commandString.append(app.getOutputDir());
+            
+            Command cmd = session.exec(commandString.toString());
+            cmd.join(COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
+        } catch (ConnectionException e) {
+            new ProviderException(e.getMessage(), e);
+        } catch (TransportException e) {
+            new ProviderException(e.getMessage(), e);
         } catch (IOException e) {
-            throw new ProviderException(e.getMessage(), e);
+            new ProviderException(e.getMessage(), e);
         } finally {
-            try {
-                ssh.disconnect();
-            } catch (Exception e) {
-                log.warn("Cannot Close SSH Connection");
-            }
+            closeSession(session);
         }
     }
 
@@ -155,139 +163,101 @@ public class SSHProvider extends Abstrac
         // TODO: This only works for the BASH shell. CSH and TCSH will be
         // different.
         command += SPACE + "1>" + SPACE + app.getStdOut();
-        command += SPACE + "2>" + SPACE + app.getStdErr();       
+        command += SPACE + "2>" + SPACE + app.getStdErr();
     }
 
     public void executeApplication(InvocationContext context) throws ProviderException {
-        // TODO: initSSHSecurity can throw an IOException but you are
-        // treating everything as a GFAC exception.
-
-        HostDescription host = context.getExecutionDescription().getHost();
         ShellApplicationDeployment app = (ShellApplicationDeployment) context.getExecutionDescription().getApp();
 
-        SSHClient ssh = new SSHClient();
+        Session session = null;
         try {
+            session = getSession(context);
 
-            initSSHSecurity(context, ssh);
-            ssh.connect(host.getName());
-
-            final Session session = ssh.startSession();
-            try {
-                /*
-                 * Going to working Directory
-                 */
-                session.exec("cd " + app.getWorkingDir());
-
-                // get the env of the host and the application
-                Map<String, String> nv = app.getEnv();
-
-                // extra env's
-                nv.put(GFacConstants.INPUT_DATA_DIR_VAR_NAME, app.getInputDir());
-                nv.put(GFacConstants.OUTPUT_DATA_DIR_VAR_NAME, app.getOutputDir());
-
-                /*
-                 * Set environment
-                 */
-                log.info("Command = " + command);
-                for (Entry<String, String> entry : nv.entrySet()) {
-                    log.info("Env[" + entry.getKey() + "] = " + entry.getValue());
-                    session.setEnvVar(entry.getKey(), entry.getValue());
-                }                              
-
-                /*
-                 * Execute
-                 */
-                Command cmd = session.exec(command);
-                log.info("stdout=" + GfacUtils.readFromStream(session.getInputStream()));
-				cmd.join(COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
-
-                /*
-                 * check return value. usually not very helpful to draw
-                 * conclusions based on return values so don't bother. just
-                 * provide warning in the log messages
-                 */
-                if (cmd.getExitStatus() != 0) {
-                    log.error("Process finished with non zero return value. Process may have
failed");
-                } else {
-                    log.info("Process finished with return value of zero.");
-                }
-
-            } catch (ConnectionException e) {
-                throw e;
-            } finally {
-                try {
-                    session.close();
-                } catch (Exception e) {
-                    log.warn("Cannot Close SSH Session");
-                }
-            }
+            /*
+             * Going to working Directory
+             */
+            session.exec("cd " + app.getWorkingDir());
+
+            // get the env of the host and the application
+            Map<String, String> nv = app.getEnv();
+
+            // extra env's
+            nv.put(GFacConstants.INPUT_DATA_DIR_VAR_NAME, app.getInputDir());
+            nv.put(GFacConstants.OUTPUT_DATA_DIR_VAR_NAME, app.getOutputDir());
+
+            /*
+             * Set environment
+             */
+            log.info("Command = " + command);
+            for (Entry<String, String> entry : nv.entrySet()) {
+                log.info("Env[" + entry.getKey() + "] = " + entry.getValue());
+                session.setEnvVar(entry.getKey(), entry.getValue());
+            }
+
+            /*
+             * Execute
+             */
+            Command cmd = session.exec(command);
+            log.info("stdout=" + GfacUtils.readFromStream(session.getInputStream()));
+            cmd.join(COMMAND_EXECUTION_TIMEOUT, TimeUnit.SECONDS);
+
+            /*
+             * check return value. usually not very helpful to draw conclusions
+             * based on return values so don't bother. just provide warning in
+             * the log messages
+             */
+            if (cmd.getExitStatus() != 0) {
+                log.error("Process finished with non zero return value. Process may have
failed");
+            } else {
+                log.info("Process finished with return value of zero.");
+            }
+
+        } catch (ConnectionException e) {
+            new ProviderException(e.getMessage(), e);
+        } catch (TransportException e) {
+            new ProviderException(e.getMessage(), e);
         } catch (IOException e) {
-            throw new ProviderException(e.getMessage(), e);
+            new ProviderException(e.getMessage(), e);
         } finally {
-            try {
-                ssh.disconnect();
-            } catch (Exception e) {
-                log.warn("Cannot Close SSH Connection");
-            }
+            closeSession(session);
         }
     }
 
-    public Map<String, ?> processOutput(InvocationContext context) throws ProviderException
{
-        HostDescription host = context.getExecutionDescription().getHost();
+    public Map<String, ?> processOutput(InvocationContext context) throws ProviderException
{       
         ShellApplicationDeployment app = (ShellApplicationDeployment) context.getExecutionDescription().getApp();
-        SSHClient ssh = new SSHClient();
         try {
 
-            initSSHSecurity(context, ssh);
-            ssh.connect(host.getName());
+            // Get the Stdouts and StdErrs
+            String timeStampedServiceName = GfacUtils.createUniqueNameForService(context.getServiceName());
+            File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
+            File localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");
 
-            final Session session = ssh.startSession();
-            try {
-                // TODO: The location of the logDir should be a configurable
-                // parameter.
-                // TODO: This location is easy to lose. Also, why not use
-                // standard logging
-                // TODO: tools for this? Or are these really temporary
-                // directories rather than logs?
-                File logDir = new File("./service_logs");
-                if (!logDir.exists()) {
-                    if (!logDir.mkdir()){
-                    	log.error("error in creating directory "+logDir.toString());
-                    }
-                }
-                // Get the Stdouts and StdErrs
-                QName x = QName.valueOf(context.getServiceName());
-                String timeStampedServiceName = GfacUtils.createServiceDirName(x);
-                File localStdOutFile = new File(logDir, timeStampedServiceName + ".stdout");
-                File localStdErrFile = new File(logDir, timeStampedServiceName + ".stderr");
-
-                SCPFileTransfer fileTransfer = ssh.newSCPFileTransfer();
-                fileTransfer.download(app.getStdOut(), localStdOutFile.getAbsolutePath());
-                fileTransfer.download(app.getStdErr(), localStdErrFile.getAbsolutePath());
-
-                String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
-                String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());
-
-                // set to context
-                return OutputUtils.fillOutputFromStdout(context.<AbstractParameter>
getOutput(), stdOutStr);
-
-            } catch (ConnectionException e) {
-                throw e;
-            } finally {
-                try {
-                    session.close();
-                } catch (Exception e) {
-                    log.warn("Cannot Close SSH Session");
-                }
-            }
+            SCPFileTransfer fileTransfer = ssh.newSCPFileTransfer();
+            fileTransfer.download(app.getStdOut(), localStdOutFile.getAbsolutePath());
+            fileTransfer.download(app.getStdErr(), localStdErrFile.getAbsolutePath());
+
+            String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
+            String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());
+
+            return OutputUtils.fillOutputFromStdout(context.<AbstractParameter> getOutput(),
stdOutStr);
+
+        } catch (ConnectionException e) {
+            throw new ProviderException(e.getMessage(), e);
+        } catch (TransportException e) {
+            throw new ProviderException(e.getMessage(), e);
         } catch (IOException e) {
             throw new ProviderException(e.getMessage(), e);
-        } finally {
-            try {
+        }
+    }
+
+    public void dispose(InvocationContext invocationContext) throws GfacException {
+        super.dispose(invocationContext);
+        try {
+            if (ssh != null && ssh.isConnected()) {
                 ssh.disconnect();
-            } catch (Exception e) {
-                log.warn("Cannot Close SSH Connection");
             }
+        } catch (Exception e) {
+            log.warn("Cannot Close SSH Connection");
         }
     }
 }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java?rev=1170358&r1=1170357&r2=1170358&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/SchedulerImpl.java
Tue Sep 13 21:24:20 2011
@@ -32,9 +32,9 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
 import org.apache.airavata.core.gfac.context.invocation.impl.DefaultExecutionDescription;
 import org.apache.airavata.core.gfac.exception.SchedulerException;
-import org.apache.airavata.core.gfac.provider.GramProvider;
-import org.apache.airavata.core.gfac.provider.LocalProvider;
 import org.apache.airavata.core.gfac.provider.Provider;
+import org.apache.airavata.core.gfac.provider.impl.GramProvider;
+import org.apache.airavata.core.gfac.provider.impl.LocalProvider;
 import org.apache.airavata.core.gfac.scheduler.Scheduler;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
 import org.slf4j.Logger;

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java?rev=1170358&r1=1170357&r2=1170358&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java
(original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GfacUtils.java
Tue Sep 13 21:24:20 2011
@@ -33,8 +33,6 @@ import java.net.UnknownHostException;
 import java.util.Date;
 import java.util.UUID;
 
-import javax.xml.namespace.QName;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -100,12 +98,11 @@ public class GfacUtils {
                 || GFacConstants._127_0_0_1.equals(appHost));
     }
 
-    // TODO: why do you need the date? UUID will give you a unique ID.
-    public static String createServiceDirName(QName serviceName) {
+    public static String createUniqueNameForService(String serviceName) {
         String date = new Date().toString();
         date = date.replaceAll(" ", "_");
         date = date.replaceAll(":", "_");
-        return serviceName.getLocalPart() + "_" + date + "_" + UUID.randomUUID();
+        return serviceName + "_" + date + "_" + UUID.randomUUID();
     }
 
     public static URI createGsiftpURI(GridFTPContactInfo host, String localPath) throws URISyntaxException
{



Mime
View raw message