[
https://issues.apache.org/jira/browse/FELIX-5636?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Jeroen Daanen updated FELIX-5636:
---------------------------------
Description:
The Component for an aspect service does not have service properties. It looks
like this is broken since r.1781908 (had a quick look, but could not find the
cause in the time available).
Without these properties it is not possible to add a dependency in the init
method of the aspect based on one of the aspected service properties.
Example to test it:
{code}
public class Activator extends DependencyActivatorBase {
@Override
public void init(BundleContext context, DependencyManager manager)
throws Exception {
Properties properties = new Properties();
properties.put("PropKey", "PropValue");
Component aComponent =
manager.createComponent().setInterface(X.class.getName(),
properties).setImplementation(new A());
manager.add(aComponent);
manager.add(manager.createAspectService(X.class, null,
100).setImplementation(B.class));
}
public static class A implements X {
public void init(Component component) {
System.out.println("Service properties in A: " +
component.getServiceProperties());
}
}
public static class B implements X {
public void init(Component component) {
System.out.println("Service properties in B: " +
component.getServiceProperties());
}
}
public interface X {
}
}
{code}
The init of B shows empty properties, I expected the inherited properties,
aspect ranking etc.
was:
The Component for an aspect service does not have service properties. It looks
like this is broken since r.1781908 (had a quick look, but could not find the
cause).
Without these properties it is not possible to add a dependency in the init
method of the aspect based on one of the aspected service properties.
Example to test it:
{code}
public class Activator extends DependencyActivatorBase {
@Override
public void init(BundleContext context, DependencyManager manager)
throws Exception {
Properties properties = new Properties();
properties.put("PropKey", "PropValue");
Component aComponent =
manager.createComponent().setInterface(X.class.getName(),
properties).setImplementation(new A());
manager.add(aComponent);
manager.add(manager.createAspectService(X.class, null,
100).setImplementation(B.class));
}
public static class A implements X {
public void init(Component component) {
System.out.println("Service properties in A: " +
component.getServiceProperties());
}
}
public static class B implements X {
public void init(Component component) {
System.out.println("Service properties in B: " +
component.getServiceProperties());
}
}
public interface X {
}
}
{code}
The init of B shows empty properties.
> Component of aspect service does not have any service properties anymore
> ------------------------------------------------------------------------
>
> Key: FELIX-5636
> URL: https://issues.apache.org/jira/browse/FELIX-5636
> Project: Felix
> Issue Type: Bug
> Components: Dependency Manager
> Affects Versions: org.apache.felix.dependencymanager-r9,
> org.apache.felix.dependencymanager-r10
> Reporter: Jeroen Daanen
>
> The Component for an aspect service does not have service properties. It
> looks like this is broken since r.1781908 (had a quick look, but could not
> find the cause in the time available).
> Without these properties it is not possible to add a dependency in the init
> method of the aspect based on one of the aspected service properties.
> Example to test it:
> {code}
> public class Activator extends DependencyActivatorBase {
> @Override
> public void init(BundleContext context, DependencyManager manager)
> throws Exception {
> Properties properties = new Properties();
> properties.put("PropKey", "PropValue");
> Component aComponent =
> manager.createComponent().setInterface(X.class.getName(),
> properties).setImplementation(new A());
> manager.add(aComponent);
>
> manager.add(manager.createAspectService(X.class, null,
> 100).setImplementation(B.class));
> }
> public static class A implements X {
> public void init(Component component) {
> System.out.println("Service properties in A: " +
> component.getServiceProperties());
> }
> }
> public static class B implements X {
> public void init(Component component) {
> System.out.println("Service properties in B: " +
> component.getServiceProperties());
> }
> }
> public interface X {
> }
> }
> {code}
> The init of B shows empty properties, I expected the inherited properties,
> aspect ranking etc.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)