@Plugin(name="LSST Rest Service Plugin", id="rest-service", description="Plugin that handles connection to the REST server.") public class LsstRestService extends ConsolePlugin
This class is thread-safe, public methods can be called on any thread.
Listeners are notified on EDT.
Getters might block waiting for the REST server connection to be (re)established.
Getters return null if the server is not available.
| Modifier and Type | Field and Description |
|---|---|
static String |
CONNECT_ON_STARTUP_PROPERTY |
static String |
FROM_BUS_PROPERTY |
static String |
HOST_PROPERTY |
static String |
PORT_PROPERTY |
| Constructor and Description |
|---|
LsstRestService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ChangeListener listener)
Registers a listener to be notified when the service is (re)connected to a new REST server.
|
List<org.lsst.ccs.localdb.statusdb.server.AlertEvent> |
geAlerts(long begin,
long end,
String... ids)
Retrieves and returns alerts history.If the REST service has not been started earlier, if will be initialized before the data is retrieved.
|
org.lsst.ccs.localdb.statusdb.server.AlertInfo.AlertInfoList |
getAlertList(long begin)
Retrieves and returns the list of alert channels available from the REST server.
|
org.lsst.ccs.localdb.statusdb.server.StateInfo.StateInfoList |
getStateInfo(String agent)
Retrieves and returns the list of states and their possible values for the specified subsystem.
|
org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList |
getStateList(long begin)
Retrieves and returns the list of state channels currently available from the REST server.
|
List<org.lsst.ccs.localdb.statusdb.server.StateChange> |
getStateTransitions(long begin,
long end,
String agent,
Collection<String> components,
Collection<String> states)
Retrieves and returns state transitions history.
|
org.lsst.ccs.localdb.statusdb.server.TrendingResult[] |
getTrendingData(long begin,
long end,
String flavor,
int nBins,
String... paths)
Retrieves and returns data for the specified channels and time window.
|
org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList |
getTrendingList(long begin)
Retrieves and returns the list of trending data channels currently available from the REST server.
|
void |
initialize()
Called by the framework when the console starts, to initialize this plugin..
|
void |
propertiesChanged(Object source,
Map<String,Object> changes)
Called by the framework in response to change in preferences.
|
void |
refreshConnection(boolean queue)
Requests reestablishing connection based on current preferences.
|
void |
removeAllListeners()
Removes all listeners.
|
void |
removeListener(ChangeListener listener)
Removes a listener.
|
void |
shutdown()
Called by the framework when the graphical console is shut down.
|
void |
start()
Called by the framework when the console starts, after all plugins have been initialized.
|
getConsole, getServices, restore, save, setServicesProvider, stoppublic static final String FROM_BUS_PROPERTY
public static final String HOST_PROPERTY
public static final String PORT_PROPERTY
public static final String CONNECT_ON_STARTUP_PROPERTY
public void initialize()
ConsolePlugininitialize in class ConsolePluginpublic void start()
ConsolePluginstart in class ConsolePluginpublic void shutdown()
ConsolePluginshutdown in class ConsolePluginpublic void propertiesChanged(Object source, Map<String,Object> changes)
propertiesChanged in class ConsolePluginsource - Source of notification.changes - For the changed properties, map of keys to their new values.public void refreshConnection(boolean queue)
queue - Defines what happens if connection is already being reestablished when this method is called.
If true, a flag is set to tell the connecting thread that once the current attempt is
finished, it should be repeated (regardless of the result).
If false, the call is ignored.public void addListener(ChangeListener listener)
listener - Listener to be registered.public void removeListener(ChangeListener listener)
listener - Listener to be removed.public void removeAllListeners()
public org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList getTrendingList(long begin)
begin seconds are included.
If the REST service has not been started earlier, if will be initialized before the data is retrieved.begin - Maximum time with no data, in seconds. If zero, the default set on the server side is used.null if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList getStateList(long begin)
begin seconds are included.
If the REST service has not been started earlier, if will be initialized before the data is retrieved.begin - Maximum time with no data, in seconds. If zero, the default set on the server side is used.null if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.AlertInfo.AlertInfoList getAlertList(long begin)
begin - Maximum time with no data, in seconds. CURRENTLY IGNORED..null if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.StateInfo.StateInfoList getStateInfo(String agent)
agent - Subsystem name.null if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.TrendingResult[] getTrendingData(long begin,
long end,
String flavor,
int nBins,
String... paths)
begin - Start of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.end - End of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.flavor - Data flavor, "raw" or "stat".nBins - Requested number of bins. If non-positive, the number of bins is not specified in the request.paths - Paths of the data channels.null if the REST server is not available.public List<org.lsst.ccs.localdb.statusdb.server.StateChange> getStateTransitions(long begin, long end, String agent, Collection<String> components, Collection<String> states)
begin - Start of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.end - End of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.agent - Subsystem name.components - Names of components, or null if all components should be included.states - Names of states, or null if all states should be included.public List<org.lsst.ccs.localdb.statusdb.server.AlertEvent> geAlerts(long begin, long end, String... ids)
begin - Start of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.end - End of the time window, milliseconds since January 1, 1970, 00:00:00 GMT.ids - Alert IDs (long as string).Copyright © 2024 LSST. All rights reserved.