Package org.corpus_tools.pepper.impl
Class PepperMapperControllerImpl
- java.lang.Object
-
- java.lang.Thread
-
- org.corpus_tools.pepper.impl.PepperMapperControllerImpl
-
- All Implemented Interfaces:
Runnable,PepperMapperController
public class PepperMapperControllerImpl extends Thread implements PepperMapperController
The classPepperMapperControllerImplis a communicator class between aPepperModuleand aPepperMapperobject. The aim of this class is to provide some fields, which can be set by thePepperMapperand be read by thePepperModuleobject. ThePepperModuleobject should not contain any static or object references to thePepperMapperobject. This mechanism is used, to make sure that in case of a forgotten clean up, thePepperMapperobject can be removed by the java garbage collector and does not overfill the main memory.- Author:
- Florian Zipser
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description org.slf4j.Loggerloggerprotected PepperModulepepperModulePepperModulecontaining this objectprotected DoubleprogresswhengetPepperMapper()is set to null, inmap(), the progress value has to be stored here.-
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
-
Constructor Summary
Constructors Constructor Description PepperMapperControllerImpl(ThreadGroup threadGroup, String threadName)Initializes this object and sets itsThreadGroupand the name of the thread.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.corpus_tools.salt.graph.IdentifiergetIdentifier(){@inheritDoc PepperMapperController#getIdentifier()}DOCUMENT_STATUSgetMappingResult(){@inheritDoc PepperMapperController#getMappingResult()}List<MappingSubject>getMappingSubjects()Returns a list of all subjects (SDocumentorSCorpus) to be mergedPepperMappergetPepperMapper()Returns thePepperMapper, controlled by this object.PepperModulegetPepperModule()ReturnsPepperModuleobject containing this objectbooleangetPermissionForProcessDoument(DocumentController controller){@inheritDoc PepperJobImpl#getPermissionForProcessDoument(DocumentController)}DoublegetProgress(){@inheritDoc PepperMapperController#getProgress()}voidmap(){@inheritDoc PepperMapper#map()}voidrun()This method starts thePepperMapperobject in a thread.voidsetIdentifier(org.corpus_tools.salt.graph.Identifier sElementId){@inheritDoc PepperMapperController#setIdentifier(Identifier)}voidsetPepperMapper(PepperMapper pepperMapper)Sets the mapper, controlled by this object.voidsetPepperModule(PepperModule pepperModule){@inheritDoc PepperMapperController#setPepperModule(PepperModule)}-
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.corpus_tools.pepper.modules.PepperMapperController
join, setUncaughtExceptionHandler, start
-
-
-
-
Field Detail
-
logger
public org.slf4j.Logger logger
-
progress
protected volatile Double progress
whengetPepperMapper()is set to null, inmap(), the progress value has to be stored here.
-
pepperModule
protected PepperModule pepperModule
PepperModulecontaining this object
-
-
Constructor Detail
-
PepperMapperControllerImpl
public PepperMapperControllerImpl(ThreadGroup threadGroup, String threadName)
Initializes this object and sets itsThreadGroupand the name of the thread.- Parameters:
threadGroup-threadName-
-
-
Method Detail
-
setPepperMapper
public void setPepperMapper(PepperMapper pepperMapper)
Sets the mapper, controlled by this object.- Specified by:
setPepperMapperin interfacePepperMapperController- Parameters:
pepperMapper-
-
getPepperMapper
public PepperMapper getPepperMapper()
Returns thePepperMapper, controlled by this object.- Specified by:
getPepperMapperin interfacePepperMapperController- Returns:
-
getMappingSubjects
public List<MappingSubject> getMappingSubjects()
Returns a list of all subjects (SDocumentorSCorpus) to be merged- Specified by:
getMappingSubjectsin interfacePepperMapperController- Returns:
- a list of
MappingSubject
-
getMappingResult
public DOCUMENT_STATUS getMappingResult()
{@inheritDoc PepperMapperController#getMappingResult()}- Specified by:
getMappingResultin interfacePepperMapperController- Returns:
- mapping result
-
getIdentifier
public org.corpus_tools.salt.graph.Identifier getIdentifier()
{@inheritDoc PepperMapperController#getIdentifier()}- Specified by:
getIdentifierin interfacePepperMapperController- Returns:
-
setIdentifier
public void setIdentifier(org.corpus_tools.salt.graph.Identifier sElementId)
{@inheritDoc PepperMapperController#setIdentifier(Identifier)}- Specified by:
setIdentifierin interfacePepperMapperController
-
getProgress
public Double getProgress()
{@inheritDoc PepperMapperController#getProgress()}- Specified by:
getProgressin interfacePepperMapperController
-
run
public void run()
This method starts thePepperMapperobject in a thread. If#getCorpus()is not null,#mapSCorpus()is called, if#getDocument()is not null,#mapSDocument()is called.
If an exception occurs in this method, it will be caught byPepperModuleImpl.uncaughtException(Thread, Throwable).
-
map
public void map()
{@inheritDoc PepperMapper#map()}- Specified by:
mapin interfacePepperMapperController
-
setPepperModule
public void setPepperModule(PepperModule pepperModule)
{@inheritDoc PepperMapperController#setPepperModule(PepperModule)}- Specified by:
setPepperModulein interfacePepperMapperController- Parameters:
pepperModule- containingPepperModuleobject
-
getPepperModule
public PepperModule getPepperModule()
ReturnsPepperModuleobject containing this object- Returns:
-
getPermissionForProcessDoument
public boolean getPermissionForProcessDoument(DocumentController controller)
{@inheritDoc PepperJobImpl#getPermissionForProcessDoument(DocumentController)}- Specified by:
getPermissionForProcessDoumentin interfacePepperMapperController
-
-