Package org.apache.uima.resource

Examples of org.apache.uima.resource.URISpecifier


  private String getServiceUri(CasProcessorConfiguration aCasProcessorConfig)
          throws ResourceConfigurationException {
    URL descriptorUrl;
    descriptorUrl = aCasProcessorConfig.getDescriptorUrl();

    URISpecifier uriSpecifier = getURISpecifier(descriptorUrl);
    String uri = uriSpecifier.getUri();
    if (uri == null || uri.trim().length() == 0) {
      throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_invalid_deployment__SEVERE", new Object[] {
                  Thread.currentThread().getName(), descriptorUrl, uri });
    }
View Full Code Here


          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

      primDesc2.setAnnotatorImplementationName("fakeClass");
      primDesc2.getAnalysisEngineMetaData().setName("fakeAnnotator");
      primDesc2.getAnalysisEngineMetaData().setCapabilities(
              new Capability[] { new Capability_impl() });
      delegateTaeMap.put("Empty", primDesc2);
      URISpecifier uriSpec = new URISpecifier_impl();
      uriSpec.setUri("http://incubator.apache.org/uima");
      uriSpec.setProtocol(Constants.PROTOCOL_SOAP);
      FlowControllerDeclaration fcDecl = new FlowControllerDeclaration_impl();
      fcDecl.setKey("TestFlowController");
      FlowControllerDescription fcDesc = new FlowControllerDescription_impl();
      fcDesc.getMetaData().setName("MyTestFlowController");
      fcDecl.setSpecifier(fcDesc);
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

      primDesc2.setAnnotatorImplementationName("fakeClass");
      primDesc2.getAnalysisEngineMetaData().setName("fakeAnnotator");
      primDesc2.getAnalysisEngineMetaData().setCapabilities(
              new Capability[] { new Capability_impl() });
      delegateTaeMap.put("Empty", primDesc2);
      URISpecifier uriSpec = new URISpecifier_impl();
      uriSpec.setUri("http://www.incubator.apache.org/uima");
      uriSpec.setProtocol(Constants.PROTOCOL_SOAP);
      ExternalResourceDependency dep = UIMAFramework.getResourceSpecifierFactory()
              .createExternalResourceDependency();
      dep.setKey("ResourceKey");
      dep.setDescription("Test");
      aggregateDesc.setExternalResourceDependencies(new ExternalResourceDependency[] { dep });
View Full Code Here

    // aSpecifier must be a URISpecifier
    if (!(aSpecifier instanceof URISpecifier)) {
      return false;
    }

    URISpecifier uriSpec = (URISpecifier) aSpecifier;
    // protocol must be Vinci or VinciBinaryCAS
    if (!uriSpec.getProtocol().equals(Constants.PROTOCOL_VINCI)
            && !uriSpec.getProtocol().equals(Constants.PROTOCOL_VINCI_BINARY_CAS)) {
      return false;
    }

    // As of 2.0, we allow an AnalysisEngine adapter to connect
    // to a CAS Consumer service. So we no longer reject that case.

    // create proxy to service
    if (uriSpec.getProtocol().equals(Constants.PROTOCOL_VINCI)) {
      setStub(new VinciAnalysisEngineServiceStub(uriSpec.getUri(), uriSpec.getTimeout(), this,
              uriSpec.getParameters()));
    } else {
      setStub(new VinciBinaryAnalysisEngineServiceStub(uriSpec.getUri(), uriSpec.getTimeout(),
              this, uriSpec.getParameters()));
    }

    // do superclass initialization, which among other things initializes UimaContext.
    // note we need to establish connection to service before calling this, since
    // superclass initialization depends on having access to the component metadata.
View Full Code Here

  }
 
  public void testParseURISpecifier() throws Exception {
    XMLInputSource in = new XMLInputSource(
            JUnitExtension.getFile("XmlParserTest/TestUriSpecifier.xml"));
    URISpecifier uriSpec = mXmlParser.parseURISpecifier(in);
    assertEquals("AnalysisEngine", uriSpec.getResourceType());
    assertEquals("Vinci", uriSpec.getProtocol());
    assertEquals(60000, uriSpec.getTimeout().intValue());
    Parameter[] params = uriSpec.getParameters();
    assertEquals(2, params.length);
    assertEquals("VNS_HOST", params[0].getName());
    assertEquals("some.internet.ip.name-or-address", params[0].getValue());
    assertEquals("VNS_PORT", params[1].getName());
    assertEquals("9000", params[1].getValue());   
View Full Code Here

  private String getServiceUri(CasProcessorConfiguration aCasProcessorConfig)
          throws ResourceConfigurationException {
    URL descriptorUrl;
    descriptorUrl = aCasProcessorConfig.getDescriptorUrl();

    URISpecifier uriSpecifier = getURISpecifier(descriptorUrl);
    String uri = uriSpecifier.getUri();
    if (uri == null || uri.trim().length() == 0) {
      throw new ResourceConfigurationException(CPMUtils.CPM_LOG_RESOURCE_BUNDLE,
              "UIMA_CPM_invalid_deployment__SEVERE", new Object[] {
                  Thread.currentThread().getName(), descriptorUrl, uri });
    }
View Full Code Here

          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

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.