@Override public final void start(AgentContext agentContext) throws Exception { if (agentContext == null) { throw new IllegalArgumentException("Context must not be null"); } else if (getAgentContext() != agentContext) { // Just to be sure... throw new IllegalStateException("Context changed between init and start?!"); } onStart(); }
@Override public final void init(AgentContext agentContext) throws Exception { if (agentContext == null) { throw new IllegalArgumentException("Context must not be null"); } setAgentContext(agentContext); onInit(); }
@Override public final void stop() throws Exception { try { onStop(); } finally { setAgentContext(null); } }
protected final DownloadHandler getDownloadHandler() { return getAgentContext().getHandler(DownloadHandler.class); }
protected final void logDebug(String message, Throwable cause, Object... args) { getLoggingHandler().logDebug(m_identifier, message, cause, args); }
private void resetConfigurationHandler(ConfigurationHandler configurationHandler) throws Exception { ConfigurationHandler oldConfigurationHandler = m_agentContextImpl.getHandler(ConfigurationHandler.class); if (oldConfigurationHandler instanceof ComponentBase) { ((ComponentBase) oldConfigurationHandler).stop(); } m_agentContextImpl.setHandler(ConfigurationHandler.class, configurationHandler); m_agentContextImpl.start(); } }
protected final ScheduledExecutorService getExecutorService() { return getAgentContext().getHandler(ScheduledExecutorService.class); }
protected final void logWarning(String message, Object... args) { getLoggingHandler().logWarning(m_identifier, message, null, args); }
protected final ConnectionHandler getConnectionHandler() { return getAgentContext().getHandler(ConnectionHandler.class); }
protected final void logInfo(String message, Object... args) { getLoggingHandler().logInfo(m_identifier, message, null, args); }
protected final DeploymentHandler getDeploymentHandler() { return getAgentContext().getHandler(DeploymentHandler.class); }
protected final void logInfo(String message, Throwable cause, Object... args) { getLoggingHandler().logInfo(m_identifier, message, cause, args); }
protected final IdentificationHandler getIdentificationHandler() { return getAgentContext().getHandler(IdentificationHandler.class); }
protected final void logDebug(String message, Object... args) { getLoggingHandler().logDebug(m_identifier, message, null, args); }
protected final DiscoveryHandler getDiscoveryHandler() { return getAgentContext().getHandler(DiscoveryHandler.class); }
protected final void logWarning(String message, Throwable cause, Object... args) { getLoggingHandler().logWarning(m_identifier, message, cause, args); }
protected final ConfigurationHandler getConfigurationHandler() { return getAgentContext().getHandler(ConfigurationHandler.class); }
protected final void logError(String message, Object... args) { getLoggingHandler().logError(m_identifier, message, null, args); }
protected final AgentUpdateHandler getAgentUpdateHandler() { return getAgentContext().getHandler(AgentUpdateHandler.class); }
protected final void logError(String message, Throwable cause, Object... args) { getLoggingHandler().logError(m_identifier, message, cause, args); }