Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java')
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java58
1 files changed, 3 insertions, 55 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
index 6a41d2d38..043ba761d 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
@@ -10,76 +10,24 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.artifact.repository;
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
-import org.osgi.framework.*;
-import org.osgi.util.tracker.ServiceTracker;
-import org.osgi.util.tracker.ServiceTrackerCustomizer;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
-public class Activator implements BundleActivator, ServiceTrackerCustomizer {
+public class Activator implements BundleActivator {
public static final String ID = "org.eclipse.equinox.p2.artifact.repository"; //$NON-NLS-1$
public static final String REPO_PROVIDER_XPT = ID + '.' + "artifactRepositories"; //$NON-NLS-1$
private static BundleContext context;
- private ServiceRegistration repositoryManagerRegistration;
- private static final Map<ArtifactRepositoryManager, IProvisioningAgent> createdManagers = new HashMap<ArtifactRepositoryManager, IProvisioningAgent>();
- private ServiceTracker agentTracker;
public static BundleContext getContext() {
return Activator.context;
}
- /**
- * Remember an artifact repository manager so we can shut it down when the bundle stops
- */
- static void addManager(ArtifactRepositoryManager manager, IProvisioningAgent agent) {
- synchronized (createdManagers) {
- createdManagers.put(manager, agent);
- }
- }
-
public void start(BundleContext aContext) throws Exception {
Activator.context = aContext;
- // need to track agent so we can register global artifact repository manager
- String filter = "(&(objectClass=" + IProvisioningAgent.SERVICE_NAME + ")(agent.current=true))"; //$NON-NLS-1$ //$NON-NLS-2$
- agentTracker = new ServiceTracker(context, aContext.createFilter(filter), this);
- agentTracker.open();
}
public void stop(BundleContext aContext) throws Exception {
Activator.context = null;
- if (repositoryManagerRegistration != null)
- repositoryManagerRegistration.unregister();
- repositoryManagerRegistration = null;
- synchronized (createdManagers) {
- for (ArtifactRepositoryManager manager : createdManagers.keySet()) {
- manager.shutdown();
- IProvisioningAgent agent = createdManagers.get(manager);
- agent.unregisterService(IArtifactRepositoryManager.SERVICE_NAME, manager);
- }
- createdManagers.clear();
- }
- agentTracker.close();
- }
-
- public Object addingService(ServiceReference reference) {
- //when someone registers the agent service, register a repository manager service
- IProvisioningAgent agent = (IProvisioningAgent) context.getService(reference);
- repositoryManagerRegistration = context.registerService(IArtifactRepositoryManager.SERVICE_NAME, agent.getService(IArtifactRepositoryManager.SERVICE_NAME), null);
- return agent;
- }
-
- public void modifiedService(ServiceReference reference, Object service) {
- // ignored
- }
-
- public void removedService(ServiceReference reference, Object service) {
- //the agent is going away so withdraw our service
- if (repositoryManagerRegistration != null) {
- repositoryManagerRegistration.unregister();
- repositoryManagerRegistration = null;
- }
}
}

Back to the top