felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark van Cuijk <m...@van-cuijk.nl>
Subject Service properties on aspect services in DM
Date Sat, 20 Oct 2012 21:34:40 GMT
Hi,

I've been playing a bit with aspect services using the DependencyManager and I've found some
behavior that doesn't match my expectations. So either my expectations are wrong or I stumbled
upon a bug...

Given an empty interface example.ExampleService, an empty implementation class example.ExampleServiceImpl
and the Activator included below, would expect the aspect with ranking 20 to have property=aspect,
but it actually has property=original, as shown in the Gogo Shell output included below the
Activator source.

What is the intended behavior in this situation?

Regards,
Mark

public class Activator extends DependencyActivatorBase {

  @Override
  public void init(BundleContext context, DependencyManager manager) throws Exception {
    manager.add(createComponent()
        .setInterface(ExampleService.class.getName(), new Properties() {{
          put("property", "original");
        }})
        .setImplementation(ExampleServiceImpl.class));

    manager.add(createAspectService(ExampleService.class, null, 10)
        .setServiceProperties(new Properties() {{
          put("property", "aspect");
        }})
        .setImplementation(ExampleServiceImpl.class));

    manager.add(createAspectService(ExampleService.class, null, 20)
        .setImplementation(ExampleServiceImpl.class));
  }

  @Override
  public void destroy(BundleContext context, DependencyManager manager) throws Exception {
  }

}

[8] AspectExample
  example.ExampleService(property=original) registered
  org.apache.felix.dm.impl.AspectServiceImpl$AspectImpl@6087e704 registered
    example.ExampleService (!(org.apache.felix.dependencymanager.aspect=*)) service optional
available
  example.ExampleService(service.ranking=10,property=aspect,org.apache.felix.dependencymanager.aspect=19)
registered
    example.ExampleService (&(|(!(service.ranking=*))(service.ranking<=9))(|(service.id=19)(org.apache.felix.dependencymanager.aspect=19)))
service required available
  org.apache.felix.dm.impl.AspectServiceImpl$AspectImpl@7a4fe91e registered
    example.ExampleService (!(org.apache.felix.dependencymanager.aspect=*)) service optional
available
  example.ExampleService(service.ranking=20,property=original,org.apache.felix.dependencymanager.aspect=19)
registered
    example.ExampleService (&(|(!(service.ranking=*))(service.ranking<=19))(|(service.id=19)(org.apache.felix.dependencymanager.aspect=19)))
service required available


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message