Package org.apache.uima.resource

Examples of org.apache.uima.resource.URISpecifier


          CasProcessorConfiguration aCasProcessorConfig, String aDefault)
          throws ResourceConfigurationException {
    String vnsParam = null;

    URL descriptorUrl = aCasProcessorConfig.getDescriptorUrl();
    URISpecifier uriSpecifier = getURISpecifier(descriptorUrl);
    Parameter[] params = uriSpecifier.getParameters();

    for (int i = 0; params != null && i < params.length; i++) {
      if (aVNSParamKey.equals(params[i].getName())) {
        vnsParam = params[i].getValue();
        break;
View Full Code Here


  public ResourceMetaData getMetaDataFromDescription(ResourceSpecifier o) {
    if (o instanceof ResourceCreationSpecifier) {
      return ((ResourceCreationSpecifier) o).getMetaData();
    }
    if (o instanceof URISpecifier) {
      URISpecifier uriSpec = ((URISpecifier) o);
      AnalysisEngine ae = null;
      try {
        setVnsHostAndPort(o);
        ae = UIMAFramework.produceAnalysisEngine(uriSpec);
      } catch (ResourceInitializationException e) {
View Full Code Here

   */
  private boolean isCasConsumerSpecifier(ResourceSpecifier specifier) {
    if (specifier instanceof CasConsumerDescription) {
      return true;
    } else if (specifier instanceof URISpecifier) {
      URISpecifier uriSpec = (URISpecifier) specifier;
      return URISpecifier.RESOURCE_TYPE_CAS_CONSUMER.equals(uriSpec.getResourceType());
    } else
      return false;
  }
View Full Code Here

          throws ResourceInitializationException {
    // aSpecifier must be a URISpecifier using the SOAP protocol
    if (!(aSpecifier instanceof URISpecifier)) {
      return false;
    }
    URISpecifier uriSpec = (URISpecifier) aSpecifier;
    if (!uriSpec.getProtocol().equals(Constants.PROTOCOL_SOAP)
            && !uriSpec.getProtocol().equals(Constants.PROTOCOL_SOAP_WITH_ATTACHMENTS)) {
      return false;
    }
    // resource type must be null or AnalysisEngine
    if (uriSpec.getResourceType() != null
            && !uriSpec.getResourceType().equals(URISpecifier.RESOURCE_TYPE_ANALYSIS_ENGINE)) {
      return false;
    }

    try {
      // create proxy to service
      AnalysisEngineServiceStub stub = new AxisAnalysisEngineServiceStub(uriSpec.getUri(), uriSpec
              .getTimeout(), uriSpec.getProtocol().equals(Constants.PROTOCOL_SOAP_WITH_ATTACHMENTS));
      setStub(stub);

      // finish initialization. This requires access to metadata, so must be called
      // after we create the stub
      super.initialize(aSpecifier, aAdditionalParams);

    } catch (MalformedURLException e) {
      throw new ResourceInitializationException(ResourceInitializationException.MALFORMED_URL,
              new Object[] { uriSpec.getUri(), uriSpec.getSourceUrlString() }, e);
    }
   
    // Sofa mappings are currently not implemented for remote AEs.  Catch this
    // and report an error.
    if (getUimaContextAdmin().getSofaMap().size() > 0) {
View Full Code Here

   */
  private boolean isCasConsumerSpecifier(ResourceSpecifier specifier) {
    if (specifier instanceof CasConsumerDescription) {
      return true;
    } else if (specifier instanceof URISpecifier) {
      URISpecifier uriSpec = (URISpecifier) specifier;
      return URISpecifier.RESOURCE_TYPE_CAS_CONSUMER.equals(uriSpec.getResourceType());
    } else
      return false;
  }
View Full Code Here

    private boolean isCasConsumerSpecifier(ResourceSpecifier specifier)
    {
        if (specifier instanceof CasConsumerDescription) {
            return true;
        } else if (specifier instanceof URISpecifier) {
            URISpecifier uriSpec = (URISpecifier)specifier;
            return URISpecifier.RESOURCE_TYPE_CAS_CONSUMER.equals(uriSpec.getResourceType());
        }
        return false;
    }
View Full Code Here

            u.setInstanceName(p.getName());
            u.configParamDecls    = p.getConfigurationParameterDeclarations();
            u.configParamSettings = p.getConfigurationParameterSettings();

        } else if (xmlizable instanceof URISpecifier) {
            URISpecifier uriSpecifier = (URISpecifier) xmlizable;
//            Trace.err("URISpecifier protocol=" + uriSpecifier.getProtocol()
//                    + " resource type=" + uriSpecifier.getResourceType()
//                    + " uri=" + uriSpecifier.getUri());
            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_SERVICE);
            // Create a name from URI
            String name = "Unknow";
              try {
                  name = new URI(uriSpecifier.getUri()).getPath();
              } catch (URISyntaxException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
            u.setInstanceName(name);           
View Full Code Here

    private boolean isCasConsumerSpecifier(ResourceSpecifier specifier)
    {
        if (specifier instanceof CasConsumerDescription) {
            return true;
        } else if (specifier instanceof URISpecifier) {
            URISpecifier uriSpec = (URISpecifier)specifier;
            return URISpecifier.RESOURCE_TYPE_CAS_CONSUMER.equals(uriSpec.getResourceType());
        }
        return false;
    }
View Full Code Here

            u.setInstanceName(p.getName());
            u.configParamDecls    = p.getConfigurationParameterDeclarations();
            u.configParamSettings = p.getConfigurationParameterSettings();
           
        } else if (xmlizable instanceof URISpecifier) {
            URISpecifier specifier = (URISpecifier) xmlizable;
            Trace.err("URISpecifier protocol=" + specifier.getProtocol()
                    + " resource type=" + specifier.getResourceType()
                    + " uri=" + specifier.getUri());
            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_SERVICE);
           
        } else if (xmlizable instanceof CustomResourceSpecifier) {
            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_CUSTOM_RESOURCE_SPECIFIER);
            CustomResourceSpecifier specifier = (CustomResourceSpecifier) xmlizable;
            u.cloneResourceSpecifier = specifier.clone();
            Parameter[] params = specifier.getParameters();
            Trace.err("CustomResourceSpecifier ResourceClassname=" + specifier.getResourceClassName()
                    + " Parameter size=" + params.length);
            for (int i=0; i<params.length; ++i) {
                Trace.err("Param name: " + params[i].getName() +
                          " value: " + params[i].getValue());
            }
View Full Code Here

            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_CAS_CONSUMER);
            u.setInstanceName(p.getName());
            u.configParamDecls    = p.getConfigurationParameterDeclarations();
            u.configParamSettings = p.getConfigurationParameterSettings();           
        } else if (xmlizable instanceof URISpecifier) {
            URISpecifier specifier = (URISpecifier) xmlizable;
//            Trace.err("URISpecifier protocol=" + specifier.getProtocol()
//                    + " resource type=" + specifier.getResourceType()
//                    + " uri=" + specifier.getUri());
            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_SERVICE);
            // Create a name from URI
            String name = "Unknow";
            try {
                name = new URI(specifier.getUri()).getPath();
            } catch (URISyntaxException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            u.setInstanceName(name);           
           
        } else if (xmlizable instanceof CustomResourceSpecifier) {
            CustomResourceSpecifier specifier = (CustomResourceSpecifier) xmlizable;
//            Parameter[] params = specifier.getParameters();
//            Trace.err("CustomResourceSpecifier ResourceClassname=" + specifier.getResourceClassName()
//                    + " Parameter size=" + params.length);
//            for (int i=0; i<params.length; ++i) {
//                Trace.err("Param name: " + params[i].getName() +
//                          " value: " + params[i].getValue());
//            }
            u.setCasProcessorCategory(UimaCasProcessor.CASPROCESSOR_CAT_CUSTOM_RESOURCE_SPECIFIER);
           
            // Create a name from ResourceClassName
            u.setInstanceName(specifier.getResourceClassName());           
        }
       
        u.configParamsModel = new ConfigParametersModel(u.configParamDecls, u.configParamSettings,
                cpeCasProcessor.getConfigurationParameterSettings());
        createConfigParamOverrides(u.configParamsModel);
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.URISpecifier

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.