Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the easiest framework to transfer POJOs between Java programs?

I need a framework to transfer POJOs between two (or more in a client/server model) Java programs over TCP/IP. I need it to be as simple as possible but it must support several clients per server, and easy implementation of encryption is a plus.

So far I have looked at Java RMI, JRemoting, AltRMI and NinjaRMI. Right now JRemoting looks like the best choice as it is simple and don't require strange and seemingly unnecessary extends and implements as most of the others do. No active development seems to be going on on any of them except a little on Java RMI. I don't know if that is because they are stable and don't need more development, or because these kinds of frameworks are just not "cool" any more.

The POJOs are just bags of properties. I need the server to hold a static list of objects, and the clients must be able to (1) Read the list, (2) Add an object to the list, and (3) Remove an object from the list.

Any suggestions?

like image 270
Svante Avatar asked May 04 '11 08:05

Svante


People also ask

What is pojo used for?

POJO stands for Plain Old Java Object. It is an ordinary Java object, not bound by any special restriction other than those forced by the Java Language Specification and not requiring any classpath. POJOs are used for increasing the readability and re-usability of a program.

Can POJO class have methods?

A POJO has no naming convention for our properties and methods. This class can be used by any Java program as it's not tied to any framework.

What is POJO class in API?

In software engineering, a plain old Java object (POJO) is an ordinary Java object, not bound by any special restriction.


2 Answers

You could probably use any serialization technology, for example you could use JSON and add on encryption and compression later in order to cutdown the amount of traffic you are sending. JSON has the advantage of being language agnostic, so you don't restrict the implementation of either side of the connection.

Many JSON libraries are available; see json.org.

like image 50
trojanfoe Avatar answered Sep 28 '22 02:09

trojanfoe


Do you need to do remote method calls, or are your POJOs just bags of properties? If the latter, it would probably be easiest to just use plain Java serialization.

like image 20
artbristol Avatar answered Sep 28 '22 02:09

artbristol