ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1514613 - in /ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent: impl/Activator.java impl/AgentUpdateHandlerImpl.java updater/Activator.java
Date Fri, 16 Aug 2013 08:25:04 GMT
Author: marrs
Date: Fri Aug 16 08:25:04 2013
New Revision: 1514613

URL: http://svn.apache.org/r1514613
Log:
ACE-342 Added a feature to uninstall the temporary update bundle when the agent starts.

Modified:
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java
    ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/updater/Activator.java

Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java?rev=1514613&r1=1514612&r2=1514613&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/Activator.java Fri Aug 16
08:25:04 2013
@@ -45,7 +45,7 @@ public class Activator extends Dependenc
     private volatile ConnectionHandler m_connectionHandler;
     private volatile ScheduledExecutorService m_executorService;
     private volatile AgentControlImpl m_agentControl;
-    private volatile AgentUpdateHandler m_agentUpdateHandler;
+    private volatile AgentUpdateHandlerImpl m_agentUpdateHandler; // we use the implementation
type here on purpose
 
     private volatile DefaultController m_controller;
 
@@ -107,14 +107,19 @@ public class Activator extends Dependenc
             .setInterface(AgentControl.class.getName(), null)
             .setImplementation(m_agentControl);
         m_manager.add(m_component);
-        if (m_controller != null)
+        if (m_controller != null) {
             m_controller.start();
+        }
+        // at this point we know the agent has started, so any updater bundle that
+        // might still be running can be uninstalled
+        m_agentUpdateHandler.uninstallUpdaterBundle();
     }
 
     void stopAgent() throws Exception {
         System.out.println("Stopping agent");
-        if (m_controller != null)
+        if (m_controller != null) {
             m_controller.stop();
+        }
         m_manager.remove(m_component);
     }
 

Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java?rev=1514613&r1=1514612&r2=1514613&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java
(original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/impl/AgentUpdateHandlerImpl.java
Fri Aug 16 08:25:04 2013
@@ -36,6 +36,7 @@ import org.apache.ace.agent.DownloadHand
 import org.apache.ace.agent.RetryAfterException;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
 import org.osgi.util.tracker.ServiceTracker;
@@ -49,6 +50,20 @@ public class AgentUpdateHandlerImpl exte
         super(agentContext);
         m_bundleContext = bundleContext;
     }
+    
+    public void uninstallUpdaterBundle() throws BundleException {
+        for (Bundle b : m_bundleContext.getBundles()) {
+            if (UPDATER_SYMBOLICNAME.equals(b.getSymbolicName())) {
+                try {
+                    b.uninstall();
+                }
+                catch (BundleException e) {
+                    b.stop();
+                    throw e;
+                }
+            }
+        }
+    }
 
     @Override
     public Version getInstalledVersion() {

Modified: ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/updater/Activator.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/updater/Activator.java?rev=1514613&r1=1514612&r2=1514613&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/updater/Activator.java (original)
+++ ace/trunk/org.apache.ace.agent/src/org/apache/ace/agent/updater/Activator.java Fri Aug
16 08:25:04 2013
@@ -69,6 +69,7 @@ public class Activator implements Bundle
     
     @Override
     public void run() {
+        // TODO First fetch both streams and store them in a file inside the bundle cache.
         try {
             m_agent.update(m_newStream);
         }



Mime
View raw message