Package edu.indiana.extreme.gfac.utils

Examples of edu.indiana.extreme.gfac.utils.GfacException


        while (tokernizer.hasMoreTokens()) {
          String nameVal = tokernizer.nextToken();

          int index = nameVal.indexOf('=');
          if (index <= 0) {
            throw new GfacException("Illegal Name value Pairs "
                + host.getHostEnv() + " at parsing " + nameVal,
                FaultCode.InvaliedLocalArgumnet);
          }
          String name = nameVal.substring(0, index);
          NameValuePairType nmPair = envMap.get(name);
          if (nmPair == null) {
            nmPair = hostConf.addNewHostEnv();
          }
          nmPair.setName(name);
          nmPair.setValue(nameVal.substring(index + 1));
        }
      }
      if(host.isSshEnabled()){
      hostDesc.getHostConfiguration().setSshEnabled(true);
      }
      // Validates correctness of XML message
      try {
        SchemaValidator validator = new SchemaValidator(hostDesc);
        validator.validate();
      } catch (GFacSchemaException e) {
        throw new GfacException(e,FaultCode.SchemaValidationError);
      }
      return hostDescDoc.xmlText();
    } catch (NumberFormatException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here


        while (tokernizer.hasMoreTokens()) {
          String nameVal = tokernizer.nextToken();

          int index = nameVal.indexOf('=');
          if (index <= 0) {
            throw new GfacException("Illegal Name value Pairs "
                + host.getHostEnv() + " at parsing " + nameVal,
                FaultCode.InvaliedLocalArgumnet);
          }
          String name = nameVal.substring(0, index);
          NameValuePairType nmPair = envMap.get(name);
          if (nmPair == null) {
            nmPair = hostConf.addNewHostEnv();
          }
          nmPair.setName(name);
          nmPair.setValue(nameVal.substring(index + 1));
        }
      }
      if(host.isSshEnabled()){
      hostDesc.getHostConfiguration().setSshEnabled(true);
      }
      // Validates correctness of XML message
      try {
        SchemaValidator validator = new SchemaValidator(hostDesc);
        validator.validate();
      } catch (GFacSchemaException e) {
        throw new GfacException(e,FaultCode.SchemaValidationError);
      }
      return hostDescDoc.xmlText();
    } catch (NumberFormatException e) {
      throw new GfacException(e, FaultCode.InvaliedLocalArgumnet);
    }
  }
View Full Code Here

        File tempFile = new File(propertyFile.getFile());
        if (tempFile.exists()) {
          webinfDir = tempFile.getParentFile().getParentFile();
        }
      } else {
        throw new GfacException(
            " Not able to locate gfac.properties",FaultCode.InitalizationError);
      }
      InputStream propertyStream = classLoader
          .getResourceAsStream(GFAC_PROPERTY);
      properties = new Properties();
      if(credentials == null){
      this.credentials = new MyProxyCredentials();
      }
      if (propertyStream != null) {
        properties.load(propertyStream);

        rewriteValues(webinfDir);
        String factoryUrlTmp = properties
            .getProperty(GFacOptions.FACTORY_URL_NAME);
        if (factoryUrlTmp != null) {
          this.gfacFactoryUrl = factoryUrlTmp;
        }
        String registryUrlTmp = properties
            .getProperty(GFacOptions.REGISTRY_URL_NAME);
        if (registryUrlTmp != null) {
          this.registryUrl = registryUrlTmp;
        }
        String myproxyServerTmp = properties
            .getProperty(GFacOptions.MYPROXY_SERVER);
        if (myproxyServerTmp != null) {
          this.credentials.setMyproxyHostname(myproxyServerTmp.trim());
        }
        String myproxyPortTemp = properties.getProperty("myproxyPort");
        if (myproxyPortTemp != null
            && myproxyPortTemp.trim().length() > 0) {
          this.credentials.setMyproxyPortNumber(Integer.parseInt(myproxyPortTemp.trim()));
        } else {
          this.credentials.setMyproxyPortNumber(MyProxy.DEFAULT_PORT);
        }
        String myproxyUserTemp = properties
            .getProperty(GFacOptions.MYPROXY_USERNAME);
        if (myproxyUserTemp != null) {
          this.credentials.setMyproxyUserName(myproxyUserTemp.trim());
        }
        String myproxyPassTemp = properties
            .getProperty(GFacOptions.MYPROXY_PASSWD);
        if (myproxyPassTemp != null) {
          this.credentials.setMyproxyPassword(myproxyPassTemp.trim());
        }
        this.credentials.setTrustedCertsFile(properties.getProperty("ssl.trustedCertsFile"));
       
      }
      }
     
    } catch (GfacException e) {
      logger.severe(e.getLocalizedMessage());
      throw e;
    } catch (Exception e) {
      logger.severe(e.getLocalizedMessage());
      throw new GfacException(e,FaultCode.InitalizationError);
    }

  }
View Full Code Here

            if (serviceMapStr != null) {
                ServiceMapType serviceMapType = ServiceMapDocument.Factory.parse(serviceMapStr)
                        .getServiceMap();
                return serviceMapType;
            } else {
                throw new GfacException("Service  " + serviceName + " does not exist",FaultCode.InvaliedLocalArgumnet);
            }
        } catch (XmlException e) {
            throw new GfacException(e,FaultCode.ErrorAtDependentService);
        }

    }
View Full Code Here

             
              if(wsdlStr != null){
                  WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
                  def = wsdlReader.readWSDL(null, new InputSource(new ByteArrayInputStream(wsdlStr.getBytes())));
              }else{
                  throw new GfacException("No Concreate WSDL found for Service "+ serviceName,FaultCode.InvaliedLocalArgumnet);
              }

              service = (Service) def.getServices().values().iterator().next();
              endpoint = (Port) service.getPorts().values().iterator().next();
              portType = (PortType) def.getPortTypes().values().iterator().next();
             
              List extensibilityElements  = endpoint.getExtensibilityElements();
              for(Object ele:extensibilityElements){
                  if(ele instanceof SOAPAddress){
                      String serviceUrl = null;
                      try {
                          serviceUrl = ((SOAPAddress)ele).getLocationURI();
                          System.out.println("Service Url for service "+serviceName + " is "+serviceUrl);
                          SoapHttpDynamicInfosetInvoker invoker;
                         
                          if(serviceUrl.startsWith("https")){
                    //          invoker = gloablContext.createSecureInvoker();
                          }else{
                              invoker = new SoapHttpDynamicInfosetInvoker();
                          }
             //             invoker.invokeHttpGet(serviceUrl);
                      } catch (Exception e) {
                          //thsi will avoid finding outservice is down at last moment
                          throw new GfacException("Could not connect to the service "+serviceName + " at "+ serviceUrl,e,FaultCode.ErrorAtDependentService);
                      }
                  }
              }
          } catch (WSDLException e) {
              throw new GfacException(e,FaultCode.Unknown);
          }
      }
View Full Code Here

      GSSCredential credential = gfacConfiguration.getGssCredential();
      if (trustedCertFile != null && credential != null) {
          registryClient = XRegistryClientUtil.CreateGSISecureRegistryInstance(credential, trustedCertFile, xregistryUrl);
      }
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

    try {
      if (trustedCertFile != null && credential != null) {
        registryClient = XRegistryClientUtil.CreateGSISecureRegistryInstance(credential, trustedCertFile, xregistryUrl);
      }
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

  public XregistryServiceWrapper(String xregistryUrl) throws GfacException {
    try {
      registryClient = new XRegistryClient(xregistryUrl);
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

  public String[] app2Hosts(String appName) throws GfacException {
    try {
      return registryClient.app2Hosts(appName);
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

                resources[i].nameSpace = appDesc[i].getName().getNamespaceURI();
                resources[i].sn = i +1;
            }
      return resources;
    } catch (XRegistryClientException e) {
      throw new GfacException(e, FaultCode.ErrorAtDependentService);
    }
  }
View Full Code Here

TOP

Related Classes of edu.indiana.extreme.gfac.utils.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.