Bug 570902 - Remove PROP_USE_DS and activator from
org.eclipse.equinox.event

This code was in place to allow equinox.event to work without DS. We
should enforce that one is installed along with equinox.event.

Also removes activation from test code.

Change-Id: I24efbf466dba9ae4a8629cf2093cf84ace1adc06
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/event/tests/EventAdminTest.java b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/event/tests/EventAdminTest.java
index 3d8039e..0f9256f 100644
--- a/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/event/tests/EventAdminTest.java
+++ b/bundles/org.eclipse.equinox.compendium.tests/src/org/eclipse/equinox/event/tests/EventAdminTest.java
@@ -29,7 +29,6 @@
 
 	@Before
 	public void setUp() throws Exception {
-		Activator.getBundle(Activator.BUNDLE_EVENT).start();
 		eventAdminReference = Activator.getBundleContext().getServiceReference(EventAdmin.class);
 		eventAdmin = Activator.getBundleContext().getService(eventAdminReference);
 	}
@@ -37,7 +36,6 @@
 	@After
 	public void tearDown() throws Exception {
 		Activator.getBundleContext().ungetService(eventAdminReference);
-		Activator.getBundle(Activator.BUNDLE_EVENT).stop();
 	}
 
 	/*
diff --git a/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF
index 3b8e7a5..c92a7cd 100644
--- a/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF
@@ -2,7 +2,6 @@
 Bundle-Name: %bundleName
 Bundle-Version: 1.6.0.qualifier
 Bundle-SymbolicName: org.eclipse.equinox.event
-Bundle-Activator: org.eclipse.equinox.internal.event.Activator
 Import-Package: org.eclipse.osgi.framework.eventmgr;version="1.1.0",
  org.eclipse.osgi.util;version="1.1.0",
  org.osgi.framework;version="1.6.0",
@@ -24,4 +23,6 @@
   osgi.implementation="osgi.event";
   uses:="org.osgi.service.event";
   version:Version="1.4"
+Require-Capability: osgi.extender;
+ filter:="(&(osgi.extender=osgi.component)(version>=1.0)(!(version>=2.0)))"
 Automatic-Module-Name: org.eclipse.equinox.event
diff --git a/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/Activator.java b/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/Activator.java
deleted file mode 100644
index 042fae2..0000000
--- a/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/Activator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2018 IBM Corporation and others.
- *
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
- * https://www.eclipse.org/legal/epl-2.0/
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- *     IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.event;
-
-import org.osgi.framework.*;
-import org.osgi.service.event.EventAdmin;
-
-public class Activator implements BundleActivator {
-	private static final String PROP_USE_DS = "equinox.use.ds"; //$NON-NLS-1$
-	private ServiceRegistration<EventAdmin> eventAdminService;
-	private EventComponent eventAdmin;
-
-	@Override
-	public void start(BundleContext bundleContext) throws InvalidSyntaxException {
-		if (Boolean.valueOf(bundleContext.getProperty(PROP_USE_DS)).booleanValue())
-			return; // If this property is set we assume DS is being used.
-		String serviceName = EventAdmin.class.getName();
-		Filter serviceFilter = bundleContext.createFilter("(objectclass=" + serviceName + ")"); //$NON-NLS-1$ //$NON-NLS-2$
-		//don't register the service if this bundle has already registered it declaratively
-		ServiceReference<?>[] refs = bundleContext.getBundle().getRegisteredServices();
-		if (refs != null) {
-			for (ServiceReference<?> ref : refs) {
-				if (serviceFilter.match(ref)) {
-					return; // We found a service registered by this bundle already
-				}
-			}
-		}
-
-		eventAdmin = new EventComponent();
-		eventAdmin.activate(bundleContext);
-		eventAdminService = bundleContext.registerService(EventAdmin.class, eventAdmin, null);
-	}
-
-	@Override
-	public void stop(BundleContext bundleContext) {
-		if (eventAdmin != null) {
-			eventAdminService.unregister();
-			eventAdmin.deactivate(bundleContext);
-		}
-	}
-}