Enhanced support for custom scopes
----------------------------------
Key: ARIES-657
URL: https://issues.apache.org/jira/browse/ARIES-657
Project: Aries
Issue Type: Improvement
Components: Blueprint
Reporter: Brian DePradine
I am currently working on a project that requires the use of a custom scope as
follows:
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:test="http://test.org">
<bean id="fooService" class="fooServiceImpl" scope="test:foo"/>
</blueprint>
In order to support my custom scope, I provide a NamespaceHandler whose job it
is to register a BeanProcessor that implements the caching required by my
custom scope. This then allows the cached instances to be retried using
BlueprintContainer.getComponentInstance(). When I tried to get this working,
however, I discovered a few issues.
1) Aries treats all scopes as strings, and as a result the scope from the
example above is "test:foo". This is incorrect, as custom scopes are always
qualified names, and so the correct value for the scope is
"{http://test.org}foo".
2) All beans that do not have a scope of "prototype" are automatically cached
by the blueprint container. This means that my bean processor is only ever
called the first time that the bean is requested. My bean processor is unable
to do its job unless it is called everytime that a request for the bean is made.
3) Eager activation doesn't make sense for a custom scope, as it should only
apply to 'singleton' scopes.
Patch to follow.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira