Package org.apache.uima.resource.metadata

Examples of org.apache.uima.resource.metadata.Import


    AnalysisEngineDescription desc = UIMAFramework.getResourceSpecifierFactory()
            .createAnalysisEngineDescription();
    desc.setPrimitive(false);

    // import pear specifiers
    Import impPear1 = UIMAFramework.getResourceSpecifierFactory().createImport();
    File import1 = new File(instPear1.getComponentPearDescPath());
    impPear1.setLocation(import1.toURI().getPath());

    // import main pear descriptor
    Import impPear2 = UIMAFramework.getResourceSpecifierFactory().createImport();
    File import2 = new File(instPear1.getComponentPearDescPath());
    impPear2.setLocation(import2.toURI().getPath());

    // add delegates as imports
    Map delegates = desc.getDelegateAnalysisEngineSpecifiersWithImports();
    delegates.put("Pear1", impPear1);
    delegates.put("Pear2", impPear2);
View Full Code Here


              "Use Source tab below to specify a key name " +
              "in the <flowController> element, or the imported <flowController>");
    } else
      keyName = fcd.getKey();
    flowControllerKeyGUI.setText(keyName);
    Import fcdImport = fcd.getImport();
    String fileName = null;
    if (null != fcdImport) {
      fileName = fcdImport.getLocation();
      if (null == fileName || (0 == fileName.length()))
        fileName = fcdImport.getName();
    }
    flowControllerGUI.setText(null == fileName ?
            "Warning: no <import> in <flowController>" : fileName);
    flowControllerChoice.setText(USER_DEFINED_FLOW);
    // must follow label updates
View Full Code Here

    }
    flowControllerGUI.setToolTipText(sDesc);
  }

  private void handleContextMenuRequest(Event event) {
    Import imp = getFlowControllerDeclaration().getImport();

    bDisableToolTipHelp = true;
    requestPopUpOverImport(imp, flowControllerGUI, event);
    bDisableToolTipHelp = false;
  }
View Full Code Here

    }
  }

  private void produceKeyAddFlowController(String shortName, String fullPathFileName,
          boolean isImportByName) {
    Import imp = createImport(fullPathFileName, isImportByName);

    // key is shortName plus a suffix if needed to make it unique.
    // The set of existing keys is obtained from the model,
    // not from the GUI table (as was the case in earlier design)
    FlowControllerDeclaration oldFcd = getFlowControllerDeclaration();
View Full Code Here

    List<Import> imports = new ArrayList<Import>();
    boolean contextDelta = false;
    for (String descriptorLocation : ds.getIncludedFiles()) {
      File descriptorFile = new File(ds.getBasedir(), descriptorLocation);
      this.getLog().info("JCasGen: Found descriptor '" + descriptorFile.getAbsolutePath() + "'");
      Import imp = new Import_impl();
      // setLocation takes a string which must be a URL
      // https://issues.apache.org/jira/browse/UIMA-2983
      URL url;
      try {
        url = descriptorFile.toURI().toURL();
      } catch (MalformedURLException e) {
        throw new RuntimeException(e); // this should never happen for files
      }
      imp.setLocation(url.toString());
      imports.add(imp);

      contextDelta |= this.buildContext.hasDelta(new File(ds.getBasedir(), descriptorLocation));
    }
    Import[] importArray = new Import[imports.size()];
View Full Code Here

    if (null == item) {
      return;
    }

    String thisKey = item.getText(1);
    Import imp = (Import) getDelegateAnalysisEngineSpecifiersWithImports().get(thisKey);

    bDisableToolTipHelp = true;
    requestPopUpOverImport(imp, filesTable, event);
    bDisableToolTipHelp = false;
  }
View Full Code Here

    filesTable.setToolTipText(sDesc);
  }

  private boolean addDelegate(String fileName, String shortName, String keyName,
          boolean isImportByName) {
    Import imp;
    Map delegatesWithImport = getDelegateAnalysisEngineSpecifiersWithImports();

    // if the delegate is not a remote, read / parse it and add ae to
    // the delegate hash map
    // -- also add the import
View Full Code Here

   *
   * @param fileName
   * @param keyName
   */
  private void addFile(Object o, String keyName) {
    Import impItem = (Import) o;
    String fileName = impItem.getLocation();
    if (null == fileName || (0 == fileName.length()))
      fileName = impItem.getName();
    // create new TableItem
    TableItem item = new TableItem(filesTable, SWT.NONE);
    item.setImage(TAEConfiguratorPlugin.getImage(TAEConfiguratorPlugin.IMAGE_ANNOTATOR));
    item.setText(0, fileName);
    item.setText(1, keyName);
View Full Code Here

    for (Map.Entry<String, MetaDataObject> entry :
      getDelegateAnalysisEngineSpecifiersWithImports().entrySet()) {
      String key = entry.getKey();
      keys.add(key);
      if (entry.getValue() instanceof Import) {
        Import aeImport = ((Import) entry.getValue());
        // see if we processed this already
        if (entry.getValue().equals(mProcessedImports.get(key))) {
          continue;
        }
        // make sure Import's relative path base is set, to allow for
        // users who create
        // new import objects
        if (aeImport instanceof Import_impl) {
          ((Import_impl) aeImport).setSourceUrlIfNull(this.getSourceUrl());
        }
        // locate import target
        URL url = aeImport.findAbsoluteUrl(aResourceManager);

        // check for resursive import
        if (aEnclosingAggregateAeUrls.contains(url.toString())) {
          String name = getMetaData() == null ? "<null>" : getMetaData().getName();
          throw new InvalidXMLException(InvalidXMLException.CIRCULAR_AE_IMPORT, new Object[] {
              name, url });
        }

        // parse import target
        XMLInputSource input;
        try {
          input = new XMLInputSource(url);
        } catch (IOException e) {
          throw new InvalidXMLException(InvalidXMLException.IMPORT_FAILED_COULD_NOT_READ_FROM_URL,
                  new Object[] { url, aeImport.getSourceUrlString() }, e);
        }
        ResourceSpecifier spec = UIMAFramework.getXMLParser().parseResourceSpecifier(input);

        // update entry in derived mDelegateAnalysisEngineSpecifiers map.
        mDelegateAnalysisEngineSpecifiers.put(key, spec);
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

TOP

Related Classes of org.apache.uima.resource.metadata.Import

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.