2009/2/4 Stuart McCulloch <[email protected]>:
> however, with great power comes great responsibility ;)
>
> the main reason (afaik) there hasn't been much progress on either
> of these issues is that it can quickly lead to systems where it's hard
> to tell how things will behave at runtime, or indeed if everything has
> been configured correctly
Yes, I was thinking that such an 'improvement' could lead to a
situation where simple things could become difficult :/
> I believe the Guice team understand the need, but prefer to take the
> cautious route (it's easier to add features than remove them later on)
So, instead of changing the main branch, maybe some kind of extension
could be introduced and evaluated?
> you might also want to look into writing a custom module that can take
> a list of remote interfaces and go through them adding bindings like:
>
> for (Class<?> remote : someList) { // list was passed into module
Yes, I have created EjbModule for Guice like this:
---------------------------------------
public class EjbModule extends AbstractModule {
@Override
protected void configure() {
collect(DummyEJBRemote.class);
collect(AppUserServiceRemote.class);
collect(DictServiceRemote.class);
collect(XyzServiceRemote.class, "specialNameForXyzBeanIsPossible");
}
public EjbModule() {
String serverAddress = System.getProperty("netBroker.serverAddress");
NamingContextFactory ctxFactory = new
NamingContextFactory(serverAddress);
Context namingContext = ctxFactory.build();
this.ejbLookup = new DefaultEJbLookup(namingContext);
}
protected final EjbLookup ejbLookup;
protected final ProgrammaticLogin pLogin = new ProgrammaticLogin();
protected void collect(Class remoteInterface) {
collect(remoteInterface, null);
}
protected void collect(Class remoteInterface, String beanName) {
Provider p = new FailsafeEjbProvider(ejbLookup,
remoteInterface, beanName);
binder().bind(remoteInterface).toProvider(p);
}
}
---------------------------------------
In configure, all one has to do is to collect every remote interface
used in application. When injector uses this module, there is no need
to specify any extra annotation, simple @Inject will do.
Maybe, instead of changing the internals of Guice, that would be
enough to refactor/parametrize such an EjbModule and put it in some
Guice Extras. Then, in some FAQ or tutorial, there could be an
example: how to use Giuce for remote EJB3 clients...
Regards,
Witold Szczerba
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---