Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sisu-dev] Sisu 0.3.x???

Hi Jonathan,

For custom annotations you can choose a new scanning strategy (either programatically or with META-INF/services/org.eclipse.sisu.space.SpaceVisitor):

new SpaceModule(space).with(
    new SpaceModule.Strategy() {
        public SpaceVisitor visitor(Binder binder) {
            return new MyTypeVisitor(new QualifiedTypeBinder(binder));
        }
    }
);

Where MyTypeVisitor contains the logic to decide whether a class is a component or not (this allows for more complex logic such as looking for marker interfaces, etc). You can use the delegate pattern to add your custom logic on top of QualifiedTypeVisitor to get both your custom components and any JSR330 components processed in a single pass.

But you can actually use whatever technique you want to bind components - because Sisu can work with any source of bindings. As long as the binding is contained in a module wrapped inside the WireModule then any external dependencies required by that binding will be supplied by Sisu. And as long as the injector is known by Sisu (either because it has a binding to the shared BeanLocator, or because it was added explicitly to the BeanLocator) then the bindings contained inside it will be distributed to satisfy requirements in other injectors. You can add modules programatically by overriding methods in the SisuExtender and related classes or declaratively by listing them in META-INF/services/com.google.inject.Module

In 0.3.0 you’ll also be able to flag certain annotations as pseudo-qualifiers, which is much easier since you then don’t need to mess around with custom strategies.

Wrt. the latest schedule, 0.3.0 should be out before the end of this year shortly followed by 1.0.0 (focus on graduating from the incubator and baselining the public API).

-- 
Cheers, Stuart

PS. the BindingPublisher SPI is meant to be used to integrate non-Guice sources of bound components like the OSGi service registry, etc.

On Monday, 17 November 2014 at 23:03, Jonathan Doklovic wrote:

So, I'm back on trying to get beans exported as OSGi services based on a
custom annotation within the Sisu lifecycle.
Wow, that's actually more complicated than it should be. In Sisu 0.2.x
I'm pretty sure I need to do it within a XXXTypeBinder similar to the
NexusTypeBinder. Unfortunately, I'm not sure if I can just use
binder.bind() along with peaberry stuff, or if I need to lean on the
"BeanPublisher" apis.

At any rate, I know all of this is going to be for not when Sisu 0.3.x
comes out as it's supposed to better handle OSGi service for us.
Any chance that's going to be out soon?

Thanks,

- JD


_______________________________________________
sisu-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit


Back to the top