2.17.2: 2011-06-17

net.sf.basedb.core.signal
Class Signal

java.lang.Object
  extended by net.sf.basedb.core.signal.Signal

public class Signal
extends Object

Represents a signal that can be sent to a class implementing the SignalTarget interface. Signals must be registered before they can be used. Use getSignals() to get a list of signals that have been registered. A signal can only be registered once.

Version:
2.6
Author:
nicklas
Last modified
$Date: 2010-09-02 14:09:15 +0200 (Thu, 02 Sep 2010) $

Field Summary
static Signal ABORT
          The ABORT signal, that requests that the receiver should clean up and die.
private  String description
           
private  String id
           
private  String name
           
static Signal SHUTDOWN
          The SHUTDOWN signal, that requests that the receiver should clean up and die.
private static Map<String,Signal> signals
          Holds all registered signals.
 
Constructor Summary
private Signal(String id, String name, String description)
           
 
Method Summary
 boolean equals(Object other)
          Two signals are equal if they have the same ID.
 String getDescription()
          Get the description of the what the signal means and how receivers should behave when the signal is sent to them
 String getId()
          Get the signal ID.
 String getName()
          Get the short name of the signal.
static Signal getSignal(String id)
          Get the signal with a given ID.
static Collection<Signal> getSignals()
          Get all registered signals.
 int hashCode()
          The hashcode for a signal is the same as the hashcode for the ID.
static Signal registerSignal(String id, String name, String description)
          Register a signal.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ABORT

public static final Signal ABORT
The ABORT signal, that requests that the receiver should clean up and die. This signal is typically sent to a plug-in when the user manually requests that a job is aborted. It is also sent when the system is shutting down to plug-ins that doesn't support the SHUTDOWN signal.


SHUTDOWN

public static final Signal SHUTDOWN
The SHUTDOWN signal, that requests that the receiver should clean up and die. When the system is up again the receiver may continue were it was stopped if supported. Otherwise, this signal should be treated as ABORT.

Since:
2.16

signals

private static Map<String,Signal> signals
Holds all registered signals.


id

private final String id

name

private final String name

description

private final String description
Constructor Detail

Signal

private Signal(String id,
               String name,
               String description)
Method Detail

registerSignal

public static Signal registerSignal(String id,
                                    String name,
                                    String description)
Register a signal.

Parameters:
id - The ID of the signal. This must be unique. If another signal with the same ID already exists, this method does nothing.
name - The short name of the signal
description - A description of the what the signal means and how receivers should behave when the signal is sent to them
Returns:
The Signal object

getSignal

public static Signal getSignal(String id)
Get the signal with a given ID.

Parameters:
id - The signal ID.
Returns:
The Signal object, or null if no signal with the given ID has been registered
See Also:
getSignals()

getSignals

public static Collection<Signal> getSignals()
Get all registered signals. The returned collection can't be modified.

Returns:
A Collection with all registered signals
See Also:
getSignal(String)

toString

public String toString()
Overrides:
toString in class Object
Returns:
The name of the signal.

equals

public boolean equals(Object other)
Two signals are equal if they have the same ID.

Overrides:
equals in class Object

hashCode

public int hashCode()
The hashcode for a signal is the same as the hashcode for the ID.

Overrides:
hashCode in class Object

getId

public String getId()
Get the signal ID. The ID must be unique among all registered signals.


getName

public String getName()
Get the short name of the signal.


getDescription

public String getDescription()
Get the description of the what the signal means and how receivers should behave when the signal is sent to them


2.17.2: 2011-06-17