You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Guillaume Sauthier (JIRA)" <ji...@apache.org> on 2013/09/17 10:46:53 UTC

[jira] [Comment Edited] (FELIX-4229) Provide a way to obtain the component's BundleContext (other than constructor injection)

    [ https://issues.apache.org/jira/browse/FELIX-4229?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13769333#comment-13769333 ] 

Guillaume Sauthier edited comment on FELIX-4229 at 9/17/13 8:45 AM:
--------------------------------------------------------------------

Other options:
{code:java}
    @Context            // same as @Context(COMPONENT)
    @Context(INSTANCE)  // Bundle that declared the instance
    @Context(COMPONENT) // bundle that contains the component's factory
    @Context(PARENT)    // (in composite) parent bundle context
    @Context(HANDLER)   // (in handler) bundle containing the handler factory
    private BundleContext bundleContext;
{code}

                
      was (Author: sauthieg):
    Other options:

    @Context            // same as @Context(COMPONENT)
    @Context(INSTANCE)  // Bundle that declared the instance
    @Context(COMPONENT) // bundle that contains the component's factory
    @Context(PARENT)    // (in composite) parent bundle context
    @Context(HANDLER)   // (in handler) bundle containing the handler factory


                  
> Provide a way to obtain the component's BundleContext (other than constructor injection)
> ----------------------------------------------------------------------------------------
>
>                 Key: FELIX-4229
>                 URL: https://issues.apache.org/jira/browse/FELIX-4229
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>            Reporter: Guillaume Sauthier
>
> Currently, the only common way to get the component's BundleContext is to use constructor injection.
> If we need a no-arg constructor, this is not possible to use that feature.
> It is also possible to be the BundleContext though @PostRegistration annotation, but it's only usable if your component provides a service.
> I need another way to get my BundleContext.
> Maybe something like:
> {code}
> @Requires / @Inject
> private BundleContext bundleContext;
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira