org.pf.tools.cda.core.processing
Class WaitingIElementsProcessingResultHandler

java.lang.Object
  extended by org.pf.tools.cda.core.processing.WaitingIElementsProcessingResultHandler
All Implemented Interfaces:
IElementsProcessingResultHandler

public class WaitingIElementsProcessingResultHandler
extends java.lang.Object
implements IElementsProcessingResultHandler

An instance of this class is capable of launching an asynchronous task and waiting until it receives the result.

Version:
1.0
Author:
M.Duchrow

Constructor Summary
WaitingIElementsProcessingResultHandler()
          Initialize the new instance with default timeout of 10 seconds.
WaitingIElementsProcessingResultHandler(long timeoutInMs)
          Initialize the new instance with a timeout.
 
Method Summary
 ClassInformation[] findDependantsOfClass(ClassInformation classInformation, java.lang.String taskId, IProgressMonitor monitor, boolean findAll)
          Starts a separate thread that collects dependants of the given class.
 GenericClassContainer[] findDependantsOfContainer(GenericClassContainer container, java.lang.String taskId, IProgressMonitor monitor, boolean findAll)
          Starts a separate thread that collects dependants of the given container.
 ClassPackage[] findDependantsOfPackage(ClassPackage aPackage, java.lang.String taskId, IProgressMonitor monitor, boolean findAll)
          Starts a separate thread that collects dependants of the given package.
 ClassInformation[] findImplementorsOfInterface(ClassInformation interfaceClass, java.lang.String taskId, IProgressMonitor monitor, boolean directOnly)
          Starts a separate thread that collects implementors of the given interface.
 void handleElementsProcessingCancellation(java.lang.String type, IAnalyzableElement startElement)
          This method will be called by ClassesProcessingTask if the search was cancelled during its processing.
 void handleElementsProcessingResult(java.lang.String type, IAnalyzableElement startElement, ProcessingResult result)
          This method will be called by ClassesProcessingTask after successfully completed the processing.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WaitingIElementsProcessingResultHandler

public WaitingIElementsProcessingResultHandler()
Initialize the new instance with default timeout of 10 seconds.


WaitingIElementsProcessingResultHandler

public WaitingIElementsProcessingResultHandler(long timeoutInMs)
Initialize the new instance with a timeout.

Method Detail

handleElementsProcessingCancellation

public void handleElementsProcessingCancellation(java.lang.String type,
                                                 IAnalyzableElement startElement)
Description copied from interface: IElementsProcessingResultHandler
This method will be called by ClassesProcessingTask if the search was cancelled during its processing. It allows the implementor to restore a proper state if necessary.

Specified by:
handleElementsProcessingCancellation in interface IElementsProcessingResultHandler
Parameters:
type - Specifies the type of processing
startElement - The element on which the processing was started

handleElementsProcessingResult

public void handleElementsProcessingResult(java.lang.String type,
                                           IAnalyzableElement startElement,
                                           ProcessingResult result)
Description copied from interface: IElementsProcessingResultHandler
This method will be called by ClassesProcessingTask after successfully completed the processing.

Specified by:
handleElementsProcessingResult in interface IElementsProcessingResultHandler
Parameters:
type - Specifies the type of processing
startElement - The element on which the processing was started (must not be null).
result - The collection containing all found elements (must not be null).

findDependantsOfContainer

public GenericClassContainer[] findDependantsOfContainer(GenericClassContainer container,
                                                         java.lang.String taskId,
                                                         IProgressMonitor monitor,
                                                         boolean findAll)
Starts a separate thread that collects dependants of the given container. The result (found containers) will be sent back to this object and then provided as the result of this method. That is, the method waits until the result is available or the timeout is reached.

Parameters:
container - The container for which to collect the dependant containers.
taskId - A unique identifier that allows the result handler to associate the result to the initiator.
monitor - An optional monitor that will be called during processing to allow display current progress (may be null).
findAll - Specifies whether all dependants (recursively) or only direct dependants should be collected.
Returns:
An array of found containers (The result might be an empty array, but never null).

findDependantsOfPackage

public ClassPackage[] findDependantsOfPackage(ClassPackage aPackage,
                                              java.lang.String taskId,
                                              IProgressMonitor monitor,
                                              boolean findAll)
Starts a separate thread that collects dependants of the given package. The result (found packages) will be sent back to this object and then provided as the result of this method. That is, the method waits until the result is available or the timeout is reached.

Parameters:
aPackage - The package for which to collect the dependant packages.
taskId - A unique identifier that allows the result handler to associate the result to the initiator.
monitor - An optional monitor that will be called during processing to allow display current progress (may be null).
findAll - Specifies whether all dependants (recursively) or only direct dependants should be collected.
Returns:
An array of found packages (The result might be an empty array, but never null).

findDependantsOfClass

public ClassInformation[] findDependantsOfClass(ClassInformation classInformation,
                                                java.lang.String taskId,
                                                IProgressMonitor monitor,
                                                boolean findAll)
Starts a separate thread that collects dependants of the given class. The result (found classes) will be sent back to this object and then provided as the result of this method. That is, the method waits until the result is available or the timeout is reached.

Parameters:
classInformation - The class for which to collect the dependant classes.
taskId - A unique identifier that allows the result handler to associate the result to the initiator.
monitor - An optional monitor that will be called during processing to allow display current progress (may be null).
findAll - Specifies whether all dependants (recursively) or only direct dependants should be collected.
Returns:
An array of found classes (The result might be an empty array, but never null).

findImplementorsOfInterface

public ClassInformation[] findImplementorsOfInterface(ClassInformation interfaceClass,
                                                      java.lang.String taskId,
                                                      IProgressMonitor monitor,
                                                      boolean directOnly)
Starts a separate thread that collects implementors of the given interface. The result (found classes) will be sent to the given resultHandler.

Parameters:
interfaceClass - The interface for which to lookup the implementors.
taskId - A unique identifier that allows the result handler to associate the result to the initiator.
monitor - An optional monitor that will be called during processing to allow display current progress (may be null).
directOnly - Specifies whether only direct implementors all implementors (including all subclasses of direct implementors) should be collected.