Package org.apache.uima.resource

Examples of org.apache.uima.resource.ExternalResourceDescription


  @Test
  public void testResourceSharing() throws Exception {
    ThreeDocsReader.resource = null;
    GetTextAE.resource = null;
   
    ExternalResourceDescription res = createExternalResourceDescription(DummySharedResource.class);
    for (@SuppressWarnings("unused") JCas jcas : iteratePipeline(
            createReaderDescription(ThreeDocsReader.class, "resource", res),
            createEngineDescription(GetTextAE.class, "resource", res))) {
    }
   
View Full Code Here


   * @return the description.
   * @see FileResourceSpecifier
   */
  public static ExternalResourceDescription createExternalResourceDescription(final String aName,
          String aUrl) {
    ExternalResourceDescription extRes = new ExternalResourceDescription_impl();
    extRes.setName(aName);
    FileResourceSpecifier frs = new FileResourceSpecifier_impl();
    frs.setFileUrl(aUrl);
    extRes.setResourceSpecifier(frs);
    return extRes;
  }
View Full Code Here

   *           if import resolution failed
   * @see FileResourceSpecifier
   */
  public static void bindResource(ResourceSpecifier aDesc, String aKey, String aUrl)
          throws InvalidXMLException {
    ExternalResourceDescription extRes = createExternalResourceDescription(aKey, aUrl);
    bindResource(aDesc, aKey, extRes);
  }
View Full Code Here

  public static void bindResource(ResourceSpecifier aDesc, Class<?> aApi,
          Class<? extends Resource> aRes, String... aParams) throws InvalidXMLException,
          ClassNotFoundException {
    // Appending a disambiguation suffix it possible to have multiple instances of the same
    // resource with different settings to different keys.
    ExternalResourceDescription extRes = createExternalResourceDescription(
            uniqueResourceKey(aRes.getName()), aRes, (Object[]) aParams);
    bindResource(aDesc, extRes);
  }
View Full Code Here

   * @see SharedResourceObject
   */
  public static void bindResource(ResourceSpecifier aDesc,
          Class<? extends SharedResourceObject> aRes, String aUrl, Object... aParams)
          throws InvalidXMLException, ClassNotFoundException {
    ExternalResourceDescription extRes = createExternalResourceDescription(
            uniqueResourceKey(aRes.getName()), aRes, aUrl, aParams);
    bind((AnalysisEngineDescription) aDesc, extRes);
  }
View Full Code Here

   * @see SharedResourceObject
   */
  public static void bindResource(ResourceSpecifier aDesc, String aKey,
          Class<? extends SharedResourceObject> aRes, String aUrl, Object... aParams)
          throws InvalidXMLException {
    ExternalResourceDescription extRes = createExternalResourceDescription(
            uniqueResourceKey(aRes.getName()), aRes, aUrl, aParams);
    bind((AnalysisEngineDescription) aDesc, aKey, extRes);
  }
View Full Code Here

      createDependency(aDesc, aKey, DataResource.class);
    }

    // Appending a disambiguation suffix it possible to have multiple instances of the same
    // resource with different settings to different keys.
    ExternalResourceDescription extRes = createExternalResourceDescription(
            uniqueResourceKey(aRes.getName()), aRes, (Object[]) aParams);
    bindResource(aDesc, aKey, extRes);
  }
View Full Code Here

        }
        // Avoid unnecessary binding and an infinite loop when a resource binds to itself
        if (!aBindings.containsKey(key)) {
          // Mark the current binding as processed so we do not recurse
          aBindings.put(key, b);
          ExternalResourceDescription nestedRes = res.get(b.getResourceName());
          aResources.put(nestedRes.getName(), nestedRes);
          bindNestedResources(nestedRes, aBindings, aResources);
          // Set the proper key on the binding.
          b.setKey(key);
        }
      }
View Full Code Here

      }
     
      // Store External Resource parameters separately
      ResourceValueType type = getExternalResourceParameterType(value);
      if (type == ResourceValueType.PRIMITIVE) {
        ExternalResourceDescription description = (ExternalResourceDescription) value;
        extRes.put(key, description);
      }
      else if (type.isMultiValued()) {
        Collection<ExternalResourceDescription> resList;
        if (type == ResourceValueType.ARRAY) {
View Full Code Here

TOP

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

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.