• Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting a Swing JFrame refrence in to a java bean using RMI

 
Leon Csergity
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got a project at my university , and we are working with JBoss with the free version WildFly .
And also with Java EE.
Now the application is a simple game of Battle Ships or sinking ships to be honest i am not sure as to how the game is actually called.
Registering a user and saving his or her information is not hard using a Stateless java bean , to save the data in the database.

I have a Stateful java bean for every user , the bean is created on the server side after the user succeeds in logging in to the game.
This bean is used mainly for sending an invite from one user to another , to log out the user and everything else that is needed for the user.
The main problem that i encountered here is that JBoss dose not let me have a reference on my frame inside of the bean.
This makes things hard because i would need to use a Timer to ask the bean every second or so if there is an invite from someone , and i would need to save all of the invites .
This was the only thing i could think of .
And also implementing the game it self , the communication between users would be complicated more so than i think its needed.

Then my professor said that i could make a service on the clients side in witch i would have a reference of the JFrame ,
and i could send this service to the java bean and using this service i could get access to the JFrame making things faster.

This would make things a lot easier.
For the invite and for the game itself too.

My professor explained that JBoss or WildFly is based on RMI , and he said also that i would need to set up the registry on the server side .
But i got lost because i was not sure as to what should i search for .
So as my last resort i would like to ask for pointers here .

We are using an older version of WildFly not the newest but one version older , CR1 i think.
And we are also using JPA in the Dynamic web project , server .

Thank you in advance for the help.
And if by chance i did not mention something important that is needed or something is unclear i am sorry and i will try to be clearer.
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So from a high-level, are you looking for a mechanism to provide a bi-directional communications channel between a SWING client and an enterprise app running on the Wildfly application server? If you are not limited to using RMI, you might consider other protocols/APIs such as Websockets or JMS.
 
Leon Csergity
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Helo Ron!

No i am not limited to RMI .
And yes that is exactly what i am looking for!!!
I did not use Websockets or JMS before so i am currently looking in to them to see witch one can i implement easier and faster.
Because sadly i lost a lot of time trying to make something work that did not quite make sense.

But i would like to ask you Ron witch one would you recommend ?

Thanks in advance !!!
 
Ron McLeod
Saloon Keeper
Posts: 1263
131
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are short of time, then I don't recommend either one - both will take significant effort to learn if you are not already familiar. Maybe you are better just to go with a polling-type solution for the near-term, then look at Websockets when you have more time.

Ron
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!