Package org.ogce.gfac.exception

Examples of org.ogce.gfac.exception.GfacException


            AppData resultAppData = new AppData(xbeansData.getName(), xbeansData.getOwner(), xbeansData.getHostName());
            resultAppData.allowedAction = xbeansData.getAllowedAction();
            resultAppData.resourceID = xbeansData.getName();
            appDescList.add(resultAppData);
          } catch (XmlValueOutOfRangeException e) {
            throw new GfacException("Problem with retrieving object : " + e.getLocalizedMessage(), FaultCode.ErrorAtDependentService);
          }
        }
        appDesc = appDescList.toArray(new AppData[0]);
      } else {
        return null;
      }
      return appDesc;
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here


      if (!host.hostName.endsWith("/"))
        buf.append("/");
      buf.append(localPath);
      return new URI(buf.toString());
    } catch (URISyntaxException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here

          DocData data = new DocData(new QName(host.getResourceID()), host.getOwner());
          data.allowedAction = host.getAllowedAction();
          data.resourceID = new QName(host.getResourceID());
          results.add(data);
        } catch (XmlValueOutOfRangeException e) {
          throw new GfacException("Problem with retrieving object : " + e.getLocalizedMessage(), FaultCode.ErrorAtDependentService);
        }
      }
      return results.toArray(new DocData[0]);
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

      if (!host.endsWith("/"))
        buf.append("/");
      buf.append(localPath);
      return new URI(buf.toString());
    } catch (URISyntaxException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here

          DocData data = new DocData(serviceDescData[i].getName(), serviceDescData[i].getOwner());
          data.allowedAction = serviceDescData[i].getAllowedAction();
          data.resourceID = serviceDescData[i].getName();
          results.add(data);
        } catch (XmlValueOutOfRangeException e) {
          throw new GfacException("Problem with retrieving object : " + e.getLocalizedMessage(), FaultCode.ErrorAtDependentService);
        }
      }
      return results.toArray(new DocData[0]);
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

            URI uri = new URI("gsiftp://" + localhost + "/" + file.getAbsolutePath());
            files.add(uri);
          }
        }
      } else {
        throw new GfacException("can not find the output data directory to list files", FaultCode.InvaliedLocalArgumnet);
      }
      return files;
    } catch (URISyntaxException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here

  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);
    }
  }
View Full Code Here

  public static QName findApplcationName(ServiceMapType serviceMap) throws GfacException {
    MethodType method = GfacUtils.findOperationWithApplication(serviceMap);

    if (method == null) {
      throw new GfacException("None of the methods has application defined", FaultCode.InvaliedLocalArgumnet);
    }

    String applicationName = method.getApplication().getApplicationName().getStringValue();
    String applicationNameNs = method.getApplication().getApplicationName().getTargetNamespace();
    return new QName(applicationNameNs, applicationName);
View Full Code Here

      if (resourceMapping != null) {
        URI gatekeeperfromResourceMapping = null;
        try {
          gatekeeperfromResourceMapping = new URI(resourceMapping.getGatekeeperEpr());
        } catch (URISyntaxException e) {
          throw new GfacException(e.getLocalizedMessage(), e);
        }
        if (gatekeeperfromResourceMapping != null) {
          log.info("Gate keeper selected from resource mapping");
          GlobusGatekeeperType gatekeeper = GlobusGatekeeperType.Factory.newInstance();

          if (!resourceMapping.getWsgramPreferred()) {
            if (resourceMapping.getJobManager() != null) {
              throw new GfacException("Job Manager parameter must not defined for Pre-WSGram in Resource Mapping, " + "include it with your gatekeepr EPR in resource mapping", FaultCode.InternalServiceError);
            }
          } else {
            if (resourceMapping.getJobManager() != null) {
              gatekeeper.setJobmanagertype(GlobusJobManagerType.Enum.forString(resourceMapping.getJobManager()));
            }
View Full Code Here

            throw new JobSubmissionFault(e, localHost, "", "", CurrentProviders.Gram);
          }
        } else {
          String errorMsg = "Job " + job.getID() + " on host " + context.getExecutionModel().getHost() + " Error Code = " + errCode;
          String localHost = context.getServiceContext().getGlobalConfiguration().getLocalHost();
          GfacException error = new JobSubmissionFault(new Exception(errorMsg), localHost, contact, rsl, CurrentProviders.Gram);
          if (errCode == 8) {
            error.setFaultCode(ErrorCodes.JOB_CANCELED);
          } else {
            error.setFaultCode(ErrorCodes.JOB_FAILED);
          }
          // error.addProperty(ErrorCodes.JOB_TYPE,
          // ErrorCodes.JobType.Gram.toString());
          // error.addProperty(ErrorCodes.CONTACT, contact);
          throw error;
        }
      }
      notifier.computationFinished(compObj);     

      /*
       * Stdout and Stderror
       */
      GridFtp ftp = new GridFtp();

      // get Hostname
      String hostgridFTP = null;

      if (invocationContext.getExecutionContext().getExecutionModel().getHostDesc().getHostConfiguration().getGridFTPArray() != null && invocationContext.getExecutionContext().getExecutionModel().getHostDesc().getHostConfiguration().getGridFTPArray().length > 0) {
        hostgridFTP = invocationContext.getExecutionContext().getExecutionModel().getHostDesc().getHostConfiguration().getGridFTPArray(0).getEndPointReference();
      } else {
        hostgridFTP = invocationContext.getExecutionContext().getExecutionModel().getHost();
      }     

      URI stdoutURI = GfacUtils.createGsiftpURI(hostgridFTP, invocationContext.getExecutionContext().getExecutionModel().getStdOut());
      URI stderrURI = GfacUtils.createGsiftpURI(hostgridFTP, invocationContext.getExecutionContext().getExecutionModel().getStderr());
     
      System.out.println(stdoutURI);
      System.out.println(stderrURI);
     
      File logDir = new File("./service_logs");
      if (!logDir.exists()) {
        logDir.mkdir();
      }

      // Get the Stdouts and StdErrs
      QName x = QName.valueOf(invocationContext.getServiceName());
      String timeStampedServiceName = GfacUtils.createServiceDirName(x);
      File localStdOutFile = new File(logDir, timeStampedServiceName + ".stdout");
      File localStdErrFile = new File(logDir, timeStampedServiceName + ".stderr");
     
      String stdout = ftp.readRemoteFile(stdoutURI, gssCred, localStdOutFile);
      String stderr = ftp.readRemoteFile(stderrURI, gssCred, localStdErrFile);
     
      //set to context
      OutputUtils.fillOutputFromStdout(invocationContext.getMessageContext("output"), stdout, stderr);
     
     
      jobSucsseful = true;     
    } catch (GramException e) {
      String localHost = "xxxx";
      GfacException error = new JobSubmissionFault(e, localHost, contact, rsl, CurrentProviders.Gram);
      if (errCode == 8) {
        error.setFaultCode(ErrorCodes.JOB_CANCELED);
      } else {
        error.setFaultCode(ErrorCodes.JOB_FAILED);
      }
      // error.addProperty(ErrorCodes.JOB_TYPE,
      // ErrorCodes.JobType.Gram.toString());
      // error.addProperty(ErrorCodes.CONTACT, contact);
      throw error;
    } catch (GSSException e) {
      String localHost = context.getServiceContext().getGlobalConfiguration().getLocalHost();
      throw new JobSubmissionFault(e, localHost, contact, rsl, CurrentProviders.Gram);
    } catch (URISyntaxException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    } catch (InterruptedException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    } finally {
      if (job != null && !jobSucsseful) {
        try {
          job.cancel();
        } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.ogce.gfac.exception.GfacException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.