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..7deb99b78d 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.SERVICE_NAME) 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..b26d804168 --- /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$ + + String 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..50d594b9d8 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.SERVICE_NAME) 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..d812b17dc3 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.SERVICE_NAME) public class ProfileRegistryComponent implements IAgentServiceFactory { @Override diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java index 293329c568..cd0b6b2531 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IEngine.java @@ -28,7 +28,7 @@ * customize the set of phases that are executed, or else the engine will execute * a default set of phases. During each phase the changes described by the provisioning * plan are performed against the profile being provisioned. - * + * * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. * @since 2.0 @@ -37,37 +37,37 @@ public interface IEngine { /** * Service name constant for the engine service. */ - public static final String SERVICE_NAME = IEngine.class.getName(); + String SERVICE_NAME = "org.eclipse.equinox.p2.engine.IEngine"; //$NON-NLS-1$ /** * Creates a provisioning plan whose methods can be use to provide pre-validated changes. * This is an advanced method for clients that know they are creating changes that do * not require validation by a planner. Most clients should instead obtain a validated plan * from a planner. - * + * * @param profile The profile to operate against * @param context The provisioning context for the plan * @return A provisioning plan */ - public IProvisioningPlan createPlan(IProfile profile, ProvisioningContext context); + IProvisioningPlan createPlan(IProfile profile, ProvisioningContext context); /** * Executes a provisioning plan. - * + * * @param plan The plan describing the changes to be made * @param phaseSet The phases to run, or null to run default phases * @param monitor A progress monitor, or null if progress reporting is not required * @return The result of executing the plan */ - public IStatus perform(IProvisioningPlan plan, IPhaseSet phaseSet, IProgressMonitor monitor); + IStatus perform(IProvisioningPlan plan, IPhaseSet phaseSet, IProgressMonitor monitor); /** * Executes a provisioning plan with a default phase set and context. - * + * * @param plan The plan describing the changes to be made * @param monitor A progress monitor, or null if progress reporting is not required * @return The result of executing the plan */ - public IStatus perform(IProvisioningPlan plan, IProgressMonitor monitor); + IStatus perform(IProvisioningPlan plan, IProgressMonitor monitor); } diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java index eddb377b33..557a284e92 100644 --- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java +++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/IProfileRegistry.java @@ -20,9 +20,9 @@ import org.eclipse.equinox.p2.core.ProvisionException; /** - * This encapsulates the access to the profile registry. + * This encapsulates the access to the profile registry. * It deals with persistence in a transparent way. - * + * * @noimplement This interface is not intended to be implemented by clients. * @noextend This interface is not intended to be extended by clients. * @since 2.0 @@ -35,77 +35,77 @@ public interface IProfileRegistry { * may not have a defined self profile, for example if the running system doesn't * have a profile, or resides in a different profile registry. */ - public static final String SELF = "_SELF_"; //$NON-NLS-1$ + String SELF = "_SELF_"; //$NON-NLS-1$ /** * Service name constant for the profile registry service. */ - public static final String SERVICE_NAME = IProfileRegistry.class.getName(); + String SERVICE_NAME = "org.eclipse.equinox.p2.engine.IProfileRegistry"; //$NON-NLS-1$ /** - * Return the profile in the registry that has the given id. If it does not exist, + * Return the profile in the registry that has the given id. If it does not exist, * then return null. - * + * * @param id the profile identifier * @return the profile or null */ - public IProfile getProfile(String id); + IProfile getProfile(String id); /** - * Return the profile in the registry that has the given id and timestamp. If it does not exist, + * Return the profile in the registry that has the given id and timestamp. If it does not exist, * then return null. - * + * * @param id the profile identifier * @param timestamp the profile's timestamp * @return the profile or null */ - public IProfile getProfile(String id, long timestamp); + IProfile getProfile(String id, long timestamp); /** - * Return an array of timestamps in ascending order for the profile id in question. + * Return an array of timestamps in ascending order for the profile id in question. * If there are none, then return an empty array. - * + * * @param id the id of the profile to list timestamps for * @return the array of timestamps */ - public long[] listProfileTimestamps(String id); + long[] listProfileTimestamps(String id); /** * Return an array of profiles known to this registry. If there are none, then * return an empty array. - * + * * @return the array of profiles */ - public IProfile[] getProfiles(); + IProfile[] getProfiles(); /** * Add the given profile to this profile registry. - * + * * @param id the profile id * @throws ProvisionException if a profile * with the same id is already present in the registry. * @return the new empty profile */ - public IProfile addProfile(String id) throws ProvisionException; + IProfile addProfile(String id) throws ProvisionException; /** * Add the given profile to this profile registry. - * + * * @param id the profile id * @param properties the profile properties * @throws ProvisionException if a profile * with the same id is already present in the registry. * @return the new empty profile */ - public IProfile addProfile(String id, Map properties) throws ProvisionException; + IProfile addProfile(String id, Map properties) throws ProvisionException; /** * Returns whether this profile registry contains a profile with the given id. - * + * * @param profileId The id of the profile to search for * @return true if this registry contains a profile with the given id, * and false otherwise. */ - public boolean containsProfile(String profileId); + boolean containsProfile(String profileId); /** * Remove the given profile snapshot from this profile registry. This method has no effect @@ -113,50 +113,50 @@ public interface IProfileRegistry { * The current profile cannot be removed using this method. When a particular profile state * is removed from the registry, the corresponding profile state properties for that * particular state are also removed. - * + * * @param id the profile to remove - * @param timestamp the timestamp of the profile to remove + * @param timestamp the timestamp of the profile to remove * @throws ProvisionException if the profile with the specified id and timestamp is the current profile. */ - public void removeProfile(String id, long timestamp) throws ProvisionException; + void removeProfile(String id, long timestamp) throws ProvisionException; /** * Remove the given profile from this profile registry. This method has no effect * if this registry does not contain a profile with the given id. When a profile is removed * from the registry, all of its associated profile state properties are removed as well. - * + * * @param id the profile to remove */ - public void removeProfile(String id); + void removeProfile(String id); /** * Check if the given profile from this profile registry is up-to-date. - * + * * @param profile the profile to check * @return boolean true if the profile is current; false otherwise. */ - public boolean isCurrent(IProfile profile); + boolean isCurrent(IProfile profile); /** * Set properties on a specific profile state. Overwrite existing properties if present. - * + * * @param id the identifier of the profile * @param timestamp the timestamp of the profile * @param properties the properties to set on the profile * @return status object indicating success or failure - * @throws NullPointerException if either id or properties are null + * @throws NullPointerException if either id or properties are null * @since 2.1 */ - public IStatus setProfileStateProperties(String id, long timestamp, Map properties); + IStatus setProfileStateProperties(String id, long timestamp, Map properties); /** * Set a specific property on a specific profile state. Overwrite existing properties if present. *

* Use of this method is discouraged if multiple properties will be set on the same state since - * the implementation of this method may access the file-system with each call. Callers should use - * {@link #setProfileStateProperties(String, long, Map)} instead. + * the implementation of this method may access the file-system with each call. Callers should use + * {@link #setProfileStateProperties(String, long, Map)} instead. *

- * + * * @param id the profile identifier * @param timestamp the timestamp of the profile * @param key the property key to set @@ -165,13 +165,13 @@ public interface IProfileRegistry { * @throws NullPointerException if any of id, key or value is null * @since 2.1 */ - public IStatus setProfileStateProperty(String id, long timestamp, String key, String value); + IStatus setProfileStateProperty(String id, long timestamp, String key, String value); /** * Return all properties for a particular profile state. Both the key and the values are String. * Return an empty map if there was a problem accessing the properties. *

- * There is no guarantee that all state timestamps returned will still exist in the registry + * There is no guarantee that all state timestamps returned will still exist in the registry * since the user could delete profile states from the file system. *

* @param id the profile identifier @@ -180,14 +180,14 @@ public interface IProfileRegistry { * @throws NullPointerException if profile id is null. * @since 2.1 */ - public Map getProfileStateProperties(String id, long timestamp); + Map getProfileStateProperties(String id, long timestamp); /** * Return a map of profile timestamps to values for all profile states that contain the given property key. * Both the key and value are of type String. * Return an empty map if there was a problem accessing the properties. *

- * There is no guarantee that all state timestamps returned will still exist in the registry + * There is no guarantee that all state timestamps returned will still exist in the registry * since the user could delete profile states from the file system. *

* @param id the profile identifier @@ -196,13 +196,13 @@ public interface IProfileRegistry { * @throws NullPointerException if the profile id or key is null. * @since 2.1 */ - public Map getProfileStateProperties(String id, String key); + Map getProfileStateProperties(String id, String key); /** * Remove all properties with matching keys from the given profile state. Non-existent keys are * ignored. If the state does not exist the method performs a no-op and returns normally. If the keys * parameter is null then remove all properties from the profile state. - * + * * @param id the profile identifier * @param timestamp the profile timestamp * @param keys the property keys to remove, or null @@ -210,5 +210,5 @@ public interface IProfileRegistry { * @throws NullPointerException if the profile id is null. * @since 2.1 */ - public IStatus removeProfileStateProperties(String id, long timestamp, Collection keys); + IStatus removeProfileStateProperties(String id, long timestamp, Collection keys); }