diff --git a/bundles/org.eclipse.passage.loc.products.core/OSGI-INF/org.eclipse.passage.loc.internal.products.core.ProductOperatorServiceImpl.xml b/bundles/org.eclipse.passage.loc.products.core/OSGI-INF/org.eclipse.passage.loc.internal.products.core.ProductOperatorServiceImpl.xml
index 39a46d441..f357d7cc2 100644
--- a/bundles/org.eclipse.passage.loc.products.core/OSGI-INF/org.eclipse.passage.loc.internal.products.core.ProductOperatorServiceImpl.xml
+++ b/bundles/org.eclipse.passage.loc.products.core/OSGI-INF/org.eclipse.passage.loc.internal.products.core.ProductOperatorServiceImpl.xml
@@ -1,9 +1,8 @@
-
+
-
-
+
-
+
\ No newline at end of file
diff --git a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductOperatorServiceImpl.java b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductOperatorServiceImpl.java
index cfea8fc7d..e909b9f15 100644
--- a/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductOperatorServiceImpl.java
+++ b/bundles/org.eclipse.passage.loc.products.core/src/org/eclipse/passage/loc/internal/products/core/ProductOperatorServiceImpl.java
@@ -13,30 +13,32 @@
*******************************************************************************/
package org.eclipse.passage.loc.internal.products.core;
+import java.util.ArrayList;
+import java.util.List;
+
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.eclipse.passage.lic.products.model.api.ProductVersion;
import org.eclipse.passage.loc.internal.e4.events.OperatorProductEvents;
import org.eclipse.passage.loc.internal.equinox.OperatorProductService;
-import org.osgi.framework.BundleContext;
-import org.osgi.service.component.annotations.Activate;
+import org.osgi.framework.FrameworkUtil;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.event.EventAdmin;
@SuppressWarnings("restriction")
@Component
-public class ProductOperatorServiceImpl implements OperatorProductService {
+public final class ProductOperatorServiceImpl implements OperatorProductService {
+
+ private final List events = new ArrayList<>();
- private String plugin;
- @Reference
- private EnvironmentInfo environment;
- @Reference
- private EventAdmin events;
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ public void bindEventAdmin(EventAdmin admin) {
+ this.events.add(admin);
+ }
- @Activate
- public void activate(BundleContext context) {
- plugin = context.getBundle().getSymbolicName();
+ public void unbindEventAdmin(EventAdmin admin) {
+ this.events.remove(admin);
}
@Override
@@ -46,11 +48,12 @@ public String createPassword(ProductVersion descriptor) {
@Override
public IStatus createProductKeys(ProductVersion target) {
- return new ProductVersionKeys(plugin, this::broadcast).createKeys(target);
+ return new ProductVersionKeys(FrameworkUtil.getBundle(getClass()).getSymbolicName(), this::broadcast)
+ .createKeys(target);
}
private void broadcast(String info) {
- events.postEvent(new OperatorProductEvents().keysCreated(info));
+ events.stream().findAny().get().postEvent(new OperatorProductEvents().keysCreated(info));
}
}