by February 22, 2006 0 comments

The Sun Java Studio 8 Enterprise Edition, built on top of
NetBeans IDE, provides an extensive set of options for coding any Java
application. It is available for free if you register as a member of SDN (Sun
Developer Network). The simple installation procedure gives you an option to
select the version of JDK (you need at least JDK 5.0 Update-1).

You will first see options to include the NetBeans Mobility
pack, view documentation and the Studio. In later steps, the installer gives
options for installing Sun Java Application Server 8.1 and ‘Collaboration
Runtime’. The latter is a great tool for developers to collaborate and work on
the same file. The recommended memory requirements are pretty high, with the
recommended as a machine with at least 1 GB of RAM and a P4 1.4 GHz is required.

Java/J2EE programmers
Complete set of tools for software engineering, with support for round trip engineering also
Java Studio 

Coming to its features, you can find a detailed set of
options for any type of project you initiate, be it a Java, J2EE or a mobile
application. When you start a new project, you can select to either import a
project from an existing Ant script or create a standard project from existing
sources. However, in case of an enterprise Java application, it must conform to
the J2EE BluePrints Project Conventions for Enterprise Applications.

UML modelling
The Studio allows developers to perform UML modeling of their projects. This
can be initiated from the New Project dialog box. Once the model is created, the
user can easily create Java classes from the class diagrams constructed,
reducing a good amount of development time. UML modeling is available in four
different flavors. One of these is the platform-independent model. The good
thing about this option is that only UML modeling rules are applied, no code is
generated and it does not apply any language related rules to the model.

Adding ‘Collaborate Login Account’ to configure computer for using an existing account on a collaboration server

The other options are Java Platform Model, reverse
engineering, and the Imported Rose Model. The The Java Platform Model is needed
to create code from the project model created. The third option for generating
the Java Platform Model by reverse engineering a Java project is impressive as
this lets developers view the UML model of a project in Java and then optimize
it. However Reverse engineering over here is not to be confused with
de-compilation as this option simply gives the skeletal model of the project and
does not provide any details of implementations of various methods in a class. 
The final option is the Imported Rose Model, where you can import models
created in Rational Rose. This way the IDE also provides interoperability and
portability of the project models.

Collaborate on projects
The ‘Collaboration Runtime’ feature provided for developers allows
sharing the coding session itself during the development process. This means,
two developers can be working on the same file with any changes being made by
one of them automatically reflected on the others’ screen. The Runtime also
lets them converse and login to a collaboration server and join public
conversations. To use the ‘Collaboration Runtime’ you need to sign up for an
account with any collaboration server of your choice, the default one being The ‘Add Account’ wizard does this in five simple steps. The
collaboration server required is bundled with the Studio if you wish to start
your own.

In this series on Studio, we shall look at the features of
Studio and how you can use them to improve your development effort. In this
part, we will create a sample library management application and see how the UML
modeling features of the IDE can be used.

Sample application
Our project called ‘Library Manager’ consists of three classes:
‘member’ to represent a member of a library, ‘librarian’ and ‘book’.
To start off create a new Java project from File>New Project. Choose ‘Java
Application’ and click on Next. Give the project name as ‘LibraryManager’,
a path and click on Finish. The IDE will scan the class paths and once created,
the LibraryManager project will be visible in project window.

Now create a UML project by choosing the ‘Java Platform
Model’ option from the same ‘New Project’ window. Click on Next, provide
the project name as ‘LibraryUML’ and give the same path as LibraryManager.
Check on the ‘Generate Code’ box and click on Next. Choose the
LibraryManager project from the ‘Choose Java Project’ window that opens and
then click on OK. The LibraryUML project will also be visible in the Project
window now. In the ‘New Wizard’ window that opens automatically, select
‘Class Diagram’ for the Diagram Type List and click on OK.

The IDE opens a modeling palette and a blank class diagram.
To add the Book class, click on the class icon from the palette and then on the
blank diagram. Right click to deselect the empty class and then change its name
to Book. To add attributes, right click on Attribute in the diagram and select
‘Insert Attribute’ from the menu. Rename the attribute as bookId (integer).
You will notice that the following code will be automatically added under the
Operations section.

public int getBookId()
public void setBookId(int val)

Selecting LibraryManager project for LibraryUML to provide code generation from class diagram The ‘Class Diagrams’ for the project with source code auto generated from the designs

To add operations right click on the Operations section and
choose ‘Insert Option’. You can change the visibility of a method from the
Properties window. For instance, to change visibility of setBookId() method to
‘protected’ select  that value
from the dropdown list next to Visibility in the properties window. Similarly,
add string attributes for ‘bookName’, ‘author’; ‘cabinetNo’,
‘ShelfNo’ as integers and a boolean ‘issued’.

The get and set methods will be automatically generated for
them. Change the Visibility for all set methods except the setIssued method to

The Member class will contain the attributes memberId,
memberName, and memberAddress. The Librarian class contains only one attribute
‘fineValue’, which is a static and final integer. To set it up as static and
final, check the boxes for that from the Properties window after you’ve
inserted and renamed the attributes as before. Now, we need to insert the
following operations. 

public void issueBook(int
bookId, Date issueDate, Date returnDate, int memberId)   
public void returnBook(int bookId)   
public void addMember(Member val)
public void addBook(librarymanager.Book val)

You can also edit the operations created by double clicking
on Operations, or by clicking on the button under the Parameters option of the
Properties window for the class whose method needs to be edited.

So far we have modeled our class. In the next part we shall
implement an interface for the library repository and creating implementation
for the interface using the UML modeling tool.  
Also see how to create action diagrams for our application to model the
State Transitions of different objects during runtime to complete the modeling
phase of our Project.

Anadi Misra

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.