GWTP + Errai

519 views
Skip to first unread message

V

unread,
Apr 8, 2012, 4:31:55 PM4/8/12
to GWTP
I'd like to use the Errai event bus and the Errai CDI in a GWT
application built using GWTP. Since Errai provides its own IoC
container, it would simplify things a great deal if the Errai could be
used instead of Gin to manage the GWTP-related components.

If I just leave out the Gin configuration and hope that Errai takes
over (using the correct injection annotations, of course) leads to the
following error message on startup:

The required configuration property 'gin.ginjector' was not found.

I'm just trying to get an idea of the size of the problem - would it
be trivial to change GWTP to use Errai or would it be a large effort?

Thanks!

Cheers,

V.

Christian Goudreau

unread,
Apr 10, 2012, 10:23:08 PM4/10/12
to gwt-pl...@googlegroups.com
Well, there may be some ways to simplify the process. Is Errai using Javax annotations?

If yes, we may only need to change the google provider that we're still using into the gwtp generator by the Javax provider, you would still need to bind the gin.ginjector and give it to the gwtp generators.

We would also need to encapsulate the Ginjector into a provider that will be able to handle both representation. It's not that big of a change, but my assumptions may be wrong...

Don't forget those two line in your ui.xml:
    <define-configuration-property name='gin.ginjector' is-multi-valued='false'/>
    <set-configuration-property name='gin.ginjector' value='You're ginjector'/>

Cheers,
--
Christian Goudreau

V

unread,
Apr 13, 2012, 3:03:23 PM4/13/12
to GWTP
Thanks for the response and the pointers. Yes, Errai is using javax
annotations. I'm going to go through the code with a finer comb and
come back with more questions. The two lines were in the GWT module
configuration.

Currently my project is using GWTP for the client implementation and
Errai for the client-server (and server-client - Errai wonderfully and
seamlessly integrates reverse Ajax) communication. Having CDI support
would make the code super elegant, but wouldn't add or remove any
functionality.

Cheers,

V.

On Apr 11, 4:23 am, Christian Goudreau <goudreau.christ...@gmail.com>
wrote:

christian.sadilek

unread,
Apr 24, 2012, 1:31:30 PM4/24/12
to GWTP
Hi,

In Errai we support both javax.inject and com.google.inject. Errai's
IOC container should be able to satisfy all these injection points. I
think we could find a way to bootstrap GWTP without GIN and let Errai
take care of dependency injection.

We are pretty busy with the 2.0 release but I am definitely interested
in making this work. Contributions are very welcome of course :)!

Cheers,
Christian

On Apr 13, 3:03 pm, V <valen...@nvcode.com> wrote:
> Thanks for the response and the pointers. Yes,Erraiis using javax
> annotations. I'm going to go through the code with a finer comb and
> come back with more questions. The two lines were in the GWT module
> configuration.
>
> Currently my project is using GWTP for the client implementation andErraifor the client-server (and server-client -Erraiwonderfully and
> seamlessly integrates reverse Ajax) communication. Having CDI support
> would make the code super elegant, but wouldn't add or remove any
> functionality.
>
> Cheers,
>
> V.
>
> On Apr 11, 4:23 am, Christian Goudreau <goudreau.christ...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > Well, there may be some ways to simplify the process. IsErraiusing Javax
> > annotations?
>
> > If yes, we may only need to change the google provider that we're still
> > using into the gwtp generator by the Javax provider, you would still need
> > to bind the gin.ginjector and give it to the gwtp generators.
>
> > We would also need to encapsulate the Ginjector into a provider that will
> > be able to handle both representation. It's not that big of a change, but
> > my assumptions may be wrong...
>
> > Don't forget those two line in your ui.xml:
>
> >     <define-configuration-property name='gin.ginjector'
> > is-multi-valued='false'/>
> >     <set-configuration-property name='gin.ginjector' value='You're ginjector'/>
>
> > Cheers,
>
> > On Sun, Apr 8, 2012 at 4:31 PM, V <valen...@nvcode.com> wrote:
> > > I'd like to use theErraievent bus and theErraiCDI in a GWT
> > > application built using GWTP. SinceErraiprovides its own IoC
> > > container, it would simplify things a great deal if theErraicould be
> > > used instead of Gin to manage the GWTP-related components.
>
> > > If I just leave out the Gin configuration and hope thatErraitakes
> > > over (using the correct injection annotations, of course) leads to the
> > > following error message on startup:
>
> > > The required configuration property 'gin.ginjector' was not found.
>
> > > I'm just trying to get an idea of the size of the problem - would it
> > > be trivial to change GWTP to useErraior would it be a large effort?

Christian Goudreau

unread,
Apr 25, 2012, 11:00:29 AM4/25/12
to gwt-pl...@googlegroups.com
We are pretty busy with the 2.0 release but I am definitely interested in making this work. Contributions are very welcome of course :)!
We also are!

Continue the good work guys! I loved your boot at last year Google IO! 

Cheers,
--
Christian Goudreau
Message has been deleted

Jonas Zuberbuehler

unread,
May 6, 2012, 7:25:01 AM5/6/12
to gwt-pl...@googlegroups.com
I'm really looking forward to an integration of Errai into GWTP!

Do you have any suggestion for a workaround to use Errai and GWTP together now until the integration is official?

Cheers
--jonas

Heiko Braun

unread,
May 7, 2012, 2:47:44 AM5/7/12
to gwt-pl...@googlegroups.com
Errai has a low level API that you can use. It allows you to skip the annotations on the client side, but still leverage the core features. 

/heiko


Jonas Zuberbuehler

unread,
May 21, 2012, 3:32:36 PM5/21/12
to gwt-pl...@googlegroups.com
Would appreciate it if you could give me a hint on how to use that API (didn't find anything in the docs).

Thanks!
--jonas

Przemyslaw Galazka

unread,
Feb 25, 2013, 4:38:33 AM2/25/13
to gwt-pl...@googlegroups.com
moreover, it would be very cool to replace GIN by Errai CDI in mature gwt apps with a big base code.
AFAIK Errai cdi provides runtime di not like gin, the compile time di, which force us to recompile the all project.

So, I'm looking forward for official integration. 

Christian Goudreau

unread,
Feb 25, 2013, 11:39:10 AM2/25/13
to gwt-pl...@googlegroups.com
Runtime vs Compile time with GWT... Uhm, I would like to see the sizes of the app between both since GWT compilers doesn't optimize that code anymore. What information does Errai CDI needs to add to objects so that it's easy to manage? I'm really curious. I'll need to experiment :D

Removing reflexion from GWT was a choice rather than an obligation.


--
You received this message because you are subscribed to the Google Groups "GWTP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gwt-platform...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Christian Goudreau

Ümit Seren

unread,
Feb 26, 2013, 3:01:04 AM2/26/13
to gwt-pl...@googlegroups.com
I would be interested in using Errai Bus for Server push. I guess that should be doable without using Errai CDI. 
However at some point I definitely have to look into Errai. The tutorial videos I saw were really impressive.

Mike Brock

unread,
Mar 2, 2013, 2:13:02 PM3/2/13
to gwt-pl...@googlegroups.com
Since I authored Errai IOC/CDI I can offer some insight into that. 

Yes, there's some code-size overhead due to the fact we're supporting bean manager functionality at runtime. So, in Errai you can arbitrarily ask for a new bean that will be wired up when you ask for it.

ie. beanManager.lookupBean(SomeBean.class).newInstance();

Basically, Errai IOC has a bootstrapper class that builds up a set of bean providers, which in turn are generated with dynamic lookups to other providers. So this allows the wiring code of any specific bean to be executed arbitrarily at runtime. There's also some meta-data which is stored to facilitate dynamic lookup.

It's particularly complex for us, too, because CDI supports graph cycles in the spec, meaning we had to support that as well. So there's also some infrastructure for creating proxies and such. 

In Errai 3.0 it's even MORE complicated because we support code splitting at the bean level ...

There's a penalty for using the Errai client side bean manager on the magnitude of perhaps 20kb-50kb depending on how many beans there are -- it could get larger with really large apps, of course. But there's a lot more functionality there. 

I don't think there's much of a runtime performance overhead, computationally speaking compared to Gin, however. The generated wiring code is still largely deterministic: 

--snip-snip--
 
 private final BeanProvider<Bean> inj1857_Bean_creational = new BeanProvider<Bean>() {
   
public Bean getInstance(final CreationalContext context) {
     
final Bean inj1856_Bean = new Bean();
      context
.addBean(context.getBeanReference(Bean.class, arrayOf_19635043Annotation_20063346), inj1856_Bean);
      _1886092084_serviceA
(inj1856_Bean, inj1834_ServiceA);
      _1886092084_serviceB
(inj1856_Bean, inj1854_ServiceB);
      _1886092084_serviceC
(inj1856_Bean, inj1836_ServiceC_creational.getInstance(context));
     
return inj1856_Bean;
   
}
 
};
 
private final Bean inj1856_Bean = inj1857_Bean_creational.getInstance(context);
 
private final BeanProvider<OuterBean> inj1859_OuterBean_creational = new BeanProvider<OuterBean>() {
   
public OuterBean getInstance(final CreationalContext context) {
     
final OuterBean inj1858_OuterBean = new OuterBean();
      context
.addBean(context.getBeanReference(OuterBean.class, arrayOf_19635043Annotation_20063346), inj1858_OuterBean);
      _1089641927_testBean
(inj1858_OuterBean, inj1856_Bean);
     
return inj1858_OuterBean;
   
}
 
};

--snip-snip--

Christian Goudreau

unread,
Mar 5, 2013, 2:35:00 PM3/5/13
to gwt-pl...@googlegroups.com
Nice insight! Thanks Mike! I had only hypotheses, this truly helps me understand.

On another side, what is the payload like for the events? That is the feature I'm most interested in and it look like Errai is growing to be a full fledged framework :D How would you integrate it with GWTP?

We should really build a POC at the GWT Meetup together, kind of a hackaton day before / after io. I really want to know more and give something useful to gwtp community to work with errai! And while I'm having you at hands, why not making the best out of it? :D

Cheers and thanks again!

Mike Brock

unread,
Mar 16, 2013, 12:07:46 PM3/16/13
to gwt-pl...@googlegroups.com
Sure! Sounds awesome!
Reply all
Reply to author
Forward
0 new messages