@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.
|
org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList |
getChannelList()
Retrieves and returns the list of channels currently available from the REST server.
|
org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList |
getChannelList(long begin)
Retrieves and returns the list of channels currently available from the REST server.
|
org.lsst.ccs.localdb.statusdb.server.TrendingResult |
getData(long begin,
long end,
String flavor,
int nBins,
Integer... ids)
Retrieves and returns the data for the specified channel and time window.
|
org.lsst.ccs.localdb.statusdb.server.TrendingResult[] |
getData(long begin,
long end,
String flavor,
int nBins,
String... paths)
Retrieves and returns the data for the specified channels and time window.
|
org.lsst.ccs.localdb.statusdb.server.Datas |
getData(long begin,
long end,
String flavor,
int nBins,
String path)
Retrieves and returns the data for the specified channel and time window.
|
org.lsst.ccs.localdb.statusdb.server.TrendingData |
getLatestData(String path)
Retrieves and returns the latest recorded data for the specified channel.
|
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 getChannelList()
nill if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.DataChannel.DataChannelList getChannelList(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.nill if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.TrendingData getLatestData(String path)
path - Data channel path.null if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.Datas getData(long begin,
long end,
String flavor,
int nBins,
String path)
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.path - Path of the data channel.nill if the REST server is not available.public org.lsst.ccs.localdb.statusdb.server.TrendingResult[] getData(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 org.lsst.ccs.localdb.statusdb.server.TrendingResult getData(long begin,
long end,
String flavor,
int nBins,
Integer... 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.flavor - Data flavor, "raw" or "stat".nBins - Requested number of bins. If non-positive, the number of bins is not specified in the request.ids - IDs of the data channels.nill if the REST server is not available.Copyright © 2023 LSST. All rights reserved.