squirrelInTheBarel
squirrelInTheBarel

Reputation: 154

Application architecture - how to connect Swing app to backend?

We are developing a java application which provide web services through SSL. This application is running in Tomcat server.
The purpose of web services is insert, update and select data. So under web service tier is implemented backend tier, which provide access to database.

Suddenly we were asked to build swing application which will also access the data in database. We want to use the same backend (exactly the same runtime) which is used for web service application. How to reach this goal?

I see following possibilities:

  1. use web app instead swing application, which will be part of the same project like web service application and then it will be able to connect backend
  2. Provide some extra web services for swing application only.
  3. Use JMX. It is possible run JMX on Tomcat. Backend could provide functionality through JMX and Swing application could connect it.

Each of these possibilities have advantages and disadvantages. We followed solution 3 and I think it wasn't a clever selection. JMX has problem with generics, you can run only one JMX on tomcat etc.

Java world is rich and there should be some optimal solution for this situation. Could you help?

Upvotes: 1

Views: 1054

Answers (1)

duffymo
duffymo

Reputation: 309028

Add a web service client to the Swing app and let it make exactly the same calls to web services that a browser based UI would.

You're certainly free to add extra, Swing-only web services if you choose.

I didn't think JMX was anything other than a way to allow you to monitor MBeans using a JConsole. What does that have to do with Swing?

Upvotes: 2

Related Questions