After several months of searching & reading, now i need your help, taking in consideration the following:
- My Application Developed using Java Swing.
- MySQL has been used as database.
- JDBC has been used to make the communication between the application & database.
- The application will run on network environment with multiple client will connect to database.
- The application use Financial transactions, Posting, Billing ... etc.
** now i want to develop a server side that will work as middle-ware, this server side will do the following:
- Connecting to the database to retrieve data as client request.
- Business logic will be on the server side.
- Client will not know about the database.
- Queries Syntax will be on the server side.
- The Client will View,Save,Edit, Cancel ... etc, sending these actions to the server side & server will response.
--- I have read about JFC, J2EE, EJB ... etc, but i don't want to run my application from browser, it will be kept as desktop application only due to the complexity of the application.
--- So i will do it using Sockets.
Any ideas, or tutorials that i can follow?
I suggest using a web-based approach to writing the back-end (e.g. a web service, either SOAP or Rest), and then communicating between the swing app and the back-end app via HTTP / HTTPS.
This is how mobile apps are typically written, and your swing desktop app is no different from a mobile app in this respect.
As far as frameworks for the back end, both Spring MVC and Grails make this pretty easy. Do yourself a huge favor and stay away from EJB unless you really need.it and understand why.
When you have 1-2 hours left, it might be worth to look at the Scout framework.
Scout seems to be a pretty good fit to your application context. Scout applications consist of a Scout server that handles access to web services (currently including support for JAX-WS) and database access over JDBC. The Scout client communicates via HTTP(S) with the Scout server and is available in the form of desktop clients (either supporting Swing or SWT) and as web application (currently based on Eclipse RAP). The web client also supports different renderings to optimize the application to desktop browser or mobile devices with touch support.
Related
I have to develop enterprise level application using Java technologies. I decided to develop client side environment with swing and server side related things using Java EE components. My planned way could be described as following
First swing client makes request to application server. And application server has business logic and it has ability to decide which way should transfer my requests. Database server has my DBs.
these technologies I willing to use.
swing for client side
servlet for HTTP request handling in application server
EJB for handling business logic in application server
Hibernate to access my DBs form EJB.
Could you tell me above architecture is compatible with JEE enterprise level system architecture?
Swing <==>Socket<==>JEE (Application) REST based <==>Hiberate (DAO)
Yes its good but.
But if your application is going to be used by different end user devices then you need to think different way of client side.
Using JNLP you can deliver your SWING client items to your end users that will give you better upgradation and later customization also possible without any intimation to your clients.
This is my points only.
I am learning to program Java. My objective is to create client server application based on Java and MySQL.
That would have following.
Server Application where all admin controls would be available to configure.
server application will be the only to have access rights to MySQL.
Server will have all functions and objects that clients will require and call and get that functionality. (Reason for that is "I don't want to share MySQL credentials to client apps or rather i don't want MySQL credentials to be transmitted on the network to clients"). As it would increase maintenance tough and it could be a security loop hole.
An analogy of functionality could be: client calls to server telling to add an Order such addOrder(order_id, payment,..,...,..) and so on.
What are the method in practice for such kind of application these days? A example code/or material to get in right direction would suffice
These days the universal way to expose a service remotely is via a web service. This solution was preferred by the industry over time due to its simplicity and ease of integration to the point that binary based protocols like CORBA are now seldom used.
Take the example of Android applications, they are native application mostly using REST web services.
A REST web service can be easilly integrated in the same way with a desktop application, a mobile application or a web application, even if the clients are written in different native platforms and languages.
As sample code, have a look at tutorials on the Spring stack. For the server see this tutorial for building an hello word REST web service. For the client, consider the REST template.
For security, see this Spring security hello world example. Using the Spring stack in Java will likelly give you the largest number of tutorials and online support.
This sounds like a good place to use RMI, which Java has built in support for. RMI will allow your client to call server-side methods on a local object that corresponds to the server, where all messages/commands get transparently sent to the actual server, where you have your DB access stuff and logic.
My Current application working in network environment, each user run the application from their desktop to connect to the database server.
Since, the application dealing with many transaction that accrued from multiple station during working day, I would like to ensure there will be no confectionist within same record, since the data shared between all stations & each employee working on these records.
The application working as ERP solution there will be many kind of transaction for (Receipts, Payments, sales, purchases, etc).
For that I need to make sure there will be no transactions could be edited from two users at same time.
I searched the internet for solutions, what I understood:
- Applications deals with 3-tier will achieve this approach.
- Applications should run as client server using web server.
My Client: Java Desktop Application SE Thin Client.
My Server: MySQL Database server.
I don't want to go web application.
What i need to achieve this?
What is could be used to get functionality as 3-tier.
Replace Apache with Jetty which is an embeddable web server built with
java. Jetty can serve php pages if it's linked to the php executable.
MySQL is not a great option for this at all - if you need a portable
high powered solution use MongoDB which you can simply package and run
alongside your application.
Here is the background of my situation:
I want to create an iPad application that interacts with a oracle SQL database. I have existing Java code from my Flex application that handles all the database requests, and modifications using the Spring Framework. The Flex Application ran as a web service through TomCat. Now I want to make that flex application into a mobile iPad version. I am having trouble figuring out what is the easiest way to use existing Java code and use it for the iPad because the iPad interacts using URL requests instead of direct with the Java.
My question is, can I use the existing Java code with the Spring framework to save time from coding all the back-end handling? Basically I want to access all the classes from my Java code by doing Requests from the iPad. Is this possible and will I need JSON or XML to interact between the iPad and the Java code?
Summary:
Can I use
iPad Objective-C <-----> Java (with spring framework) on TomCat Web Service to handle oracle SQL data handeling? If so, how and what technologies do I need? Will I need JSON or XML and how does that factor between the iPad and Java?
Thanks!
A good approach would be to design your app to communicate with RESTful services that return JSON. Once this is done your iPad app doesn't have to even know that the server code is written in Java.. it's just interacting over HTTP.
Here's a good tutorial on setting up your tomcat to host your RESTful services: http://www.vogella.com/articles/REST/article.html - I've used this for an app I'm developing. Spring isn't even necessary.
You could go XML, but JSON is just easier in my opinion. Here's a good blog outlining the good and bad of both sides. http://digitalbazaar.com/2010/11/22/json-vs-xml/
OK, I'm making the following presumptions.
Your flex application runs on a different machine from the Tomcat
server
Your flex application makes web service calls to the Tomcat server
So, the flex application doesn't know the underlying technology that provides the web services. It's just seeing/consuming the output
There's no reason why the iPad app can't do the same thing. There's no reason why it can't use the same web services that the Flex application uses. It could consume the same messages (Assuming it can handle the request/response format currently employed by the Flex application).
You can make changes if you like if you want to change the structure of the requests/responses between the clients. But the clients don't know (nor care) how the web services are implemented. They are just requesting and consuming info.
I am developing a multi-platform (Android, iPhone, Windows and Blacbberry) mobile application. The application needs to communicate with our server for several tasks, such as retrieving buddy lists etc. The server interacts with data that is stored in a MySQL database. I intend to code the server element in Java, however I am confused by all the different types. So far, I think I have narrowed it down to three options:
1) I code the application using Jetty to accept http posts. I post XML to the server, handle it, interact with the DB and post a XML response back. I would save the application as a jar and leave it running on my server.
2)I develop a Java web service. REST/JSON/SOAP?
3)I develop a Java web application.
Whilst there are many questions already out there asking what the differences is, I am struggling to find a clear explanation as to what is the best approach in which situation. I have previously used the first approach but am assuming the second approach is the better option, I'm just not sure what the advantage is.
your 1-3 options are all variants of a "Web application".
Jetty is a Java based http server/servlet container. If you want to communicate between client and server using http, you are using an http server (although not necessarily Jetty).
A Web Service is part of a web application that conforms to a standard around how clients communicate with the server, and how the server offers up information to the clients.
A web application is a Java application that makes it services available over http.
So if you want to have your clients communicate with a server, and store info in a db, you are using a web-application.
I would recommend going with option 2 as it is more lightweight and can be parsed directly in you're web application. XML got more overhead and must be translated, while you can just serialize objects directly to JSON from you're Java application and then parse them in javascript at frontend