May 30th, 2006, 10:49 AM
I have a Spring application running in Tomcat. It uses Tapestry for the web tier. This all works fine.
What I would like to do is create a Swing front end in addition to the web front end. So I would like to re-use all the existing Spring middle tier.
One of the motivations behind adding a Swing front end is to cater for two clients viewing the same screen and when a change is made by one client this is immediately transferred to the other. This is crucial for the application to function correctly. If this can be done with AJAX without sending timed requests from the web tier I would also be interested.
The Swing front end will have to use Acegi security which already exists in the current application.
I am not sure how to go about this, and whether I need to use an alternate container (JEE) or can continue to just use Tomcat.
I have had a brief look at JMS but am not sure this is the easiest or right way to proceed.
As you can tell I am slightly confused. Any suggestions would be gratefully received and any links to examples of the suggested solutions.
Jun 1st, 2006, 12:44 PM
there's a number of points brought up in your questions so I'll do my best to answer.
First off, my situation mirrors yours quite closely. I started off with a spring based web application using Tapestry as the front end. Then we added a Swing front end. This was actually very easy using spring. I use spring's httpinvoker remoting facility to communicate between the swing app and the server. This allows you to continue using a servlet engine for remote communication. It also integrates very well with acegi for security. Setting it up is pretty trivial, just a matter of adding the factory beans and servlet to your web application - no coding needed.
I'm using the Spring RCP subproject as well, and there is a section on security on their wiki that explains how to use acegi with httpinvoker, (http://opensource.atlassian.com/conf.../RCP/Security). You might be able to get information about using remoting and swing from their, even if you don't intend to use SpringRCP.
As for your final requirement of clients talking to each other. I guess there's potentially many solutions but my first impression would be to look into JMS. There's a project out there that implements spring remoting like constructs over a JMS base (http://lingo.codehaus.org/). I've no experience of using this but it looks useful.
Last edited by jwray; Jun 1st, 2006 at 04:36 PM.
Jun 6th, 2006, 02:58 AM
Thanks for your reply. I think I will take the same route as yourself with regard to remoting using Spring RCP. I will also look at the Lingo project for the client communication using JMS.
Jun 7th, 2006, 10:49 PM
Glad to be of help. Although what I outlined above is how my current application works, if I were to do it all again I might approach the remoting slightly differently. Since this is the architecture discussion section I'll outline some thoughts I've been having recently regarding this.
i) One aspect of the spring remoting functionality is that it is sychronous. This means, in order to avoid blocking the EDT, you end up making the remote calls within a worker thread, effectively turning the call into an asynch. one. Thus, it might make more sense just to use an asych. remoting implementation (eg the lingo ones) from the outset. This also fits well (conceptually) with the event/listener driven programming model of a swing app.
ii) The http invoker implies specifying the url of your service implementation in the client application. I've never liked this but I don't know of a way around it. The activemq jms server provides a discovery mechanism, so a client using a jms based remoting solution would be able to discover the remote services.
iii) The activemq and lingo documentation discuss the use of jms based remoting to provide service clustering providing for, among other things, load balancing and fail over.
iv) The mule esb has an interesting integration with the spring event mechanism. It may be possible to utilize that as a way of abstracting out service access into event publish/listen code in a swing app.
as I said, these are just thoughts I've been having lately with no concrete code to back them up, but I'd be interested in anyone's thoughts.
Originally Posted by pg
Jun 15th, 2006, 04:31 AM
I have the same requirement and architceture.
But I'd like to use netbeans RCP.
Jun 15th, 2006, 01:16 PM
You should be able to - non of the remoting solutions I mentioned depend on the RCP project of Spring, only standard Spring. I mentioned the RCP project because there's an example of how to integrate remote security, using acegi, and turning commands on and off. The same approach could be used outside spring rcp.
Originally Posted by zjbbridge