felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Felix Meschberger (JIRA)" <j...@apache.org>
Subject [jira] Commented: (FELIX-925) Extend SCR to allow alternate activate and deactivate method signatures
Date Thu, 09 Jul 2009 12:29:14 GMT

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

Felix Meschberger commented on FELIX-925:
-----------------------------------------

Added support for deactivation reason and enhanced method lookup for the activate/deactivate
methods in Rev. 792527

> Extend SCR to allow alternate activate and deactivate method signatures
> -----------------------------------------------------------------------
>
>                 Key: FELIX-925
>                 URL: https://issues.apache.org/jira/browse/FELIX-925
>             Project: Felix
>          Issue Type: New Feature
>          Components: Declarative Services (SCR), Specification compliance
>    Affects Versions: scr-1.0.6
>         Environment: OSGi RFC-0134, OSGi R4.2 Early Draft 2 (http://www.osgi.org/download/osgi-4.2-early-draft2.pdf)
>            Reporter: Felix Meschberger
>            Assignee: Felix Meschberger
>             Fix For: scr-1.2.0
>
>
> A way is needed to avoid using DS API at all in components with SCR. This means the activate
and deactivate methods should not require the ComponentContext parameter. We should also allow
the names of the activate and deactivate methods to be specified to avoid requiring specific
method names.
> To support this, the follow attributes will be added to the component element:
>     <attribute name="activate" type="token" use="optional" default="activate" />
>     <attribute name="deactivate" type="token" use="optional default="deactivate" />
> The activate attribute will specify the name of the activate method and the deactivate
attribute will specify the name of the deactivate method.
> The signature for the activate and deactivate methods is:
>                     p r o t e c t ed vo i d <me thod - name> (< a r gumen t
s > ) ;
> <arguments> can be zero or more arguments.
> For the activate method each argument must be of one of the following types:
>      ●   ComponentContext - the Component Context for the component
>      ●   BundleContext - the Bundle Context of the component's bundle
>      ●   Map - the Component Properties from ComponentContext.getProperties.
> If any argument of the activate method is not one of the above types, SCR must log an
error message with the Log Service, if present, and the component configuration is not activated.
> For the deactivate method each argument must be of one of the following types:
>      ●   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.
> If any argument of the deactivate method is not one of the above types, SCR must log
an error message with the Log Service, if present, and the deactivation of the component configuration
will continue.
> The methods may also be declared public. The same rules as specified in 112.5.8 will
be used to locate the activate and deactivate methods in the implementation class hierarchy.
> 3.2.1 Component deactivation reasons
> When a component is deactivated, the reason for the deactivation can be passed to the
deactivate method. The following deactivation reasons are specified in ComponentConstants.
>                  /**
>                    * The reason the component instance was deactivated is unspecified.
>                    *
>                    * @since 1.1
>                    */
>                  public static final int DEACTIVATION_REASON_UNSPECIFIED = 0;
>                  /**
>                    * The component instance was deactivated because the component was
disabled.
>                    *
>                    * @since 1.1
>                    */
>                  public static final int DEACTIVATION_REASON_DISABLED = 1;
>                  /**
>                    * The component instance was deactivated because a reference became
unsatisfied.
>                    *
>                    * @since 1.1
>                    */
>                   public static final int DEACTIVATION_REASON_REFERENCE = 2;
>                   /**
>                    * The component instance was deactivated because its configuration
was changed.
>                    *
>                    * @since 1.1
>                    */
>                   public static final int DEACTIVATION_REASON_CONFIGURATION_MODIFIED
= 3;
>                   /**
>                    * The component instance was deactivated because its configuration
was deleted.
>                    *
>                    * @since 1.1
>                    */
>                   public static final int DEACTIVATION_REASON_CONFIGURATION_DELETED =
4;
>                   /**
>                    * The component instance was deactivated because the component was
disposed.
>                    *
>                    * @since 1.1
>                    */
>                   public static final int DEACTIVATION_REASON_DISPOSED = 5;
>                   /**
>                    * The component instance was deactivated because the bundle was stopped.
>                    *
>                    * @since 1.1
>                    */
>                   public static final int DEACTIVATION_REASON_BUNDLE_STOPPED = 6;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message