Java Code Examples for org.apache.uima.resource.ResourceInitializationException#NO_RESOURCE_FOR_PARAMETERS

The following examples show how to use org.apache.uima.resource.ResourceInitializationException#NO_RESOURCE_FOR_PARAMETERS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TextLineReader.java    From bluima with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("resource")
@Override
public void initialize(UimaContext context)
        throws ResourceInitializationException {
    super.initialize(context);
    docId = 0;

    LOG.debug("inputFile is " + inputFile);
    try {
        InputStream inputFileIs = ResourceHelper.getInputStream(inputFile);
        checkArgument(inputFileIs != null);
        lineIt = new LineReader(inputFileIs).iterator();
    } catch (Exception e) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
                new Object[] { "inputFile: " + inputFile });
    }

    if (splitMode == null || splitMode < 1 || splitMode > 2) {
        throw new ResourceInitializationException(
                ResourceInitializationException.RESOURCE_DATA_NOT_VALID,
                new Object[] { splitMode, PARAM_SPLIT_MODE });
    }
}
 
Example 2
Source File: ZipXmiCollectionReader.java    From bluima with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(UimaContext context)
        throws ResourceInitializationException {
    super.initialize(context);
    try {
        // we duplicate the code from AbstractFileReader to add "zip"
        // filtering
        File dir = getFile(inputDir);
        fileIterator = DirectoryIterator.get(directoryIterator, dir, "zip",
                isRecursive);

    } catch (Exception e) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
                new Object[] { inputDir });
    }
}
 
Example 3
Source File: BlueAnnotationViewerAnnotator.java    From bluima with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(UimaContext context)
        throws ResourceInitializationException {
    super.initialize(context);

    try {
        styleMapFile = ResourceHelper.getFile(styleMap);
    } catch (FileNotFoundException e) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
                new Object[] { styleMap });
    }

    // set to /tmp by default
    annotationViewer = new BlueAnnotationViewer(new File("/tmp"));
}
 
Example 4
Source File: JythonAnnotator.java    From bluima with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(UimaContext context)
		throws ResourceInitializationException {
	super.initialize(context);

	interp = new PythonInterpreter(null, new PySystemState());
	// LATER allow for nonstandard Python modules
	// PySystemState sys = Py.getSystemState();
	// sys.path.append(new PyString(rootPath));
	// sys.path.append(new PyString(modulesDir));

	try {
		scriptFileIs = ResourceHelper.getInputStream(scriptPath);
	} catch (Exception e) {
		throw new ResourceInitializationException(
				ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
				new Object[] { scriptPath });
	}
}
 
Example 5
Source File: UscTteCollectionReader.java    From bluima with Apache License 2.0 6 votes vote down vote up
@Override
public void initialize(UimaContext context)
        throws ResourceInitializationException {
    inputDir = CORPORA_BASE + "USC_TTE_corpus";
    // inputDir = CORPORA_HOME + "src/test/resources/corpus/USC_TTE_corpus";
    docCnt = 1;
    super.initialize(context);
    try {
        File corpusDir = new File(inputDir);
        checkArgument(corpusDir.exists());
        // duplicating code from AbstractFileReader to add "xml" filtering
        fileIterator = DirectoryIterator.get(directoryIterator, corpusDir,
                "xml", false);
        builder = new SAXBuilder();
        xo = new XMLOutputter();
        xo.setFormat(Format.getRawFormat());
        sentenceXPath = XPathFactory.instance().compile("//S");
    } catch (Exception e) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
                new Object[] { inputDir });
    }
}
 
Example 6
Source File: BioNLPGeniaEventsCollectionReader.java    From bluima with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")
   @Override
   public void initialize(UimaContext context)
    throws ResourceInitializationException {
super.initialize(context);

try {
    File dir = ResourceHelper.getFile(inputDirectory);

    directoryIterator = FileUtils.iterateFiles(dir,
	    new String[] { EXTENSION }, true);

} catch (Exception e) {
    LOG.debug(StringUtils.print(e));
    throw new ResourceInitializationException(
	    ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
	    new Object[] { inputDirectory }, e);
}
   }
 
Example 7
Source File: PubmedWebServiceCollectionReader.java    From bluima with Apache License 2.0 5 votes vote down vote up
@Override
public void initialize(UimaContext context)
        throws ResourceInitializationException {
    super.initialize(context);

    try {
        PubmedSearch pubmedSearch = new PubmedSearch();
        resultsIt = pubmedSearch.search(query, maxNrResults);

    } catch (Exception e) {
        throw new ResourceInitializationException(
                ResourceInitializationException.NO_RESOURCE_FOR_PARAMETERS,
                new Object[] { BlueUima.PARAM_QUERY + " :" + query }, e);
    }
}