What I am trying to do.
An industrial control kind of system where servlets are representing
state and allowing control of various hardwares.
For now, I have decided that actual hardwares should each have their
own RESTful servers allowing them to be anywhere on a network.
However, these servers only provide state (GET) and allow changes to
it (POST) with no gui, just JSON. Resources are available by GET (url)
and respond with JSON state. Similarly POST. Hardware looks somewhat
like a database.
User interface is provided by an OSGi framework server. It can
present static home or other pages that someone with a very modest
knowledge of html might use to customise his particular presentation.
In addition, it allows for canned (Vaadin) drop-in pages showing
controls which ultimately connect through REST to hardware. I read
that Vaadin can support "canned" widgets which can be interleaved with
ordinary html (I did not try that yet) and allow a degree of
custumisation without getting into Java. I would include something
like the Vaadin 3 tab panels example, see
http://vaadin.com/wiki/-/wiki/Main/Creating%20a%20Modular%20Vaadin%20Application%20with%20OSGi
Specifically, I do not wish to use a Web service container as that is
just another level of complexity that ordinary users do not need.
There will be no IT infrastructure to manage servers, and this is not
building Amazon.com. So no Apache, Tomcat or Glassfish.
The sole startup requirement should be to boot the OSGi framework,
perhaps with a few modifications to config.ini, but for the most part,
just ( dragging and ) dropping bundles into say Felix's bundle
directory.
So what do I need?
What I think I need:
1. Vaadin seems a good start. I tried GWT, but then I am left handling
RPC. And GWT is not really OSGi-friendly. Vaadin (I think) uses JSON
instead of RPC to handle remote access and does not OSGi-stress the
finer points of GWT. It seems clever to develop widgets for display
on the browser which have very reusable code because Vaadin people
have to worry about the implementation, and the servlet end just
transparently uses the Vaadin AJAX display capability.
2. A static html server with no state (sessions) which can handle home
pages and icons. This was an easy extension to HttpService with a
method add( alias,location) which could easily be connected to
properties. In addition it needs to handle URL forwarding to deal
with browser one-source policies, but this is perhaps no problem when
using Vaadin as the communication is from the servlet not the
browser. It is useful if Javascript code needs third party data.
3. A server to handle static Vaadin resources, javascript, css, etc.
Chris Brind's class StatisResources does that well. That does need
not need session awareness as it is just serving static Vaadin
resources from the Vaadin distribution jar. See
http://www.perplentropy.com/2010/02/in-bed-with-vaadin-and-osgi.html
The design allows use of the vaadin jar without alteration, an
important consideration.
4. Chris Brind's Vaadin resource supplement fragment jar also seems a
useful idea and addition allowing Vaadin Themes to be extended.
5. On the other hand, I found his VaadinOSGiApplicationManager hid the
servlet too much and made it difficult to connect the servlet to the
world outside. See for example the discussion
http://vaadin.com/forum/-/message_boards/message/85141
Instead, Neil Bartlett's ExampleApplication and ExampleAppFactory,
http://njbartlett.github.com/#VaadinOSGi%C2%A0
seems to have the capability to expose the components to connection to
the wide world while at the same time incorporating session
management. This code needs to extended to include connection to
HttpService.
So now I am going to try to stitch these pieces together.
Do you think this is the way to go?