diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/DefaultArtifactManagerServiceFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/DefaultArtifactManagerServiceFactory.java
index 202d2de07e..a5df865330 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/DefaultArtifactManagerServiceFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/DefaultArtifactManagerServiceFactory.java
@@ -18,7 +18,7 @@
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.repository.Transport;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.core.spi.AgentServicename;
+import org.eclipse.equinox.p2.core.spi.AgentServiceName;
import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.osgi.service.component.annotations.Component;
@@ -28,7 +28,7 @@
* the transport.
*/
@Component(service = IAgentServiceFactory.class)
-@AgentServicename(ArtifactManager.class)
+@AgentServiceName(ArtifactManager.class)
public class DefaultArtifactManagerServiceFactory implements IAgentServiceFactory {
@Override
diff --git a/bundles/org.eclipse.equinox.p2.core/.settings/.api_filters b/bundles/org.eclipse.equinox.p2.core/.settings/.api_filters
new file mode 100644
index 0000000000..d4816d4f61
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.core/.settings/.api_filters
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
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..252782b60a 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
@@ -21,7 +21,7 @@
/**
* Factory for creating {@link IProvisioningEventBus} instances.
*/
-@Component(service = IAgentServiceFactory.class, property = IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + "="
+@Component(service = IAgentServiceFactory.class, property = IAgentServiceFactory.PROP_AGENT_SERVICE_NAME + "="
+ IProvisioningEventBus.SERVICE_NAME, name = "org.eclipse.equinox.p2.core.eventbus")
public class EventBusComponent implements IAgentServiceFactory {
@Override
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
index 85db1b2bdf..91057e3842 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/internal/p2/core/ProvisioningAgent.java
@@ -55,7 +55,9 @@ public Object getService(String serviceName) {
//attempt to get factory service from service registry
Collection> refs;
try {
- refs = context.getServiceReferences(IAgentServiceFactory.class, "(" + IAgentServiceFactory.PROP_CREATED_SERVICE_NAME + '=' + serviceName + ')'); //$NON-NLS-1$
+ refs = context.getServiceReferences(IAgentServiceFactory.class,
+ String.format("(|(%s=%s)(p2.agent.servicename=%s)", //$NON-NLS-1$ use old property as fallback
+ IAgentServiceFactory.PROP_AGENT_SERVICE_NAME, serviceName, serviceName));
} catch (InvalidSyntaxException e) {
e.printStackTrace();
return null;
@@ -171,7 +173,7 @@ public void modifiedService(ServiceReference reference, Ob
public void removedService(ServiceReference reference, Object factoryService) {
if (stopped)
return;
- String serviceName = (String) reference.getProperty(IAgentServiceFactory.PROP_CREATED_SERVICE_NAME);
+ String serviceName = getAgentServiceName(reference);
if (serviceName == null)
return;
Object registered = agentServices.get(serviceName);
@@ -186,4 +188,13 @@ public void removedService(ServiceReference reference, Obj
}
}
+ private String getAgentServiceName(ServiceReference reference) {
+ Object property = reference.getProperty(IAgentServiceFactory.PROP_AGENT_SERVICE_NAME);
+ if (property instanceof String s) {
+ return s;
+ }
+ // backward compatibility
+ return (String) reference.getProperty("p2.agent.servicename"); //$NON-NLS-1$
+ }
+
}
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
similarity index 91%
rename from bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServicename.java
rename to bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/AgentServiceName.java
index 2213d16bf0..ee874436af 100644
--- 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
@@ -23,14 +23,14 @@
/**
* 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}.
+ * required {@link IAgentServiceFactory#PROP_AGENT_SERVICE_NAME}.
*
* @since 2.13
*/
@Retention(CLASS)
@Target(TYPE)
@ComponentPropertyType
-public @interface AgentServicename {
+public @interface AgentServiceName {
public static final String PREFIX_ = "p2."; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/IAgentServiceFactory.java b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/IAgentServiceFactory.java
index a56ec642d9..fb626177e8 100644
--- a/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/IAgentServiceFactory.java
+++ b/bundles/org.eclipse.equinox.p2.core/src/org/eclipse/equinox/p2/core/spi/IAgentServiceFactory.java
@@ -25,12 +25,24 @@ public interface IAgentServiceFactory {
/**
* The service name for the factory service.
*/
- public static final String SERVICE_NAME = IAgentServiceFactory.class.getName();
+ String SERVICE_NAME = IAgentServiceFactory.class.getName();
/**
- * The service property specifying the name of the service created by this factory.
+ * The service property specifying the name of the service created by this
+ * factory.
+ *
+ * @deprecated use {@link #PROP_AGENT_SERVICE_NAME} instead
+ */
+ @Deprecated()
+ String PROP_CREATED_SERVICE_NAME = "p2.agent.servicename"; //$NON-NLS-1$
+
+ /**
+ * The service property specifying the name of the service created by this
+ * factory.
+ *
+ * @since 2.13
*/
- public static final String PROP_CREATED_SERVICE_NAME = "p2.agent.servicename"; //$NON-NLS-1$
+ String PROP_AGENT_SERVICE_NAME = "p2.agent.service.name"; //$NON-NLS-1$
/**
* Instantiates a service instance for the given provisioning agent.
@@ -38,5 +50,5 @@ public interface IAgentServiceFactory {
* @param agent The agent this service will belong to
* @return The created service
*/
- public Object createService(IProvisioningAgent agent);
+ Object createService(IProvisioningAgent agent);
}