You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2013/08/23 17:21:03 UTC
svn commit: r1516879 -
/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/
Author: bramk
Date: Fri Aug 23 15:21:03 2013
New Revision: 1516879
URL: http://svn.apache.org/r1516879
Log:
ACE-347 Improved controller robustness and made it extend component base
Added:
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ComponentBase.java
- copied, changed from r1516836, ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/HandlerBase.java
Removed:
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/HandlerBase.java
Modified:
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConnectionHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DefaultController.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DiscoveryHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DownloadHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/FeedbackHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/IdentificationHandlerImpl.java
ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java
Copied: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ComponentBase.java (from r1516836, ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/HandlerBase.java)
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ComponentBase.java?p2=ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ComponentBase.java&p1=ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/HandlerBase.java&r1=1516836&r2=1516879&rev=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/HandlerBase.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ComponentBase.java Fri Aug 23 15:21:03 2013
@@ -18,15 +18,30 @@
*/
package org.apache.ace.agent.impl;
+import java.io.File;
+import java.util.concurrent.ScheduledExecutorService;
+
import org.apache.ace.agent.AgentContext;
import org.apache.ace.agent.AgentContextAware;
-
-public abstract class HandlerBase implements AgentContextAware {
+import org.apache.ace.agent.AgentUpdateHandler;
+import org.apache.ace.agent.ConfigurationHandler;
+import org.apache.ace.agent.ConnectionHandler;
+import org.apache.ace.agent.DeploymentHandler;
+import org.apache.ace.agent.DiscoveryHandler;
+import org.apache.ace.agent.DownloadHandler;
+import org.apache.ace.agent.FeedbackHandler;
+import org.apache.ace.agent.IdentificationHandler;
+
+/**
+ * Convenience implementation base class for all {@link AgentContextAware} components, such as handlers & controllers.
+ *
+ */
+public abstract class ComponentBase implements AgentContextAware {
private final String m_componentIdentifier;
private AgentContext m_agentContext;
- public HandlerBase(String handlerIdentifier) {
+ public ComponentBase(String handlerIdentifier) {
m_componentIdentifier = handlerIdentifier;
}
@@ -56,6 +71,46 @@ public abstract class HandlerBase implem
protected void onStop() throws Exception {
}
+ protected final IdentificationHandler getIdentificationHandler() {
+ return m_agentContext.getIdentificationHandler();
+ }
+
+ protected final DiscoveryHandler getDiscoveryHandler() {
+ return m_agentContext.getDiscoveryHandler();
+ }
+
+ protected final ConnectionHandler getConnectionHandler() {
+ return m_agentContext.getConnectionHandler();
+ }
+
+ protected final DeploymentHandler getDeploymentHandler() {
+ return m_agentContext.getDeploymentHandler();
+ }
+
+ protected final DownloadHandler getDownloadHandler() {
+ return m_agentContext.getDownloadHandler();
+ }
+
+ protected final ConfigurationHandler getConfigurationHandler() {
+ return m_agentContext.getConfigurationHandler();
+ }
+
+ protected final AgentUpdateHandler getAgentUpdateHandler() {
+ return m_agentContext.getAgentUpdateHandler();
+ }
+
+ protected final FeedbackHandler getFeedbackHandler() {
+ return m_agentContext.getFeedbackHandler();
+ }
+
+ protected final ScheduledExecutorService getExecutorService() {
+ return m_agentContext.getExecutorService();
+ }
+
+ protected final File getWorkDir() {
+ return m_agentContext.getWorkDir();
+ }
+
protected final void logDebug(String message, Object... args) {
getAgentContext().logDebug(m_componentIdentifier, message, null, args);
}
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConfigurationHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -36,7 +36,7 @@ import org.apache.ace.agent.Configuratio
* Default configuration handler that reads the serverURL(s) from the configuration using key
* {@link DISCOVERY_CONFIG_KEY}.
*/
-public class ConfigurationHandlerImpl extends HandlerBase implements ConfigurationHandler {
+public class ConfigurationHandlerImpl extends ComponentBase implements ConfigurationHandler {
public static final String COMPONENT_IDENTIFIER = "configuration";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConnectionHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConnectionHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConnectionHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/ConnectionHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -42,7 +42,7 @@ import org.apache.commons.codec.binary.B
* Default connection handler with support for BASIC authentication and HTTPS client certificates.
*
*/
-public class ConnectionHandlerImpl extends HandlerBase implements ConnectionHandler {
+public class ConnectionHandlerImpl extends ComponentBase implements ConnectionHandler {
public static final String COMPONENT_IDENTIFIER = "connection";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DefaultController.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DefaultController.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DefaultController.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DefaultController.java Fri Aug 23 15:21:03 2013
@@ -21,16 +21,13 @@ package org.apache.ace.agent.impl;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.util.Collections;
import java.util.Set;
import java.util.SortedSet;
+import java.util.TreeSet;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
-import org.apache.ace.agent.AgentContext;
-import org.apache.ace.agent.AgentContextAware;
-import org.apache.ace.agent.AgentControl;
-import org.apache.ace.agent.AgentUpdateHandler;
-import org.apache.ace.agent.ConfigurationHandler;
import org.apache.ace.agent.DeploymentHandler;
import org.apache.ace.agent.DownloadHandle;
import org.apache.ace.agent.DownloadResult;
@@ -43,7 +40,7 @@ import org.osgi.framework.Version;
* Default configurable controller
*
*/
-public class DefaultController implements Runnable, AgentContextAware {
+public class DefaultController extends ComponentBase implements Runnable {
public static final String COMPONENT_IDENTIFIER = "controller";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + ".controller";
@@ -85,6 +82,7 @@ public class DefaultController implement
* deployment session. Otherwise the agent tries to minimize the impact by only restarting bundles that are actually
* affected. Not stopping unaffected bundles reduces overhead, but may fail in complex wiring scenarios.
*/
+ // FIXME Not considered yet
public static final String CONFIG_KEY_STOPUNAFFECTED = CONFIG_KEY_BASE + ".stopUnaffected";
public static final boolean CONFIG_DEFAULT_STOPUNAFFECTED = true; // spec behavior
@@ -95,114 +93,176 @@ public class DefaultController implement
public static final String CONFIG_KEY_FIXPACKAGES = CONFIG_KEY_BASE + ".fixPackages";
public static final boolean CONFIG_DEFAULT_FIXPACKAGES = true;
- private volatile AgentContext m_agentContext;
private volatile ScheduledFuture<?> m_scheduledFuture;
private volatile UpdateInstaller m_updateInstaller;
- @Override
- public void start(AgentContext agentContext) throws Exception {
- m_agentContext = agentContext;
-
- ConfigurationHandler configurationHandler = m_agentContext.getConfigurationHandler();
+ public DefaultController() {
+ super(COMPONENT_IDENTIFIER);
+ }
- boolean disabled = configurationHandler.getBoolean(CONFIG_KEY_DISABLED, CONFIG_DEFAULT_DISABLED);
- if (disabled) {
- m_agentContext.logInfo(COMPONENT_IDENTIFIER, "Default controller disabled by configuration");
- }
- else {
- long delay = configurationHandler.getLong(CONFIG_KEY_SYNCDELAY, CONFIG_DEFAULT_SYNCDELAY);
- scheduleRun(delay);
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Controller scheduled to sync in %d seconds", delay);
- }
+ @Override
+ protected void onStart() throws Exception {
+ long delay = getConfigurationHandler().getLong(CONFIG_KEY_SYNCDELAY, CONFIG_DEFAULT_SYNCDELAY);
+ scheduleRun(delay);
+ logDebug("Controller scheduled to run in %d seconds", delay);
}
- public void stop() {
- unscheduleRun();
+ @Override
+ protected void onStop() throws Exception {
if (m_updateInstaller != null) {
m_updateInstaller.reset();
}
+ unscheduleRun();
}
+ @Override
public void run() {
- ConfigurationHandler configurationHandler = m_agentContext.getConfigurationHandler();
+ boolean disabled = getConfigurationHandler().getBoolean(CONFIG_KEY_DISABLED, CONFIG_DEFAULT_DISABLED);
+ long interval = getConfigurationHandler().getLong(CONFIG_KEY_SYNCINTERVAL, CONFIG_DEFAULT_SYNCINTERVAL);
+ if (disabled) {
+ logDebug("Controller disabled by configuration. Skipping..");
+ scheduleRun(interval);
+ return;
+ }
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Controller syncing...");
- long interval = configurationHandler.getLong(CONFIG_KEY_SYNCINTERVAL, CONFIG_DEFAULT_SYNCINTERVAL);
+ logDebug("Controller syncing...");
try {
- runSafeFeedback();
- runSafeAgentUpdate();
- runSafeDeploymentUpdate();
+ runFeedback();
+ runAgentUpdate();
+ runDeploymentUpdate();
}
catch (RetryAfterException e) {
+ // any method may throw this causing the sync to abort. The server is busy so no sense in trying
+ // anything else until the retry window has passed.
interval = e.getSeconds();
- m_agentContext.logInfo(COMPONENT_IDENTIFIER, "Sync received retry exception from server.");
- }
- catch (IOException e) {
- m_agentContext.logWarning(COMPONENT_IDENTIFIER, "Sync aborted due to IOException.", e);
+ logWarning("Sync received retry exception from server. Rescheduled in %d seconds", e.getSeconds());
}
catch (Exception e) {
- m_agentContext.logError(COMPONENT_IDENTIFIER, "Sync aborted due to Exception.", e);
+ // serious problem throw by a method that decides this is cause enough to abort the sync. Not much
+ // we can do but log it as an error and reschedule as usual.
+ logError("Sync aborted due to Exception.", e);
}
scheduleRun(interval);
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Sync completed. Rescheduled in %d seconds", interval);
+ logDebug("Sync completed. Rescheduled in %d seconds", interval);
}
- private void runSafeFeedback() throws RetryAfterException, IOException {
- AgentControl agentControl = m_agentContext.getAgentControl();
-
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Synchronizing feedback channels");
- Set<String> channelNames = agentControl.getFeedbackHandler().getChannelNames();
- for (String channelName : channelNames) {
- FeedbackChannel channel = agentControl.getFeedbackHandler().getChannel(channelName);
+ private void runFeedback() throws RetryAfterException {
+ logDebug("Synchronizing feedback channels");
+ Set<String> names = getFeedbackChannelNames();
+ for (String name : names) {
+ FeedbackChannel channel = getFeedbackChannel(name);
if (channel != null) {
- channel.sendFeedback();
+ try {
+ channel.sendFeedback();
+ logDebug("Feedback send succesfully for channel %s", names);
+ }
+ catch (IOException e) {
+ // Hopefully temporary problem due to remote IO or configuration. No cause to abort the sync so we
+ // just log it as a warning.
+ logWarning("Exception while sending feedback on channel %s", e, names);
+ }
}
}
}
- private void runSafeAgentUpdate() throws RetryAfterException, IOException {
- AgentUpdateHandler updateHandler = m_agentContext.getAgentUpdateHandler();
+ private Set<String> getFeedbackChannelNames() {
+ try {
+ return getFeedbackHandler().getChannelNames();
+ }
+ catch (IOException e) {
+ // Probably a serious problem due to local IO related to feedback. No cause to abort the sync so we just log
+ // it as an error.
+ logError("Exception while Looking up feedback channelnames. This is ");
+ }
+ return Collections.emptySet();
+ }
+
+ private FeedbackChannel getFeedbackChannel(String name) {
+ try {
+ return getFeedbackHandler().getChannel(name);
+ }
+ catch (IOException e) {
+ // Probably a serious problem due to local IO related to feedback. No cause to abort the sync so we just log
+ // it as an error.
+ logError("Exception while looking up feedback channel %s", e, name);
+ }
+ return null;
+ }
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Checking for agent update");
- Version current = updateHandler.getInstalledVersion();
- SortedSet<Version> available = updateHandler.getAvailableVersions();
+ private void runAgentUpdate() throws RetryAfterException {
+ logDebug("Checking for agent update");
+ Version current = getAgentUpdateHandler().getInstalledVersion();
+ SortedSet<Version> available = getAvailableAgentVersions();
Version highest = Version.emptyVersion;
if (available != null && !available.isEmpty()) {
highest = available.last();
}
- if (highest.compareTo(current) > 0) {
- m_agentContext.logInfo(COMPONENT_IDENTIFIER, "Installing agent update %s => %s", current, highest);
- InputStream inputStream = updateHandler.getInputStream(highest);
- updateHandler.install(inputStream);
+
+ if (highest.compareTo(current) < 1) {
+ logDebug("No agent update available for version %s", current);
+ return;
}
- else {
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "No agent update available for version %s", current);
+
+ logInfo("Installing agent update %s => %s", current, highest);
+ InputStream inputStream = null;
+ try {
+ inputStream = getAgentUpdateHandler().getInputStream(highest);
+ getAgentUpdateHandler().install(inputStream);
+ }
+ catch (IOException e) {
+ // Hopefully temporary problem due to remote IO or configuration. No cause to abort the sync so we
+ // just log it as a warning.
+ // FIXME Does not cover failed updates and should handle retries
+ logWarning("Exception while installing agent update %s", e, highest);
}
}
- private void runSafeDeploymentUpdate() throws RetryAfterException, IOException {
+ private SortedSet<Version> getAvailableAgentVersions() throws RetryAfterException {
+ try {
+ return getAgentUpdateHandler().getAvailableVersions();
+ }
+ catch (IOException e) {
+ // Hopefully temporary problem due to remote IO or configuration. No cause to abort the sync so we just
+ // log it as a warning.
+ logWarning("Exception while retrieving agent versions", e);
+ }
+ return new TreeSet<Version>();
+ }
+
+ private void runDeploymentUpdate() throws RetryAfterException {
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "Checking for deployment update");
- DeploymentHandler deploymentHandler = m_agentContext.getDeploymentHandler();
- Version current = deploymentHandler.getInstalledVersion();
- SortedSet<Version> available = deploymentHandler.getAvailableVersions();
+ logDebug("Checking for deployment update");
+ Version current = getDeploymentHandler().getInstalledVersion();
+ SortedSet<Version> available = getAvailableDeploymentVersions();
Version highest = Version.emptyVersion;
if (available != null && !available.isEmpty()) {
highest = available.last();
}
+
if (highest.compareTo(current) < 1) {
- m_agentContext.logDebug(COMPONENT_IDENTIFIER, "No deployment update available for version %s", current);
+ logDebug("No deployment update available for version %s", current);
return;
}
- ConfigurationHandler configurationHandler = m_agentContext.getConfigurationHandler();
- boolean fixPackage = configurationHandler.getBoolean(CONFIG_KEY_FIXPACKAGES, CONFIG_DEFAULT_FIXPACKAGES);
- boolean updateStreaming = configurationHandler.getBoolean(CONFIG_KEY_UPDATESTREAMING, CONFIG_DEFAULT_UPDATESTREAMING);
- long maxRetries = configurationHandler.getLong(CONFIG_KEY_UPDATERETRIES, CONFIG_DEFAULT_UPDATERETRIES);
+ boolean updateStreaming = getConfigurationHandler().getBoolean(CONFIG_KEY_UPDATESTREAMING, CONFIG_DEFAULT_UPDATESTREAMING);
+ boolean fixPackage = getConfigurationHandler().getBoolean(CONFIG_KEY_FIXPACKAGES, CONFIG_DEFAULT_FIXPACKAGES);
+ long maxRetries = getConfigurationHandler().getLong(CONFIG_KEY_UPDATERETRIES, CONFIG_DEFAULT_UPDATERETRIES);
getUpdateInstaller(updateStreaming).installUpdate(current, highest, fixPackage, maxRetries);
}
+ private SortedSet<Version> getAvailableDeploymentVersions() throws RetryAfterException {
+ try {
+ return getDeploymentHandler().getAvailableVersions();
+ }
+ catch (IOException e) {
+ // Hopefully temporary problem due to remote IO or configuration. No cause to abort the sync so we just
+ // log it as a warning.
+ logWarning("Exception while retrieving deployment versions", e);
+ }
+ return new TreeSet<Version>();
+ }
+
private UpdateInstaller getUpdateInstaller(boolean streaming) {
if (streaming) {
if (m_updateInstaller == null) {
@@ -227,7 +287,7 @@ public class DefaultController implement
private void scheduleRun(long seconds) {
unscheduleRun();
- m_scheduledFuture = m_agentContext.getExecutorService().schedule(this, seconds, TimeUnit.SECONDS);
+ m_scheduledFuture = getExecutorService().schedule(this, seconds, TimeUnit.SECONDS);
}
private void unscheduleRun() {
@@ -235,10 +295,6 @@ public class DefaultController implement
m_scheduledFuture.cancel(true);
}
- private AgentContext getAgentContext() {
- return m_agentContext;
- }
-
/**
* Base class for internal installer strategies. This implementation handles max update retry contraints and
* delegates the rest to concrete implementations.
@@ -260,8 +316,7 @@ public class DefaultController implement
public final void installUpdate(Version fromVersion, Version toVersion, boolean fixPackage, long maxRetries) throws RetryAfterException {
if (m_lastVersion != null && toVersion.equals(m_lastVersion)) {
if (m_failureCount >= maxRetries) {
- getController().getAgentContext().logInfo(COMPONENT_IDENTIFIER,
- "Ignoring deployment update %s => %s because max retries reached %d", fromVersion, toVersion, maxRetries);
+ getController().logInfo("Ignoring deployment update %s => %s because max retries reached %d", fromVersion, toVersion, maxRetries);
return;
}
}
@@ -306,10 +361,9 @@ public class DefaultController implement
@Override
public void doInstallUpdate(Version from, Version to, boolean fix) throws RetryAfterException, IOException {
- getController().getAgentContext().logInfo(COMPONENT_IDENTIFIER,
- "Installing streaming deployment update %s => %s", from, to);
+ getController().logInfo("Installing streaming deployment update %s => %s", from, to);
- DeploymentHandler deploymentHandler = getController().getAgentContext().getDeploymentHandler();
+ DeploymentHandler deploymentHandler = getController().getDeploymentHandler();
InputStream inputStream = null;
try {
inputStream = deploymentHandler.getInputStream(to, fix);
@@ -317,19 +371,18 @@ public class DefaultController implement
return;
}
catch (IOException e) {
- getController().getAgentContext().logWarning(COMPONENT_IDENTIFIER,
- "IOException opening/streaming package inputstream", e);
+ getController().logWarning("Exception opening/streaming package inputstream", e);
throw e;
}
finally {
- if (inputStream != null)
+ if (inputStream != null) {
try {
inputStream.close();
}
catch (Exception e) {
- getController().getAgentContext().logWarning(COMPONENT_IDENTIFIER,
- "Exception while closing streaming package inputstream", e);
+ getController().logWarning("Exception while closing streaming package inputstream", e);
}
+ }
}
}
@@ -358,48 +411,36 @@ public class DefaultController implement
@Override
public void doInstallUpdate(Version fromVersion, Version toVersion, boolean fixPackage) throws RetryAfterException, IOException {
- AgentContext agentContext = getController().getAgentContext();
- DeploymentHandler deploymentHandler = agentContext.getDeploymentHandler();
-
+ DeploymentHandler deploymentHandler = getController().getDeploymentHandler();
if (m_downloadHandle != null && !m_downloadVersion.equals(toVersion)) {
-
- agentContext.logInfo(COMPONENT_IDENTIFIER,
- "Cancelling deployment package download for %s because a newer version is available", m_downloadVersion);
+ getController().logInfo("Cancelling deployment package download for %s because a newer version is available", m_downloadVersion);
m_downloadHandle.discard();
m_downloadHandle = null;
}
if (m_downloadHandle == null) {
-
- agentContext.logInfo(COMPONENT_IDENTIFIER, "Starting deployment package download %s => %s", fromVersion, toVersion);
+ getController().logInfo("Starting deployment package download %s => %s", fromVersion, toVersion);
m_downloadVersion = toVersion;
- m_downloadHandle = agentContext.getDeploymentHandler().getDownloadHandle(toVersion, fixPackage)
+ m_downloadHandle = deploymentHandler.getDownloadHandle(toVersion, fixPackage)
.setProgressListener(this).setCompletionListener(this).start();
}
else {
-
if (m_downloadResult == null) {
- agentContext.logInfo(COMPONENT_IDENTIFIER,
- "Deployment package download for %s is in progress %d / %d", toVersion, m_downloadProgress, m_downloadLength);
+ getController().logInfo("Deployment package download for %s is in progress %d / %d", toVersion, m_downloadProgress, m_downloadLength);
}
else if (m_downloadResult.getState() == DownloadState.FAILED) {
- agentContext.logWarning(COMPONENT_IDENTIFIER,
- "Deployment package download for %s is FAILED. Clearing for retry");
+ getController().logWarning("Deployment package download for %s is FAILED. Clearing for retry");
m_downloadHandle.discard();
m_downloadHandle = null;
throw new IOException("Download failed");
}
else if (m_downloadResult.getState() == DownloadState.STOPPED) {
- agentContext.logWarning(COMPONENT_IDENTIFIER,
- "Deployment package download for %s is STOPPED. Trying to resume");
+ getController().logWarning("Deployment package download for %s is STOPPED. Trying to resume");
m_downloadResult = null;
m_downloadHandle.start();
}
else if (m_downloadResult.getState() == DownloadState.SUCCESSFUL) {
-
- agentContext.logInfo(COMPONENT_IDENTIFIER,
- "Installing downloaded deployment update %s => %s", fromVersion, toVersion);
-
+ getController().logInfo("Installing downloaded deployment update %s => %s", fromVersion, toVersion);
InputStream inputStream = new FileInputStream(m_downloadResult.getFile());
try {
deploymentHandler.deployPackage(inputStream);
@@ -416,8 +457,7 @@ public class DefaultController implement
@Override
public void doReset() {
if (m_downloadHandle != null) {
- getController().getAgentContext().logInfo(COMPONENT_IDENTIFIER,
- "Cancelling deployment package download for version %s because of reset", m_downloadVersion);
+ getController().logInfo("Cancelling deployment package download for version %s because of reset", m_downloadVersion);
m_downloadHandle.discard();
}
clearDownloadState();
@@ -432,8 +472,7 @@ public class DefaultController implement
@Override
public void completed(DownloadResult result) {
m_downloadResult = result;
- getController().getAgentContext().logInfo(COMPONENT_IDENTIFIER,
- "Deployment package completed for version %s. Rescheduling the controller to run in %d seconds", m_downloadVersion, 5);
+ getController().logInfo("Deployment package completed for version %s. Rescheduling the controller to run in %d seconds", m_downloadVersion, 5);
getController().scheduleRun(5);
}
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DiscoveryHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DiscoveryHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DiscoveryHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DiscoveryHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -32,7 +32,7 @@ import org.apache.ace.agent.DiscoveryHan
* Default discovery handler that reads the serverURL(s) from the configuration using key {@link DISCOVERY_CONFIG_KEY}.
*
*/
-public class DiscoveryHandlerImpl extends HandlerBase implements DiscoveryHandler {
+public class DiscoveryHandlerImpl extends ComponentBase implements DiscoveryHandler {
public static final String COMPONENT_IDENTIFIER = "discovery";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DownloadHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DownloadHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DownloadHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/DownloadHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -24,7 +24,7 @@ import java.util.concurrent.ExecutorServ
import org.apache.ace.agent.DownloadHandle;
import org.apache.ace.agent.DownloadHandler;
-public class DownloadHandlerImpl extends HandlerBase implements DownloadHandler {
+public class DownloadHandlerImpl extends ComponentBase implements DownloadHandler {
public static final String COMPONENT_IDENTIFIER = "download";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/FeedbackHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/FeedbackHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/FeedbackHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/FeedbackHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -31,7 +31,7 @@ import org.apache.ace.agent.FeedbackHand
/**
* Default implementation of the feedback handler.
*/
-public class FeedbackHandlerImpl extends HandlerBase implements FeedbackHandler {
+public class FeedbackHandlerImpl extends ComponentBase implements FeedbackHandler {
public static final String COMPONENT_IDENTIFIER = "feedback";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/IdentificationHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/IdentificationHandlerImpl.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/IdentificationHandlerImpl.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/IdentificationHandlerImpl.java Fri Aug 23 15:21:03 2013
@@ -26,7 +26,7 @@ import org.apache.ace.agent.Identificati
* {@link IDENTIFICATION_CONFIG_KEY}.
*
*/
-public class IdentificationHandlerImpl extends HandlerBase implements IdentificationHandler {
+public class IdentificationHandlerImpl extends ComponentBase implements IdentificationHandler {
public static final String COMPONENT_IDENTIFIER = "identification";
public static final String CONFIG_KEY_BASE = ConfigurationHandlerImpl.CONFIG_KEY_NAMESPACE + "." + COMPONENT_IDENTIFIER;
Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java?rev=1516879&r1=1516878&r2=1516879&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/UpdateHandlerBase.java Fri Aug 23 15:21:03 2013
@@ -33,7 +33,7 @@ import org.apache.ace.agent.DownloadHand
import org.apache.ace.agent.RetryAfterException;
import org.osgi.framework.Version;
-public class UpdateHandlerBase extends HandlerBase {
+public class UpdateHandlerBase extends ComponentBase {
public UpdateHandlerBase(String componentIdentifier) {
super(componentIdentifier);