Discussion:
Deferred Binding - Help!
Matthew Bergshoeff
2018-09-14 13:02:01 UTC
Permalink
Hi Everyone - I've been searching everywhere for a solution to this and
haven't been able to resolve it. I don't think I've properly wrapped my
head around the issue, so hoping someone could provide some guidance.

I am trying to build a modular GWT application - by that I mean that there
will be the core application, but it should support the addition of gwt
modules ("plugins") without having to rebuild. This is being accomplished
by updating parameters in the web.xml so that I can just stop the webapp,
add a .jar file to the /lib directory, define the new .jar in the web.xml
and restart the application. So far so good. The problem arises when trying
to initialize/access the classes within the plugins.

Let's imagine I had a PetStore application (classic example!). I have an
interface called *Pet* that is implemented by some classic examples (Cat,
Dog, Fish) in the core application. However, I want to be able to add a
plugin for an exotic pet (Borneo Pygmy Elephant), and have the application
(client-side) be able to load the class when a record comes up that refers
to it. I am able to do this server-side using a URLClassLoader, but can't
figure out how to use a Generator to instantiate all possible *Pet*
implementations within a module.

If I am going to implement a generator, should it be in the plugin or in
the core application? I've found a few examples, but none seem to pinpoint
exactly what I'm trying to do. Appreciate any help...
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Thomas Broyer
2018-09-14 13:23:58 UTC
Permalink
Post by Matthew Bergshoeff
Hi Everyone - I've been searching everywhere for a solution to this and
haven't been able to resolve it. I don't think I've properly wrapped my
head around the issue, so hoping someone could provide some guidance.
I am trying to build a modular GWT application - by that I mean that there
will be the core application, but it should support the addition of gwt
modules ("plugins") without having to rebuild. This is being accomplished
by updating parameters in the web.xml so that I can just stop the webapp,
add a .jar file to the /lib directory, define the new .jar in the web.xml
and restart the application. So far so good. The problem arises when trying
to initialize/access the classes within the plugins.
Let's imagine I had a PetStore application (classic example!). I have an
interface called *Pet* that is implemented by some classic examples (Cat,
Dog, Fish) in the core application. However, I want to be able to add a
plugin for an exotic pet (Borneo Pygmy Elephant), and have the application
(client-side) be able to load the class when a record comes up that refers
to it. I am able to do this server-side using a URLClassLoader, but can't
figure out how to use a Generator to instantiate all possible *Pet*
implementations within a module.
If I am going to implement a generator, should it be in the plugin or in
the core application? I've found a few examples, but none seem to pinpoint
exactly what I'm trying to do. Appreciate any help...
What you're doing is put several totally distinct apps on a single page,
and making them talk to each other.
Because they are totally distinct apps, their "initially-Java classes" are
produced as different JS objects, obfuscated separately, etc.

Solutions:
* think in terms of JS, not Java, and make the apps actually talk to each
other (e.g. plugin "registers" into core); use JsInterop.
* make a single app with GWT.runAsync() to split the payload, and
configuration to enable/disable some code branches such that some
GWT.runAsync() are never reached.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Josselin Bardet
2018-09-14 13:48:33 UTC
Permalink
Hi

As far has I know (I might be wrong), the generators are executed during
the compilation of the web app. So I think you can't do that without
recompiling you app.

If you recompile your app, with all your plugins in your classpath, you can
implement a generator that will scan for Pet implementations and
instanciate a given class for exemple.

Ex (generated code):
public Pet newPet(Class<? extends Pet> clazz) {
if (clazz.getName().equals("pet.Cat") return new pet.Cat();
if (clazz.getName().equals("pet.Dog") return new pet.Dog();
return null;
}

Le ven. 14 sept. 2018 à 15:09, Matthew Bergshoeff <
Post by Matthew Bergshoeff
Hi Everyone - I've been searching everywhere for a solution to this and
haven't been able to resolve it. I don't think I've properly wrapped my
head around the issue, so hoping someone could provide some guidance.
I am trying to build a modular GWT application - by that I mean that there
will be the core application, but it should support the addition of gwt
modules ("plugins") without having to rebuild. This is being accomplished
by updating parameters in the web.xml so that I can just stop the webapp,
add a .jar file to the /lib directory, define the new .jar in the web.xml
and restart the application. So far so good. The problem arises when trying
to initialize/access the classes within the plugins.
Let's imagine I had a PetStore application (classic example!). I have an
interface called *Pet* that is implemented by some classic examples (Cat,
Dog, Fish) in the core application. However, I want to be able to add a
plugin for an exotic pet (Borneo Pygmy Elephant), and have the application
(client-side) be able to load the class when a record comes up that refers
to it. I am able to do this server-side using a URLClassLoader, but can't
figure out how to use a Generator to instantiate all possible *Pet*
implementations within a module.
If I am going to implement a generator, should it be in the plugin or in
the core application? I've found a few examples, but none seem to pinpoint
exactly what I'm trying to do. Appreciate any help...
--
You received this message because you are subscribed to the Google Groups
"GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Radu Matasaru
2018-09-15 14:36:46 UTC
Permalink
Matthew,
what you describe sounds like the Turducken. Have a look at:
https://www.slideshare.net/RobertKeane1/turducken-divide-and-conquer-large-gwt-apps-with-multiple-teams
and
https://www.slideshare.net/gwtcon/diy-split-gwt-applications-using-turducken-approach-by-alberto-mancini

I vaguely remember Google Wave was done in GWT and had a plugin system:
http://incubator.apache.org/projects/wave.html
Post by Matthew Bergshoeff
Hi Everyone - I've been searching everywhere for a solution to this and
haven't been able to resolve it. I don't think I've properly wrapped my
head around the issue, so hoping someone could provide some guidance.
I am trying to build a modular GWT application - by that I mean that there
will be the core application, but it should support the addition of gwt
modules ("plugins") without having to rebuild. This is being accomplished
by updating parameters in the web.xml so that I can just stop the webapp,
add a .jar file to the /lib directory, define the new .jar in the web.xml
and restart the application. So far so good. The problem arises when trying
to initialize/access the classes within the plugins.
Let's imagine I had a PetStore application (classic example!). I have an
interface called *Pet* that is implemented by some classic examples (Cat,
Dog, Fish) in the core application. However, I want to be able to add a
plugin for an exotic pet (Borneo Pygmy Elephant), and have the application
(client-side) be able to load the class when a record comes up that refers
to it. I am able to do this server-side using a URLClassLoader, but can't
figure out how to use a Generator to instantiate all possible *Pet*
implementations within a module.
If I am going to implement a generator, should it be in the plugin or in
the core application? I've found a few examples, but none seem to pinpoint
exactly what I'm trying to do. Appreciate any help...
--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+***@googlegroups.com.
To post to this group, send email to google-web-***@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
Loading...