ctakes-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lewis John McGibbney (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CTAKES-385) URI is not hierarchical when attempting to obtain lvg.properties within JAR
Date Fri, 16 Oct 2015 18:42:05 GMT

     [ https://issues.apache.org/jira/browse/CTAKES-385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Lewis John McGibbney updated CTAKES-385:
----------------------------------------
    Attachment: CTAKES-385.patch

Patch for trunk. I've tested this on my uber jars running in cluster environment. 
I want to note that this does not fix the mvn install scenario. The function which is 'broken'
is within http://svn.apache.org/repos/asf/ctakes/trunk/ctakes-lvg/src/main/java/org/apache/ctakes/lvg/resource/LvgCmdApiResourceImpl.java
{code}
    /**
     * Get the path to the root directory of the installation of 
     * NLMs lvg lexical tools.
     * Note, does not look at the LVG_DIR properties in the lvg properties
     * file because LVG_DIR might not contain a path - 
     * LVG_DIR=AUTO_MODE. 
     * Assumes the lvg properties file is in data\config\.
     * For example, if LVG project is installed into   <br>
     *   /pipeline/LVG                                 <br>
     * with the lvg.properties file therefore in       <br>
     *   /pipeline/ctakes-lvg/resources/ctakes-lvg/data/config/      <br>
     * this method will return                         <br>
     *   /pipeline/ctakes-lvg/resources/lvg                   <br>
     *  
     */
    private String getLvgDir(File configFile) {
    	
    	String pathToLvgRoot = null;
    	File configDir = configFile.getParentFile();
    	String configDirAbsPath = configDir.getPath();
    	
    	// Use the path after stripping off data/config
    	// If path is not what was expected, try cwd as a last resort
    	String dataConfigPath = "data"+File.separator+"config";
    	if (!configDirAbsPath.endsWith(dataConfigPath)) {
    		pathToLvgRoot = getCurrentWorkingDirectory();
    	}
    	else {
    		int configDirAbsPathLen = configDirAbsPath.length();
    		int pathLen = dataConfigPath.length();
    		pathToLvgRoot = configDirAbsPath.substring(0, configDirAbsPathLen-pathLen);
    	}
    	
    	return pathToLvgRoot;
    }
{code}
This currently breaks
{code}
TestClearNLPPipeLine(org.apache.ctakes.dependency.parser.ae.util.TestClearNLPAnalysisEngines):
URI is not hierarchical
{code}
I think, in order to keep the patch attached manageable we can address the above issue in
another issue.

> URI is not hierarchical when attempting to obtain lvg.properties within JAR
> ---------------------------------------------------------------------------
>
>                 Key: CTAKES-385
>                 URL: https://issues.apache.org/jira/browse/CTAKES-385
>             Project: cTAKES
>          Issue Type: Improvement
>          Components: ctakes-lvg
>    Affects Versions: 3.2.2
>         Environment: MaxOSX 10.9.5, cTAKES 3.2.3-SNAPSHOT (nightly Wed Oct 14th, 2015),
Apache Spark 1.5.1 on Apache Hadoop 2.4.0
>            Reporter: Lewis John McGibbney
>             Fix For: 3.2.3
>
>         Attachments: CTAKES-385.patch
>
>
> As described in the [accompanying mailing list thread|http://www.mail-archive.com/user%40ctakes.apache.org/msg00969.html]
this issue concerns LvgAnnotator.createAnnotatorDescription(LvgAnnotator.java:565) using the
following syntax
> {code}
> ExternalResourceFactory.createExternalResourceDescription(
>               LvgCmdApiResourceImpl.class,
>               new File(LvgCmdApiResourceImpl.class.getResource(
>                   "/org/apache/ctakes/lvg/data/config/lvg.properties").toURI()))
> {code}
> Use of LvgCmdApiResourceImpl.class.getResource should be exchanged for 
> {code}
> LvgCmdApiResourceImpl.class.getResourceAsStream
> {code}
> Patch coming up.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message