Package org.apache.uima.resource.metadata.impl

Examples of org.apache.uima.resource.metadata.impl.Import_impl


   * @return A {@link FsIndexCollection} that includes the indexes from all of the specified files.
   */
  public static FsIndexCollection createTypeSystemDescriptionFromPath(String... descriptorURIs) {
    List<Import> imports = new ArrayList<Import>();
    for (String descriptorURI : descriptorURIs) {
      Import imp = new Import_impl();
      imp.setLocation(descriptorURI);
      imports.add(imp);
    }
    Import[] importArray = new Import[imports.size()];

    FsIndexCollection fsIndexCollection = new FsIndexCollection_impl();
View Full Code Here


    if (sDescriptorRelativePath.indexOf("file:/") == -1 //$NON-NLS-1$
            && sDescriptorRelativePath.indexOf(":/") > -1) { //$NON-NLS-1$
      sDescriptorRelativePath = "file:/" + sDescriptorRelativePath; //$NON-NLS-1$
    }

    Import imp = new Import_impl();
    // fails on unix? URL url = new URL("file:/" + getDescriptorDirectory());
    // Set relative Path Base
    // a version that might work on all platforms
    URL url = new File(editor.getDescriptorDirectory()).toURL();
    ((Import_impl) imp).setSourceUrl(url);

    imp.setLocation(sDescriptorRelativePath);
    return imp;
  }
View Full Code Here

      specifiers[inx++] = getResourceSpecifier(aeDescription);
      // UimaClassFactory.produceResourceSpecifier(aeDescription);
    }

    for (String aeDescription : descriptorPaths) {
      Import descriptorImport = new Import_impl();
      // If user provides a descriptor with .xml at the end, assume he
      // wants import by location
      if (aeDescription.endsWith(".xml")) {
        aeDescription = Utils.resolvePlaceholderIfExists(aeDescription,
            System.getProperties());
        if (!aeDescription.startsWith("file:")) {
          aeDescription = "file:" + aeDescription;
        }
        descriptorImport.setLocation(aeDescription);
      } else {
        // uima import by name expects dot separated path as in
        // a.b.descriptor and no .xml at the end
        descriptorImport.setName(aeDescription);
      }
      String key = new String(aeDescription);
      if (key.startsWith("file:")) {
        key = key.substring(5); // skip "file:"
      }
      if (key.endsWith(".xml")) {
        key = key.substring(0, key.indexOf(".xml")); // strip ".xml"
      }
      // preprocess the ae descriptor name to replace "/" and
      // "\" with ".". We will use the ae
      // descriptor name as AE key in the aggregate
      if (key.indexOf("/") != -1) {
        key = key.replaceAll("/", ".");
      }
      if (key.indexOf("\\") != -1) {
        key = key.replaceAll("\\\\", ".");
      }
      key = key.substring(key.lastIndexOf(".") + 1);
      desc.getDelegateAnalysisEngineSpecifiersWithImports().put(key,
          descriptorImport);
      flowNames.add(key);

    }
    String fcsn;
    if ( (fcsn = DuccPropertiesResolver.getInstance().getProperty(FlowControllerResourceSpecifier)) != null ) {
      FlowControllerDeclaration fcd = new FlowControllerDeclaration_impl();
      desc.setFlowControllerDeclaration(fcd);
      fcd.setImport(new Import_impl());   
      fcd.setKey(FlowControllerKey);
      fcd.getImport().setName(fcsn);
    }
   
    FixedFlow fixedFlow = new FixedFlow_impl();
View Full Code Here

  public void testDelegateImports() throws Exception {
    // create aggregate TAE description and add delegate AE import
    AnalysisEngineDescription_impl testAgg = new AnalysisEngineDescription_impl();
    Map delegateMap = testAgg.getDelegateAnalysisEngineSpecifiersWithImports();
    Import_impl delegateImport = new Import_impl();
    delegateImport.setLocation(JUnitExtension.getFile(
            "TextAnalysisEngineImplTest/TestPrimitiveTae1.xml").toURL().toString());
    delegateMap.put("key", delegateImport);

    // test that import is resolved
    Map mapWithImportsResolved = testAgg.getDelegateAnalysisEngineSpecifiers();
View Full Code Here

    if (sDescriptorRelativePath.indexOf("file:/") == -1 //$NON-NLS-1$
            && sDescriptorRelativePath.indexOf(":/") > -1) { //$NON-NLS-1$
      sDescriptorRelativePath = "file:/" + sDescriptorRelativePath; //$NON-NLS-1$
    }

    Import imp = new Import_impl();
    // fails on unix? URL url = new URL("file:/" + getDescriptorDirectory());
    // Set relative Path Base
    // a version that might work on all platforms
    URL url = new File(multiPageEditor.cde.getDescriptorDirectory()).toURL();
    ((Import_impl) imp).setSourceUrl(url);

    imp.setLocation(sDescriptorRelativePath);
    return imp;
  }
View Full Code Here

          ResourceManager aResourceManager) throws InvalidXMLException,
          ResourceInitializationException, IOException {
    XMLInputSource input;

    if (aFileResource.startsWith(IMPORT_BY_NAME_PREFIX)) {
      Import theImport = new Import_impl();
      theImport.setName(aFileResource.substring(IMPORT_BY_NAME_PREFIX.length()));
      input = new XMLInputSource(theImport.findAbsoluteUrl(aResourceManager));
    } else {
      input = new XMLInputSource(aFileResource);
    }
    return input;
View Full Code Here

public class XsltImportByName {
  private static final Class CLASS_NAME = XsltImportByName.class;

  public static String resolveByName(String input) {
    ResourceManager resourceManager = UIMAFramework.newDefaultResourceManager();
    Import theImport = new Import_impl();
    theImport.setName(input);
    try {
      return theImport.findAbsoluteUrl(resourceManager).toExternalForm();
    } catch (InvalidXMLException e) {
      if (UIMAFramework.getLogger(CLASS_NAME).isLoggable(Level.WARNING)) {
        UIMAFramework.getLogger(CLASS_NAME).logrb(Level.WARNING, XsltImportByName.class.getName(),
                "resolveByName", UIMAEE_Constants.JMS_LOG_RESOURCE_BUNDLE,
                "UIMAEE_exception__WARNING", e);
View Full Code Here

    if (sDescriptorRelativePath.indexOf("file:/") == -1 //$NON-NLS-1$
            && sDescriptorRelativePath.indexOf(":/") > -1) { //$NON-NLS-1$
      sDescriptorRelativePath = "file:/" + sDescriptorRelativePath; //$NON-NLS-1$
    }

    Import imp = new Import_impl();
    // fails on unix? URL url = new URL("file:/" + getDescriptorDirectory());
    // Set relative Path Base
    // a version that might work on all platforms
    URL url = new File(extractDirectory(parentFile)).toURL();
    ((Import_impl) imp).setSourceUrl(url);

    imp.setLocation(sDescriptorRelativePath);
    return imp;
  }
View Full Code Here

    if (sDescriptorRelativePath.indexOf("file:/") == -1 //$NON-NLS-1$
            && sDescriptorRelativePath.indexOf(":/") > -1) { //$NON-NLS-1$
      sDescriptorRelativePath = "file:/" + sDescriptorRelativePath; //$NON-NLS-1$
    }

    Import imp = new Import_impl();
    // fails on unix? URL url = new URL("file:/" + getDescriptorDirectory());
    // Set relative Path Base
    // a version that might work on all platforms
    URL url = new File(multiPageEditor.cde.getDescriptorDirectory()).toURL();
    ((Import_impl) imp).setSourceUrl(url);

    imp.setLocation(sDescriptorRelativePath);
    return imp;
  }
View Full Code Here

    if (sDescriptorRelativePath.indexOf("file:/") == -1 //$NON-NLS-1$
            && sDescriptorRelativePath.indexOf(":/") > -1) { //$NON-NLS-1$
      sDescriptorRelativePath = "file:/" + sDescriptorRelativePath; //$NON-NLS-1$
    }

    Import imp = new Import_impl();
    // fails on unix? URL url = new URL("file:/" + getDescriptorDirectory());
    // Set relative Path Base
    // a version that might work on all platforms
    URL url = new File(multiPageEditor.cde.getDescriptorDirectory()).toURL();
    ((Import_impl) imp).setSourceUrl(url);

    imp.setLocation(sDescriptorRelativePath);
    return imp;
  }
View Full Code Here

TOP

Related Classes of org.apache.uima.resource.metadata.impl.Import_impl

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.