Created

Jan 29, 2013

OSGI Activate & Deactivate signatures

Posted by Nicolas Peltier

it's sometimes a bit confusing which signature to use for activate or deactivate in an OSGI component. This is because you have the choice, and this is nice :-) 

As long as you add the @Activate and @Deactivate tag before your methods, you can have zero, one or several arguments among following types (that will be automatically bound at component activation/deactivation): 

Activation

  • ComponentContext - the Component Context for the component
  • BundleContext - the Bundle Context of the component's bundle
  • Map - the Component Properties from ComponentContext.getProperties.     

Deactivation:     

  • int/Integer - the deactivation reason
  • ComponentContext - the Component Context for the component
  • BundleContext - the Bundle Context of the component's bundle
  • Map - the Component Properties from ComponentContext.getProperties.

For more information on this, you can look at the dedicated Apache Felix JIRA

COMMENTS

  • By nieufnie.pl - 8:04 AM on May 27, 2013   Reply
    Naturalnie, nie wszyscy poń mogą dosięgać, tudzież wręcz odwrotnie, papierosy elektroniczne są skierowane jedynie aż do osób
    • By poker live - 9:41 AM on Jun 15, 2013   Reply
      This is a good reason. Thanks, I enjoyed and bookmarked.

      ADD A COMMENT