Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

recoin.container
Class RetrievalContainer  view RetrievalContainer download RetrievalContainer.java

java.lang.Object
  extended byrecoin.group.ComponentSupportImpl
      extended byrecoin.container.RetrievalContainer
All Implemented Interfaces:
recoin.group.ComponentSupport, java.io.Serializable

public class RetrievalContainer
extends recoin.group.ComponentSupportImpl

A RetrievalContainer is a very simple container object that can be used in a RetrievalCycle to store data that is used during retrieval. This data could be anything from input to the retrieval process like a query, output that has been created, result lists for example, or any other data that aids in the retrieval process.

The RetrievalContainer is passed along different ModuleGroup objects and it lets the Component objects of a particular group access, process and store information inside the container. A RetrievalContainer object can switch between two different states to signal if there still are threads operating on its data. The RetrievalContainer class provides functions to block and wake up threads when this state changes.
This is important, because the RetrievalCycle waits for this signal in the wait set of this RetrievalContainer while it is being processed by a certain ModuleGroup.

It extends the simple class ComponentSupportImpl in order for a RetrievalContainer object to be passed to Component objects.

Version:
0.2.9

Field Summary
private  recoin.system.session.ComponentChain componentChain
          A ComponentChain object that can be used to distribute the container to a predefined number Component objects.
protected  java.util.Vector componentSupport
          The ComponentSupport objects used in the retrieval process.
protected  java.util.Vector exceptions
          A special Vector that stores exceptions there was a problem inside a Component that processed this RetrievalContainer.
private  boolean finished
          The flag to signal the end of processing this RetrievalContainer.
(package private) static org.apache.log4j.Logger logger
          The logger for this class
protected  java.util.Vector runnables
          The ComponentRunnable objects that process this RetrievalContainer.
protected  java.lang.ThreadGroup threadGroup
          The ThreadGroup to group the threads working on this RetrievalContainer.
 recoin.util.TimeLog timeLog
          The timelog to protocol the time needed for the RetrievalCycle and by individual components.
 
Fields inherited from class recoin.group.ComponentSupportImpl
chainID, classname, description, id, name
 
Constructor Summary
RetrievalContainer()
          Creates a new RetrievalContainer.
The TimeLog of the RetrievalContainer is initiated with a new DurationStamp.
 
Method Summary
 void addComponentSupport(recoin.group.ComponentSupport support)
          Adds the specified ComponentSupport to this RetrievalContainer.
 void addComponentSupports(java.util.Vector supports)
          Adds the specified Vector of ComponentSupport objects to this RetrievalContainer.
 void addException(recoin.exception.ComponentException e)
          Adds the specified ComponentException to this RetrievalContainer.
 void addException(recoin.exception.ComponentRunnableException e)
          Adds the specified ComponentRunnableException to this RetrievalContainer.
 void addRunnable(recoin.group.ComponentRunnable runnable)
          Adds the specified ComponentRunnable to this RetrievalContainer.
 void addRunnables(java.util.Vector runnableVector)
          Adds the ComponentRunnable objects inside the specified Vector to this RetrievalContainer.
 void checkFinished()
          This method checks if there are any more active threads working on this RetrievalContainer.
 recoin.system.session.ComponentChain getComponentChain()
          Returns the ComponentChain of this RetrievalContainer.
 java.util.Vector getComponentSupport()
          Returns all ComponentSupport objects currently contained in this RetrievalContainer.
 recoin.group.ComponentSupport getComponentSupport(java.lang.String chainID)
          Returns the ComponentSupport that has the specified chain ID.
 java.util.Vector getExceptions()
          Returns the exceptions that are currently contained in this RetrievalContainer.
 java.util.Vector getResultLists()
          Returns all ComponentSupport objects in this RetrievalContainer that are instances of the ResultList class.
 recoin.util.TimeLog getTimeLog()
          Returns the TimeLog of the RetrievalContainer.
 void setComponentChain(recoin.system.session.ComponentChain chain)
          Sets the ComponentChain of this RetrievalContainer.
 void setFinished(boolean fin)
          Sets the field finished to the specified value.
 void startRunnables()
          Starts all ComponentRunnables currently contained in this RetrievalContainer.
 void waitForFinished()
          Adds the calling thread to the wait set of this RetrievalContainer object.
 
Methods inherited from class recoin.group.ComponentSupportImpl
getChainID, getClassname, getDescription, getID, getName, setChainID, setClassname, setDescription, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.log4j.Logger logger
The logger for this class


finished

private boolean finished
The flag to signal the end of processing this RetrievalContainer. Inital value is 'true'.


componentChain

private recoin.system.session.ComponentChain componentChain
A ComponentChain object that can be used to distribute the container to a predefined number Component objects.


threadGroup

protected java.lang.ThreadGroup threadGroup
The ThreadGroup to group the threads working on this RetrievalContainer.


runnables

protected java.util.Vector runnables
The ComponentRunnable objects that process this RetrievalContainer.


componentSupport

protected java.util.Vector componentSupport
The ComponentSupport objects used in the retrieval process.


exceptions

protected java.util.Vector exceptions
A special Vector that stores exceptions there was a problem inside a Component that processed this RetrievalContainer.


timeLog

public recoin.util.TimeLog timeLog
The timelog to protocol the time needed for the RetrievalCycle and by individual components.

Constructor Detail

RetrievalContainer

public RetrievalContainer()
Creates a new RetrievalContainer.
The TimeLog of the RetrievalContainer is initiated with a new DurationStamp.

Method Detail

setFinished

public void setFinished(boolean fin)
Sets the field finished to the specified value. If 'true' it wakes up a single thread waiting in the wait set of this RetrievalContainer. Normaly this should only be a RetrievalCycle object, because the method cannot garantue to wake up a specific thread waiting for a notify() from this RetrievalContainer.


waitForFinished

public void waitForFinished()
                     throws java.lang.InterruptedException
Adds the calling thread to the wait set of this RetrievalContainer object. The method uses a guarded wait by re-checking the value of the finished field to avoid spurious or accidental wake ups.


getTimeLog

public recoin.util.TimeLog getTimeLog()
Returns the TimeLog of the RetrievalContainer.


startRunnables

public void startRunnables()
Starts all ComponentRunnables currently contained in this RetrievalContainer.


addRunnable

public void addRunnable(recoin.group.ComponentRunnable runnable)
Adds the specified ComponentRunnable to this RetrievalContainer.


addRunnables

public void addRunnables(java.util.Vector runnableVector)
Adds the ComponentRunnable objects inside the specified Vector to this RetrievalContainer.


addComponentSupport

public void addComponentSupport(recoin.group.ComponentSupport support)
Adds the specified ComponentSupport to this RetrievalContainer.


addComponentSupports

public void addComponentSupports(java.util.Vector supports)
Adds the specified Vector of ComponentSupport objects to this RetrievalContainer.


addException

public void addException(recoin.exception.ComponentException e)
Adds the specified ComponentException to this RetrievalContainer.


addException

public void addException(recoin.exception.ComponentRunnableException e)
Adds the specified ComponentRunnableException to this RetrievalContainer.


getComponentChain

public recoin.system.session.ComponentChain getComponentChain()
Returns the ComponentChain of this RetrievalContainer.


setComponentChain

public void setComponentChain(recoin.system.session.ComponentChain chain)
Sets the ComponentChain of this RetrievalContainer.


getComponentSupport

public java.util.Vector getComponentSupport()
Returns all ComponentSupport objects currently contained in this RetrievalContainer.


getResultLists

public java.util.Vector getResultLists()
Returns all ComponentSupport objects in this RetrievalContainer that are instances of the ResultList class.


getExceptions

public java.util.Vector getExceptions()
Returns the exceptions that are currently contained in this RetrievalContainer.


getComponentSupport

public recoin.group.ComponentSupport getComponentSupport(java.lang.String chainID)
Returns the ComponentSupport that has the specified chain ID. NULL if the specified ComponentSupport could not be found.


checkFinished

public void checkFinished()
This method checks if there are any more active threads working on this RetrievalContainer. If there are none or they have all finished processing, setFinished(true) is called and the Vector runnables is emptied to dispose of the no longer needed ComponentRunnable objects.