![]() |
J2EE architecture defines the typical EJB component development lifecycle as create, assemble, deploy, and run the application. Express Development provides an easy programming archetype by automating the tasks in a typical J2EE development life cycle.
The main features of Express Development are:
This chapter describes Express Development in Studio and its features in detail.
For J2EE development, it is necessary to create, assemble, and deploy each J2EE module in an application according to the specification. Express Development allows assembling and updation of changed components to be automated with default values and always keeps the desk root, EJB modules and web modules ready-to-deploy; the default values can be modified.
Advantages of using Express Development are:
Express Development provides event feedback for:
Status of each event is displayed as a node in the Express Development tab of output panel. The status is shown by means of icons and colors. Each event triggered has processes that are displayed as sub-nodes under the main node. These tasks are marked as they are completed with unsuccessful events displayed in red, and successful ones in blue. For example, clean building a module or file creates a separate node in the tree, and successful completion of the task depends on completion of all sub-nodes. The main node does not change its status until all sub-nodes have been completed. Actions that can be performed in Express Development tab in output panel are:
EJB module is a source root stored directly under desk node in the desk tree hierarchy; it is always in a ready-to-deploy state. EJB module represents an extracted archive view of ejb-jar and provides with all added functions of Express Development.
The types of EJB modules in a desk are:
The advantages of using Express Development with EJB modules are:
Creating a bean in EJB module using Bean Wizard, generates the bean class file, bean, its interfaces, and compiles them, automatically. The classes directory of EJB module is set by Studio based on module name and is placed under the desk classes directory specified at desk creation time; it cannot be modified. For example, if the EJB module name is TestEJB, the classes are stored in the directory <Desk-classes-dir>/TestEJB. This is set so that Express Development can maintain physical separation between different modules and treat them as virtual ejb-jars.
Packaging information in ejb-jar.xml for a bean under EJB module is generated from the information provided in bean properties of that bean. Any changes made to the packaging information in bean properties is picked up by Express Development. Use Bean Properties panel to change any packaging information. To open Bean Properties panel, right click on the bean properties node in the desk and select Open or double click on the node. The attributes that can be set here are:
For more information, read `Packaging EJB Components'.
Express Development generates ejb-jar.xml file automatically. The ejb-jar.xml comprises of enterprise beans in addition to packaging information, so that the module functions as a complete EJB application and is ready-to-deploy. The ejb-jar file must contain class files of each enterprise bean either by inclusion or by reference. The class files are:
To view the ejb-jar.xml properties, right click on the EJB module and select ejb-jar.xml. This provides an archive view of the JAR.
This panel allows you to add and make changes to the Security Roles. All other changes to be made should be made in the Bean Properties panel. EJB module displays all the beans to be deployed and their properties such as:
Deleting a bean from the desk automatically removes all beans holding relationships with that bean from the ejb-jar.xml for that module. The related beans are not physically removed. This process is repeated until ejb-jar.xml is consistent as per EJB specifications. The XML is updated accordingly and all related deployment information is modified and updated. To reconstruct the JAR, new relationships should be created again using the Relationship Manager or by editing bean sources, manually. To add any removed beans, compile them in the desk. This triggers Express Development to add these beans back to ejb-jar.xml.
All deployment information for beans under EJB modules are stored in:
The deployment information is taken from bean properties. Changes made here all are placed in the appropriate Bean Properties panel. Deployment information can be examined and modified for any target server by opening the EJB module as an archive file in Deploy Tool, and saving this information. To open and modify the module in Deploy tool, select Tools > Deploy, and in the Deploy Tool, select Archive > Open > Module Name.
The EJB module can be configured to include or exclude sub-components to be deployed. Right click on the module and select Properties. In Properties panel, select the Deploy tab.
Here, Beans option in the Include field allows beans to be marked as deployable or non-deployable. Non-deployable beans are ignored by Express Development. Unchecking a bean marks it as non-deployable and removes it from packaging information. Other properties that can be configured are files and folders. In this case, the files and folders to be deployed with the JAR can be selected manually.
Information on all queries for EJB 1.1 modules are stored in the queries.props file. This information is also available in Finders node in Bean Properties panel. To modify any query, use this panel. For more information, read `Designing Queries using the Query Manager in Studio'.
The `Export as Archive' option ask s you to choose the destination. The following files are available in the exported Java archive:
The exported Java archive can be used in the desk like any other ejb-jar created using Package Tool; it is enabled for updation. Right click on the JAR and select Update to pick new packaging information. As per Update Operation semantics for Package Tool, the deployment information does not get updated. For Example, if we change finder or select methods, the update option will not work. `Export as Archive' option should be selected again on the module.
You can filter files to be excluded when an EJB module is exported as an archive. Filters are stored in the file <ModuleName>ExportAsArchiveFitlers.props located under the desk root directory. Files matching any of the provided patterns in this file are removed from the archive, automatically. For example, to exclude all CVS files from an exported archive, edit the files in the module for filters by adding the entry <ModuleName>.<filterNum>=*CVS/* as the pattern to exclude. The default patterns that are used for EJB modules is *.java. The filter files can be edited any time. The changes is pick up the next time `Export as Archive' operation is performed.
A web module is a folder directly under desk node in the desk tree hierarchy and is always in a ready-to-deploy state. Web module represents the archive view of WAR in the desk and provides you with all the added functions of Express Development. There can be more than one web module in a desk but two web modules can not point to the same source root directory in the file system. Web module has the following benefits with Express Development:
Files are organized under Web module with the classes directory defined according to the J2EE specification and cannot be modified. It is constructed by <Web module Location>/WEB-INF/classes.
The web module automatically generates web.xml file when required. To modify web component properties:
To deploy a web module, right click on the module node and select Deploy. If the deployment information is incomplete and reasonable defaults are not available for that option, Deploy Tool opens where all pending tasks can be completed. The changes made are saved into the module and corresponding web module files. Changes made to the JSPs are reflected when they are saved, and the module need not be redeployed. If the interfaces of the referenced beans are modified, the module must be redeployed to reflect these changes. This is especially important when references are auto-packaged into supportingClasses.jar as this JAR is updated only on deployment.
To pick up Servlets/Filters from a web module classpath and add them to the web.xml file:
To convert the web module into a physical archive visible in the desk, right click on the module and select Export as Archive. Before exporting into an archive, ensure that a WAR archive node exists in the desk. Selecting Export as Archive prompts for the destination. The files that are added to the archived WAR are:
Exported archive can be used in the desk like any other WAR created using Package Tool. It is enabled for updation, and right clicking on the file and selecting Update picks up all the latest packaging information, but deployment information is not updated.
When a web module is deployed, the context root is taken as the web module name. To modify the context root, refer to the methods explained in the following sections.
The first method involves creating a new web module with a name same as the context root name, and then deploying it as follows:
This method involves creating a WAR using the Export As Archive option, and changing the context root of the WAR file created.
This method involves creating a WAR, adding it to an EAR and then deploying the application as an EAR.
The exported archive picks up all available files in the Web module for performance reasons. This may result in certain unnecessary files getting packaged, increasing the WAR file size. These files include Java source files, map files used by the Debugger. The Filtering Files option helps avoid this situation, by not including these unnecessary Java source and map files.
Files can be filtered to be excluded when a Web module is exported as an archive. Filters are stored in a file named <ModuleName>ExportAsArchiveFitlers.props located under the Desk Root directory. File matching any of the provided patterns in this file, are automatically removed from the archive.
Always use / to indicate path names. The default patterns that are used for Web modules are *.java, *.map
The filter files can be edited any time. The changes get picked up the next time the operation, Export as Archive is performed. Filter Patterns are not applied on the supportingClasses.jar.
A Desk Root is a virtual representation of a J2EE desk, and is stored. The Desk Root acts as the node containing the entire J2EE application. It represents the archive view of the EAR in the desk and provides the user with all the added functions of Express Development.
Using the option Deploy available on a right click deploys the modules under the Desk Root. Using Deploy as EAR, available on a right click deploys the application as an enterprise archive. If all the settings required for deployment are not provided, the deploy tool comes up so that the user can make the required changes.
Changes made in the Deploy Tool are not persisted when the desk is deployed as an EAR. The application gets deployed with the changed deployment information only for the current deployment. The JSP Pages are also not refreshed automatically in this case. But, When a JSP page is changed and saved, the changes reflect without redeployment.
To smoothen the progress of moving from the Express Development mode of working to the typical J2EE mode of working, use the Export As Archive option. This option converts the Desk Root node into a physical enterprise archive (EAR).
To do this, right click on the Desk Root node in the Explore Panel and select Export as Archive. This converts it into a physical archive in the desk. To export the Desk Root into an EAR, the desk must have a folder of the type, enterprise archive.
These archives are complete J2EE archives and comprise the deployment descriptors (XML files) and can be deployed on the Server or opened in Studio to be modified. These archives have an independent existence from their source. Changes here do not get reflected anywhere else.
The Desk Root can be validated before deploying, to verify that all tasks to be performed by the bean provider, as mentioned in the EJB 2.0 specification, are complete.
To validate the Desk Root, right click on the Desk Root node in the Explore Panel and select Validate. This exports the Desk Root into an enterprise archive (EAR), and then validates the archive created.
The desk can be deployed without all the modules under it. This is especially useful when the desk contains modules that are still being developed, or are incomplete. To do this, right click on the desk tree node and select Properties. In the Properties panel that comes up, click on the Deploy tab, and uncheck the modules that are not to be deployed. The modules that are unchecked are not included in any of the operations - Deploy, Validate, or Export as Archive.
Express Development keeps track of user operations and tries to keep the application in a state where all the common, error-prone, manual tasks have been automated. To achieve this, it uses certain user operations like triggers. Example, Bean compilation is treated as trigger. Such triggers result in requests that have to be processed sequentially. Some of these requests may take some time to get executed. This results in stopping all other operations until the request is executed completely. For example, deployment requests may take a long time to execute completely. When the user invokes an operation that requires UI feedback like validation, displaying packaging properties, or exporting as archive, the operation may not be executed immediately because of pending tasks. Pending task are tasks in Studio that are yet to be executed.
The Express Development Pending Tasks Panel in such a case, pops-up in the Status Bar and shows all the pending tasks of the different modules. When the specified tasks are executed successfully, the panel disappears from the Status bar. This panel can also be hidden by clicking on the Hide button.
The EJB module, Web module or the Desk Root in the desk may not reflect the specified settings of the application. To solve this, Right Click on the Desk Root/EJB module/Web module > Properties. This brings up the Properties dialog box. Click on the Repair tab and use the Sync State button to forcibly regenerate all the deployment information.
| Pramati Technologies © Copyright |
|