
public class AgentLockService extends Object implements LockLevelService, ServiceLifecycle, AgentService
| Modifier and Type | Class and Description |
|---|---|
static interface |
AgentLockService.AgentLevelListener |
static interface |
AgentLockService.AgentLockUpdateListener
Interface for being notified of lock update events.
|
| Constructor and Description |
|---|
AgentLockService() |
| Modifier and Type | Method and Description |
|---|---|
void |
addAgentLevelListener(AgentLockService.AgentLevelListener l) |
void |
addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul) |
void |
connectUserWithAgent(String userId) |
void |
disconnectUserFromAgent() |
String |
getAgentServiceName()
Get the name of this service.
|
AgentStateService |
getAgentStateService() |
List<String> |
getAllWorkerAgents() |
Map<String,AgentLock> |
getHeldLocks()
Get information of the locks currently held by this agent.
|
int |
getLevelForAgent(String agentName)
Get this agent's authorized level at which it can operate the given
agentName. |
List<String> |
getLockableAgents() |
List<String> |
getLockedAgents() |
AgentLock |
getLockForAgent(String agentName)
Returns a lock held by the associated agent on the given
agentName,
or null if the associated agent does not hold a lock on the given
agent |
Map<String,AgentLock> |
getLocks()
Get information on all the current existing locks in a cluster of subsystems.
|
String |
getUserId()
Returns the ID of the
Agent user. |
void |
lockAgent(String agentName)
Request for this agent to obtain a lock on the given subsystem.
|
void |
preInit() |
void |
preStart()
Called from the enclosing
Subsystem when
org.lsst.ccs.Subsystem#start() has been called. |
void |
removeAgentLevelListener(AgentLockService.AgentLevelListener l) |
void |
removeAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener l) |
void |
setLevelForAgent(String agentName,
int level)
Set this agent's operational level for the given subsystem.
|
void |
setUserId(String newUserId)
Sets the ID of the logged
Agent user. |
void |
unlockAgent(String agentName)
Request for this agent to release a lock on the given subsystem.
|
boolean |
validateLock(AgentLock lock)
Validate a lock object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitafterInit, afterStart, preBuild, preShutdownstartForAgentpublic AgentStateService getAgentStateService()
public String getAgentServiceName()
AgentServicegetAgentServiceName in interface AgentServicepublic void preInit()
preInit in interface ServiceLifecyclepublic void preStart()
ServiceLifecycleSubsystem when
org.lsst.ccs.Subsystem#start() has been called.
The preceding lifecycle step is HasLifecycle.postInit()
The following lifecycle step is HasLifecycle.start()
At the time it is called :
PhaseState is
INITIALIZING
connection with the messaging layer is effective, the enclosing
subsystem has started StatusHeartBeat
publication
preStart in interface ServiceLifecyclepublic void setLevelForAgent(String agentName, int level) throws UnauthorizedLevelException, UnauthorizedLockException, IOException
AgentLevelListener will be notified with the new level valueagentName - the subsystem for which to change the levellevel - the level to setUnauthorizedLevelException - if the requested level cannot be set. This happens if this agent
owns a lock on the given subsystem and that lock defines a
maximum level that is lower than the requested level, or if this
agent does not hold a lock on the given subsystem and this
agent's default subsystem level is lower than the requested
level.UnauthorizedLockException - if the user is not allowed to acquire a lock on the specified
AgentIOException - if there was a communication problem on the buses.public int getLevelForAgent(String agentName)
agentName. It returns 0 if this agent does not hold a lock on
agentName.getLevelForAgent in interface LockLevelServiceagentName - the agent to get the level for.public void connectUserWithAgent(String userId)
public void disconnectUserFromAgent()
public AgentLock getLockForAgent(String agentName)
agentName,
or null if the associated agent does not hold a lock on the given
agentgetLockForAgent in interface LockLevelServiceagentName - public void lockAgent(String agentName) throws UnauthorizedLockException, IOException
AgentLockUpdateListener will be notified. The list of owned valid
locks will be updated.agentName - UnauthorizedLockException - if the user is not allowed to acquire a lock on the specified
AgentIOException - if there was a communication problem on the buses.public void unlockAgent(String agentName) throws IOException
AgentLockUpdateListener and AgentLevelListener will be
notified. The list of owned valid locks will be updated.agentName - IOException - if there was a communication problem on the buses.public Map<String,AgentLock> getLocks()
public Map<String,AgentLock> getHeldLocks()
public boolean validateLock(AgentLock lock)
lock - the lock object to validatepublic void addAgentLevelListener(AgentLockService.AgentLevelListener l)
l - public void removeAgentLevelListener(AgentLockService.AgentLevelListener l)
public void addAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener slul)
slul - public void removeAgentLockUpdateListener(AgentLockService.AgentLockUpdateListener l)
public String getUserId()
Agent user.Agent current userpublic void setUserId(String newUserId)
Agent user.newUserId - Copyright © 2020 LSST. All rights reserved.