You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2012/05/24 18:14:26 UTC

svn commit: r1342312 - /incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java

Author: lahiru
Date: Thu May 24 16:14:25 2012
New Revision: 1342312

URL: http://svn.apache.org/viewvc?rev=1342312&view=rev
Log:
sending failure notificaiton during exception occurances.

Modified:
    incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java

Modified: incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/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?rev=1342312&r1=1342311&r2=1342312&view=diff
==============================================================================
--- incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java (original)
+++ incubator/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java Thu May 24 16:14:25 2012
@@ -347,8 +347,10 @@ public class GramProvider extends Abstra
                     }
                     return stringMap;
                 } catch (ToolsException e) {
+                    invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,e.getMessage());
                     throw new ProviderException(e.getMessage(), e);
                 } catch (URISyntaxException e) {
+                    invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,e.getMessage());
                     throw new ProviderException("URI is malformatted:" + e.getMessage(), e);
                 }
             }
@@ -359,8 +361,10 @@ public class GramProvider extends Abstra
             throw pe;
 
         } catch (IOException e) {
+            invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,e.getMessage());
             throw new ProviderException(e.getMessage(), e);
         } catch (SecurityException e) {
+            invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,e.getMessage());
             throw new ProviderException(e.getMessage(), e);
         }
 
@@ -370,6 +374,7 @@ public class GramProvider extends Abstra
 	protected Map<String, ?> processInput(InvocationContext invocationContext)
             throws ProviderException {
         MessageContext inputNew = new ParameterContextImpl();
+        try {
 		MessageContext<Object> input = invocationContext.getInput();
         for (Iterator<String> iterator = input.getNames(); iterator.hasNext();) {
 			String paramName = iterator.next();
@@ -378,42 +383,21 @@ public class GramProvider extends Abstra
 					.getValue(paramName);
 			//TODO: Review this with type
 			if ("URI".equals(actualParameter.getType().getType().toString())) {
-					try {
                         ((URIParameterType) actualParameter.getType()).setValue(stageInputFiles(invocationContext, paramValue, actualParameter).getPath());
-                    } catch (URISyntaxException e) {
-                        throw new ProviderException(e.getMessage(), e);
-                    } catch (ToolsException e) {
-                        throw new ProviderException(e.getMessage(), e);
-                    } catch (SecurityException e) {
-                        throw new ProviderException(e.getMessage(), e);
-                    } catch (MalformedURLException e) {
-                        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                    } catch (IOException e) {
-                        e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                    }
-
             }else if("URIArray".equals(actualParameter.getType().getType().toString())){
                 List<String> split = Arrays.asList(paramValue.split(","));
                 List<String> newFiles = new ArrayList<String>();
-                try {
                     for (String paramValueEach : split) {
                         newFiles.add(stageInputFiles(invocationContext, paramValueEach, actualParameter).getPath());
                     }
-                } catch (URISyntaxException e) {
-                    throw new ProviderException(e.getMessage(), e);
-                } catch (ToolsException e) {
-                    throw new ProviderException(e.getMessage(), e);
-                } catch (SecurityException e) {
-                    throw new ProviderException(e.getMessage(), e);
-                } catch (MalformedURLException e) {
-                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                } catch (IOException e) {
-                    e.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
-                }
-                ((URIArrayType) actualParameter.getType()).setValueArray((String[]) newFiles.toArray());
+                ((URIArrayType) actualParameter.getType()).setValueArray(newFiles.toArray(new String[newFiles.size()]));
             }
 			inputNew.add(paramName, actualParameter);
 		}
+        }catch (Exception e){
+           invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,e,"Error during Input File staging");
+            throw new ProviderException("Error while input File Staging", e.getCause());
+        }
         invocationContext.setInput(inputNew);
 		return null;
 	}
@@ -482,7 +466,7 @@ public class GramProvider extends Abstra
                         for (String paramValueEach : split) {
                             newFiles.add(stageOutputFiles(outputFileStagingPath, paramValueEach, actualParameter, ftp, gssCred, endpoint));
                         }
-                        ((URIArrayType) actualParameter.getType()).setValueArray((String[])newFiles.toArray());
+                        ((URIArrayType) actualParameter.getType()).setValueArray(newFiles.toArray(new String[newFiles.size()]));
                     }
 
                 }