@Plugin(name="Lock Service Plugin", id="lock-service", description="Graphical console service that provides interface between GUI components and Agent services dealing with locks, levels, logins, etc.") public class LockService extends ConsolePlugin implements ConsoleService
Getters provided by this class should be used to retrieve lock management information related to
multiple remote agents. For information on a specific agent, getters of the corresponding
Locker instance can be used. All getters should be called on EDT.
To be notified of changes, command browser components register listeners
through this class. LockService.Listener instances added through addListener(Listener)
method are notified whenever the set of watched agents changes (a remote agent is watched
if it is either connected to the buses or is locked by someone). To be notified of changes
related to a specific agent, a ChangeListener should be registered on the corresponding
Locker instance. Listener registration and removal can be requested on any thread,
but the callbacks are always executed on EDT. Note that if an unlocked subsystem disconnects
from the buses, the corresponding Locker instance is destroyed. Listeners that wish
to resume receiving subsystem-specific events once the subsystem reconnects, should listen to
service events and register themselves on the new Locker when it is created.
To initiate lock management related operations, clients can call one of the
executeOperation(Operation, String, int), executeBulkOperation(Operation, List), and login(String, String) methods.
These methods can be called on any thread. If the requested operation involves
communicating over the buses, it will be offloaded to a worker thread.
| Modifier and Type | Class and Description |
|---|---|
static interface |
LockService.Listener
Listener interface for receiving notifications of changes in the set of agents watched by this service, and of changes in userID.
|
static class |
LockService.Operation
Lock management operations.
|
static class |
LockService.State
States of remote agents with respect to lock management.
|
| Constructor and Description |
|---|
LockService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(LockService.Listener listener)
Adds a listener to be notified of changes in the set of agents watched by this service, and of changes in userID.
|
void |
executeBulkOperation(LockService.Operation op,
List<String> agentNames)
Executes the specified operation on multiple agents.
|
void |
executeOperation(LockService.Operation op,
String agentName,
int level)
Executes the specified operation on the given agent.
|
Locker |
getAgent(String agentName)
Returns
Locker for the specified agent. |
List<String> |
getAgentNames(LockService.State... states)
Lists names of agents in the specified states.
|
List<Locker> |
getAgents(LockService.State... states)
Returns
Lockers for agents in one of the specified states.Like all getters of this class, this method should be called on EDT. |
static LockService |
getService() |
String |
getUserId()
Returns user ID of this console.
|
void |
login(String userID,
String credentials)
Changes user ID associated with this console.
|
void |
removeListener(LockService.Listener listener)
Removes a listener.
|
void |
startService() |
void |
stopService() |
getConsole, getServices, initialize, propertiesChanged, restore, save, setServicesProvider, shutdown, start, stoppublic static LockService getService()
public void startService()
startService in interface ConsoleServicepublic void stopService()
stopService in interface ConsoleServicepublic Locker getAgent(String agentName)
Locker for the specified agent.
Like all getters of this class, this method should be called on EDT.agentName - Agent name.Locker for the specified agent, or null if the agent is unlocked and offline.public List<Locker> getAgents(LockService.State... states)
Lockers for agents in one of the specified states.Like all getters of this class, this method should be called on EDT.states - States to include.Locker for the specified agent, or null if the agent is unlocked and offline.public String getUserId()
public List<String> getAgentNames(LockService.State... states)
states - States to include.public void executeBulkOperation(LockService.Operation op, List<String> agentNames)
op - Operation.agentNames - Agent names.public void executeOperation(LockService.Operation op, String agentName, int level)
op - Operation.agentName - Agent name.level - Desired level (ignored for operations other than LEVEL.public void login(String userID, String credentials)
userID - Desired user ID, or null if the user ID should be reset to system user name.credentials - Ignored in the current implementation.public void addListener(LockService.Listener listener)
listener - Listener to add.public void removeListener(LockService.Listener listener)
listener - Listener to remove.Copyright © 2023 LSST. All rights reserved.