[ http://issues.apache.org/jira/browse/BEEHIVE-365?page=all ]
Kyle Marvin updated BEEHIVE-365:
--------------------------------
Fix Version: TBD
(was: V1)
Pushing this minor feature out to a future release, there is a simple
workaround, which is use to use BeanContextServices API on ControlBeanContext
to query the existence of a service, as follows:
@Context ControlBeanContext context;
...
TheService service = context.getService(TheService.class,
null);
if (service == null)
{
// service unavailable in execution context
}
else
{
// service available in execution context
}
> Enable optional declarative contextual services
> -----------------------------------------------
>
> Key: BEEHIVE-365
> URL: http://issues.apache.org/jira/browse/BEEHIVE-365
> Project: Beehive
> Type: Improvement
> Components: Controls
> Versions: V1Beta
> Reporter: Kyle Marvin
> Assignee: Kyle Marvin
> Priority: Minor
> Fix For: TBD
>
> It would be nice to be able to declaratively specify a contextual service
> whose presence is optional. Currently, if a service isn't available a
> ControlException will be thrown during impl initialization.
> Having a 'soft failure' mode where no exception is thrown but the service ref
> is left null would allow:
> - user code to generate a more specific and useful error message in an
> onCreate handler if a needed service is unavailable.
> - allow user (or test) code to be written that behaves conditionally based
> upon whether certain contextual services are/are not available
> The default value of 'required' would be true, meaning that if the attribute
> was not present on an @Context declaration, the behavior would be identical
> to what it is today (bean instantiation will fail).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira