diff --git a/src/main/java/icapa/cc/AbstractJdbcWriter.java b/src/main/java/icapa/cc/AbstractJdbcWriter.java index 8916925..00d0542 100644 --- a/src/main/java/icapa/cc/AbstractJdbcWriter.java +++ b/src/main/java/icapa/cc/AbstractJdbcWriter.java @@ -6,7 +6,6 @@ import org.apache.log4j.Logger; import org.apache.uima.UimaContext; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.component.JCasAnnotator_ImplBase; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; diff --git a/src/main/java/icapa/cc/JdbcWriter.java b/src/main/java/icapa/cc/JdbcWriter.java deleted file mode 100644 index cb8c9bb..0000000 --- a/src/main/java/icapa/cc/JdbcWriter.java +++ /dev/null @@ -1,29 +0,0 @@ -package icapa.cc; - -import icapa.Const; -import icapa.services.AnalysisEngine; -import org.apache.log4j.Logger; -import org.apache.uima.analysis_engine.AnalysisEngineProcessException; -import org.apache.uima.fit.component.JCasAnnotator_ImplBase; -import org.apache.uima.fit.descriptor.ConfigurationParameter; -import org.apache.uima.jcas.JCas; - -// TODO -public class JdbcWriter extends AbstractJdbcWriter { - private static final Logger LOGGER = Logger.getLogger(JdbcWriter.class.getName()); - - public static final String PARAM_NAMESPACE = "Namespace"; - @ConfigurationParameter( - name = PARAM_NAMESPACE, - mandatory = false, - defaultValue = "" - ) - private String _namespace; - - private AnalysisEngine _writer; - - @Override - public void process(JCas jCas) throws AnalysisEngineProcessException { - - } -} diff --git a/src/main/java/icapa/cc/LocalFileOntologyWriter.java b/src/main/java/icapa/cc/LocalFileOntologyWriter.java index b7332a3..03ae584 100644 --- a/src/main/java/icapa/cc/LocalFileOntologyWriter.java +++ b/src/main/java/icapa/cc/LocalFileOntologyWriter.java @@ -1,7 +1,9 @@ package icapa.cc; -import icapa.cc.AbstractFileOntologyWriter; -import icapa.services.*; +import icapa.services.AnalysisEngine; +import icapa.services.FileOntologyConsumer; +import icapa.services.OntologyConsumer; +import icapa.services.OntologyWriterService; import org.apache.uima.UimaContext; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.fit.descriptor.ConfigurationParameter; diff --git a/src/main/java/icapa/cc/S3FileOntologyWriter.java b/src/main/java/icapa/cc/S3FileOntologyWriter.java index 024d5cc..8ac9e83 100644 --- a/src/main/java/icapa/cc/S3FileOntologyWriter.java +++ b/src/main/java/icapa/cc/S3FileOntologyWriter.java @@ -1,14 +1,16 @@ package icapa.cc; -import icapa.cc.AbstractFileOntologyWriter; -import icapa.services.*; +import icapa.services.AnalysisEngine; +import icapa.services.OntologyConsumer; +import icapa.services.OntologyWriterService; +import icapa.services.S3OntologyConsumer; import org.apache.uima.UimaContext; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; -import java.io.*; +import java.io.IOException; public class S3FileOntologyWriter extends AbstractFileOntologyWriter { static public final String PARAM_BUCKET = "Bucket"; diff --git a/src/main/java/icapa/cc/XmiLineWriter.java b/src/main/java/icapa/cc/XmiLineWriter.java index 172b1e1..8423335 100644 --- a/src/main/java/icapa/cc/XmiLineWriter.java +++ b/src/main/java/icapa/cc/XmiLineWriter.java @@ -6,14 +6,18 @@ import org.apache.uima.UimaContext; import org.apache.uima.analysis_engine.AnalysisEngineProcessException; import org.apache.uima.cas.CAS; -import org.apache.uima.fit.component.JCasAnnotator_ImplBase; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; import org.xml.sax.SAXException; -import java.io.*; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +/** + * For each document, write the XMI as a single line to the OutputFile + * */ public class XmiLineWriter extends BaseWriter { static private final Logger LOGGER = Logger.getLogger(XmiLineWriter.class.getName()); @@ -36,17 +40,15 @@ public void initialize(UimaContext context) throws ResourceInitializationExcepti FileWriter fileWriter = new FileWriter(file); writer = new CSVWriter(fileWriter); } catch (IOException e) { - e.printStackTrace(); + LOGGER.error("Error opening file " + _outputFile, e); } } public void process(JCas jCas) throws AnalysisEngineProcessException { try { writeXmi(jCas.getCas()); - } catch (IOException e) { - e.printStackTrace(); - } catch (SAXException e) { - e.printStackTrace(); + } catch (IOException | SAXException e) { + LOGGER.error("Error writing xmi", e); } } @@ -70,7 +72,7 @@ public void destroy() { // Closing will cause the writer to actually do the writing. writer.close(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.error("Error closing xmi writer", e); } } } diff --git a/src/main/java/icapa/cr/DelimiterReader.java b/src/main/java/icapa/cr/DelimiterReader.java index ff5915d..45d9b52 100644 --- a/src/main/java/icapa/cr/DelimiterReader.java +++ b/src/main/java/icapa/cr/DelimiterReader.java @@ -5,7 +5,6 @@ import icapa.services.DelimiterReaderService; import org.apache.log4j.Logger; import org.apache.uima.UimaContext; -import org.apache.uima.collection.CollectionException; import org.apache.uima.fit.descriptor.ConfigurationParameter; import org.apache.uima.jcas.JCas; import org.apache.uima.resource.ResourceInitializationException; @@ -13,7 +12,6 @@ import java.io.FileNotFoundException; import java.io.FileReader; -import java.io.IOException; public class DelimiterReader extends AbstractDelimiterReader { static private final Logger LOGGER = Logger.getLogger(DelimiterReader.class.getName()); diff --git a/src/main/java/icapa/cr/S3DelimiterReader.java b/src/main/java/icapa/cr/S3DelimiterReader.java index 6c63acb..3944e4c 100644 --- a/src/main/java/icapa/cr/S3DelimiterReader.java +++ b/src/main/java/icapa/cr/S3DelimiterReader.java @@ -1,10 +1,6 @@ package icapa.cr; -import com.amazonaws.auth.AWSStaticCredentialsProvider; -import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.client.builder.AwsClientBuilder; import com.amazonaws.services.s3.AmazonS3; -import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.S3Object; import icapa.Util; import icapa.services.CollectionReader;