Peter and I managed to get kitchensink, helloworld and desktopclone to
be deployed in OSGi environment. So far the experience of using GWT
has been a pleasure.
However, I'm stuck to get further i.e. by using OSGi to contributes
content to Gwt application (i.e. similar to how eclipse plugin can
contribute view or perspective to an eclipse application). The basic
idea is, if we create a CRM application for example, if the client only
buy 4 modules, all we need to do is just deploy the 4 module bundles.
If the client is buying additional 3 modules, all is required is just
to deploy the 3 additional bundles.
If someone can enlighten me on how to do this. I'll be very grateful.
Regards,
Edward Yakop
Note:
- If anyone interested on how to get GWT application to be deployed in
OSGi container (in this case is equinox). The source codes can be
downloaded from ops4j svn repository:
https://scm.ops4j.org/repos/ops4j/laboratory/users/peter/gwt-osgi
> How did you deploy the GWT application? As a bundle?
I use OBR http service (http://oscar-osgi.sf.net/repo/http/http.jar)
and everything are are deployed in equinox OSGi container.
All the samples gwt application are managed by gwtview bundle (to be
renamed to pax-gwt-service). Each of the gwt application are deployed
in their own separate bundle. In this context, kitchen sink, helloword
and desktop clone are in their own seperate bundle. Each of the gwt
application bundle only requires to instantiate PaxGwtApplication in
the activator and register the PaxGwtApplication.
For example:
<code>
package org.ops4j.pax.gwt.samples.mail.internal;
import org.ops4j.pax.gwt.PaxGwtApplication;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
public final class Activator
implements BundleActivator
{
private static final String APPLICATION_ID =
"pax.samples.gwt.desktopClone";
private static final String MOUNT_POINT =
"/pax/gwt/samples/desktopClone";
private static final String DEFAULT_RESOURCE_MOUNT_PATH =
"webcontent/org.ops4j.pax.gwt.samples.mail.internal.Mail";
private static final String WELCOME_FILE = "Mail.html";
private ServiceRegistration m_registration;
public final void start( BundleContext iContext )
throws Exception
{
PaxGwtApplication application = new PaxGwtApplication(
iContext, APPLICATION_ID, MOUNT_POINT );
application.setDefaultResourceMountPath(
DEFAULT_RESOURCE_MOUNT_PATH );
application.setWelcomeFile( WELCOME_FILE );
m_registration = application.register();
}
public final void stop( BundleContext iContext )
throws Exception
{
m_registration.unregister();
}
}
</code>
In the Activator#start() method, we just tell enough information for
PaxGwtApplication to know the alias for the application to be
registered under httpservice (OSGI_R4_compendium, chapter 102), where
are the default resources files (this is useful to have a short url,
[/pax/gwt/samples/desktopClone] instead of
[/pax/gwt/samples/desktopClone/webcontent/org.ops4j.pax.gwt.samples.mail.internal.Mail].
gwtview bundles responsibles to track HttpService, manage the lifecycle
of GwtOSGIRemoteServiceServlet and tracks PaxGwtApplication.
The Activator class is the only class required to get the samples
application OSGi-fied :). Obviously, these samples application does not
have client server interactivity. I was hoping before tackling client
server interactivity, I want to get the bigger issue solved which is
for OSGi bundles to be able to contribute modules/content to Gwt
application in OSGi manner.
> Is OSGi hosting your web container?
Yes. OBR http service is deployed as a bundle in equinox.
Hope this helps.
Regards,
Edward Yakop