![]() |
Studio provides an archetype called Desk, an intuitive and adaptable way of organizing and managing various artefacts that constitute the application being developed. The desk is a visual management tool and enables faster development cycles for J2EE applications by constantly tracking changes made to the application artefacts and making sure that the application is always in a ready-to-run state.
This document introduces you to the concept of desk and describes desk components, hierarchy, templates, properties, search within desk, and desk merge.
Desk is a logical organization of application artefacts into a hierarchical tree structure. The nodes of the desk tree can be modules, archives, or general purpose folders or files. EJB and web modules function as complete J2EE applications in a ready-to-deploy state and the Java, web and enterprise archives comprise the corresponding packaged components. A desk provides a general-purpose folder for storing other supporting files for building the application. Desk structure can be defined as required and one of the templates can be used as a starting point. Creating a desk maps the structure on to an underlying directory structure in the file system. Creating a new desk creates a corresponding folder with the same name in the file system. All meta-data related to the desk and its components are stored in a file with the same name with .dsk extension. For example, creating myDesk under Studio installation directory creates a folder and .dsk file as <install_dir>/desks/myDesk/myDesk.dsk.
Creating a desk creates a directory in the file system. The fully qualified path to this directory is called desk root. The .dsk file is located under desk root. For example, If ArchiveDesk is created under the target location <install_dir>, then <install_dir>/desks/ArchiveDesk represents the desk root. The file ArchiveDesk.dsk is located in <install_dir>/desks/ArchiveDesk.
Application source files are organized under desk nodes called modules. An application can contain many modules of different types indicating the nature of the module content. Studio desk consists of:
The type of a module is significant as different Studio tools treat the content according to their type.
The directory in the file system, where sources for EJBs, servlets, helper classes, and other Java files are located, is called the source root. The desk uses source root to organize Java files in their class package hierarchies. Studio expects the source files organized under Source Root to be in a directory tree, that matches the class-package hierarchy. Every Module in the desk has a Source Root. More than one EJB module or Java Module can point to the same Source Root in the file system.
EJB module represents an extracted view of an EJB archive, JAR. It points to a source root and is always stored under the desk node in the desk hierarchy. The source root contains all files forming the beans, including bean classes, helper classes, and other metadata.
EJB modules can be of two types, EJB 1.1 and EJB 2.0. EJB 2.0 modules can hold both 1.1 and 2.0 types of enterprise beans, EJB 1.1 modules can hold only 1.1 type of enterprise beans.
Organizing EJBs under EJB modules enables Express Development that speeds up development cycles through:
A desk with two EJB modules point to the same source root. For example, two EJB modules, Employee EJB and Sales EJB are stored in a desk. The beans under the respective modules can be viewed as ArchiveDesk/Employee EJB/com/pramati/hr/ejb/EmployeeBean.java and ArchiveDesk/Sales EJB/com/pramati/sales/ejb/SalesBean.java in the desk tree hierarchy. Both modules can point to the same source root directory, c:/src_root. The files are stored in c:/src_root/com/pramati/hr/ejb/EmployeeBean.java and c:/src_root/com/pramati/sales/ejb/SalesBean.java, respectively.
A web module is a folder that contains all components constituting a WAR and provides the user with the following added functions:
A web module is stored directly under the desk in the desk tree hierarchy and points to a source root in the file system. It can also have Java files under along with the web components. This module is always in a ready-to-deploy state. There can be more than one web modules in a desk but only one can point to the same source root.
When a web module is created in the desk, a directory with the same name as the module is created under the specified DocRoot in the file system. A DocRoot is the path of the root directory where web applications are stored and sourced.
The web module name acts as the context root of the web application. To access any content, the URL is http://localhost:8181/web-module-name/file. Here, 8181 is the default port and file is the file name with extension. Context roots have the same name as the module. For example, a web module, WebMod is stored in a desk, ArchiveDesk. The module is created under a DocRoot called c:/doc_root. A directory called c:/doc_root/WebMod gets created in the file system. The web module contains a file called index.jsp stored in c:/doc_root/WebMod/index.jsp. It is represented in the desk as ArchiveDesk/WebMod/index.jsp. Explore panel displays the desk view.
To modify the context root, read the instructions provided in `Express Development'.
A Java module stores pure Java source files of an application and points to a source root. For example, JavaMod represents a Java module and points to a source root, c:/src_root. Hello.Java is a Java file with package class hierarchy, com.pramati and is stored under JavaMod in the desk. The file is stored in c:/src_root/com/pramati and the desk represents it as ArchiveDesk/Java Mod/com/pramati.
A desk template is characterized by the types of folders and files it holds. Studio ships with five default desk templates, Blank Desk, Default Desk, EJB 2.0 Desk, EJB 1.1 Desk, and Web Desk. A Blank Desk contains no folders or files in it. Default Desk has a directory structure and folder attributes required for J2EE application development. This template contains folders that hold J2EE components such as EJBs, JSPs, servlets, HTML, images, tags, JARs, WARs, RARs, EAR and other file types.
EJB 2.0 desk contains a EJB 2.0 module, a Java archive and an enterprise archive. WebDesk contains a Web module, a web archive and an enterprise archive.
To create a new desk, select Desk > New and enter details.
To open an existing desk, select Desk > Open. Browse and select an existing desk. Desks are stored as files with extension .dsk. Open desks have a tab in the explore panel of Studio with the desk name as the tab label. If two desks have the same name, then an asterisk is suffixed to the name of the second desk on the tab label. Dragging and dropping the files in the editor can open files within a desk.
Studio keeps the list of last five desks opened and these can be opened directly from the desk main menu. To reopen the desk last opened in the previous Studio session on Studio restart, select File > IDE Options > General and select Reopen last used desk as startup option.
Several desks can be opened at the same time. The desk being viewed is the active desk. Operations of all configured tools in Studio would relate to the active desk.
The explore panel can have other tools open besides the desk. For example, Debugger.
If no desk is selected, the desk last selected is active. A newly opened or newly created desk is automatically set as the active desk.
Studio allows new folders such as EJB module, web module, Java module, MIDlet suite, JSP Test Module, Java archive, web archive, resource adapter archive, enterprise archive, or a blank folder to be added under a desk.
Right click on a desk node and select New Folder > EJB module.
Right click on the desk node and select New Folder > Java Module.
Right click on the desk node and select New Folder > Web module.
Right click on the desk node and select New Folder > Java Archive. This creates a node jar under the desk tree node. Web Archive and Enterprise Archive options can be used similarly.
Right click on the desk node and select New Folder > Other. This creates a node New Folder under the desk tree node.
Right click on a desk root and select Properties. The types of properties that can be set for the desk and its folders is explained in the following sections.
View the following folder properties here. The fields here cannot be edited.
The build properties for the desk or the folder chosen can be edited here. For more information, read `Compiling and Building Applications'.
Select the components to be deployed in the module or the desk tree node. By default all the modules in the desk and all the beans, servlets, or filters in the module are selected. For more information on Deploy properties, read `Express Development'.
Repair option is used to check if the modules under the desk are reflecting the state of the application. Select the Sync State tab to regenerate deployment information for the application.
Open a desk in Studio; right click on desk root and select Export As Archive. It ensure that at least one EJB module or web module folder is present under the desk and then converts the desk into an EAR and places the file under the EAR folder of the desk. This archive can be used for commercial deployment.
EJB modules and web modules can also be exported as archives. Right click on the module node and select Export As Archive to convert the EJB modules into JARs and web modules into WARs. The archives are placed under the respective folders in the desk.
Archiving a desk involves packaging a desk into an EAR as explained in the following sections.
Select Desk > Pack from the main menu.
The work status can be archived in desk at any stage and can be retrieved in another location. This is achieved by the packing routine. To archive a desk, choose the desk from the Pack Desk dialog. This compresses all files stored under the desk into a Desk Archive (DAR) file with .dar extension. The DAR is stored at the selected location and contains the .dsk file along with its contents.
Select Desk > Unpack.
Unpacking the desk creates a one-to-one file structure under a parent directory with the name of the desk.
To convert a desk created in previous Pramati Studio versions into a desk in Pramati Studio 3.5:
To merge existing desks, select Desk > Desk Merge from the main menu.
Enter all required details and click OK.
The new panel allows to customize the desk to be created using the source desk displayed in the explore panel. This gives greater control on the structure of target desk, and also helps resolve pending tasks.
When a module is moved from the Staging area to the destination desk, metadata is also moved transparently. Moving files individually requires the user to move corresponding metadata files separately. For example, the ejb-jar.xml in EJB module.
The target desk is displayed in Studio. To move modules from the source desk to the target desk, select a node in the staging area and a single node in the target desk; click forward icon. The staging area highlights the module and components that have been moved and a set of pending tasks. To move the entire desk from source desk to target desk, select the desk root in staging area and click the forward icon.
All the pending tasks are displayed in the Pending Tasks area after migration. To resolve the tasks, double click on a task in the list. A dialog appears which can be used to resolve the task. For example, if the pending task is a missing file, the file chooser appears. If a resource required in the target desk is not present, clicking on the pending task opens the Resource Tool.
In order to maintain the desk semantics, there are some restrictions in merging desks:
To close an active desk, select Desk > Close. If some changes have not been saved, a dialog displaying the unsaved file names appears. Select from Save All and Save none options before the desk is closed.
To delete a desk, select Desk > Delete. An alert appears; select from Yes and No buttons to continue. Selecting Yes removes all associated folders and files from the file system. A desk once deleted, cannot be recovered.
To open existing files, select File > Open from the main menu. In the dialog, browse to the file location and click Open. It is possible to open a desk by clicking a .dsk file using File > Open or Desk > Open.
The file menu displays the ten recently opened files. To modify the number of recent files using IDE Options dialog. For details, read `Setting general properties' section in `Working with Studio Editor'.
Double clicking on a closed file in the Explore Panel opens it in Editor. To make an open file active, click on the file name node in explore panel. All open files appear in black font with colored icons; all closed files appear in grey font with grey icons, in explore panel. The active file always appears in bold font.
Right click on a module node in the explore panel and select Import Files.
Click OK to add all the files to the target directories.
Importing large number of files into a web module may increase memory load on the system, and cause Studio to become very slow. To reduce memory load, import only those files that are going to be edited in Editor. Other files can be manually copied under the web module directory but not imported to the desk.
The web container serves all files present in the file system and will not be restricted to files in the desk. Similarly, Export as Archive will package all files from the file-system. Large files like image (*.gif, *.bmp), zip ,and other content files need not be imported into Studio.
Select Files > Quick Open from the main menu.
To view all files of a type, type *.<file type>. Click on a file name to view it in Editor.
To view all files in the current desk, type *.
Select View > Show Open Files from main menu. This opens a floating panel that displays the names of all open files.
Click a file name to make it active.
To save the active file, select File > Save from main menu. To save a copy of the file to a desired location, select File > Save As. To save all files currently open in the Editor, select File > Save All.
Select File > Print from main menu to print the active file.
Select File > Close from main menu to close the active file. To close all files open in the editor, select File > Close All from main menu.
| Pramati Technologies © Copyright |
|