Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceInitializationException


    }
    else if (value == null) {
      return null;
    }
    else {
      throw new ResourceInitializationException(
          ExceptionMessages.MESSAGE_CATALOG,
          ExceptionMessages.WRONG_PARAMETER_TYPE,
          new Object[] {parameter, "String"});
    }
  }
View Full Code Here


    if (value instanceof String[]) {
      return (String[]) value;
    } else if (value == null) {
      return new String[0];
    } else {
      throw new ResourceInitializationException(
          ExceptionMessages.MESSAGE_CATALOG,
          ExceptionMessages.WRONG_PARAMETER_TYPE, new Object[] { parameter,
              "String array" });
    }
  }
View Full Code Here

    }
    else if (value == null) {
      return null;
    }
    else {
      throw new ResourceInitializationException(
              ExceptionMessages.MESSAGE_CATALOG,
              ExceptionMessages.WRONG_PARAMETER_TYPE,
              new Object[] {parameter, "Integer"});
    }
  }
View Full Code Here

    }
    else if (value == null) {
      return null;
    }
    else {
      throw new ResourceInitializationException(
              ExceptionMessages.MESSAGE_CATALOG,
              ExceptionMessages.WRONG_PARAMETER_TYPE,
              new Object[] {parameter, "Float"});
    }
  }
View Full Code Here

    }
    else if (value == null) {
      return null;
    }
    else {
      throw new ResourceInitializationException(
              ExceptionMessages.MESSAGE_CATALOG,
              ExceptionMessages.WRONG_PARAMETER_TYPE,
              new Object[] {parameter, "Boolean"});
    }
  }
View Full Code Here

      throws ResourceInitializationException {

    InputStream inResource = getOptionalResourceAsStream(context, name);

    if (inResource == null) {
      throw new ResourceInitializationException(
          ExceptionMessages.MESSAGE_CATALOG,
          ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] { name
              + " could not be found!" });
    }
View Full Code Here

    InputStream inResource;

    try {
      inResource = context.getResourceAsStream(name);
    } catch (ResourceAccessException e) {
      throw new ResourceInitializationException(e);
    }

    return inResource;
  }
View Full Code Here

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

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

    Integer beamSize = AnnotatorUtil.getOptionalIntegerParameter(context,
        UimaUtil.BEAM_SIZE_PARAMETER);
View Full Code Here

            (ChunkerModelResource) context.getResourceObject(UimaUtil.MODEL_PARAMETER);
       
        model = modelResource.getModel();
    }
    catch (ResourceAccessException e) {
        throw new ResourceInitializationException(e);
    }
   
    mChunker = new ChunkerME(model);
  }
View Full Code Here

      // check for duplicates in common params
      Set<String> commonParamNames = new HashSet<String>();
      if (commonParams != null) {
        for (int i = 0; i < commonParams.length; i++) {
          if (!commonParamNames.add(commonParams[i].getName())) {
            throw new ResourceInitializationException(
                    ResourceInitializationException.DUPLICATE_CONFIGURATION_PARAMETER_NAME,
                    new Object[] { commonParams[i].getName(), getMetaData().getName(),
                        commonParams[i].getSourceUrlString() });
          }
        }
      }
      // check for duplicates in groups
      ConfigurationGroup[] groups = cfgParamDecls.getConfigurationGroups();
      if (groups != null) {
        Map<String, Set<String>> groupToParamSetMap = new HashMap<String, Set<String>>(); // map from group name to HashSet of param names
        // in that group
        for (int i = 0; i < groups.length; i++) {
          String[] names = groups[i].getNames();
          for (int j = 0; j < names.length; j++) {
            Set<String> paramNamesInGroup = groupToParamSetMap.get(names[j]);
            if (paramNamesInGroup == null) {
              // first time we've seen this group. create an entry and add common params
              paramNamesInGroup = new HashSet<String>(commonParamNames);
            }

            // check for duplicate parameter names
            ConfigurationParameter[] paramsInGroup = groups[i].getConfigurationParameters();
            if (paramsInGroup != null) {
              for (int k = 0; k < paramsInGroup.length; k++) {
                if (!paramNamesInGroup.add(paramsInGroup[k].getName())) {
                  throw new ResourceInitializationException(
                          ResourceInitializationException.DUPLICATE_CONFIGURATION_PARAMETER_NAME,
                          new Object[] { paramsInGroup[k].getName(), getMetaData().getName(),
                              paramsInGroup[k].getSourceUrlString() });
                }
              }
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.