From f3eee4cb2ad004bdfd3d06f98c67cbe93ba7e1d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Sat, 16 Mar 2024 08:29:14 +0100 Subject: [PATCH] Add a component property type for Agentservice name --- .../org.eclipse.pde.ds.annotations.prefs | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../internal/p2/core/EventBusComponent.java | 5 +- .../equinox/p2/core/spi/AgentServicename.java | 39 +++++++++++++++ .../.settings/.api_filters | 47 ------------------- .../org.eclipse.pde.ds.annotations.prefs | 7 +++ .../META-INF/MANIFEST.MF | 5 +- .../OSGI-INF/.gitignore | 1 + .../OSGI-INF/engine.xml | 8 ---- .../OSGI-INF/profileRegistry.xml | 8 ---- .../internal/p2/engine/EngineComponent.java | 6 ++- .../p2/engine/ProfileRegistryComponent.java | 4 ++ .../.settings/.api_filters | 21 --------- .../META-INF/MANIFEST.MF | 2 +- 14 files changed, 65 insertions(+), 92 deletions(-) create mode 100644 bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServicename.java delete mode 100644 bundles/org.eclipse.equinox.p2.engine/.settings/.api_filters create mode 100644 bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.ds.annotations.prefs create mode 100644 bundles/org.eclipse.equinox.p2.engine/OSGI-INF/.gitignore delete mode 100644 bundles/org.eclipse.equinox.p2.engine/OSGI-INF/engine.xml delete mode 100644 bundles/org.eclipse.equinox.p2.engine/OSGI-INF/profileRegistry.xml diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.ds.annotations.prefs b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.ds.annotations.prefs index 38f9eecff8..5faf08b7d5 100644 --- a/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.ds.annotations.prefs +++ b/bundles/org.eclipse.equinox.p2.core/.settings/org.eclipse.pde.ds.annotations.prefs @@ -1,4 +1,4 @@ -dsVersion=V1_3 +dsVersion=V1_4 eclipse.preferences.version=1 enabled=true generateBundleActivationPolicyLazy=true diff --git a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF index 845cea4229..38b2d0e262 100644 --- a/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.core;singleton:=true -Bundle-Version: 2.11.0.qualifier +Bundle-Version: 2.12.0.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.core.Activator Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/EventBusComponent.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/EventBusComponent.java index 425bc5d3ad..1996b89acb 100644 --- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/EventBusComponent.java +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/EventBusComponent.java @@ -15,14 +15,15 @@ import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.spi.AgentServicename; import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; import org.osgi.service.component.annotations.Component; /** * Factory for creating {@link IProvisioningEventBus} instances. */ -@Component(service = IAgentServiceFactory.class, property = IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + "=" - + IProvisioningEventBus.SERVICE_NAME, name = "org.eclipse.equinox.p2.core.eventbus") +@Component(service = IAgentServiceFactory.class, name = "org.eclipse.equinox.p2.core.eventbus") +@AgentServicename(IProvisioningEventBus.class) public class EventBusComponent implements IAgentServiceFactory { @Override public Object createService(IProvisioningAgent agent) { diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServicename.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServicename.java new file mode 100644 index 0000000000..fe96d63363 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServicename.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2024 Christoph Läubrich 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: + * Christoph Läubrich - initial API and implementation + *******************************************************************************/ +package org.eclipse.equinox.p2.core.spi; + +import static java.lang.annotation.ElementType.TYPE; +import static java.lang.annotation.RetentionPolicy.CLASS; + +import java.lang.annotation.Retention; +import java.lang.annotation.Target; +import org.osgi.service.component.annotations.ComponentPropertyType; + +/** + * This component property type can be used to annotate a declarative service + * component that provides an {@link IAgentServiceFactory} to provides the + * required {@link IAgentServiceFactory#PROP_CREATED_SERVICE_NAME}. + * + * @since 2.12 + */ +@Retention(CLASS) +@Target(TYPE) +@ComponentPropertyType +public @interface AgentServicename { + + public static final String PREFIX_ = "p2."; //$NON-NLS-1$ + + Class value(); + +} diff --git a/bundles/org.eclipse.equinox.p2.engine/.settings/.api_filters b/bundles/org.eclipse.equinox.p2.engine/.settings/.api_filters deleted file mode 100644 index cd22b134bf..0000000000 --- a/bundles/org.eclipse.equinox.p2.engine/.settings/.api_filters +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.ds.annotations.prefs b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.ds.annotations.prefs new file mode 100644 index 0000000000..5faf08b7d5 --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/.settings/org.eclipse.pde.ds.annotations.prefs @@ -0,0 +1,7 @@ +dsVersion=V1_4 +eclipse.preferences.version=1 +enabled=true +generateBundleActivationPolicyLazy=true +path=OSGI-INF +validationErrorLevel=error +validationErrorLevel.missingImplicitUnbindMethod=error diff --git a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF index 18c3eb4c23..0c5aa45f5f 100644 --- a/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.engine;singleton:=true -Bundle-Version: 2.10.0.qualifier +Bundle-Version: 2.10.100.qualifier Bundle-Activator: org.eclipse.equinox.internal.p2.engine.EngineActivator Bundle-Vendor: %providerName Bundle-Localization: plugin @@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.equinox.common, Eclipse-RegisterBuddy: org.eclipse.equinox.p2.metadata.repository Bundle-RequiredExecutionEnvironment: JavaSE-17 Bundle-ActivationPolicy: lazy -Service-Component: OSGI-INF/profileRegistry.xml, OSGI-INF/engine.xml +Service-Component: OSGI-INF/org.eclipse.equinox.p2.engine.registry.xml, + OSGI-INF/org.eclipse.equinox.p2.engine.xml Import-Package: javax.xml.parsers, org.bouncycastle.openpgp;version="1.65.0", org.eclipse.core.internal.preferences, diff --git a/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/.gitignore b/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/.gitignore new file mode 100644 index 0000000000..b878e882ac --- /dev/null +++ b/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/.gitignore @@ -0,0 +1 @@ +/*.xml diff --git a/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/engine.xml b/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/engine.xml deleted file mode 100644 index e656d3628c..0000000000 --- a/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/engine.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/profileRegistry.xml b/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/profileRegistry.xml deleted file mode 100644 index 3d4ac83840..0000000000 --- a/bundles/org.eclipse.equinox.p2.engine/OSGI-INF/profileRegistry.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java index e283447ed2..f2272728dc 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java @@ -7,20 +7,24 @@ * 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.p2.engine; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.spi.AgentServicename; import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; import org.eclipse.equinox.p2.engine.IEngine; +import org.osgi.service.component.annotations.Component; /** * Component that provides a factory that can create and initialize * {@link IEngine} instances. */ +@Component(name = "org.eclipse.equinox.p2.engine", service = IAgentServiceFactory.class) +@AgentServicename(IEngine.class) public class EngineComponent implements IAgentServiceFactory { @Override diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java index d27ae5b8f0..df8f183a41 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java @@ -16,12 +16,16 @@ import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus; import org.eclipse.equinox.p2.core.IAgentLocation; import org.eclipse.equinox.p2.core.IProvisioningAgent; +import org.eclipse.equinox.p2.core.spi.AgentServicename; import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory; import org.eclipse.equinox.p2.engine.IProfileRegistry; +import org.osgi.service.component.annotations.Component; /** * Instantiates default instances of {@link IProfileRegistry}. */ +@Component(name = "org.eclipse.equinox.p2.engine.registry", service = IAgentServiceFactory.class) +@AgentServicename(IProfileRegistry.class) public class ProfileRegistryComponent implements IAgentServiceFactory { @Override diff --git a/bundles/org.eclipse.equinox.p2.metadata/.settings/.api_filters b/bundles/org.eclipse.equinox.p2.metadata/.settings/.api_filters index dff2851189..d8f48e5c23 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/.settings/.api_filters +++ b/bundles/org.eclipse.equinox.p2.metadata/.settings/.api_filters @@ -1,26 +1,5 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF index 9cc4af592d..07c1cbaa1e 100644 --- a/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.p2.metadata;singleton:=true -Bundle-Version: 2.9.0.qualifier +Bundle-Version: 2.9.100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Export-Package: org.eclipse.equinox.internal.p2.metadata;