Examples of ResourceSpecifier


Examples of org.apache.uima.resource.ResourceSpecifier

              sCascadeDeleteMessage);
      if (!bContinue) {
        return;
      }
    }
    ResourceSpecifier delegate = (ResourceSpecifier) editor.getResolvedDelegates().get(key);
    // remove the selected delegate from delegate list

    Map delegatesWithImport = editor.getAeDescription()
            .getDelegateAnalysisEngineSpecifiersWithImports();
    Object savedDelegate1 = delegatesWithImport.get(key);
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

    String keyName = (String) entry.getKey();
    // support CasConsumers also
    // support Flow Controllers too
    // and skip remote service descriptors

    ResourceSpecifier rs = (ResourceSpecifier) entry.getValue();
    if (rs instanceof AnalysisEngineDescription || rs instanceof CasConsumerDescription
            || rs instanceof FlowControllerDescription) {
      ConfigurationParameterDeclarations delegateCpd = ((ResourceCreationSpecifier) rs)
              .getMetaData().getConfigurationParameterDeclarations();
     
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

                      getSourceUrlString() });
        }
        String delegateKey = overrides[j].substring(0, slashPos);
        String paramName = overrides[j].substring(slashPos + 1);
        // get component descriptor (could be an AE or could be the FlowController)
        ResourceSpecifier componentSpecifier = getComponentSpecifier(delegateKey);
        if (componentSpecifier == null) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.INVALID_PARAM_OVERRIDE_NONEXISTENT_DELEGATE,
                  new Object[] { overrides[j], aParams[i].getName(), getMetaData().getName(),
                      delegateKey, getSourceUrlString() });
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

   * @return the specifier for the component, null if there is no component with the given key
   * @throws ResourceInitializationException
   *           if there's a problem resolving imports
   */
  public ResourceSpecifier getComponentSpecifier(String key) throws ResourceInitializationException {
    ResourceSpecifier componentSpecifier;
    if (getFlowControllerDeclaration() != null
            && key.equals(getFlowControllerDeclaration().getKey())) {
      try {
        getFlowControllerDeclaration().resolveImports();
      } catch (InvalidXMLException e) {
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

    Map<String, String> sofamap = new TreeMap<String, String>();
    SofaMapping[] sofaMappings = this.getSofaMappings();
    if (sofaMappings != null) {
      for (int s = 0; s < sofaMappings.length; s++) {
        String componentKey = sofaMappings[s].getComponentKey();
        ResourceSpecifier componentSpec = getComponentSpecifier(componentKey);
        if (componentSpec == null) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.SOFA_MAPPING_HAS_UNDEFINED_COMPONENT_KEY,
                  new Object[] { componentKey, sofaMappings[s].getAggregateSofaName(), aggName,
                      getSourceUrlString() });
        }
        String componentSofaName = sofaMappings[s].getComponentSofaName();
        if (componentSofaName == null) {
          componentSofaName = CAS.NAME_DEFAULT_SOFA;
        } else if (componentSpec instanceof AnalysisEngineDescription
                && !CAS.NAME_DEFAULT_SOFA.equals(componentSofaName)
                && !declaresSofa((AnalysisEngineDescription) componentSpec, componentSofaName)) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.SOFA_MAPPING_HAS_UNDEFINED_COMPONENT_SOFA,
                  new Object[] { componentKey, componentSofaName,
                      sofaMappings[s].getAggregateSofaName(), aggName, getSourceUrlString() });
        }

        String compoundKey = sofaMappings[s].getComponentKey() + "@/@"
                + sofaMappings[s].getComponentSofaName();
        String aggSofaName = sofaMappings[s].getAggregateSofaName();
        // check for double-mapping
        String existingMapping = (String) sofamap.get(compoundKey);
        if (existingMapping != null && !existingMapping.equals(aggSofaName)) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.SOFA_MAPPING_CONFLICT, new Object[] {
                      sofaMappings[s].getComponentSofaName(), sofaMappings[s].getComponentKey(),
                      aggName, existingMapping, aggSofaName, getSourceUrlString() });
        } else {
          sofamap.put(compoundKey, aggSofaName);
        }
      }
    }

    // Rules for SofAs:
    // (1) Each component output sofa must be mapped to an aggregate output sofa
    // (2) Each aggregate output sofa must be mapped to a component output sofa
    // (3) Each component input sofa must be mapped to an aggregate input sofa OR a component output
    // sofa
    // (4) Each aggregate input sofa must be mapped to a component input sofa

    // From (1) and (3) we derive that:
    // Each component input sofa must be mapped to an aggregate input sofa OR an aggregate output
    // sofa
    // (which is easier to check)

    // Exception: if aggregate contains a remote component, we cannot check that remote
    // component's input or output sofas, so rules (2) and (4) cannot be checked.

    boolean containsRemote = false;
    Set<String> correctlyMappedAggregateOutputs = new HashSet<String>();
    Set<String> correctlyMappedAggregateInputs = new HashSet<String>();

    Iterator<Map.Entry<String, ResourceSpecifier>> iter;
    try {
      iter = getDelegateAnalysisEngineSpecifiers().entrySet().iterator();
    } catch (InvalidXMLException e) {
      throw new ResourceInitializationException(e);
    }
    while (iter.hasNext()) {
      Map.Entry<String, ResourceSpecifier> entry = iter.next();
      String componentKey = entry.getKey();
      ResourceSpecifier delegateSpec = entry.getValue();

      if (delegateSpec instanceof AnalysisEngineDescription) {
        Capability[] caps = ((AnalysisEngineDescription) delegateSpec).getAnalysisEngineMetaData()
                .getCapabilities();
        for (int i = 0; i < caps.length; i++) {
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

          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);

        // add to processed imports map so we don't redo
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

      XMLParser xmlParser = UIMAFramework.getXMLParser();
      // create XML source
      xmlSource = (xmlDescFile != null) ? new XMLInputSource(xmlDescFile) : new XMLInputSource(
              xmlDescUrl);
      // parse XML source and create resource specifier
      ResourceSpecifier resourceSpec = null;
      try {
        resourceSpec = xmlParser.parseResourceSpecifier(xmlSource);
      } catch (UIMAException err) {
        __errTableByUri.put( xmlDescUri, err );
      } catch (UIMARuntimeException exc) {
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

    assertTrue("Descriptor must exist: " + descriptorFile.getAbsolutePath(),
        descriptorFile.exists());

    try {
      XMLParser parser = UIMAFramework.getXMLParser();
      ResourceSpecifier spec = (ResourceSpecifier) parser.parse(new XMLInputSource(descriptorFile));
      AnalysisEngine ae = UIMAFramework.produceAnalysisEngine(spec);
      this.cas = (CASImpl) ae.newCAS();
      assertTrue(this.cas != null);
      this.ts = this.cas.getTypeSystem();
      assertTrue(this.ts != null);
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

    // loop through all entries in the (key, specifier) map
    Iterator<Map.Entry<String,ResourceSpecifier>> i = aSpecifiers.entrySet().iterator();
    while (i.hasNext()) {
      Map.Entry<String,ResourceSpecifier> entry = i.next();
      String key =entry.getKey();
      ResourceSpecifier spec = entry.getValue();

      Map<String, String> sofamap = new TreeMap<String, String>();

      // retrieve the sofa mappings for input/output sofas of this analysis engine
      if (mSofaMappings != null && mSofaMappings.length > 0) {
View Full Code Here

Examples of org.apache.uima.resource.ResourceSpecifier

      displayError(e);
      return false;
    }
    long fileModStamp = f.lastModified(); // get mod stamp before parsing, to prevent race condition
    XMLInputSource aeInputSource = new XMLInputSource(aeSpecifierUrl);
    ResourceSpecifier aeSpecifier = UIMAFramework.getXMLParser().parseResourceSpecifier(
            aeInputSource);

    AnalysisEnginePanel aePanel = new AnalysisEnginePanel(aeSpecifier, f, fileModStamp);
    String tabName;
    if (aeSpecifier instanceof AnalysisEngineDescription) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.