About Me

My photo
{"cs student","java developer","software engineer"}

Thursday, March 11, 2010

course 1 : lesson 1 : javaEE and netbeans platform - preparing the projects

This lesson is trivial one - and don't expect further ones to be as detailed as this one - so if you will have any problems with it - you will be probably better with some simpler tutorials (or in fact maybe you are drunk - really drunk ...).

The effect of this tutorial will be creation of few maven projects which will be needed later on - I will also describe briefly why each project is needed and how they depend on each other.

Zero you have to have working netbeans installation with glassfish-v3 configured - the simplest way is to download the "javaee" or "all" netbeans bundle from netbeans.org and install it - this step will not be covered here.

First you will create your server module - which will actually create 3 projects - the ejb (your actual server module), ear (packaging of your module) and the enclosing pom - in which you will put all other modules as well later on.
Create new maven enterprise application project

click next and set the properties

and unset the web module - we will create it later on and deploy separately - to show you the modularity of javaee.

Now you have created the basis of you application - here you will write the database code and business methods to work with your calendars.
Next create the client application - it will be platform application maven project.


again set properties - look, that by default you create this project in the calendar-server project - which is good baceuse all the dependencies will work without problems in maven - even without you having a full fledged maven repo set up. (and for anyone who will download your sources it will work as well)

this has created 4 maven projects - enclosing calendar-client, platform application - which is like ear in javaee, branding module which is used for things like setting the splashscreen and provding customised menu layout, and netbeans module - which is where you will do your actual coding.

Next create the webapplication - which actually won't show any webpages - it will be a rest wrapper onto your ejb. I won't show the configuration dialog again - you should have grasped it already.


the last - but not the least ;] module is api module - it is a simple jar packaged java project - which you propably are familiar with already. It will contain all interfaces and DTO classes to communicate with server - and we will depend on it from every module we have created by now.

delete the generated java files (App.java and the test for it)- you won't need them anyways.

Now your folder structure should look like this :

calendar-server
|-- calendar-client
| |-- application
| |-- branding
| `-- module1
|-- calendar-rest
|-- calendar-server-api
|-- calendar-server-ear
`-- calendar-server-ejb

now when all the projects are created we will have to tweak them a bit - first, change the platform version to 6.8 and make some sane branding token.


next - as someone made naming in netbeans maven repo... stupid at least - you will have to change the name of the platform you depend on (No, I won't listen to any reasoning behind this !- this is plain stupid ! - platform and every other cluster dependencies shall not have version in their names !) - this in the pom.xml of the platform application - fortunately every other module you will depend on has more sane naming policy.


Lastthing to do is to setup dependencies between your projects - you make it in your pom.xml files, by providing tag in tag - depend on calendar-server-api from the webapplication, the ejb module and module1 of the netbeans platform app.


With this you are finished the initial preparation.

the sourcecode is available on the kenai project nbcalendar - for this lesson - revision 0

No comments:

Post a Comment