Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceInitializationException


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

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

    mCategorizer = new DocumentCategorizerME(model);
  }
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

  public static InputStream getOptionalResourceAsStream(UimaContext context,
        String name) throws ResourceInitializationException {
      try {
        return context.getResourceAsStream(name);
      } catch (ResourceAccessException e) {
        throw new ResourceInitializationException(
            ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
            new Object[] { "There is an internal error in the UIMA SDK: " +
            e.getMessage(),
            e });
      }  
View Full Code Here

      String name) throws ResourceInitializationException {
   
    InputStream inResource = getOptionalResourceAsStream(context, name);
   
    if (inResource == null) {
      throw new ResourceInitializationException(
          ResourceAccessException.STANDARD_MESSAGE_CATALOG,
          new Object[] { "Unable to load resource!" });
    }

    return inResource;
View Full Code Here

  public static Type getType(TypeSystem typeSystem, String name)
      throws ResourceInitializationException {
    Type type = getOptionalType(typeSystem, name);
   
    if (type == null) {
      throw new ResourceInitializationException(
          ResourceInitializationException.INCOMPATIBLE_RANGE_TYPES,
          new Object[] { "Unable to retrive " + name + " type!" });
    }
   
    return type;
View Full Code Here

  private static void checkForNull(Object value, String parameterName)
      throws ResourceInitializationException{
   
    if (value == null) {
      throw new ResourceInitializationException(
          ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
          new Object[] { "The " + parameterName + " is a " +
          "requiered parameter!" });
    }
  }
View Full Code Here

    }
    else if (value instanceof String) {
      return (String) value;
    }
    else {
      throw new ResourceInitializationException(
          ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
          new Object[] {"The parameter: "  + parameter + " does not have" +
          "the expected type String"});
    }
  }
View Full Code Here

  if (value instanceof String[]) {
      return (String[]) value;
  } else if (value == null) {
      return new String[0];
  } else {
      throw new ResourceInitializationException(
        ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
        new Object[] { "The parameter: " + parameter
          + " does not have" + "the expected type String array" });
  }
    }
View Full Code Here

    }
    else if (value instanceof Integer) {
      return (Integer) value;
    }
    else {
      throw new ResourceInitializationException(
          ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
          new Object[] {"The parameter: "  + parameter + " does not have" +
          "the expected type Integer"});
    }
  }
View Full Code Here

    }
    else if (value instanceof Float) {
      return (Float) value;
    }
    else {
      throw new ResourceInitializationException(
          ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
          new Object[] {"The parameter: "  + parameter + " does not have" +
          "the expected type Float"});
    }
  }
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.