From 773882e831b629fb6ff42c93b0ded17091154b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 4 Apr 2023 16:34:34 +0200 Subject: [PATCH] Move org.eclipse.equinox.event to use automatic manifest generation This enable the new automatic manifest generation for org.eclipse.equinox.event and use annotations for the component. --- bundles/org.eclipse.equinox.event/.project | 14 ++-------- .../META-INF/MANIFEST.MF | 28 ------------------- .../OSGI-INF/component.xml | 7 ----- .../build.properties | 9 ------ bundles/org.eclipse.equinox.event/pde.bnd | 18 ++++++++++++ .../internal/event/EventComponent.java | 12 ++++++-- 6 files changed, 29 insertions(+), 59 deletions(-) delete mode 100644 bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF delete mode 100644 bundles/org.eclipse.equinox.event/OSGI-INF/component.xml create mode 100644 bundles/org.eclipse.equinox.event/pde.bnd diff --git a/bundles/org.eclipse.equinox.event/.project b/bundles/org.eclipse.equinox.event/.project index 7567a04c6b6..e7146f02ab5 100644 --- a/bundles/org.eclipse.equinox.event/.project +++ b/bundles/org.eclipse.equinox.event/.project @@ -11,17 +11,7 @@ - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.pde.ds.core.builder + org.eclipse.pde.BndBuilder @@ -32,7 +22,7 @@ - org.eclipse.pde.PluginNature + org.eclipse.pde.BndNature org.eclipse.jdt.core.javanature org.eclipse.pde.api.tools.apiAnalysisNature diff --git a/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF deleted file mode 100644 index 1fb57414a7c..00000000000 --- a/bundles/org.eclipse.equinox.event/META-INF/MANIFEST.MF +++ /dev/null @@ -1,28 +0,0 @@ -Bundle-ManifestVersion: 2 -Bundle-Name: %bundleName -Bundle-Version: 1.6.200.qualifier -Bundle-SymbolicName: org.eclipse.equinox.event -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", - org.osgi.service.event;version="[1.3,1.5)", - org.osgi.service.log;version="1.3.0", - org.osgi.util.tracker;version="1.5.0" -Export-Package: org.eclipse.equinox.internal.event;x-internal:=true, - org.eclipse.equinox.internal.event.mapper;x-internal:=true -Bundle-Vendor: %bundleVendor -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.8 -Service-Component: OSGI-INF/component.xml -Bundle-ActivationPolicy: lazy -Provide-Capability: - osgi.service; - objectClass:List="org.osgi.service.event.EventAdmin"; - uses:="org.osgi.service.event", - osgi.implementation; - 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/OSGI-INF/component.xml b/bundles/org.eclipse.equinox.event/OSGI-INF/component.xml deleted file mode 100644 index 89812d4617c..00000000000 --- a/bundles/org.eclipse.equinox.event/OSGI-INF/component.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/bundles/org.eclipse.equinox.event/build.properties b/bundles/org.eclipse.equinox.event/build.properties index fe6b70eb773..20e08a2e812 100644 --- a/bundles/org.eclipse.equinox.event/build.properties +++ b/bundles/org.eclipse.equinox.event/build.properties @@ -11,15 +11,6 @@ # Contributors: # IBM Corporation - initial API and implementation ############################################################################### -bin.includes = META-INF/,\ - plugin*.properties,\ - about.html,\ - .,\ - OSGI-INF/component.xml,\ - OSGI-INF/ -output.. = bin/ -src.includes = about.html -source.. = src/ ## Configuration for TCK tests to execute for this project pom.model.property.tck.artifact = org.osgi.test.cases.event \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.event/pde.bnd b/bundles/org.eclipse.equinox.event/pde.bnd new file mode 100644 index 00000000000..6b362ceb78c --- /dev/null +++ b/bundles/org.eclipse.equinox.event/pde.bnd @@ -0,0 +1,18 @@ +Bundle-Name: %bundleName +Bundle-Version: 1.6.200.qualifier +Bundle-SymbolicName: org.eclipse.equinox.event +Bundle-Vendor: %bundleVendor +Bundle-Localization: plugin +Bundle-ActivationPolicy: lazy +Automatic-Module-Name: org.eclipse.equinox.event +Export-Package: org.eclipse.equinox.internal.event;x-internal:=true, \ + org.eclipse.equinox.internal.event.mapper;x-internal:=true + +-dsannotations-options: version;maximum=1.3 +-runee: JavaSE-1.8 +-includeresource: plugin.properties,\ + about.html + +-buildpath: org.eclipse.osgi, \ + org.osgi.service.event + \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/EventComponent.java b/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/EventComponent.java index e7efe8d5908..c6729a71925 100644 --- a/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/EventComponent.java +++ b/bundles/org.eclipse.equinox.event/src/org/eclipse/equinox/internal/event/EventComponent.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2018 IBM Corporation and others. + * Copyright (c) 2009, 2023 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -10,18 +10,23 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Christoph Läubrich - switch to annotations *******************************************************************************/ package org.eclipse.equinox.internal.event; import org.eclipse.equinox.internal.event.mapper.EventRedeliverer; +import org.osgi.annotation.bundle.Capability; import org.osgi.framework.BundleContext; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; +import org.osgi.service.component.annotations.*; +import org.osgi.service.event.*; +@Component(service = EventAdmin.class) +@Capability(namespace = "osgi.implementation", name = EventConstants.EVENT_ADMIN_IMPLEMENTATION, uses = Event.class, version = EventConstants.EVENT_ADMIN_SPECIFICATION_VERSION) public class EventComponent implements EventAdmin { private EventRedeliverer eventRedeliverer; private EventAdminImpl eventAdmin; + @Activate void activate(BundleContext context) { eventAdmin = new EventAdminImpl(context); eventAdmin.start(); @@ -29,6 +34,7 @@ void activate(BundleContext context) { eventRedeliverer.open(); } + @Deactivate void deactivate(BundleContext context) { eventRedeliverer.close(); eventAdmin.stop();