Package org.apache.uima.resource.metadata

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


      //try to find relative path from cpeDescSaveFile to descFile
      String relPath = FileUtils.findRelativePath(descFile, cpeDescSaveFile.getParentFile());
      if (relPath != null) {
        //update CPE descriptor
        descriptor.setInclude(null);
        Import newImport = UIMAFramework.getResourceSpecifierFactory().createImport();
        newImport.setLocation(relPath);
        descriptor.setImport(newImport);
      }
    }   
  }
View Full Code Here


        // get delegate component attributes
        InstallationDescriptor dlgInsD = dlgInstDescs[i];
        String dlgName = dlgInsD.getMainComponentId();
        String dlgDescPath = dlgInsD.getMainComponentDesc();
        // create Import for delegate component
        Import dlgImport = rsFactory.createImport();
        // set relative delegate descriptor location
        String dlgDescRelPath = dlgDescPath.replaceAll(PMControllerHelper.MAIN_ROOT_REGEX,
                StringUtil.toRegExpReplacement(".."));
        dlgImport.setLocation(dlgDescRelPath);
        // add delegate Import to the Map
        delegatesMap.put(dlgName, dlgImport);
      }
      // get AE metadata
      AnalysisEngineMetaData aggMetadata = aggDescription.getAnalysisEngineMetaData();
View Full Code Here

    // check pear PackageBrowser object
    Assert.assertNotNull(instPear);
    // import pear specifiers
    Import impPear = UIMAFramework.getResourceSpecifierFactory().createImport();
    File import1 = new File(instPear.getComponentPearDescPath());
    impPear.setLocation(import1.toURI().getPath());

    return impPear;
  }
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

              "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

    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

      fileName = fileName.substring(i + 1);
    if (fileName.charAt(0) == '.')
      fileName = fileName.substring(1);
    int partStart = 0;

    Import imp = UIMAFramework.getResourceSpecifierFactory().createImport();
    ResourceManager rm = editor.createResourceManager();

    for (;;) {
      imp.setName(fileName.substring(partStart));
      try {
        imp.findAbsoluteUrl(rm);
      } catch (InvalidXMLException e) {
        partStart = fileName.indexOf('.', partStart) + 1;
        if (0 == partStart)
          return imp; // not found -outer code will catch error later
        continue;
View Full Code Here

   *          if imports should be done by name
   * @return false if any import caused an error, true of all OK
   */
  public boolean addImports(Object[] locations, boolean isByName) {
    Import[] currentImports = getModelImportArray();
    Import imp;

    int nCountCurrentImports = (currentImports == null) ? 0 : currentImports.length;
    int numberToAdd = locations.length;

    Import[] newImports = new Import[nCountCurrentImports + numberToAdd];
View Full Code Here

          System.err.println("***ERROR Item index hover out of range" + itemIndex
                  + ", size of array = " + importItems.length);
          System.err.println(this.getClass().getName());
          return;
        }
        Import importItem = getModelImportArray()[itemIndex];
        // if by location, it's relative to the descriptor.
        String absolutePath = editor.getAbsolutePathFromImport(importItem);

        String description = null;
        try {
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.