de.fh_mannheim.mm.dms.indexserver
Class IndexThread

java.lang.Object
  extended byjava.lang.Thread
      extended byde.fh_mannheim.mm.dms.indexserver.IndexThread
All Implemented Interfaces:
IElement, IMonitor, IViewer, java.lang.Runnable

public class IndexThread
extends java.lang.Thread
implements java.lang.Runnable, IMonitor, IElement

Index Server Engine Thread organizes the contentmanager to index files.

Version:
$Revision: 1.42 $
Author:
Jan Löffler, mail@jlsoft.de

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
IndexThread(java.lang.ThreadGroup group, java.lang.String strName, IViewer viewer, UploadManager uplMgr, ContentManager cntMgr)
          Constructor.
IndexThread(java.lang.ThreadGroup group, java.lang.String strName, UploadManager uplMgr, ContentManager cntMgr)
          Constructor.
 
Method Summary
 double getAverageCompression()
          Get the average compression of all prepared files.
 java.lang.String getAverageCompressionText()
          Get the average compression of all prepared files.
 Upload getCurrentUpload()
          Get the current upload of thread.
 java.util.ArrayList getErrorList()
          Get all error files.
 int getErrorNum()
          Get number of all error files.
 int getFileNum()
          Get number of all prepared files.
 FileSize getFileSize()
          Get size of all prepared files.
 FormattedDate getRunTime()
          Get the runtime of thread.
 FileSize getSpeedPerMinute()
          Get speed in bpm.
 boolean isSleeping()
          Is engine sleeping.
 void registerViewer(IViewer viewer)
          Register a viewer with callback.
 void run()
          Start the thread.
 boolean sendFinishedMail()
          Send an information mail.
 void stateHasChanged()
          Call all callbacks and send onChanged.
 org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
          Write information of indexthread in a xml element.
 org.w3c.dom.Element toElement(org.w3c.dom.Element element, org.w3c.dom.Document doc)
          Write information of indexthread in a xml element.
 java.lang.String toString()
          Write information of user in a string.
 void unregisterViewer(IViewer viewer)
          Unregister a viewer with callback.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexThread

public IndexThread(java.lang.ThreadGroup group,
                   java.lang.String strName,
                   UploadManager uplMgr,
                   ContentManager cntMgr)
Constructor.

Parameters:
group - Threadgroup
strName - Name of thread

IndexThread

public IndexThread(java.lang.ThreadGroup group,
                   java.lang.String strName,
                   IViewer viewer,
                   UploadManager uplMgr,
                   ContentManager cntMgr)
Constructor.

Parameters:
group - Threadgroup
strName - Name of thread
viewer - Viewer
Method Detail

getAverageCompression

public double getAverageCompression()
Get the average compression of all prepared files.

Returns:
compression

getAverageCompressionText

public java.lang.String getAverageCompressionText()
Get the average compression of all prepared files.

Returns:
compression as string

getCurrentUpload

public Upload getCurrentUpload()
Get the current upload of thread.

Returns:
current upload

getErrorList

public java.util.ArrayList getErrorList()
Get all error files.

Returns:
all files with errors

getErrorNum

public int getErrorNum()
Get number of all error files.

Returns:
number of errors

getFileNum

public int getFileNum()
Get number of all prepared files.

Returns:
number of files

getFileSize

public FileSize getFileSize()
Get size of all prepared files.

Returns:
size of files

getRunTime

public FormattedDate getRunTime()
Get the runtime of thread.

Returns:
time

getSpeedPerMinute

public FileSize getSpeedPerMinute()
Get speed in bpm.

Returns:
bytes per minute

isSleeping

public boolean isSleeping()
Is engine sleeping.

Returns:
true, if thread sleeps

registerViewer

public void registerViewer(IViewer viewer)
Register a viewer with callback.

Specified by:
registerViewer in interface IMonitor
Parameters:
viewer - Callback

run

public void run()
Start the thread.

Specified by:
run in interface java.lang.Runnable

sendFinishedMail

public boolean sendFinishedMail()
Send an information mail.

Returns:
true, if successful

stateHasChanged

public void stateHasChanged()
Call all callbacks and send onChanged.

Specified by:
stateHasChanged in interface IMonitor

unregisterViewer

public void unregisterViewer(IViewer viewer)
Unregister a viewer with callback.

Specified by:
unregisterViewer in interface IMonitor
Parameters:
viewer - Callback

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Document doc)
Write information of indexthread in a xml element.

Specified by:
toElement in interface IElement
Parameters:
doc - XML Document
Returns:
element

toElement

public org.w3c.dom.Element toElement(org.w3c.dom.Element element,
                                     org.w3c.dom.Document doc)
Write information of indexthread in a xml element.

Specified by:
toElement in interface IElement
Parameters:
element - Root element
doc - XML Document
Returns:
element

toString

public java.lang.String toString()
Write information of user in a string.

Specified by:
toString in interface IElement
Returns:
information