org.rhq.enterprise.server.core
Interface AgentManagerLocal

All Known Implementing Classes:
AgentManagerBean

public interface AgentManagerLocal

Local interface to the AgentManagerBean SLSB.

Author:
John Mazzitelli

Method Summary
 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 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.
 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 version file and binary file are 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.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)
          Returns a collection of paged agents, filtered by Server (if non-null).
 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.
 boolean isAgentBackfilled(int agentId)
          Returns true if the agent is "suspect" and has been backfilled.
 boolean isAgentVersionSupported(AgentVersion agentVersion)
          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 setAgentBackfilled(int agentId, boolean backfilled)
           
 org.rhq.core.domain.resource.Agent updateAgent(org.rhq.core.domain.resource.Agent agent)
          Updates an existing agent.
 

Method Detail

createAgent

void createAgent(org.rhq.core.domain.resource.Agent agent)
Persists a new agent.

Parameters:
agent -

updateAgent

org.rhq.core.domain.resource.Agent updateAgent(org.rhq.core.domain.resource.Agent agent)
Updates an existing agent.

Parameters:
agent - the agent to be updated, with the new data in it
Returns:
an updated (attached) copy of the passed-in agent

deleteAgent

void deleteAgent(org.rhq.core.domain.resource.Agent agent)
Deletes an existing agent.

Parameters:
agent -

getAgentClient

@NotNull
AgentClient getAgentClient(@NotNull
                                   org.rhq.core.domain.resource.Agent agent)
Returns an agent client that can be used to send commands to the specified JON agent.

Parameters:
agent - a JON agent
Returns:
an agent client that can be used to send commands to the specified JON agent

getAgentClient

@NotNull
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.

Parameters:
resourceId - the ID of the resource whose agent is to be returned
Returns:
an agent client that can be used to send commands to the JON agent that manages the resource

getAllAgents

List<org.rhq.core.domain.resource.Agent> getAllAgents()
Returns a collection of all agents currently in inventory.

Returns:
list of all known agents in inventory

getAgentsByServer

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)
Returns a collection of paged agents, filtered by Server (if non-null).

Parameters:
serverId - the server to filter the agent list by. pass null to view unfiltered results.
Returns:
list of all known agents in inventory

getAgentCount

int getAgentCount()
Returns the total number of agents that are in inventory.

Returns:
total agent count

getAgentByName

org.rhq.core.domain.resource.Agent getAgentByName(String agentName)
Given an agent name, this will look up and return the Agent with that name. If no agent with the given name exists, null is returned.

Parameters:
agentName -
Returns:
the agent whose name matches the given name; null if there is no agent with the given name

getAgentByID

org.rhq.core.domain.resource.Agent getAgentByID(int agentId)
Given an agent id, this will look up and return the Agent with that id. If no agent with the given name exists, null is returned.

Parameters:
agentId -
Returns:
the agent whose id matches the given id; null if there is no agent with the given id

getAgentByAgentToken

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. If the given token is invalid, null is returned.

Parameters:
token - the agent token
Returns:
the agent whose agent token matches the given token; null if there is no agent with the given token

getAgentByAddressAndPort

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. If no agent is found, null is returned.

Parameters:
address - the address that the agent is bound to
port - the port at the given address that the agent is listening on
Returns:
the agent to be known at the given address and port; null if there is no agent with the given token

getAgentByResourceId

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.

Parameters:
subject -
resourceId -
Returns:
the agent that services the resource, or null if the resource ID was invalid

getAgentIdByResourceId

Integer getAgentIdByResourceId(int resourceId)
Given a resource ID, this will return the agent id responsible for servicing that resource.

Parameters:
resourceId -
Returns:
the agentId that services the resource, or null if the resource ID was invalid

getAgentIdByName

Integer getAgentIdByName(String agentName)
Given an agent name, this will return the agent id.

Parameters:
agentName -
Returns:
the agent ID or null if there is no agent with the given name

getAgentIdByScheduleId

Integer getAgentIdByScheduleId(int scheduleId)
Given a schedule ID, this will return the agent responsible for servicing that scheduleId.

Parameters:
scheduleId -
Returns:
the agentId that services the resource, or null if the schedule ID was invalid

agentIsShuttingDown

void agentIsShuttingDown(String agentName)
This method is called whenever an agent is going down.

This will usually be triggered when an agent explicitly tells us that it is shutting down. See CoreServerService.agentIsShuttingDown(String).

Parameters:
agentName - the name of the agent that is going down

agentIsAlive

void agentIsAlive(org.rhq.core.domain.resource.Agent agent)
This method should only be called when it is confirmed that an agent is alive. This can perform some tasks that can only be done when it is known that the agent is up.

Parameters:
agent - the agent that is confirmed alive and well

checkForSuspectAgents

void checkForSuspectAgents()
Call this method to see if there are agents that we might suspect are down. This is periodically called via our scheduled job CheckForSuspectedAgentsJob.


isAgentVersionSupported

boolean isAgentVersionSupported(AgentVersion agentVersion)
Determines if the given agent version is supported by this server. In other words, this will return true if this server can talk to any agent of the given version.

Parameters:
agentVersion - the version of the agent to verify
Returns:
true 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 returned

getAgentUpdateVersionFile

File getAgentUpdateVersionFile()
                               throws Exception
Returns the path on the server's file system where the agent update version file is found. The agent update version file contains information about the agent update binary, such as what version it is.

Returns:
agent update version file location
Throws:
Exception - if the file could not be created or found

getAgentUpdateVersionFileContent

Properties getAgentUpdateVersionFileContent()
                                            throws Exception
Returns the content of the agent update version file, which simply consists of some name/value pairs. The agent update version file contains information about the agent update binary, such as what version it is.

Returns:
version properties found in the agent update version file.
Throws:
Exception - if cannot read the agent update version file

getAgentUpdateBinaryFile

File getAgentUpdateBinaryFile()
                              throws Exception
Returns the path on the server's file system where the agent update binary is found. This is the actual agent distribution that can be installed on the agent machines.

Returns:
agent update binary location
Throws:
Exception - if the binary file does not exist

getAgentDownloadDir

File getAgentDownloadDir()
                         throws Exception
The directory on the server's file system where the agent update version file and binary file are found.

Returns:
directory where the agent downloads are found
Throws:
Exception - if could not determine the location or it does not exist

setAgentBackfilled

void setAgentBackfilled(int agentId,
                        boolean backfilled)

isAgentBackfilled

boolean isAgentBackfilled(int agentId)
Returns true 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.

Parameters:
agentId - the id of the agent
Returns:
true if the agent is a suspect agent and has been backfilled

pingAgentByResourceId

Boolean pingAgentByResourceId(org.rhq.core.domain.auth.Subject subject,
                              int resourceId)
Returns true indicating successful ping of agent. Exposed so server could initiate N requests so gwt clients wont face Single Origin Policy issues.

Parameters:
agentId - the id of the agent
Returns:
true if the agent was successfully pinged.


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.