Tag Archives: Java

Begining with app engine

Here we are going to see how to install GAE plug-in in Eclipse, and to make and deploy my first basic application, in order to see how to manage the life deployment cycle this plug-in.

We will base in the Eclipse Galileo R2 for JEE projects on 64 bits package. And Google Plugin for Eclipse, which supports the GWT and GAE technologies, in Galileo version.

Eclipse installation is easy, download and unzip where you want. Then we execute it.

To install Google plug-in, Help > Install New Software … > Add, add the url Google Plugin for Eclipse for Galileo. And install Eclipse and both SDKs.

Create the application in Web File > New > Web Application Project:

Creating project

To test it in local mode, in the contextual menu choose Debug As > Web Application. Then we can how to debug an application with the usual eclipse debugger.

To deploy in the server we must enter in https://appengine.google.com, and create an ID (pe: firstapp-lebrijo). We configure it through the contextual menu Google > App Engine Settings… Then Eclipse knows where deploy it when we do Google > Deploy to App Engine.

I have my first application in: http://firstapp-lebrijo.appspot.com/

My First GAE App

Arquitectura: capa de servicios con Spring

Para implementar la capa de servicios y aprovechar su inyección de dependencias vamos a utilizar Spring.

Con Spring 2.5.6, que es la versión soportada por OEPE, para acomodar nuestro desarrollo.

Primero añadimos la Facet de Spring a nuestro proyecto. En el menu contextual del proyecto > Properties… :

Add Spring Facet

Luego generamos las clases ORM. Se generan con el menú contextual del proyecto > Spring > Generate Spring ORM Classes …

Creating new ORM Services

Como se observa, sobre las entidades JPA definidas en nuestro paquete de persistencia, se definen las clases de acceso y las de servicio. Os recomiendo echarle un buen vistazo a los paquetes lebrijo.school.services y lebrijo.school.dao.

Lo normal es que debamos limpiar estas clases de métodos, ya que genera todas las posibilidades (remove, persist, findById,…). Por ejemplo, si una entidad de nuestro modelo es una vista, no tendrá sentido mantener un DAO con los métodos persist y remove.

Aquí os dejo el zip del proyecto eclipse tras estas modificaciones.

Architecture: Services layer with Spring

In order to make the service layer and use the dependency injection we will take Spring.

Spring 2.5.6 is the OEPE default version supported.

First we will add the Spring Facet to our project. Right mouse button over the project > Properties… :

Add Spring Facet

After genertate the ORM classes. They will generate with contextual menu > Spring > Generate Spring ORM Classes …

Creating new ORM Services

You can see, about the JPA defined in our persistence package, it will create th access classes and services ones. I recommend you see the lebrijo.school.services and lebrijo.school.dao packages.

After we must clean this class of methods, the generator generates all possibilities (remove, persist, findById,…). For example, if one entity of our model is a view, we can destroy persist or remove methods.

Here I keep the zip eclipse project after these steps.