2.17.2: 2011-06-17

net.sf.basedb.clients.web.util
Class SimpleSignalProgressReporter

java.lang.Object
  extended by net.sf.basedb.core.SimpleProgressReporter
      extended by net.sf.basedb.clients.web.util.SimpleSignalProgressReporter
All Implemented Interfaces:
ProgressReporter, SignalReceiver

public class SimpleSignalProgressReporter
extends SimpleProgressReporter
implements SignalReceiver

This class can be used to report progress and hold signal receiver for those export plugins that download immediately. There can only be one SignalHandler registerd at a time to this class.

Version:
2.8
Author:
Martin

Field Summary
private  SignalHandler handler
           
private static Logger logger
          Log signals processing.
private  Thread notifyThread
           
 
Constructor Summary
SimpleSignalProgressReporter(ProgressReporter progress)
           
 
Method Summary
 void close(int wait)
          Close the receiver.
 Class<? extends SignalTransporter> getSignalTransporterClass()
          This class does not need any signal transporter.
 void init(String receiverId)
          Nothing need to be initilized.
 String registerSignalHandler(SignalHandler handler)
          This return null when there is no need for a global id.
 void sendToAll(Signal signal)
          Deprecated. 
 void sendToAll(SignalSender sender)
          Let the signal sender send one or more signals to all registered signal handlers on this reciever.
 void unregisterSignalHandler(SignalHandler handler)
          Unregister a signal handler from this receiever.
 
Methods inherited from class net.sf.basedb.core.SimpleProgressReporter
append, display, getMessage, getPercent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final Logger logger
Log signals processing.


handler

private SignalHandler handler

notifyThread

private Thread notifyThread
Constructor Detail

SimpleSignalProgressReporter

public SimpleSignalProgressReporter(ProgressReporter progress)
Method Detail

close

public void close(int wait)
Description copied from interface: SignalReceiver
Close the receiver. The receiver should close and cleanup any opened resources, unregister itself if neccesary and stop listening for signals.

Specified by:
close in interface SignalReceiver
Parameters:
wait - If the value is zero or positive, the Signal.ABORT should be sent to all registered signal handlers. The signal receiver should then wait at most the specified number of milliseconds for all signal handlers to get unregistered. If the timeout expires before all signal handlers has processed the signal, the signal receiver should continue it's shutdown.

getSignalTransporterClass

public Class<? extends SignalTransporter> getSignalTransporterClass()
This class does not need any signal transporter.

Specified by:
getSignalTransporterClass in interface SignalReceiver
Returns:
A class objects that must be a subclass of SignalTransporter
See Also:
SignalReceiver.getSignalTransporterClass()

init

public void init(String receiverId)
Nothing need to be initilized.

Specified by:
init in interface SignalReceiver
Parameters:
receiverId - Parameters needed to initialise the receiver
See Also:
SignalReceiver.init(java.lang.String)

registerSignalHandler

public String registerSignalHandler(SignalHandler handler)
This return null when there is no need for a global id.

Specified by:
registerSignalHandler in interface SignalReceiver
Parameters:
handler - The signal handler that should receive signals through this receiver
Returns:
A string that allows a transporter instance locate and send a signal to the given signal handler
See Also:
SignalReceiver.registerSignalHandler(net.sf.basedb.core.signal.SignalHandler)

sendToAll

@Deprecated
public void sendToAll(Signal signal)
Deprecated. 

Description copied from interface: SignalReceiver
Send a signal to all registered signal handlers that supports it. The main purpose of this method is to be able to send the Signal.ABORT when the system is shutting down.

Specified by:
sendToAll in interface SignalReceiver
Parameters:
signal - The signal to send

sendToAll

public void sendToAll(SignalSender sender)
Description copied from interface: SignalReceiver
Let the signal sender send one or more signals to all registered signal handlers on this reciever.

Specified by:
sendToAll in interface SignalReceiver
Parameters:
sender - A signal sender implementation

unregisterSignalHandler

public void unregisterSignalHandler(SignalHandler handler)
Description copied from interface: SignalReceiver
Unregister a signal handler from this receiever. After this method returns, the receiver must not send any more signals to the specified handler.

Specified by:
unregisterSignalHandler in interface SignalReceiver
Parameters:
handler - The handler to unregister

2.17.2: 2011-06-17