Pages

28/02/2012

Grog, a PaaS based on OSGi for Public Administrations and private networks

As a result of my 9-months thesis work, I now present Grog, a PaaS based on OSGi for Public Administrations and private networks.



10/02/2012

[Java] Find free port

Getting the number of an unused port on the system via Java 7 is as easy as:


import java.net.ServerSocket;


public static int findFreePort(){
int port = 0;
try(ServerSocket server = new ServerSocket(0)){
port = server.getLocalPort();
}catch(Exception e){
System.err.println("unable to find a free port");
return -1;
}
return port;
}


We do not need to call a server.close() since Java 7 does that automatically for us as we used the new try-catch block with resources declaration

03/02/2012

[Java] Access MySQL with Hibernate

In this post we will give a fair example on how to access a MySQL database via Hibernate in Java.
For this example we will be using MySQL server 5.5, Hibernate 3.3 and the Eclipse IDE.



01/02/2012

ECF remote OSGi DS Declarative Services example

In this post we will give a fair example of the workings of the OSGi DS Declarative Services remoted with ECF.

For this example we will be using the Eclipse IDE for Java with the ECF Remote Services Target Components  plug-in, the Equinox framework and ZooKeeper as a service discovery provider.