public class AgentManagerBean extends Object implements AgentManagerLocal, AgentManagerRemote
Agent objects.| Constructor and Description |
|---|
AgentManagerBean() |
| Modifier and Type | Method and Description |
|---|---|
void |
agentIsAlive(org.rhq.core.domain.resource.Agent agent)
This method should only be called when it is confirmed that an agent is alive.
|
void |
agentIsShuttingDown(String agentName)
This method is called whenever an agent is going down.
|
void |
backfillAgentInNewTransaction(org.rhq.core.domain.auth.Subject subject,
String agentName,
int agentId)
Call this method to set the agent DOWN and mark it 'backfilled'.
|
void |
checkForSuspectAgents()
Call this method to see if there are agents that we might suspect are down.
|
void |
createAgent(org.rhq.core.domain.resource.Agent agent)
Persists a new agent.
|
void |
deleteAgent(org.rhq.core.domain.resource.Agent agent)
Deletes an existing agent.
|
void |
deleteAgent(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.resource.Agent agent)
Deletes an existing agent by subject, if there is no platform resource for this agent.
|
void |
destroyAgentClient(org.rhq.core.domain.resource.Agent agent)
Throws away any known agent client that has been cached.
|
org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Agent> |
findAgentsByCriteria(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.criteria.AgentCriteria criteria)
Fetches the agents based on provided criteria.
|
org.rhq.core.domain.resource.Agent |
getAgentByAddressAndPort(String address,
int port)
Given an agent's address and port, this will look up and return the
Agent associated with that address
and port. |
org.rhq.core.domain.resource.Agent |
getAgentByAgentToken(String token)
Given an agent token string, this will look up and return the
Agent associated with that token. |
org.rhq.core.domain.resource.Agent |
getAgentByID(int agentId)
Given an agent id, this will look up and return the
Agent with that id. |
org.rhq.core.domain.resource.Agent |
getAgentByName(String agentName)
Given an agent name, this will look up and return the
Agent with that name. |
org.rhq.core.domain.resource.Agent |
getAgentByResourceId(org.rhq.core.domain.auth.Subject subject,
int resourceId)
Given a resource ID, this will return the agent responsible for servicing that resource.
|
AgentClient |
getAgentClient(org.rhq.core.domain.resource.Agent agent)
Returns an agent client that can be used to send commands to the specified JON agent.
|
AgentClient |
getAgentClient(org.rhq.core.domain.auth.Subject subject,
int resourceId)
Returns an agent client that can be used to send commands to the JON agent that managed the specified resource.
|
int |
getAgentCount()
Returns the total number of agents that are in inventory.
|
File |
getAgentDownloadDir()
The directory on the server's file system where the agent update binary file is found.
|
Integer |
getAgentIdByName(String agentName)
Given an agent name, this will return the agent id.
|
Integer |
getAgentIdByResourceId(int resourceId)
Given a resource ID, this will return the agent id responsible for servicing that resource.
|
Integer |
getAgentIdByScheduleId(int scheduleId)
Given a schedule ID, this will return the agent responsible for servicing that scheduleId.
|
org.rhq.core.domain.install.remote.AgentInstall |
getAgentInstallByAgentName(org.rhq.core.domain.auth.Subject user,
String agentName)
Returns the agent install information for the named agent.
|
org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Agent> |
getAgentsByServer(org.rhq.core.domain.auth.Subject subject,
Integer serverId,
org.rhq.core.domain.util.PageControl pageControl)
Methods with page control are typically accessed by the GUI, as such apply permission check.
|
File |
getAgentUpdateBinaryFile()
Returns the path on the server's file system where the agent update binary is found.
|
File |
getAgentUpdateVersionFile()
Returns the path on the server's file system where the agent update version file is found.
|
Properties |
getAgentUpdateVersionFileContent()
Returns the content of the agent update version file, which simply consists
of some name/value pairs.
|
List<org.rhq.core.domain.resource.Agent> |
getAllAgents()
Returns a collection of all agents currently in inventory.
|
PingRequest |
handlePingRequest(PingRequest request)
Process a ping request from an agent, performing any requested actions and returning any requested data.
|
boolean |
isAgentBackfilled(int agentId)
Returns
true if the agent is "suspect" and has been backfilled. |
AgentVersionCheckResults |
isAgentVersionSupported(AgentVersion agentVersionInfo)
Determines if the given agent version is supported by this server.
|
Boolean |
pingAgentByResourceId(org.rhq.core.domain.auth.Subject subject,
int resourceId)
Returns
true indicating successful ping of agent. |
void |
setAgentBackfilledInNewTransaction(int agentId,
boolean backfilled)
Do this in its own transaction to minimize locking on the agent table.
|
org.rhq.core.domain.resource.Agent |
updateAgent(org.rhq.core.domain.resource.Agent agent)
Updates an existing agent.
|
org.rhq.core.domain.install.remote.AgentInstall |
updateAgentInstall(org.rhq.core.domain.auth.Subject user,
org.rhq.core.domain.install.remote.AgentInstall agentInstall)
Persists install information on a new agent.
|
public void createAgent(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocalcreateAgent in interface AgentManagerLocalpublic org.rhq.core.domain.install.remote.AgentInstall getAgentInstallByAgentName(org.rhq.core.domain.auth.Subject user,
String agentName)
AgentManagerLocalgetAgentInstallByAgentName in interface AgentManagerLocaluser - who wants to get the dataagentName - name of the agent whose install information is to be returnedpublic org.rhq.core.domain.install.remote.AgentInstall updateAgentInstall(org.rhq.core.domain.auth.Subject user,
org.rhq.core.domain.install.remote.AgentInstall agentInstall)
AgentManagerLocalupdateAgentInstall in interface AgentManagerLocaluser - who wants to update the datapublic void deleteAgent(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocaldeleteAgent in interface AgentManagerLocalpublic void destroyAgentClient(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocaldestroyAgentClient in interface AgentManagerLocalagent - the agent whose client is to be destroyed.public org.rhq.core.domain.resource.Agent updateAgent(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocalupdateAgent in interface AgentManagerLocalagent - the agent to be updated, with the new data in itpublic AgentClient getAgentClient(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocalgetAgentClient in interface AgentManagerLocalagent - a JON agentpublic AgentClient getAgentClient(org.rhq.core.domain.auth.Subject subject, int resourceId)
AgentManagerLocalgetAgentClient in interface AgentManagerLocalresourceId - the ID of the resource whose agent is to be returnedpublic void agentIsShuttingDown(String agentName)
AgentManagerLocalThis will usually be triggered when an agent explicitly tells us that it is shutting down. See
CoreServerService.agentIsShuttingDown(String).
agentIsShuttingDown in interface AgentManagerLocalagentName - the name of the agent that is going downpublic void agentIsAlive(org.rhq.core.domain.resource.Agent agent)
AgentManagerLocalagentIsAlive in interface AgentManagerLocalagent - the agent that is confirmed alive and wellpublic void checkForSuspectAgents()
AgentManagerLocalCheckForSuspectedAgentsJob.checkForSuspectAgents in interface AgentManagerLocalpublic void backfillAgentInNewTransaction(org.rhq.core.domain.auth.Subject subject,
String agentName,
int agentId)
AgentManagerLocalbackfillAgentInNewTransaction in interface AgentManagerLocalpublic void setAgentBackfilledInNewTransaction(int agentId,
boolean backfilled)
AgentManagerLocalsetAgentBackfilledInNewTransaction in interface AgentManagerLocalpublic boolean isAgentBackfilled(int agentId)
AgentManagerLocaltrue if the agent is "suspect" and has been backfilled. A "suspect agent" means one that the
server suspects is down. When an agent is suspect, all of its resources, including the platform, will be
backfilled with DOWN availabilities.isAgentBackfilled in interface AgentManagerLocalagentId - the id of the agenttrue if the agent is a suspect agent and has been backfilledpublic List<org.rhq.core.domain.resource.Agent> getAllAgents()
AgentManagerLocalgetAllAgents in interface AgentManagerLocalpublic org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Agent> getAgentsByServer(org.rhq.core.domain.auth.Subject subject,
Integer serverId,
org.rhq.core.domain.util.PageControl pageControl)
getAgentsByServer in interface AgentManagerLocalserverId - the server to filter the agent list by. pass null to view unfiltered results.public int getAgentCount()
AgentManagerLocalgetAgentCount in interface AgentManagerLocalpublic org.rhq.core.domain.resource.Agent getAgentByAgentToken(String token)
AgentManagerLocalAgent associated with that token. If the
given token is invalid, null is returned.
This method is very efficient if you want to find a single agent by its token.
If you need to get more than one agent, you could use findAgentsByCriteria.getAgentByAgentToken in interface AgentManagerLocaltoken - the agent tokennull if there is no agent with the
given tokenpublic org.rhq.core.domain.resource.Agent getAgentByName(String agentName)
AgentManagerLocalAgent with that name. If no agent with the given
name exists, null is returned.
This method is very efficient if you want to find a single agent by its name.
If you need to get more than one agent, you could use findAgentsByCriteria.getAgentByName in interface AgentManagerLocalnull if there is no agent with the given namepublic org.rhq.core.domain.resource.Agent getAgentByID(int agentId)
AgentManagerLocalAgent with that id. If no agent with the given
name exists, null is returned.
This method is very efficient if you want to find a single agent by its ID.
If you need to get more than one agent, you could use findAgentsByCriteria.getAgentByID in interface AgentManagerLocalnull if there is no agent with the given idpublic org.rhq.core.domain.resource.Agent getAgentByAddressAndPort(String address, int port)
AgentManagerLocalAgent associated with that address
and port. If no agent is found, null is returned.
This method is very efficient if you want to find a single agent by its endpoint.
If you need to get more than one agent, you could use findAgentsByCriteria.getAgentByAddressAndPort in interface AgentManagerLocaladdress - the address that the agent is bound toport - the port at the given address that the agent is listening onnull if there is no agent with the
given tokenpublic org.rhq.core.domain.resource.Agent getAgentByResourceId(org.rhq.core.domain.auth.Subject subject,
int resourceId)
AgentManagerLocalgetAgentByResourceId in interface AgentManagerLocalnull if the resource ID was invalidpublic Integer getAgentIdByResourceId(int resourceId)
AgentManagerLocalgetAgentIdByResourceId in interface AgentManagerLocalnull if the resource ID was invalidpublic Integer getAgentIdByName(String agentName)
AgentManagerLocalgetAgentIdByName in interface AgentManagerLocalnull if there is no agent with the given namepublic Integer getAgentIdByScheduleId(int scheduleId)
AgentManagerLocalgetAgentIdByScheduleId in interface AgentManagerLocalnull if the schedule ID was invalidpublic AgentVersionCheckResults isAgentVersionSupported(AgentVersion agentVersionInfo)
AgentManagerLocaltrue if this server can talk to any agent of the given version.isAgentVersionSupported in interface AgentManagerLocalagentVersionInfo - the version of the agent to verifytrue if this server can support an agent with the given version; if the server
knows it cannot communicate successfully with an agent of that version, false
will be in the POJO's isSupported attribute. The POJO also contains agent version information on the latest
known agent available.public File getAgentUpdateVersionFile() throws Exception
AgentManagerLocalgetAgentUpdateVersionFile in interface AgentManagerLocalException - if the file could not be created or foundpublic Properties getAgentUpdateVersionFileContent() throws Exception
AgentManagerLocalgetAgentUpdateVersionFileContent in interface AgentManagerLocalException - if cannot read the agent update version filepublic File getAgentUpdateBinaryFile() throws Exception
AgentManagerLocalgetAgentUpdateBinaryFile in interface AgentManagerLocalException - if the binary file does not existpublic File getAgentDownloadDir() throws Exception
getAgentDownloadDir in interface AgentManagerLocalException - if could not determine the location or it does not existpublic PingRequest handlePingRequest(PingRequest request)
AgentManagerLocalhandlePingRequest in interface AgentManagerLocalpublic Boolean pingAgentByResourceId(org.rhq.core.domain.auth.Subject subject, int resourceId)
AgentManagerLocaltrue indicating successful ping of agent. Exposed so server could
initiate N requests so gwt clients wont face Single Origin Policy issues.pingAgentByResourceId in interface AgentManagerLocaltrue if the agent was successfully pinged.public org.rhq.core.domain.util.PageList<org.rhq.core.domain.resource.Agent> findAgentsByCriteria(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.criteria.AgentCriteria criteria)
AgentManagerRemotefindAgentsByCriteria in interface AgentManagerRemotesubject - callercriteria - the criteriapublic void deleteAgent(org.rhq.core.domain.auth.Subject subject,
org.rhq.core.domain.resource.Agent agent)
AgentManagerRemotedeleteAgent in interface AgentManagerRemotesubject - calleragent - agent object.Copyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.