You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by pa...@apache.org on 2011/09/08 21:46:03 UTC

svn commit: r1166875 [2/2] - in /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac: context/message/impl/ context/security/impl/ context/security/impl/utils/ exception/ extension/ extension/data/ extension/post/ ext...

Modified: 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/LocalProvider.java?rev=1166875&r1=1166874&r2=1166875&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/LocalProvider.java Thu Sep  8 19:46:01 2011
@@ -36,9 +36,8 @@ import org.apache.airavata.commons.gfac.
 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.message.MessageContext;
 import org.apache.airavata.core.gfac.exception.GfacException;
-import org.apache.airavata.core.gfac.exception.GfacException.FaultCode;
+import org.apache.airavata.core.gfac.exception.ProviderException;
 import org.apache.airavata.core.gfac.notification.NotificationService;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
@@ -57,7 +56,7 @@ public class LocalProvider extends Abstr
         return buff.toString();
     }
 
-    public void initialize(InvocationContext invocationContext) throws GfacException {
+    public void initialize(InvocationContext invocationContext) throws ProviderException {
         ApplicationDeploymentDescription app = invocationContext.getExecutionDescription().getApp();
 
         log.info("working diectroy = " + app.getWorkingDir());
@@ -68,7 +67,7 @@ public class LocalProvider extends Abstr
         new File(app.getOutputDir()).mkdir();
     }
 
-    public void execute(InvocationContext context) throws GfacException {
+    public void execute(InvocationContext context) throws ProviderException {
         ShellApplicationDeployment app = (ShellApplicationDeployment)context.getExecutionDescription().getApp();
         
         // input parameter
@@ -221,21 +220,21 @@ public class LocalProvider extends Abstr
 
             log.info(buf.toString());
 
-            String stdOutStr = GfacUtils.readFile(app.getStdOut());
-            String stdErrStr = GfacUtils.readFile(app.getStdErr());
+            String stdOutStr = GfacUtils.readFileToString(app.getStdOut());
+            String stdErrStr = GfacUtils.readFileToString(app.getStdErr());
 
             // set to context
             OutputUtils.fillOutputFromStdout(context.<AbstractParameter>getOutput(), stdOutStr, stdErrStr);
 
         } catch (IOException e) {
         	log.error("error", e);
-            throw new GfacException(e, FaultCode.LocalError);
+            throw new ProviderException(e.getMessage(), e);
         } catch (InterruptedException e) {
         	log.error("error", e);
-            throw new GfacException(e, FaultCode.LocalError);
+        	throw new ProviderException(e.getMessage(), e);
         } catch (Exception e){
         	log.error("error", e);
-            throw new GfacException(e, FaultCode.LocalError);
+        	throw new ProviderException(e.getMessage(), e);
         }
 
     }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/Provider.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/Provider.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/Provider.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/Provider.java Thu Sep  8 19:46:01 2011
@@ -23,12 +23,13 @@ package org.apache.airavata.core.gfac.pr
 
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
 import org.apache.airavata.core.gfac.exception.GfacException;
+import org.apache.airavata.core.gfac.exception.ProviderException;
 
 public interface Provider {
 
-    void initialize(InvocationContext invocationContext) throws GfacException;
+    void initialize(InvocationContext invocationContext) throws ProviderException;
 
-    void execute(InvocationContext invocationContext) throws GfacException;
+    void execute(InvocationContext invocationContext) throws ProviderException;
 
     void dispose(InvocationContext invocationContext) throws GfacException;
 

Modified: 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/SSHProvider.java?rev=1166875&r1=1166874&r2=1166875&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/SSHProvider.java Thu Sep  8 19:46:01 2011
@@ -32,6 +32,7 @@ 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.userauth.keyprovider.KeyProvider;
@@ -41,9 +42,9 @@ import org.apache.airavata.commons.gfac.
 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.message.MessageContext;
 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.notification.NotificationService;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.apache.airavata.core.gfac.utils.GfacUtils;
@@ -62,40 +63,39 @@ public class SSHProvider extends Abstrac
         }
         return buff.toString();
     }
-    
-    private void initSSHSecurity(InvocationContext context, SSHClient ssh) throws GfacException, IOException{
+
+    private void initSSHSecurity(InvocationContext context, SSHClient ssh) throws SecurityException, IOException {
         try {
-            SSHSecurityContextImpl sshContext = ((SSHSecurityContextImpl) context.getSecurityContext(SSH_SECURITY_CONTEXT));
+            SSHSecurityContextImpl sshContext = ((SSHSecurityContextImpl) context
+                    .getSecurityContext(SSH_SECURITY_CONTEXT));
 
             KeyProvider pkey = ssh.loadKeys(sshContext.getPrivateKeyLoc(), sshContext.getKeyPass());
 
-            ssh.loadKnownHosts();            
+            ssh.loadKnownHosts();
             ssh.authPublickey(sshContext.getUsername(), pkey);
 
         } catch (NullPointerException ne) {
-            throw new GfacException("Cannot load security context for SSH", ne);
-        } catch (IOException e){
-            throw e;
+            throw new SecurityException("Cannot load security context for SSH", ne);
         }
-        
+
     }
 
-	 //TODO: This method has a try/catch embedded in 'finally' method.  Is there a way
-	 //TODO: to force cleanup on failed connections?
-    public void initialize(InvocationContext context) throws GfacException {
+    // TODO: This method has a try/catch embedded in 'finally' method. Is there a way
+    // TODO: to force cleanup on failed connections?
+    public void initialize(InvocationContext context) throws ProviderException {
         HostDescription host = context.getExecutionDescription().getHost();
         ShellApplicationDeployment app = (ShellApplicationDeployment) context.getExecutionDescription().getApp();
 
         SSHClient ssh = new SSHClient();
         try {
 
-            initSSHSecurity(context, ssh);            
+            initSSHSecurity(context, ssh);
             ssh.connect(host.getName());
 
             final Session session = ssh.startSession();
             try {
                 StringBuilder command = new StringBuilder();
-					 //TODO: Is "|" what you want here?
+                // TODO: Is "|" what you want here?
                 command.append("mkdir -p ");
                 command.append(app.getTmpDir());
                 command.append(" | ");
@@ -109,31 +109,29 @@ public class SSHProvider extends Abstrac
                 command.append(app.getOutputDir());
                 Command cmd = session.exec(command.toString());
                 cmd.join(5, TimeUnit.SECONDS);
-            } catch (Exception e) {
+            } catch (ConnectionException e) {
                 throw e;
             } finally {
                 try {
                     session.close();
                 } catch (Exception e) {
-						  //TODO: Need to at least report this exception.  This failed "finally" could
-						  //TODO: lead to hard-to-debug crashes.
+                    log.warn("Cannot Close SSH Session");
                 }
             }
-        } catch (Exception e) {
-            throw new GfacException(e.getMessage(), e);
+        } catch (IOException e) {
+            throw new ProviderException(e.getMessage(), e);
         } finally {
             try {
                 ssh.disconnect();
             } catch (Exception e) {
-					 //TODO: Need to at least report this exception.  This failed "finally" could
-					 //TODO: lead to hard-to-debug crashes.
+                log.warn("Cannot Close SSH Connection");
             }
         }
     }
 
-	 //TODO: This method has a try/catch embedded in 'finally' method.  Is there a way
-	 //TODO: to force cleanup on failed connections?
-    public void execute(InvocationContext context) throws GfacException {
+    // TODO: This method has a try/catch embedded in 'finally' method. Is there a way
+    // TODO: to force cleanup on failed connections?
+    public void execute(InvocationContext context) throws ProviderException {
         HostDescription host = context.getExecutionDescription().getHost();
         ShellApplicationDeployment app = (ShellApplicationDeployment) context.getExecutionDescription().getApp();
 
@@ -147,7 +145,7 @@ public class SSHProvider extends Abstrac
         List<String> cmdList = new ArrayList<String>();
 
         SSHClient ssh = new SSHClient();
-        try {            
+        try {
 
             /*
              * Builder Command
@@ -159,8 +157,8 @@ public class SSHProvider extends Abstrac
             String command = buildCommand(cmdList);
 
             // redirect StdOut and StdErr
-				//TODO: Make 1> and 2> into static constants.
-				//TODO: This only works for the BASH shell.  CSH and TCSH will be different.  
+            // TODO: Make 1> and 2> into static constants.
+            // 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();
 
@@ -180,8 +178,9 @@ public class SSHProvider extends Abstrac
             // notify start
             NotificationService notifier = context.getExecutionContext().getNotificationService();
             notifier.startExecution(this, context);
-				
-				//TODO: initSSHSecurity can throw an IOException but you are treating everything as a GFAC exception.
+
+            // TODO: initSSHSecurity can throw an IOException but you are
+            // treating everything as a GFAC exception.
             initSSHSecurity(context, ssh);
             ssh.connect(host.getName());
             final Session session = ssh.startSession();
@@ -221,9 +220,9 @@ public class SSHProvider extends Abstrac
                     log.info("Process finished with return value of zero.");
                 }
 
-					 //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?
+                // 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()) {
                     logDir.mkdir();
@@ -239,30 +238,28 @@ public class SSHProvider extends Abstrac
                 fileTransfer.download(app.getStdOut(), localStdOutFile.getAbsolutePath());
                 fileTransfer.download(app.getStdErr(), localStdErrFile.getAbsolutePath());
 
-                String stdOutStr = GfacUtils.readFile(localStdOutFile.getAbsolutePath());
-                String stdErrStr = GfacUtils.readFile(localStdErrFile.getAbsolutePath());
+                String stdOutStr = GfacUtils.readFileToString(localStdOutFile.getAbsolutePath());
+                String stdErrStr = GfacUtils.readFileToString(localStdErrFile.getAbsolutePath());
 
                 // set to context
-                OutputUtils.fillOutputFromStdout(context.<AbstractParameter>getOutput(), stdOutStr, stdErrStr);
+                OutputUtils.fillOutputFromStdout(context.<AbstractParameter> getOutput(), stdOutStr, stdErrStr);
 
-            } catch (Exception e) {
+            } catch (IOException e) {
                 throw e;
             } finally {
                 try {
                     session.close();
                 } catch (Exception e) {
-						  //TODO: Need to at least report this exception.  This failed "finally" could
-						  //TODO: lead to hard-to-debug crashes.
+                    log.warn("Cannot Close SSH Session");
                 }
             }
-        } catch (Exception e) {
-            throw new GfacException(e.getMessage(), e);
+        } catch (IOException e) {
+            throw new ProviderException(e.getMessage(), e);
         } finally {
             try {
                 ssh.disconnect();
             } catch (Exception e) {
-					 //TODO: Need to at least report this exception.  This failed "finally" could
-					 //TODO: lead to hard-to-debug crashes.
+                log.warn("Cannot Close SSH Connection");
             }
         }
     }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/GramRSLGenerator.java Thu Sep  8 19:46:01 2011
@@ -26,9 +26,7 @@ import java.util.Map;
 
 import org.apache.airavata.commons.gfac.type.app.GramApplicationDeployment;
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
-import org.apache.airavata.core.gfac.context.message.MessageContext;
-import org.apache.airavata.core.gfac.exception.GfacException;
-import org.apache.airavata.core.gfac.exception.GfacException.FaultCode;
+import org.apache.airavata.core.gfac.exception.ToolsException;
 import org.apache.airavata.core.gfac.utils.GFacConstants;
 import org.globus.gram.GramAttributes;
 import org.slf4j.Logger;
@@ -41,7 +39,7 @@ public class GramRSLGenerator {
         SINGLE, MPI, MULTIPLE, CONDOR
     };
 
-    public static GramAttributes configureRemoteJob(InvocationContext context) throws GfacException {
+    public static GramAttributes configureRemoteJob(InvocationContext context) throws ToolsException {
         GramApplicationDeployment app = (GramApplicationDeployment) context.getExecutionDescription().getApp();
 
         GramAttributes jobAttr = new GramAttributes();
@@ -67,7 +65,7 @@ public class GramRSLGenerator {
             log.info("Setting max wall clock time to " + app.getWallTime());
 
             if (app.getWallTime() > 30 && app.getQueueName() != null && app.getQueueName().equals("debug")) {
-                throw new GfacException("NCSA debug Queue only support jobs < 30 minutes", FaultCode.InvalidConfig);
+                throw new ToolsException("NCSA debug Queue only support jobs < 30 minutes");
             }
 
             jobAttr.setMaxWallTime(app.getWallTime());

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java Thu Sep  8 19:46:01 2011
@@ -23,7 +23,7 @@ package org.apache.airavata.core.gfac.pr
 
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
 import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
-import org.apache.airavata.core.gfac.exception.GfacException;
+import org.apache.airavata.core.gfac.exception.SecurityException;
 import org.globus.gram.GramException;
 import org.globus.gram.GramJob;
 import org.globus.gram.GramJobListener;
@@ -49,7 +49,7 @@ public class JobSubmissionListener imple
     }
 
     // waits for DONE or FAILED status
-    public void waitFor() throws InterruptedException, GSSException, GfacException, GramException {
+    public void waitFor() throws InterruptedException, GSSException, GramException, SecurityException {
         while (!finished) {
             int proxyExpTime = job.getCredentials().getRemainingLifetime();
             if (proxyExpTime < 900) {

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/Scheduler.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/Scheduler.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/Scheduler.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/Scheduler.java Thu Sep  8 19:46:01 2011
@@ -22,9 +22,9 @@
 package org.apache.airavata.core.gfac.scheduler;
 
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
-import org.apache.airavata.core.gfac.exception.GfacException;
+import org.apache.airavata.core.gfac.exception.SchedulerException;
 import org.apache.airavata.core.gfac.provider.Provider;
 
 public interface Scheduler {
-    public Provider schedule(InvocationContext context) throws GfacException;
+    public Provider schedule(InvocationContext context) throws SchedulerException;
 }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/POJOSchedulerImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/POJOSchedulerImpl.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/POJOSchedulerImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/scheduler/impl/POJOSchedulerImpl.java Thu Sep  8 19:46:01 2011
@@ -21,9 +21,11 @@
 
 package org.apache.airavata.core.gfac.scheduler.impl;
 
+import java.net.UnknownHostException;
+
 import org.apache.airavata.commons.gfac.type.HostDescription;
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
-import org.apache.airavata.core.gfac.exception.GfacException;
+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;
@@ -32,11 +34,15 @@ import org.apache.airavata.core.gfac.uti
 
 public class POJOSchedulerImpl implements Scheduler {
 
-    public Provider schedule(InvocationContext context) throws GfacException {
-        HostDescription host = context.getExecutionDescription().getHost();
-        if(GfacUtils.isLocalHost(host.getName())){
-            return new LocalProvider();
+    public Provider schedule(InvocationContext context) throws SchedulerException {
+        try {
+            HostDescription host = context.getExecutionDescription().getHost();
+            if (GfacUtils.isLocalHost(host.getName())) {
+                return new LocalProvider();
+            }
+            return new GramProvider();
+        } catch (UnknownHostException e) {
+            throw new SchedulerException("Cannot get IP for current host", e);
         }
-        return new GramProvider();
     }
 }

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=1166875&r1=1166874&r2=1166875&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 Thu Sep  8 19:46:01 2011
@@ -21,6 +21,7 @@
 
 package org.apache.airavata.core.gfac.scheduler.impl;
 
+import java.net.UnknownHostException;
 import java.util.Iterator;
 import java.util.List;
 
@@ -30,8 +31,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.commons.gfac.type.ServiceDescription;
 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.GfacException;
-import org.apache.airavata.core.gfac.exception.GfacException.FaultCode;
+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;
@@ -44,7 +44,7 @@ public class SchedulerImpl implements Sc
 
     private static Logger log = LoggerFactory.getLogger(SchedulerImpl.class);
 
-    public Provider schedule(InvocationContext context) throws GfacException {
+    public Provider schedule(InvocationContext context) throws SchedulerException {
 
         Registry registryService = context.getExecutionContext().getRegistryService();
 
@@ -54,8 +54,8 @@ public class SchedulerImpl implements Sc
         ServiceDescription serviceDesc = registryService.getServiceDescription(context.getServiceName());
 
         if (serviceDesc == null)
-            throw new GfacException("Service Desciption for " + context.getServiceName()
-                    + " does not found on resource Catalog " + registryService, FaultCode.InvalidRequest);
+            throw new SchedulerException("Service Desciption for " + context.getServiceName()
+                    + " does not found on resource Catalog " + registryService);
 
         /*
          * Load host
@@ -63,8 +63,8 @@ public class SchedulerImpl implements Sc
         HostDescription host = scheduleToHost(registryService, context.getServiceName());
 
         if (host == null)
-            throw new GfacException("Host Desciption for " + context.getServiceName()
-                    + " does not found on resource Catalog " + registryService, FaultCode.InvalidRequest);
+            throw new SchedulerException("Host Desciption for " + context.getServiceName()
+                    + " does not found on resource Catalog " + registryService);
 
         /*
          * Load app
@@ -73,8 +73,8 @@ public class SchedulerImpl implements Sc
                 host.getName());
 
         if (app == null)
-            throw new GfacException("App Desciption for " + context.getServiceName()
-                    + " does not found on resource Catalog " + registryService, FaultCode.InvalidRequest);
+            throw new SchedulerException("App Desciption for " + context.getServiceName()
+                    + " does not found on resource Catalog " + registryService);
 
         /*
          * Check class and binding
@@ -91,10 +91,14 @@ public class SchedulerImpl implements Sc
          * Determine provider
          */
         String hostName = host.getName();
-        if (GfacUtils.isLocalHost(hostName)) {
-            return new LocalProvider();
-        } else {
-            return new GramProvider();
+        try {
+            if (GfacUtils.isLocalHost(hostName)) {
+                return new LocalProvider();
+            } else {
+                return new GramProvider();
+            }
+        } catch (UnknownHostException e) {
+            throw new SchedulerException("Cannot get IP for current host", e);
         }
 
     }
@@ -105,8 +109,8 @@ public class SchedulerImpl implements Sc
         List<HostDescription> hosts = regService.getServiceLocation(serviceName);
         if (hosts != null && hosts.size() > 0) {
             HostDescription result = null;
-            for (Iterator iterator = hosts.iterator(); iterator.hasNext();) {
-                result = (HostDescription) iterator.next();
+            for (Iterator<HostDescription> iterator = hosts.iterator(); iterator.hasNext();) {
+                result = iterator.next();
 
                 log.info("Found service on: " + result.getName());
             }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java Thu Sep  8 19:46:01 2011
@@ -22,7 +22,9 @@
 package org.apache.airavata.core.gfac.services.impl;
 
 import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
+import org.apache.airavata.core.gfac.exception.ExtensionException;
 import org.apache.airavata.core.gfac.exception.GfacException;
+import org.apache.airavata.core.gfac.exception.ServiceException;
 import org.apache.airavata.core.gfac.extension.DataServiceChain;
 import org.apache.airavata.core.gfac.extension.ExitableChain;
 import org.apache.airavata.core.gfac.extension.PostExecuteChain;
@@ -34,40 +36,40 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public abstract class AbstractSimpleService implements GenericService {
-    
+
     private static Logger log = LoggerFactory.getLogger(AbstractSimpleService.class);
 
-    public abstract void preProcess(InvocationContext context) throws GfacException;
+    public abstract void preProcess(InvocationContext context) throws ServiceException;
 
-    public abstract void postProcess(InvocationContext context) throws GfacException;
+    public abstract void postProcess(InvocationContext context) throws ServiceException;
 
-    public abstract Scheduler getScheduler(InvocationContext context) throws GfacException;
+    public abstract Scheduler getScheduler(InvocationContext context) throws ServiceException;
 
-    public abstract PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws GfacException;
+    public abstract PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws ServiceException;
 
-    public abstract PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws GfacException;
+    public abstract PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws ServiceException;
 
-    public abstract DataServiceChain[] getDataChains(InvocationContext context) throws GfacException;
+    public abstract DataServiceChain[] getDataChains(InvocationContext context) throws ServiceException;
 
     public final void execute(InvocationContext context) throws GfacException {
 
         log.debug("Before preprocess");
-        
+
         /*
          * Pre-Process
          */
         preProcess(context);
-        
+
         log.debug("After preprocess, try to get Scheduler and schedule");
 
         /*
          * Determine provider
-         */        
-        Scheduler scheduler = getScheduler(context); 
+         */
+        Scheduler scheduler = getScheduler(context);
         context.getExecutionContext().getNotificationService().startSchedule(this, context, scheduler);
         Provider provider = scheduler.schedule(context);
         context.getExecutionContext().getNotificationService().finishSchedule(this, context, scheduler, provider);
-        
+
         log.debug("After scheduling, try to run data chain");
 
         /*
@@ -76,12 +78,12 @@ public abstract class AbstractSimpleServ
         buildChains(getDataChains(context)).start(context);
 
         log.debug("After data chain, try to init provider");
-        
+
         /*
          * Init
          */
         provider.initialize(context);
-        
+
         log.debug("After provider initialization, try to run pre-execution chain");
 
         /*
@@ -90,12 +92,12 @@ public abstract class AbstractSimpleServ
         buildChains(getPreExecutionSteps(context)).start(context);
 
         log.debug("After pre-execution chain, try to execute provider");
-        
+
         /*
          * Execute
          */
         provider.execute(context);
-        
+
         log.debug("After provider execution, try to run post-execution chain");
 
         /*
@@ -104,19 +106,19 @@ public abstract class AbstractSimpleServ
         buildChains(getPostExecuteSteps(context)).start(context);
 
         log.debug("After pre-execution chain, try to dispose provider");
-        
+
         /*
          * Destroy
          */
         provider.dispose(context);
-        
+
         log.debug("After provider disposal, try to run postprocess");
 
         /*
          * Pre-Process
          */
         postProcess(context);
-        
+
         log.debug("After postprocess");
     }
 
@@ -126,12 +128,7 @@ public abstract class AbstractSimpleServ
          * Validation check and return doing-nothing chain object
          */
         if (list == null || list.length == 0) {
-            return new ExitableChain() {
-                @Override
-                protected boolean execute(InvocationContext context) {
-                    return true;
-                }
-            };
+            return new NullChain();               
         }
 
         ExitableChain currentPoint = list[0];
@@ -140,4 +137,15 @@ public abstract class AbstractSimpleServ
         }
         return currentPoint;
     }
+
+    /**
+     * Inner class for no chain
+     */
+    private static class NullChain extends ExitableChain {
+        @Override
+        protected boolean execute(InvocationContext context) throws ExtensionException {
+            return true;
+        }
+    }
+
 }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/POJOServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/POJOServiceImpl.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/POJOServiceImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/POJOServiceImpl.java Thu Sep  8 19:46:01 2011
@@ -28,6 +28,7 @@ import org.apache.airavata.core.gfac.con
 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.GfacException;
+import org.apache.airavata.core.gfac.exception.ServiceException;
 import org.apache.airavata.core.gfac.extension.DataServiceChain;
 import org.apache.airavata.core.gfac.extension.PostExecuteChain;
 import org.apache.airavata.core.gfac.extension.PreExecuteChain;
@@ -51,26 +52,26 @@ public class POJOServiceImpl extends Abs
     public void dispose() throws GfacException {
     }
 
-    public void preProcess(InvocationContext context) throws GfacException {
+    public void preProcess(InvocationContext context) throws ServiceException {
         context.setExecutionDescription(this.context);
     }
 
-    public void postProcess(InvocationContext context) throws GfacException {
+    public void postProcess(InvocationContext context) throws ServiceException {
     }
 
-    public Scheduler getScheduler(InvocationContext context) throws GfacException {
+    public Scheduler getScheduler(InvocationContext context) throws ServiceException {
         return new POJOSchedulerImpl();
     }
 
-    public PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws GfacException {
+    public PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws ServiceException {
         return null;
     }
 
-    public PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws GfacException {
+    public PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws ServiceException {
         return null;
     }
 
-    public DataServiceChain[] getDataChains(InvocationContext context) throws GfacException {
+    public DataServiceChain[] getDataChains(InvocationContext context) throws ServiceException {
         return null;
     }   
 }

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/PropertiesBasedServiceImpl.java Thu Sep  8 19:46:01 2011
@@ -35,7 +35,7 @@ import org.apache.airavata.core.gfac.con
 import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
 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.GfacException.FaultCode;
+import org.apache.airavata.core.gfac.exception.ServiceException;
 import org.apache.airavata.core.gfac.extension.DataServiceChain;
 import org.apache.airavata.core.gfac.extension.ExitableChain;
 import org.apache.airavata.core.gfac.extension.PostExecuteChain;
@@ -161,7 +161,7 @@ public class PropertiesBasedServiceImpl 
     }
 
     @Override
-    public void preProcess(InvocationContext context) throws GfacException {
+    public void preProcess(InvocationContext context) throws ServiceException {
         /*
          * Check Gram header
          */
@@ -249,7 +249,7 @@ public class PropertiesBasedServiceImpl 
     }
 
     @Override
-    public void postProcess(InvocationContext context) throws GfacException {
+    public void postProcess(InvocationContext context) throws ServiceException {
     }
 
     /*
@@ -259,7 +259,7 @@ public class PropertiesBasedServiceImpl 
      * org.apache.airavata.core.gfac.services.GenericService#getScheduler(org
      * .apache.airavata.core.gfac.context .InvocationContext)
      */
-    public Scheduler getScheduler(InvocationContext context) throws GfacException {
+    public Scheduler getScheduler(InvocationContext context) throws ServiceException {
         String className = null;
         if (this.scheduler == null) {
             log.info("try to create scheduler");
@@ -281,9 +281,9 @@ public class PropertiesBasedServiceImpl 
                 log.info("Scheduler:" + className + " is loaded");
 
             } catch (ClassNotFoundException ex) {
-                throw new GfacException("Scheduler " + className + " not found", ex);
+                throw new ServiceException("Scheduler " + className + " not found", ex);
             } catch (Exception ex) {
-                throw new GfacException("Scheduler " + className + " could not be instantiated: " + ex, ex);
+                throw new ServiceException("Scheduler " + className + " could not be instantiated: " + ex, ex);
             }
         }
         return this.scheduler;
@@ -296,7 +296,7 @@ public class PropertiesBasedServiceImpl 
      * org.apache.airavata.core.gfac.services.GenericService#getPreExecutionSteps
      * (org.ogce.gfac .context.InvocationContext)
      */
-    public PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws GfacException {
+    public PreExecuteChain[] getPreExecutionSteps(InvocationContext context) throws ServiceException {
         if (this.preChain == null) {
             log.info("try to load pre-execution chain");
             this.preChain = loadClassFromProperties(PRE_CHAIN_CLASS, PreExecuteChain.class);
@@ -311,7 +311,7 @@ public class PropertiesBasedServiceImpl 
      * org.apache.airavata.core.gfac.services.GenericService#getPostExecuteSteps
      * (org.ogce.gfac .context.InvocationContext)
      */
-    public PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws GfacException {
+    public PostExecuteChain[] getPostExecuteSteps(InvocationContext context) throws ServiceException {
         if (this.postChain == null) {
             log.info("try to load post-execution chain");
             this.postChain = loadClassFromProperties(POST_CHAIN_CLASS, PostExecuteChain.class);
@@ -326,7 +326,7 @@ public class PropertiesBasedServiceImpl 
      * org.apache.airavata.core.gfac.services.impl.OGCEGenericService#getDataChains
      * (org.apache.airavata.core.gfac.context .InvocationContext)
      */
-    public DataServiceChain[] getDataChains(InvocationContext context) throws GfacException {
+    public DataServiceChain[] getDataChains(InvocationContext context) throws ServiceException {
         if (this.dataChain == null) {
             log.info("try to load data chain");
             this.dataChain = loadClassFromProperties(DATA_CHAIN_CLASS, DataServiceChain.class);
@@ -341,11 +341,11 @@ public class PropertiesBasedServiceImpl 
      * @return
      * @throws GfacException
      */
-    private String loadFromProperty(String propertyName, boolean required) throws GfacException {
+    private String loadFromProperty(String propertyName, boolean required) throws ServiceException {
         String propValue = this.properties.getProperty(propertyName);
         if (propValue == null) {
             if (required)
-                throw new GfacException("Property \"" + propertyName + "\" is not found", FaultCode.InvalidConfig);
+                throw new ServiceException("Property \"" + propertyName + "\" is not found");
             return null;
         }
         return propValue;
@@ -356,7 +356,7 @@ public class PropertiesBasedServiceImpl 
 	 */
     @SuppressWarnings("unchecked")
     private <T> T[] loadClassFromProperties(String propertyName, Class<? extends ExitableChain> type)
-            throws GfacException {
+            throws ServiceException {
 
         // property is not set
         String propValue = loadFromProperty(propertyName, false);
@@ -385,11 +385,11 @@ public class PropertiesBasedServiceImpl 
                 log.info(type.getName() + " : " + className + " is loaded");
 
             } catch (ClassNotFoundException ex) {
-                throw new GfacException("Cannot find the class: " + className, ex);
+                throw new ServiceException("Cannot find the class: " + className, ex);
             } catch (IllegalAccessException ex) {
-                throw new GfacException("Cannot access the class: " + className, ex);
+                throw new ServiceException("Cannot access the class: " + className, ex);
             } catch (InstantiationException ex) {
-                throw new GfacException("Cannot init the class: " + className, ex);
+                throw new ServiceException("Cannot init the class: " + className, ex);
             }
         }
         return chain;

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GFacConstants.java
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GFacConstants.java?rev=1166875&r1=1166874&r2=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GFacConstants.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GFacConstants.java Thu Sep  8 19:46:01 2011
@@ -23,6 +23,8 @@ package org.apache.airavata.core.gfac.ut
 
 public class GFacConstants {
     
+    public static final String NEWLINE = System.getProperty("line.separator");
+    
     public static final String INPUT_DATA_DIR_VAR_NAME = "inputData";
 
     public static final String OUTPUT_DATA_DIR_VAR_NAME = "outputData";

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=1166875&r1=1166874&r2=1166875&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 Thu Sep  8 19:46:01 2011
@@ -21,8 +21,10 @@
 
 package org.apache.airavata.core.gfac.utils;
 
+import java.io.BufferedReader;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.InetAddress;
@@ -30,71 +32,81 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.UnknownHostException;
 import java.util.Date;
-import java.util.Properties;
 import java.util.UUID;
 
 import javax.xml.namespace.QName;
 
-import org.apache.airavata.core.gfac.exception.GfacException;
-import org.apache.airavata.core.gfac.exception.GfacException.FaultCode;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class GfacUtils {
-    protected final static Logger log = LoggerFactory.getLogger(GfacUtils.class); 
+    private final static Logger log = LoggerFactory.getLogger(GfacUtils.class);
 
+    
+    /**
+     * Read data from inputStream and convert it to String.
+     * 
+     * @param in
+     * @return String read from inputStream
+     * @throws IOException
+     */
     public static String readFromStream(InputStream in) throws IOException {
-        StringBuffer wsdlStr = new StringBuffer();
-
-        int read;
+        try {            
+            StringBuffer wsdlStr = new StringBuffer();
 
-        byte[] buf = new byte[1024];
-        while ((read = in.read(buf)) > 0) {
-            wsdlStr.append(new String(buf, 0, read));
-        }
-        in.close();
-        return wsdlStr.toString();
-    }
+            int read;
 
-	 //TODO: this is really "readFileToString()".
-    public static String readFile(String file) throws GfacException {
-        FileInputStream in = null;
-        try {
-            in = new FileInputStream(file);
-            byte[] content = new byte[in.available()];
-            in.read(content);
-            return new String(content);
-        } catch (FileNotFoundException e) {
-            throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
-        } catch (IOException e) {
-            throw new GfacException(e, FaultCode.LocalError);
+            byte[] buf = new byte[1024];
+            while ((read = in.read(buf)) > 0) {
+                wsdlStr.append(new String(buf, 0, read));
+            }
+            return wsdlStr.toString();
         } finally {
             if (in != null) {
                 try {
                     in.close();
                 } catch (IOException e) {
-                    throw new GfacException(e, FaultCode.LocalError);
+                    log.warn("Cannot close InputStream: " + in.getClass().getName(), e);
                 }
             }
         }
     }
 
-    public static boolean isLocalHost(String appHost) throws GfacException {
+    public static String readFileToString(String file) throws FileNotFoundException, IOException {
+        BufferedReader instream = null;
         try {
-            String localHost = InetAddress.getLocalHost().getCanonicalHostName();
 
-            if (localHost.equals(appHost) || GFacConstants.LOCALHOST.equals(appHost)
-                    || GFacConstants._127_0_0_1.equals(appHost)) {
-                return true;
-            } else {
-                return false;
+            instream = new BufferedReader(new FileReader(file));
+            StringBuffer buff = new StringBuffer();
+            String temp = null;
+            while ((temp = instream.readLine()) != null) {
+                buff.append(temp);
+                buff.append(GFacConstants.NEWLINE);
+            }
+            return buff.toString();            
+        } finally {
+            if (instream != null) {
+                try {
+                    instream.close();
+                } catch (IOException e) {
+                    log.warn("Cannot close FileinputStream", e);
+                }
             }
-        } catch (UnknownHostException e) {
-            throw new GfacException(e, FaultCode.LocalError);
         }
     }
 
-	 //TODO: why do you need the date?  UUID will give you a unique ID.
+    public static boolean isLocalHost(String appHost) throws UnknownHostException {
+        String localHost = InetAddress.getLocalHost().getCanonicalHostName();
+
+        if (localHost.equals(appHost) || GFacConstants.LOCALHOST.equals(appHost)
+                || GFacConstants._127_0_0_1.equals(appHost)) {
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    // TODO: why do you need the date? UUID will give you a unique ID.
     public static String createServiceDirName(QName serviceName) {
         String date = new Date().toString();
         date = date.replaceAll(" ", "_");
@@ -102,50 +114,26 @@ public class GfacUtils {
         return serviceName.getLocalPart() + "_" + date + "_" + UUID.randomUUID();
     }
 
-    public static URI createGsiftpURI(ContactInfo host, String localPath) throws GfacException {
-        try {
-            StringBuffer buf = new StringBuffer();
-
-            if (!host.hostName.startsWith("gsiftp://"))
-                buf.append("gsiftp://");
-            buf.append(host).append(":").append(host.port);
-            if (!host.hostName.endsWith("/"))
-                buf.append("/");
-            buf.append(localPath);
-            return new URI(buf.toString());
-        } catch (URISyntaxException e) {
-            throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
-        }
-    }
-
-    public static URI createGsiftpURI(String host, String localPath) throws GfacException {
-        try {
-            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());
-        } catch (URISyntaxException e) {
-            throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
-        }
-    }
-    
-    public static URI createWorkflowQName(QName name) throws GfacException {
-        try {
-            return new URI("urn:qname:" + name.getNamespaceURI() + ":" + name.getLocalPart());
-        } catch (URISyntaxException e) {
-            throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
-        }
-    }
+    public static URI createGsiftpURI(GridFTPContactInfo host, String localPath) throws URISyntaxException {
+        StringBuffer buf = new StringBuffer();
 
-    public static String findStrProperty(Properties config, String name, String defaultVal) {
-        String value = config.getProperty(name);
-        if (value == null) {
-            return defaultVal;
-        }
-        return value.trim();
+        if (!host.hostName.startsWith("gsiftp://"))
+            buf.append("gsiftp://");
+        buf.append(host).append(":").append(host.port);
+        if (!host.hostName.endsWith("/"))
+            buf.append("/");
+        buf.append(localPath);
+        return new URI(buf.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());
     }
 }

Copied: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GridFTPContactInfo.java (from r1166775, incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/ContactInfo.java)
URL: http://svn.apache.org/viewvc/incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GridFTPContactInfo.java?p2=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GridFTPContactInfo.java&p1=incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/ContactInfo.java&r1=1166775&r2=1166875&rev=1166875&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/ContactInfo.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/utils/GridFTPContactInfo.java Thu Sep  8 19:46:01 2011
@@ -24,14 +24,14 @@ package org.apache.airavata.core.gfac.ut
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class ContactInfo {
-    protected final static Logger log = LoggerFactory.getLogger(GfacUtils.class);
+public class GridFTPContactInfo {
+    protected final static Logger log = LoggerFactory.getLogger(GridFTPContactInfo.class);
     public String hostName;
     public int port;
 
-    public ContactInfo(String hostName, int port) {
+    public GridFTPContactInfo(String hostName, int port) {
         if (port <= 0 || port == 80) {
-            log.info(hostName + "port recived " + port + " setting it to " + GFacConstants.DEFAULT_GSI_FTP_PORT);
+            log.debug(hostName + "port recived " + port + " setting it to " + GFacConstants.DEFAULT_GSI_FTP_PORT);
             port = GFacConstants.DEFAULT_GSI_FTP_PORT;
         }
         this.hostName = hostName;
@@ -40,8 +40,8 @@ public class ContactInfo {
 
     @Override
     public boolean equals(Object obj) {
-        if (obj instanceof ContactInfo) {
-            return hostName.equals(((ContactInfo) obj).hostName) && port == ((ContactInfo) obj).port;
+        if (obj instanceof GridFTPContactInfo) {
+            return hostName.equals(((GridFTPContactInfo) obj).hostName) && port == ((GridFTPContactInfo) obj).port;
         } else {
             return false;
         }