Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceInitializationException


    while (it.hasNext()) {
      TypePriorities tp = (TypePriorities) it.next();
      try {
        tp.resolveImports(aResourceManager);
      } catch (InvalidXMLException e) {
        throw new ResourceInitializationException(e);
      }
      TypePriorityList[] pls = tp.getPriorityLists();
      if (pls != null) {
        for (int i = 0; i < pls.length; i++) {
          aggTypePriorities.addPriorityList(pls[i]);
View Full Code Here


        featDesc.setSourceUrl(aFeatures[i].getSourceUrl());
      } else // feature does exist
      {
        // check that the range types match
        if (!feat.getRangeTypeName().equals(rangeTypeName)) {
          throw new ResourceInitializationException(
                  ResourceInitializationException.INCOMPATIBLE_RANGE_TYPES, new Object[] {
                      aType.getName() + ":" + feat.getName(), rangeTypeName,
                      feat.getRangeTypeName(), aType.getSourceUrlString() });
        }
      }
View Full Code Here

        if (!aeDesc.isPrimitive()) {
          Map delegateMap;
          try {
            delegateMap = aeDesc.getAllComponentSpecifiers(aResourceManager);
          } catch (InvalidXMLException e) {
            throw new ResourceInitializationException(e);
          }
          Iterator delIter = delegateMap.entrySet().iterator();
          while(delIter.hasNext()) {
            Map.Entry delEntry = (Map.Entry)delIter.next();
            List tempList = new ArrayList();
            tempList.add(delEntry.getValue());
            mdList.addAll(getMetaDataList(tempList, aResourceManager, aOutputFailedRemotes, aContextName + "/" + delEntry.getKey()));
          }
        }
      } else if (current instanceof CollectionReaderDescription) {
        mdList.add(((CollectionReaderDescription) current).getMetaData().clone());
      } else if (current instanceof CasInitializerDescription) {
        mdList.add(((CasInitializerDescription) current).getMetaData().clone());
      } else if (current instanceof CasConsumerDescription) {
        mdList.add(((CasConsumerDescription) current).getMetaData().clone());
      } else if (current instanceof FlowControllerDescription) {
        mdList.add(((FlowControllerDescription) current).getMetaData().clone());
      } else if (current instanceof TypeSystemDescription) {
        ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
        md.setTypeSystem((TypeSystemDescription) current);
        mdList.add(md);
      } else if (current instanceof FsIndexCollection) {
        ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
        md.setFsIndexCollection((FsIndexCollection) current);
        mdList.add(md);
      } else if (current instanceof TypePriorities) {
        ProcessingResourceMetaData md = new ProcessingResourceMetaData_impl();
        md.setTypePriorities((TypePriorities) current);
        mdList.add(md);
      } else if (current instanceof ResourceSpecifier) {
        //try to instantiate the resource
        Resource resource = null;
        Map resourceMgrInMap = new HashMap();
        resourceMgrInMap.put(Resource.PARAM_RESOURCE_MANAGER, aResourceManager);
        try {
          resource = UIMAFramework.produceResource((ResourceSpecifier) current,
              (null == aResourceManager) ? Collections.EMPTY_MAP : resourceMgrInMap);
        } catch (Exception e) {
          //failed.  If aOutputFailedRemotes is non-null, add an entry to it to it, else throw the exception.
          if (aOutputFailedRemotes != null) {
            aOutputFailedRemotes.put(aContextName,e);
          }
          else {
            if (e instanceof ResourceInitializationException)
              throw (ResourceInitializationException)e;
            else if (e instanceof RuntimeException)
              throw (RuntimeException)e;
            else
              throw new RuntimeException(e);
          }
        }
        if (resource != null) {
          ResourceMetaData metadata = resource.getMetaData();
          if (metadata instanceof ProcessingResourceMetaData) {
            mdList.add(metadata);
          }
          resource.destroy();
        }
      } else {
        throw new ResourceInitializationException(
                ResourceInitializationException.UNSUPPORTED_OBJECT_TYPE_IN_CREATE_CAS,
                new Object[] { current.getClass().getName() });
      }
    }
View Full Code Here

    } else if (conversionPolicyString.equals("explicit")) {
      conversionPolicy = StringConversionPolicy.EXPLICIT;
    } else if (conversionPolicyString.equals("none")) {
      conversionPolicy = StringConversionPolicy.NONE;
    } else {
      throw new ResourceInitializationException("illegal conversionPolicy parameter value",
              new Object[0]);
    }
    newlineInducingTags = new HashSet<String>();
    String[] nlTags = (String[]) aContext.getConfigParameterValue(NEWLINE_INDUCING_TAGS);
    if (nlTags == null || nlTags.length == 0) {
      newlineInducingTags.add("br");
      newlineInducingTags.add("p");
      newlineInducingTags.add("div");
      newlineInducingTags.add("ul");
      newlineInducingTags.add("ol");
      newlineInducingTags.add("dl");
      newlineInducingTags.add("li");
      newlineInducingTags.add("h1");
      newlineInducingTags.add("h2");
      newlineInducingTags.add("h3");
      newlineInducingTags.add("h4");
      newlineInducingTags.add("h5");
      newlineInducingTags.add("h6");
      newlineInducingTags.add("blockquote");
    } else {
      for (String nlTag : nlTags) {
        newlineInducingTags.add(nlTag);
      }
      // check assertions
      if (modifiedViewName.equals(inputViewName)) {
        throw new ResourceInitializationException("input and output view names must differ!",
                new Object[0]);
      }
    }
    conversionPatterns = (String[]) aContext.getConfigParameterValue(CONVERSION_PATTERNS);
    if (conversionPatterns == null) {
View Full Code Here

      }
      if (!reloadScript) {
        try {
          initializeScript(CAS.NAME_DEFAULT_SOFA);
        } catch (AnalysisEngineProcessException e) {
          throw new ResourceInitializationException(e);
        }
      }
    }
  }
View Full Code Here

      // create AE here
      ae = UIMAFramework.produceAnalysisEngine(desc);

    } catch (Exception e) {
      throw new ResourceInitializationException(e);
    }

    return ae;
  }
View Full Code Here

      // create AE here
      ae = UIMAFramework.produceAnalysisEngine(desc);

    } catch (Exception e) {
      throw new ResourceInitializationException(e);
    }

    return ae;
  }
View Full Code Here

    IndexWriterProvider indexWriterProvider;
    try {
      indexWriterProvider = (IndexWriterProvider) uimaContext
          .getResourceObject(RESOURCE_INDEX_WRITER_PROVIDER);
    } catch (ResourceAccessException e) {
      throw new ResourceInitializationException(e);
    }
    indexWriter = indexWriterProvider.getIndexWriter();
  }
View Full Code Here

      this.stemmers.put("pt", new portugueseStemmer());
      this.stemmers.put("ru", new russianStemmer());
      this.stemmers.put("es", new spanishStemmer());
      this.stemmers.put("sw", new swedishStemmer());
    } catch (Exception ex) {
      throw new ResourceInitializationException(ex);
    }

    this.logger.log(Level.INFO, "Snowball annotator successfully initialized");
  }
View Full Code Here

      SentenceModelResource modelResource = (SentenceModelResource) context
          .getResourceObject(UimaUtil.MODEL_PARAMETER);

      model = modelResource.getModel();
    } catch (ResourceAccessException e) {
      throw new ResourceInitializationException(e);
    }

    sentenceDetector = new SentenceDetectorME(model);
  }
View Full Code Here

TOP

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

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.