diff --git a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUICompressionHelper.java b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUICompressionHelper.java index 431ff4aa..15f986a8 100644 --- a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUICompressionHelper.java +++ b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUICompressionHelper.java @@ -4,24 +4,36 @@ import org.apache.commons.compress.compressors.CompressorInputStream; import org.apache.commons.compress.compressors.CompressorOutputStream; import org.apache.commons.compress.compressors.CompressorStreamFactory; -import org.apache.uima.util.TypeSystemUtil; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.StringWriter; import java.nio.charset.StandardCharsets; import java.util.Base64; +/** + * Helper class for compression and decompression of strings. + */ public class DUUICompressionHelper { CompressorStreamFactory _factory; String _method; + /** + * Constructor using a {@link CompressorStreamFactory} and a compression method. + * @param method + */ public DUUICompressionHelper(String method) { _factory = new CompressorStreamFactory(); _method = method; } + /** + * Compresses a string. + * @param input The string to compress. + * @return The compressed string as a base64 encoded string. + * @throws IOException + * @throws CompressorException + */ public String compress(String input) throws IOException, CompressorException { ByteArrayOutputStream out = new ByteArrayOutputStream(); CompressorOutputStream output = _factory.createCompressorOutputStream(_method,out); @@ -30,6 +42,13 @@ public String compress(String input) throws IOException, CompressorException { return new String(Base64.getEncoder().encode(out.toByteArray()), StandardCharsets.UTF_8); } + /** + * Decompresses a string. + * @param input The compressed string as a base64 encoded string. + * @return The decompressed string. + * @throws IOException + * @throws CompressorException + */ public String decompress(String input) throws IOException, CompressorException { ByteArrayInputStream inputstream = new ByteArrayInputStream(Base64.getDecoder().decode(input.getBytes(StandardCharsets.UTF_8))); CompressorInputStream inpst = _factory.createCompressorInputStream(_method, inputstream); diff --git a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUIPipelineDescription.java b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUIPipelineDescription.java index 1c72dc1e..b1f81cc5 100644 --- a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUIPipelineDescription.java +++ b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/DUUIPipelineDescription.java @@ -10,13 +10,24 @@ import java.net.URISyntaxException; import java.util.Vector; +/** + * Description of a pipeline for the DUUI composer that holds all components. + */ public class DUUIPipelineDescription { private Vector _components; + /** + * Constructor + * @param components List of components of the pipeline. + */ public DUUIPipelineDescription(Vector components) { _components = components; } + /** + * Get the components of the pipeline. + * @return List of components. + */ public Vector getComponents() { return _components; } diff --git a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUICommunicationLayer.java b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUICommunicationLayer.java index f6f16066..51d92157 100644 --- a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUICommunicationLayer.java +++ b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUICommunicationLayer.java @@ -8,10 +8,41 @@ import java.util.List; import java.util.Map; +/** + * Interface for communication between the DUUI composer {@link DUUIComposer} and the components {@link org.texttechnologylab.DockerUnifiedUIMAInterface.driver.IDUUIDriverInterface}. + */ public interface IDUUICommunicationLayer { + /** + * Serializes a JCas to a byte array output stream by using the LUA script provided by the component. + * @param jc Input JCas. + * @param out Output stream, i.e. the input to the component. + * @param parameters Parameters for use in the LUA script. + * @throws CompressorException + * @throws IOException + * @throws SAXException + */ public void serialize(JCas jc, ByteArrayOutputStream out, Map parameters) throws CompressorException, IOException, SAXException; + + /** + * Deserializes a byte array input stream to a JCas by using the LUA script provided by the component. + * @param jc Output JCas, note that the CAS is not reset before deserialization. + * @param input Input stream, i.e. the output of the component. + * @throws IOException + * @throws SAXException + */ public void deserialize(JCas jc, ByteArrayInputStream input) throws IOException, SAXException; + + /** + * + * @return + */ public IDUUICommunicationLayer copy(); + + /** + * + * @param results + * @return + */ public ByteArrayInputStream merge(List results); String myLuaTestMerging(); diff --git a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlan.java b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlan.java index 725845c7..83685bf4 100644 --- a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlan.java +++ b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlan.java @@ -5,6 +5,9 @@ import java.util.List; import java.util.concurrent.Future; +/** + * Interface for execution plans of the DUUI composer pipleine. + */ public interface IDUUIExecutionPlan { public List getNextExecutionPlans(); diff --git a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlanGenerator.java b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlanGenerator.java index 0c2438a8..0d5d6d95 100644 --- a/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlanGenerator.java +++ b/src/main/java/org/texttechnologylab/DockerUnifiedUIMAInterface/IDUUIExecutionPlanGenerator.java @@ -2,6 +2,14 @@ import org.apache.uima.jcas.JCas; +/** + * Interface for generating execution plans {@link IDUUIExecutionPlan}. + */ public interface IDUUIExecutionPlanGenerator { + /** + * Generates an execution plan for a given JCas. + * @param jc The JCas to generate the execution plan for. + * @return The generated execution plan. + */ public IDUUIExecutionPlan generate(JCas jc); }