Skip to content

Commit

Permalink
Add a component property type for Agentservice name
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Mar 17, 2024
1 parent e0ce87e commit 47163e5
Show file tree
Hide file tree
Showing 14 changed files with 113 additions and 119 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
dsVersion=V1_3
dsVersion=V1_4
eclipse.preferences.version=1
enabled=true
generateBundleActivationPolicyLazy=true
Expand Down
2 changes: 1 addition & 1 deletion bundles/org.eclipse.equinox.p2.core/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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();

}
47 changes: 0 additions & 47 deletions bundles/org.eclipse.equinox.p2.engine/.settings/.api_filters

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dsVersion=V1_4
eclipse.preferences.version=1
enabled=true
generateBundleActivationPolicyLazy=true
path=OSGI-INF
validationErrorLevel=error
validationErrorLevel.missingImplicitUnbindMethod=error
5 changes: 3 additions & 2 deletions bundles/org.eclipse.equinox.p2.engine/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions bundles/org.eclipse.equinox.p2.engine/OSGI-INF/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*.xml
8 changes: 0 additions & 8 deletions bundles/org.eclipse.equinox.p2.engine/OSGI-INF/engine.xml

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 <code>null</code> to run default phases
* @param monitor A progress monitor, or <code>null</code> 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 <code>null</code> 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);
}
Loading

0 comments on commit 47163e5

Please sign in to comment.