Hi Lin,
the annotation code looks cool, will be well cool when blueprint xml is no
longer needed.
Some comments I have (in particular order):
- how does field injection work in the current code, I couldn't see that you
set the extension attribute anywhere?
- what is the intention behind giving the scanner service service.ranking=0, I
thought 0 was the default?
- might it be better to allow the blueprint level settings (defaultActivation,
defaultTimeout, defaultAvailability) in the bundle manifest as opposed to an
annotation on a random class?
- as far as I understand the FactoryMethod annotation, this annotation is going
to be used on the factory class, right? Does this mean that this only works for
factory classes using annotations (and in the same bundle), also how does this
work with multiple factory methods like java.util.concurrent.Executors?
- the Reference and ReferenceList annotations look a bit strange with an
annotation target of type because to me that suggests you can only use them if
your bundle contains the interfaces for any services you want to inject via
annotations.
What about supporting annotation like
class ServiceUser {
@InjectReference(
...
)
private Service service;
}
- also the bind and unbind methods look awkward being marked as Strings in the
ReferenceListener annotation as opposed to having separate annotations like
Init and Destroy? (Same for registration listeners :)
Maybe (although that works only for annotation based reference listeners), and
similarly for RegistrationListeners:
class ServiceUser {
@InjectReference(
listener=Listener.class
)
private Service service;
}
@ReferenceListener
class Listener {
@Bind
public void bind() { ... }
@Unbind
public void unbind() { ... }
}
Apologies for the amount of questions ;)
Regards,
Valentin
On 7 May 2010, at 18:00, Lin Sun wrote:
> Hi
>
> I have been doing some prototype work for blueprint annotation in my
> own sandbox[1]. Currently the code builds in these orders:
> blueprint-annotation-api, blueprint-annotation-impl and
> blueprint-sample-annotation, blueprint-annotation-itest. However the
> itest only run successfully on my local machine, since I also have
> some uncommitted code on my local machine that modifies the blueprint
> core a bit to scan blueprint annotation for bundles that have the
> Bundle-Blueprint-Annotation header to true. I intend to move the
> sandbox code to trunk if there is no objection, so that I can commit
> my change to blueprint core without breaking the aries build. I have
> coded to do runtime annotation scanning only but supporting build time
> generation of blueprint definition XML from annotation should be
> possible.
>
> The blueprint-annotation-api contains some of the basic annotations I
> am proposing, such as @Bean, @Service, @Reference, @ReferenceList,
> @Inject, etc.
>
> The blueprint-annotation-impl contains a bunch of generated and
> slightly modified jaxb files along with some code to scan annotations
> and write the generated blueprint definition to a URL location, using
> xbean-finder.
>
> The blueprint-sample-annotation contains an example of how these
> annotations can be used in the sample.
>
> Comments welcome!
>
> Thanks
>
> Lin
>
> [1] https://svn.apache.org/repos/asf/incubator/aries/sandbox/linsun/blueprint/