This is an automated email from the ASF dual-hosted git repository.
seanfinan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ctakes.git
The following commit(s) were added to refs/heads/main by this push:
new cfb4f7b Placed gui startups in gui event thread. Added info message
to PipelineBuilder if reader and input dir are not set. added specific
jackson-core for hapi fhir Added * for config/ in setenv classpath log4j2.xml
and build.xml change for dockhand
cfb4f7b is described below
commit cfb4f7b245dbe85061c2f72ac77e040ca7b2f04d
Author: Sean Finan <[email protected]>
AuthorDate: Tue Aug 20 14:29:38 2024 -0400
Placed gui startups in gui event thread.
Added info message to PipelineBuilder if reader and input dir are not set.
added specific jackson-core for hapi fhir
Added * for config/ in setenv classpath
log4j2.xml and build.xml change for dockhand
---
.../ctakes/core/pipeline/PipelineBuilder.java | 27 ++++++------
ctakes-distribution/src/main/bin/setenv.bat | 2 +-
ctakes-distribution/src/main/bin/setenv.sh | 2 +-
ctakes-dockhand/src/main/resources/log4j2.xml | 48 ++++++++++++++++++++++
.../ctakes/dockhand/goal/local/pom/build.xml | 2 +-
ctakes-fhir/pom.xml | 4 ++
.../ctakes/gui/dictionary/DictionaryCreator.java | 8 ++++
.../gui/dictionary/DictionaryDownloader.java | 8 ++++
.../ctakes/gui/generic/GenericRunnerGui.java | 12 +++++-
.../apache/ctakes/gui/pipeline/PiperRunnerGui.java | 11 ++++-
pom.xml | 5 +++
11 files changed, 112 insertions(+), 17 deletions(-)
diff --git
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PipelineBuilder.java
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PipelineBuilder.java
index 62470ca..8961e1e 100644
---
a/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PipelineBuilder.java
+++
b/ctakes-core/src/main/java/org/apache/ctakes/core/pipeline/PipelineBuilder.java
@@ -45,6 +45,7 @@ final public class PipelineBuilder {
static private final Logger LOGGER = LoggerFactory.getLogger(
"PipelineBuilder" );
private CollectionReaderDescription _readerDesc;
+ private boolean _ignoreReader = false;
// TODO replace pairs of 3 lists with 2 instances of a single class. Put a
build() (sub) method in class?
private final List<String> _aeNameList;
private final List<String[]> _aeViewList;
@@ -348,15 +349,15 @@ final public class PipelineBuilder {
public PipelineBuilder threads( final int threadCount ) {
if ( threadCount <= 1 ) {
if ( threadCount < 1 ) {
- LOGGER.warn( "Thread count (" + threadCount + ") cannot be below
1. Using 1 thread for processing." );
+ LOGGER.warn( "Thread count ({}) cannot be below 1. Using 1 thread
for processing.", threadCount );
}
_threadCount = 1;
return this;
}
final int coreCount = Runtime.getRuntime().availableProcessors();
if ( threadCount > coreCount ) {
- LOGGER.warn( "Thread count (" + threadCount + ") is greater than core
count ("
- + coreCount + "). Using core count for processing." );
+ LOGGER.warn( "Thread count ({}) is greater than core count ({}).
Using core count for processing.",
+ threadCount, coreCount );
_threadCount = coreCount;
return this;
}
@@ -402,7 +403,8 @@ final public class PipelineBuilder {
*/
public PipelineBuilder run() throws IOException, UIMAException {
if ( _readerDesc == null ) {
- LOGGER.error( "No Collection Reader specified." );
+ LOGGER.error( "No Collection Reader specified, cannot run pipeline."
);
+ LOGGER.info( "Set the InputDirectory (-i) parameter to use the
default reader FileTreeReader." );
return this;
}
build();
@@ -435,10 +437,7 @@ final public class PipelineBuilder {
* @throws UIMAException if the pipeline could not be run
*/
public PipelineBuilder run( final String text ) throws IOException,
UIMAException {
- if ( _readerDesc != null ) {
- LOGGER.error( "Collection Reader specified, ignoring." );
- return this;
- }
+ ignoreReader();
final JCas jcas = JCasFactory.createJCas();
jcas.setDocumentText( text );
return run( jcas );
@@ -455,15 +454,19 @@ final public class PipelineBuilder {
* @throws UIMAException if the pipeline could not be run
*/
public PipelineBuilder run( final JCas jCas ) throws IOException,
UIMAException {
- if ( _readerDesc != null ) {
- LOGGER.error( "Collection Reader specified, ignoring." );
- return this;
- }
+ ignoreReader();
build();
SimplePipeline.runPipeline( jCas, _analysisEngineDesc );
return this;
}
+ private void ignoreReader() {
+ if ( !_ignoreReader && _readerDesc != null ) {
+ LOGGER.warn( "Running text directly, ignoring Collection Reader {}",
_readerDesc.getClass().getSimpleName() );
+ }
+ _ignoreReader = true;
+ }
+
/**
* @return an analysis engine description, for use in creating xml
descriptor files, etc.
* @throws IOException if the description could not be built
diff --git a/ctakes-distribution/src/main/bin/setenv.bat
b/ctakes-distribution/src/main/bin/setenv.bat
index 7c77ed5..2a39d19 100644
--- a/ctakes-distribution/src/main/bin/setenv.bat
+++ b/ctakes-distribution/src/main/bin/setenv.bat
@@ -46,7 +46,7 @@ goto end
@REM use JAVA_HOME if set
if exist "%JAVA_HOME%\bin\java.exe" set PATH=%JAVA_HOME%\bin;%PATH%
-set
CLASS_PATH=%CTAKES_HOME%\desc\;%CTAKES_HOME%\resources\;%CTAKES_HOME%\config\;%CTAKES_HOME%\lib\*
+set
CLASS_PATH=%CTAKES_HOME%\desc\;%CTAKES_HOME%\resources\;%CTAKES_HOME%\config\*;%CTAKES_HOME%\lib\*
REM set LOG4J_PARM=-Dlog4j.configuration="file:\%CTAKES_HOME%\config\log4j.xml"
set PIPE_RUNNER=org.apache.ctakes.core.pipeline.PiperFileRunner
set PIPE_RUNNER_GUI=org.apache.ctakes.gui.pipeline.PiperRunnerGui
diff --git a/ctakes-distribution/src/main/bin/setenv.sh
b/ctakes-distribution/src/main/bin/setenv.sh
index 627d9df..e70c788 100644
--- a/ctakes-distribution/src/main/bin/setenv.sh
+++ b/ctakes-distribution/src/main/bin/setenv.sh
@@ -13,7 +13,7 @@ PRGDIR=`dirname "$PRG"`
# Only set CTAKES_HOME if not already set
[ -z "$CTAKES_HOME" ] && CTAKES_HOME=`cd "$PRGDIR/.." >/dev/null; pwd`
-CLASS_PATH=$CTAKES_HOME/desc/:$CTAKES_HOME/resources/:$CTAKES_HOME/config/:$CTAKES_HOME/lib/*
+CLASS_PATH=$CTAKES_HOME/desc/:$CTAKES_HOME/resources/:$CTAKES_HOME/config/*:$CTAKES_HOME/lib/*
#LOG4J2_PARM=-Dlog4j.configuration=file:$CTAKES_HOME/config/log4j2.xml
PIPE_RUNNER=org.apache.ctakes.core.pipeline.PiperFileRunner
PIPE_RUNNER_GUI=org.apache.ctakes.gui.pipeline.PiperRunnerGui
diff --git a/ctakes-dockhand/src/main/resources/log4j2.xml
b/ctakes-dockhand/src/main/resources/log4j2.xml
new file mode 100644
index 0000000..28bed75
--- /dev/null
+++ b/ctakes-dockhand/src/main/resources/log4j2.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+<Configuration status="info">
+ <Appenders>
+ <Console name="consoleAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="%d{dd MMM yyyy HH:mm:ss} %5p %c{1} -
%m%n"/>
+ </Console>
+ <Console name="noEolAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="%m"/>
+ </Console>
+ <Console name="eolAppender" target="SYSTEM_OUT">
+ <PatternLayout pattern="%m%n"/>
+ </Console>
+<!-- <File name="fileAppender" fileName="log/ctakes.log"
append="false">-->
+<!-- </File>-->
+ </Appenders>
+ <Loggers>
+ <Logger name="ProgressAppender" level="info" additivity="false">
+ <AppenderRef ref="noEolAppender"/>
+ </Logger>
+ <Logger name="ProgressDone" level="info" additivity="false">
+ <AppenderRef ref="eolAppender"/>
+ </Logger>
+ <Root level="info">
+ <AppenderRef ref="consoleAppender"/>
+ </Root>
+ </Loggers>
+
+</Configuration>
\ No newline at end of file
diff --git
a/ctakes-dockhand/src/main/resources/org/apache/ctakes/dockhand/goal/local/pom/build.xml
b/ctakes-dockhand/src/main/resources/org/apache/ctakes/dockhand/goal/local/pom/build.xml
index fe71c75..5f85035 100644
---
a/ctakes-dockhand/src/main/resources/org/apache/ctakes/dockhand/goal/local/pom/build.xml
+++
b/ctakes-dockhand/src/main/resources/org/apache/ctakes/dockhand/goal/local/pom/build.xml
@@ -44,7 +44,7 @@
<outputDirectory/>
</file>
<file>
- <source>log4j.xml</source>
+ <source>log4j2.xml</source>
<outputDirectory/>
</file>
</files>
diff --git a/ctakes-fhir/pom.xml b/ctakes-fhir/pom.xml
index ede7f4c..7c994d4 100644
--- a/ctakes-fhir/pom.xml
+++ b/ctakes-fhir/pom.xml
@@ -34,6 +34,10 @@
<groupId>org.apache.ctakes</groupId>
<artifactId>ctakes-core</artifactId>
</dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu3</artifactId>
diff --git
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryCreator.java
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryCreator.java
index 20334e8..d1416ac 100644
---
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryCreator.java
+++
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryCreator.java
@@ -2,6 +2,7 @@ package org.apache.ctakes.gui.dictionary;
import org.apache.ctakes.gui.component.DisablerPane;
+import org.apache.ctakes.gui.generic.GenericRunnerGui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +46,14 @@ final public class DictionaryCreator {
return new MainPanel();
}
+
public static void main( final String... args ) {
+ // At jdk 8 this was supposedly unnecessary. I guess that it is back ...
+ SwingUtilities.invokeLater( DictionaryCreator::run );
+ }
+
+
+ static private void run() {
try {
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
UIManager.getDefaults().put( "SplitPane.border",
BorderFactory.createEmptyBorder() );
diff --git
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryDownloader.java
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryDownloader.java
index 59877ea..df9435e 100644
---
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryDownloader.java
+++
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/dictionary/DictionaryDownloader.java
@@ -4,6 +4,7 @@ import org.apache.ctakes.core.util.external.SystemUtil;
import org.apache.ctakes.core.util.log.DotLogger;
import org.apache.ctakes.gui.component.DisablerPane;
import org.apache.ctakes.gui.component.LoggerPanel;
+import org.apache.ctakes.gui.generic.GenericRunnerGui;
import org.apache.ctakes.gui.util.IconLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,7 +47,14 @@ final public class DictionaryDownloader {
}
+
public static void main( final String... args ) {
+ // At jdk 8 this was supposedly unnecessary. I guess that it is back ...
+ SwingUtilities.invokeLater( DictionaryDownloader::run );
+ }
+
+
+ static private void run() {
try {
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
UIManager.getDefaults()
diff --git
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/generic/GenericRunnerGui.java
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/generic/GenericRunnerGui.java
index 38f8aec..b2ebfb3 100644
---
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/generic/GenericRunnerGui.java
+++
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/generic/GenericRunnerGui.java
@@ -1,6 +1,7 @@
package org.apache.ctakes.gui.generic;
import org.apache.ctakes.gui.component.DisablerPane;
+import org.apache.ctakes.gui.pipeline.PiperRunnerGui;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,7 +35,16 @@ final public class GenericRunnerGui {
}
+ static private String[] _args;
+
public static void main( final String... args ) {
+ // At jdk 8 this was supposedly unnecessary. I guess that it is back ...
+ _args = args;
+ SwingUtilities.invokeLater( GenericRunnerGui::run );
+ }
+
+
+ static private void run() {
try {
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
UIManager.getDefaults()
@@ -53,7 +63,7 @@ final public class GenericRunnerGui {
frame.setVisible( true );
DisablerPane.getInstance()
.initialize( frame );
- mainPanel.readParameterFile( args );
+ mainPanel.readParameterFile( _args );
LOGGER.info( "To start, click the Green Circular button above." );
LOGGER.info( "To stop, click the Red X button above." );
// Check for -p and -c specification of piper file and cli parameter file
diff --git
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/pipeline/PiperRunnerGui.java
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/pipeline/PiperRunnerGui.java
index 8ea68af..6f88947 100644
---
a/ctakes-gui/src/main/java/org/apache/ctakes/gui/pipeline/PiperRunnerGui.java
+++
b/ctakes-gui/src/main/java/org/apache/ctakes/gui/pipeline/PiperRunnerGui.java
@@ -42,7 +42,16 @@ final public class PiperRunnerGui {
}
+ static private String[] _args;
+
public static void main( final String... args ) {
+ // At jdk 8 this was supposedly unnecessary. I guess that it is back ...
+ _args = args;
+ SwingUtilities.invokeLater( PiperRunnerGui::run );
+ }
+
+
+ static private void run() {
try {
UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() );
UIManager.getDefaults()
@@ -70,7 +79,7 @@ final public class PiperRunnerGui {
LOGGER.info( "4. Save your Command Line Interface (cli) values to a
piper_cli parameter file." );
LOGGER.info( "5. Run the Pipeline." );
// Check for -p and -c specification of piper file and cli parameter file
- final CliOptionals options = CliFactory.parseArguments(
CliOptionals.class, args );
+ final CliOptionals options = CliFactory.parseArguments(
CliOptionals.class, _args );
final String piperPath = options.getPiperPath();
if ( piperPath != null && !piperPath.isEmpty() ) {
mainPanel.loadPiperFile( options.getPiperPath() );
diff --git a/pom.xml b/pom.xml
index da9ed14..754aa69 100644
--- a/pom.xml
+++ b/pom.xml
@@ -481,6 +481,11 @@
<version>${jakarta-activation.version}</version>
</dependency>
<!-- Jackson -->
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-core</artifactId>
+ <version>${jackson.version}</version>
+ </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>