The problem
We are involved in a new project to develop an application with several PC's that will act as general purpose computers. There is also a computer that will act from time to time as a master machine to gain the control of all the processes of the clients. That computer has to send a message to all the others through a server machine asking for instance to register assistance. At that time, a process running in the client machines has to gain the control of the computer and act as an slave machine running that application only until a new message is sent from the master machine to release them. After that, the client machines act again as a general purpose computers.
The following scheme tries to explain what happens after the CM(Control Machine) gains access of the SM(Slave Machines) through the server (SRVR)
- Control machine CM sends message to register assistance to a server 2 The SRVR receives the message, logs some information and broadcasts the register assistance message to the SMs
- The running SM process that was waiting the message gains total control in each SM
- The user chooses an action through a view in the SM and the machine sends a response to the SRVR
- The SRVR receives the response and broadcasts it to all the machines, including the results machine (RM) to update the views with the new state in the server (SRVR)
- The CM sends the End Register Message to the SRVR.
- The SRVR broadcasts the message to all the SMs, the application view closes and the application enters to a listening state again.
Stated that:
- Everything needs to be done in some kind of Java Technology
- All the machines are runing GNU/Linux/Gnome (Ubuntu)
- JPA is mandatory for the logging and persistence
- JavaFX is going to change according to Oracle because they are thinking to abandon the scripting language
Questions are:
Which mix of java technologies would you use for the view?. My opinion is using Swing and maybe embbed this in FX through SwingComponent.wrap(loginPanel) to help graphic designers do a better visual work (a must in this application). Please consider the binding options JSR-295 (now dead as I can see) or some adequate alternative.
How would you maintain updated the application client, my opinion is through Java Web Start and serving it as an applet.
Is it ok if the SRVR uses Java EE with EJB 3.0 to access to remote objects? If so, how would you integrate/model/ EJB with RMI. I have no big experience with RMI/EJ开发者_如何学GoB integration and I am not so sure that it is correct. Specially because EJB specification trusts in RMI already. But then how to broadcasts messages from a Session Bean (Stateful one as I can see) to update the view?
Any option chosen in SM has to be viewed in all the views (other SMs, RM and CM) registered as observers. Would you suggest a model/architecture/products for this.
Which is the right way to make the SM application gain total control once its process is awaken? -remember, it is Linux-
How the observer pattern has to be applied in a distributed context?
Is the HW arrangement correct for this application?
I know these are lot of questions and I am not trying to begin a discussion about this, I know that there can be a lot of different opinions and I am interested in hearing all of them, including implementation details. I am looking for some feedback from you guys, your opinions will be highly appreciated. Thanks in advance!
Well that is the way I solved this.
1. Which mix of java technologies would you use for the view?. My opinion is using Swing and maybe embbed this in FX through SwingComponent.wrap(loginPanel) to help graphic designers do a better visual work (a must in this application). Please consider the binding options JSR-295 (now dead as I can see) or some adequate alternative.
Swing was used in this case, the considerations were that It was a most stable technology and if after all JavaFX is going to be a library it can be used after to give a better aspect to the application, for now view was customized using Swing LAF
2. How would you maintain updated the application client, my opinion is through Java Web Start and serving it as an applet.
The requirement was suplied through shell scripts and ssh. After some update the client application is redeployed in to the client machine
3. Is it ok if the SRVR uses JEE with EJB 3.0 to access to remote objects? If so, how would you integrate/model/ EJB with RMI. I have no big experience with RMI/EJB integration and I am not so sure that it is correct. Specially because EJB specification trusts in RMI already. But then how to broadcasts messages from a Session Bean (Stateful one as I can see) to update the view?
RMI architecture is simple. In this case the JBoss A.S. application was the client of an RMI server deployed on each client machine through rmiregistry. When the client application goes on, the RMI stub that is the only shared class between server and client, this interface lets you invoke the client methods. Be careful to make your JPA model classes serializable.
4. Any option chosen in SM has to be viewed in all the views (other SMs, RM and CM) registered as observers. Would you suggest a model/architecture/products for this.
It is achieved in the same way stated in the previous point, but an important note is that RMI does not support multicast messaging, so be careful if you need messaging with many registered clients, because if you have 100 machines that broadcast messages to each other, it means 100x100 messages sent over network.
5. Which is the right way to make the SM application gain total control once its process is awaken? -remember, it is Linux-
Well, Java Swing's JFrame has a way to maintain the Window ALWAYS_ON_TOP. If you combine this with UNDECORATED_FRAME, the other applications will remain running but they will never achieve focus.
6. How the observer pattern has to be applied in a distributed context?
It is applied the same way, we have just to be carefull when to register the observers and when to unregister them.
7. Is the HW arrangement correct for this application?
The hardware arrangement was deployed in the way shown by the graphic included in the question.
Thanks to all that at least checked the question.
精彩评论