ctakes-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seanfi...@apache.org
Subject svn commit: r1786776 - in /ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core: cc/AbstractOutputFileWriter.java config/ConfigParameterConstants.java pipeline/CliOptionals.java pipeline/PiperFileRunner.java pipeline/StandardOptions.java
Date Mon, 13 Mar 2017 19:46:21 GMT
Author: seanfinan
Date: Mon Mar 13 19:46:20 2017
New Revision: 1786776

URL: http://svn.apache.org/viewvc?rev=1786776&view=rev
Log:
AbstractOutputFileWriter : create subdirectory if not present
ConfigParameterConstants : add SubDirectory
CliOptionals : removed -s
PiperFileRunner : auto-parse -s
StandardOptions : add -s

Modified:
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/AbstractOutputFileWriter.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/config/ConfigParameterConstants.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
    ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/StandardOptions.java

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/AbstractOutputFileWriter.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/AbstractOutputFileWriter.java?rev=1786776&r1=1786775&r2=1786776&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/AbstractOutputFileWriter.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/cc/AbstractOutputFileWriter.java
Mon Mar 13 19:46:20 2017
@@ -41,8 +41,8 @@ abstract public class AbstractOutputFile
    private File _outputRootDir;
 
    @ConfigurationParameter(
-         name = "SubDirectory",
-         description = "SubDirectory for all output files.",
+         name = ConfigParameterConstants.PARAM_SUBDIR,
+         description = ConfigParameterConstants.DESC_SUBDIR,
          defaultValue = ""
    )
    private String _subDirectory;
@@ -53,7 +53,12 @@ abstract public class AbstractOutputFile
    @Override
    public void initialize( final UimaContext context ) throws ResourceInitializationException
{
       super.initialize( context );
-      if ( !_outputRootDir.exists() ) {
+      if ( _subDirectory != null && !_subDirectory.isEmpty() ) {
+         final File subDirectory = new File( _outputRootDir, _subDirectory );
+         if ( !subDirectory.exists() ) {
+            subDirectory.mkdirs();
+         }
+      } else if ( !_outputRootDir.exists() ) {
          _outputRootDir.mkdirs();
       }
    }

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/config/ConfigParameterConstants.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/config/ConfigParameterConstants.java?rev=1786776&r1=1786775&r2=1786776&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/config/ConfigParameterConstants.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/config/ConfigParameterConstants.java
Mon Mar 13 19:46:20 2017
@@ -28,6 +28,14 @@ final public class ConfigParameterConsta
 
    /**
     * Name of configuration parameter that can be set to the path of
+    * a subdirectory for input or output files.
+    */
+   static public final String PARAM_SUBDIR = "SubDirectory";
+   static public final String OPTION_SUBDIR = "-s";
+   static public final String DESC_SUBDIR = "SubDirectory for files.";
+
+   /**
+    * Name of configuration parameter that can be set to the path of
     * a file containing dictionary lookup configuration.
     */
    static public final String PARAM_LOOKUP_XML = "LookupXml";

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java?rev=1786776&r1=1786775&r2=1786776&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/CliOptionals.java
Mon Mar 13 19:46:20 2017
@@ -91,10 +91,7 @@ public interface CliOptionals extends St
          defaultValue = "" )
    String getOption_r();
 
-   @Option(
-         shortName = "s",
-         defaultValue = "" )
-   String getOption_s();
+   // -s is reserved for common parameter "SubDirectory"
 
    @Option(
          shortName = "t",
@@ -259,10 +256,7 @@ public interface CliOptionals extends St
          defaultValue = "" )
    String getOption_R();
 
-   @Option(
-         shortName = "S",
-         defaultValue = "" )
-   String getOption_S();
+   // -s is reserved for common parameter "SubDirectory"
 
    @Option(
          shortName = "T",

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java?rev=1786776&r1=1786775&r2=1786776&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PiperFileRunner.java
Mon Mar 13 19:46:20 2017
@@ -35,6 +35,12 @@ final public class PiperFileRunner {
          }
          // set the output directory parameter if needed
          final String outputDir = options.getOutputDirectory();
+         // set the subdirectory parameter if needed
+         final String subDir = options.getSubDirectory();
+         if ( !subDir.isEmpty() ) {
+            builder.set( ConfigParameterConstants.PARAM_SUBDIR, subDir );
+         }
+         // if xmi output directory is set but standard output directory is not, use xmi
out as standard out
          final String xmiOutDir = options.getXmiOutDirectory();
          if ( !outputDir.isEmpty() ) {
             builder.set( ConfigParameterConstants.PARAM_OUTPUTDIR, outputDir );

Modified: ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/StandardOptions.java
URL: http://svn.apache.org/viewvc/ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/StandardOptions.java?rev=1786776&r1=1786775&r2=1786776&view=diff
==============================================================================
--- ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/StandardOptions.java
(original)
+++ ctakes/trunk/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/StandardOptions.java
Mon Mar 13 19:46:20 2017
@@ -31,6 +31,13 @@ interface StandardOptions {
    String getOutputDirectory();
 
    @Option(
+         shortName = "s",
+         longName = "subDir",
+         description = "path to a subdirectory for input and/or output.",
+         defaultValue = "" )
+   String getSubDirectory();
+
+   @Option(
          longName = "xmiOut",
          description = "path to the directory where xmi files are to be written.  Adds XmiWriter
to pipeline.",
          defaultValue = "" )



Mime
View raw message