HydraExpress™ C++ 2020 |
HydraExpress™ C++ API Reference Guide |
Product Documentation: HydraExpress C++ Documentation Home |
Holds state information about the entire Agent process. More...
#include <rwsf/handlers/AgentContext.h>
Public Types | |
enum | AgentState { AgentStateUnknown, AgentStateInitializing, AgentStateNormal, AgentStateBackup } |
Public Member Functions | |
AgentContext (const AgentContext &context) | |
rwsf::AgentContext::AgentState | getAgentState () const |
std::string | getConfigurationFile () const |
rwsf::Connector | getConnector (const std::string &name) const |
rwsf::Enumeration< rwsf::Connector > | getConnectors () const |
rwsf::MessageInfoHandlerChain | getHandlerChain (const std::string &name) const |
rwsf::Logger | getLogger () const |
void | init (const rwsf::Config &config) |
AgentContext & | operator= (const AgentContext &context) |
void | setConnector (const std::string &name, const rwsf::Connector &connector) |
void | setHandlerChain (const std::string &name, const rwsf::MessageInfoHandlerChain &chain) |
void | setLogger (const rwsf::Logger &logger) |
Public Member Functions inherited from rwsf::MessageInfo | |
MessageInfo () | |
MessageInfo (const rwsf::MessageInfo &second) | |
virtual void | clear () |
void | clear (const std::string &name) |
bool | contains (const std::string &name) const |
template<typename T > | |
const T & | get (const std::string &name) const |
rwsf::Attribute | getAttribute (const std::string &name) const |
MessageInfo & | operator= (const rwsf::MessageInfo &second) |
template<typename T > | |
void | set (const std::string &name, const T &value) |
void | setAttribute (const std::string &name, const rwsf::Attribute &attr) |
template<typename T > | |
T & | value (const std::string &name) |
Public Member Functions inherited from rwsf::HandleBase | |
bool | isValid (void) const |
bool | operator!= (const HandleBase &second) const |
bool | operator== (const HandleBase &second) const |
Static Public Member Functions | |
static std::string | agentStateToStr (const rwsf::AgentContext::AgentState &state) |
static rwsf::AgentContext::AgentState | strToAgentState (const std::string &type) |
Additional Inherited Members | |
Protected Member Functions inherited from rwsf::MessageInfo | |
const MessageInfoImp & | body () const |
MessageInfoImp & | body () |
Protected Member Functions inherited from rwsf::HandleBase | |
HandleBase (void) | |
HandleBase (StaticCtor) | |
HandleBase (BodyBase *body) | |
HandleBase (const HandleBase &second) | |
virtual | ~HandleBase (void) |
BodyBase & | body (void) const |
HandleBase & | operator= (const HandleBase &second) |
The AgentContext holds state information about the entire Agent process. It initializes based on the main configuration file (usually <installdir>/conf/rwagent.xml) and sets up important Agent modules, such as the connectors, handler chains, and loggers.
Querying and/or modifying the context can inspect or change the state of the running Agent, so care should be taken when using this class directly.
Enumeration containing all possible Agent states. For more information on Agent state, please see
rwsf::AgentContext::AgentContext | ( | const AgentContext & | context | ) |
Copy constructor.
|
static |
Helper method to convert the given state to a string, as follows:
Agent State | Types |
rwsf:AgentContext::AgentStateNormal | Normal |
rwsf:AgentContext::AgentStateBackup | Backup |
rwsf:AgentContext::AgentStateInitializing | Initializing |
Any other value | Unknown |
rwsf::AgentContext::AgentState rwsf::AgentContext::getAgentState | ( | ) | const |
Gets the Agent's state.
std::string rwsf::AgentContext::getConfigurationFile | ( | ) | const |
Returns the path to the configuration file used to start the Agent (i.e. the file passed with the "-c"
argument on the command line when the Agent was started).
rwsf::Connector rwsf::AgentContext::getConnector | ( | const std::string & | name | ) | const |
Retrieves the connector name, usually derived from the name of a configured connector in rwagent.xml
. If name does not exist, an invalid handle is returned.
rwsf::Enumeration<rwsf::Connector> rwsf::AgentContext::getConnectors | ( | ) | const |
Returns an enumeration of all of the connectors registered in the Agent.
rwsf::MessageInfoHandlerChain rwsf::AgentContext::getHandlerChain | ( | const std::string & | name | ) | const |
Retrieves the handler chain associated with the provided handler chain name, usually derived from the handler chain of that name in the Agent configuration file rwagent.xml
. If one does not exist, an empty chain is returned.
rwsf::Logger rwsf::AgentContext::getLogger | ( | ) | const |
Gets the current default logger for this AgentContext.
void rwsf::AgentContext::init | ( | const rwsf::Config & | config | ) |
Initializes the AgentContext with any special properties provided by config.
AgentContext& rwsf::AgentContext::operator= | ( | const AgentContext & | context | ) |
Assignment operator.
void rwsf::AgentContext::setConnector | ( | const std::string & | name, |
const rwsf::Connector & | connector | ||
) |
Sets a new connector with specified name. If name already exists, it is replaced.
void rwsf::AgentContext::setHandlerChain | ( | const std::string & | name, |
const rwsf::MessageInfoHandlerChain & | chain | ||
) |
Sets a new handler chain with the specified name. Any modules (connectors, etc) that use name for their handler chain will run the new chain specified in chain for any message processing. If the handler chain name already exists, it is replaced.
void rwsf::AgentContext::setLogger | ( | const rwsf::Logger & | logger | ) |
Sets the default logger for this AgentContext to logger.
|
static |
Helper method to convert the given type to an rwsf::AgentContext::AgentState. Case-insensitive. The possible types and the conversion to state are:
Types | Agent State |
Normal | rwsf:AgentContext::AgentStateNormal |
Backup | rwsf:AgentContext::AgentStateBackup |
Initializing | rwsf:AgentContext::AgentStateInitializing |
.* | rwsf:AgentContext::AgentStateUnknown |
Copyright © 2020 Rogue Wave Software, Inc. All Rights Reserved. |