Package org.apache.uima.resource

Examples of org.apache.uima.resource.ResourceInitializationException


  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

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

   * @throws ResourceInitializationException - if type does not match
   */
  public static void checkFeatureType(Feature feature, String expectedType)
  throws ResourceInitializationException {
    if (!feature.getRange().getName().equals(expectedType)) {
      throw new ResourceInitializationException(
          ResourceInitializationException.STANDARD_MESSAGE_CATALOG,
          new Object[] { "The Feature " + feature.getName() +
              " must be of type " + expectedType + " !"
          });
    }
View Full Code Here

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

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

    tokenizer = new TokenizerME(model);
  }
View Full Code Here

 
  public void load(DataResource resource) throws ResourceInitializationException {
    try {
        model = loadModel(resource.getInputStream());
    } catch (IOException e) {
        throw new ResourceInitializationException(
          ExceptionMessages.MESSAGE_CATALOG,
          ExceptionMessages.IO_ERROR_MODEL_READING, new Object[] {
            e.getMessage()}, e);
    }
  }
View Full Code Here

      try {
        paramsIn = new FileInputStream(new File(inFileValue));

        params = new opennlp.tools.util.TrainingParameters(paramsIn);
      } catch (IOException e) {
        throw new ResourceInitializationException(e);
      }
      finally {
        try {
          if (paramsIn != null)
            paramsIn.close();
        } catch (IOException e) {
        }
      }

      if (!TrainUtil.isValid(params.getSettings())) {
        throw new ResourceInitializationException(new Exception("Training parameters file is invalid!"));
      }

      if (!isSequenceTrainingAllowed && TrainUtil.isSequenceTraining(params.getSettings())) {
        throw new ResourceInitializationException(new Exception("Sequence training is not supported!"));
      }
    }
    else {
      params = TrainingParameters.defaultParams();
    }
View Full Code Here

      // System.out.println("Finished Creating TCas model; time= " +
      // (System.currentTimeMillis() - time));
      if (null == cachedResult)
        throw new InternalErrorCDE("null result from createTCas");
    } catch (CASAdminException e) {
      throw new ResourceInitializationException(e);
    }
    dirty = false;
    modelRoot.allTypes.dirty = true;
  }
View Full Code Here

    }
  }

  private void validateDescriptorType(int newDescriptorType) throws ResourceInitializationException {
    if (0 != descriptorType && !openingContext && ((descriptorType & newDescriptorType) == 0))
      throw new ResourceInitializationException(Messages.getString("MultiPageEditor.12"), //$NON-NLS-1$
              Messages.getString("MultiPageEditor.13"), //$NON-NLS-1$
              new String[] { descriptorTypeString(), descriptorTypeString(newDescriptorType) });
    if (!openingContext)
      descriptorType = newDescriptorType;
  }
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.