Class MemoryTransportSender
- java.lang.Object
-
- org.apache.uima.analysis_component.AnalysisComponent_ImplBase
-
- org.apache.uima.analysis_component.Annotator_ImplBase
-
- org.apache.uima.analysis_component.JCasAnnotator_ImplBase
-
- org.apache.uima.fit.component.JCasAnnotator_ImplBase
-
- uk.gov.dstl.baleen.uima.BaleenAnnotator
-
- uk.gov.dstl.baleen.uima.BaleenConsumer
-
- uk.gov.dstl.baleen.transports.components.AbstractTransportConsumer
-
- uk.gov.dstl.baleen.transports.memory.MemoryTransportSender
-
- All Implemented Interfaces:
org.apache.uima.analysis_component.AnalysisComponent
public class MemoryTransportSender extends AbstractTransportConsumer
This class provides an in memory implementation of anAbstractTransportConsumer
.This implementation can only be used for transport within a single Baleen instance and for testing and development.
- Configuration Parameters:
Parameter Description Default Value(s) topic The topic for transport use {@link AbstractTransportCollectionReader#PARAM_TOPIC_DEFAULT}
-
-
Field Summary
-
Fields inherited from class uk.gov.dstl.baleen.transports.components.AbstractTransportConsumer
PARAM_BLACKLIST, PARAM_TOPIC, PARAM_WHITELIST, QUEUE_CAPACITY, topic
-
-
Constructor Summary
Constructors Constructor Description MemoryTransportSender()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
closeQueue()
Close the queue and release and resourcesprotected void
createQueue()
Create the Queue for the transport of the dataprotected int
getDefaultCapacity()
protected int
getQueueLength()
Get the current length of the queue.protected void
writeToQueue(java.lang.String id, java.lang.String jCas)
Write the given data to the queue-
Methods inherited from class uk.gov.dstl.baleen.transports.components.AbstractTransportConsumer
doDestroy, doInitialize, doProcess
-
Methods inherited from class uk.gov.dstl.baleen.uima.BaleenAnnotator
addToJCasIndex, addToJCasIndex, createMonitor, createSupport, destroy, getDocumentAnnotation, getMonitor, getSupport, initialize, mergeWithExisting, mergeWithExisting, mergeWithNew, mergeWithNew, process, removeFromJCasIndex, removeFromJCasIndex
-
Methods inherited from class org.apache.uima.analysis_component.JCasAnnotator_ImplBase
getRequiredCasInterface, process
-
Methods inherited from class org.apache.uima.analysis_component.Annotator_ImplBase
getCasInstancesRequired, hasNext, next
-
-
-
-
Method Detail
-
createQueue
protected void createQueue() throws uk.gov.dstl.baleen.exceptions.BaleenException
Description copied from class:AbstractTransportConsumer
Create the Queue for the transport of the data- Specified by:
createQueue
in classAbstractTransportConsumer
- Throws:
uk.gov.dstl.baleen.exceptions.BaleenException
- if the queue can not be created correctly
-
closeQueue
protected void closeQueue() throws java.io.IOException
Description copied from class:AbstractTransportConsumer
Close the queue and release and resources- Specified by:
closeQueue
in classAbstractTransportConsumer
- Throws:
java.io.IOException
- if the queue can not be closed correctly
-
writeToQueue
protected void writeToQueue(java.lang.String id, java.lang.String jCas) throws java.io.IOException
Description copied from class:AbstractTransportConsumer
Write the given data to the queue- Specified by:
writeToQueue
in classAbstractTransportConsumer
- Parameters:
id
- the idjCas
- to write- Throws:
java.io.IOException
- if writing fails
-
getDefaultCapacity
protected int getDefaultCapacity()
- Overrides:
getDefaultCapacity
in classAbstractTransportConsumer
- Returns:
- the default capacity for the queue
-
getQueueLength
protected int getQueueLength()
Description copied from class:AbstractTransportConsumer
Get the current length of the queue. This is used, with the capacity to determine if we should backoff writing to the queue.- Specified by:
getQueueLength
in classAbstractTransportConsumer
- Returns:
- the current length of the queue or 0 if this can not be determined.
-
-