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

course 1 : lesson 0 : javaEE and netbeans platform - hard topic step by step

This post starts the series of tutorials I'll be writing about wiring server application on Java EE 6 with a client built on netbeans platform.

Topic is somehow not easy - and frequently asked about on nb_dev mailing list.

Course will be provided in few tutorials -from 0 to calendar application.
I'll start with creating the necessary projects, and setting up glassfish application server - which would be somehow basic post and most people interested in the topic will skip it - but many will need it and if I would omit it - questions will pop-out.

Then I'll discuss basic structure of the calendar server - from JPA entities, to EJB-s and restful facade built on jersey - I won't use classic remote ejb-s - not for the flaw in their idea or the coolness of restful webservices - but for the sole fact, that they are best working sollution as for now - and by design can't be broken easily from software version to version - which happens to remote ejb-s unfortunatelly.

After this - the netbeans application will be covered - first - the options panel and rest client - made "by hand" with jersey client library - one reason is - atomatic creation of those kind of client are not present in 6.8 netbeans - second one is for the reader to understand how the client works - which he will need with generated code when need of change will arise - and it arise always.

Having this basic structure - next tutorials will cover extending it's features - authentication, exception over rest, nodes, reusing actions, maybe some visual library magic ;].

ps:// if someone is interested in helping - I at least will need icons and splash screen - and making them will take me much time which I accidently don't have enough to do all the things I want - Icons are not in that list ;]

start

This blog is created for the purpose of providing tips and tutorials that I'm writing / finding out.
Technologies described here will probably be Java centric, with strong emphasis on Netbeans platform development, Apache Maven and Java ee.
Some other topics you might encounter here are software design (the internals - i could care less about the gui - there are better people than me in this area), and linux+kde.