|
The J2EE architecture defines the typical EJB component's development lifecycle as follows:
Express Development provides an easy programming archetype by automating the tasks in the typical J2EE development life cycle. The main features of Express Development are:
This chapter describes the Express Development and its features in detail.
J2EE Development necessitates each J2EE module in the application to be created, assembled and deployed according to the requirements of the specification. Express Development allows steps like assembling and updation of changed components to be automated with default values and always keeps the Desk Root, EJB Modules and Web Modules in a ready-to-deploy state. The user can always modify the default values. The Desk behaves like a J2EE application with Express Development- the Desk, EJB Modules and Web Modules always being in a ready-to-deploy state.
The following are some of the advantages of Express Deployment:
Express Development provides feedback each time one of the following events is triggered:
Each event's status is displayed as a node in the Express Development tab of Output Panel. The status is shown visually by means of icons and colors. Each event that is triggered has processes that are displayed as sub-nodes under the main node. As these tasks complete, they are marked. The unsuccessful events are displayed in red, and the successful ones in blue.
Example
Clean building a module or a file each time creates a separate node in the tree, and the node's successful completion depends on the completion of all the sub-nodes.
The main node does not change its status until all the sub-nodes have been completed.
The following are some of the actions that can be performed in the Express Development tab in Output Panel:
EJB Module is a Source Root stored directly under the Desk node in the Desk tree hierarchy, which is always in a ready-to-deploy state. The EJB Module represents an extracted archive view of the ejb-jar and provides the user with all the added functions of Express Development.
There can be more than one EJB Module in one Desk and also point to a single Source Root in the file system. More than one EJB Module in the Desk can share a single EJB component.
There are two types of EJB Modules in the Desk:
The following are the advantages of Express Development with EJB Modules:
The following section describes the file system structure of the EJB Module created by Express Development. Creating a bean using the wizard in the EJB Module automatically generates the bean class file, the bean and its interfaces, and also compiles them. The classes directory of the EJB Module, which cannot be changed by the user, is set by Studio based on its name and goes under the Desk's classes directory (specified by the user at Desk creation time). This is set as such, so that Express Development can maintain physical separation between different modules and treat them as virtual ejb-jars.
Example
If the EJB Module name is TestEJB, then the classes are stored in the directory called <Desk-classes-dir>/TestEJB.
The following is the structure of the EJB Module and its files as maintained in Studio:
Packaging Information (ejb-jar.xml) for a bean under an EJB Module is generated from the Packaging 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 to change any packaging information. To bring up the Bean Properties panel, right click on the specific Bean Properties node in the Desk and select Open. Some of the attributes that can be set here are:
To know more on each one of these, read the chapter Packaging EJB Components.
Express Development generates the ejb-jar.xml file automatically. The ejb-jar.xml file comprises the enterprise beans, in addition to the packaging information, so that the module functions as a complete EJB application in a "ready-to-deploy state". The ejb-jar file must contain, either by inclusion or by reference, the class files of each enterprise bean as follows:
To view the ejb-jar.xml properties, right click on the EJB Module and select ejb-jar.xml. This brings up a panel with the EJB Module representing an archive view of the JAR.
The user can only add and make changes to the Security Roles in this dialog box. All other changes to be made should be made in the Bean Properties Panel. The EJB Module displays all the beans to be deployed and their following properties:
Deleting a bean from the Desk would automatically remove all beans holding relationships with the bean from the ejb-jar for that EJB module (the related beans are not physically removed).
This process is repeated until the ejb-jar is consistent as per EJB specifications. The ejb-jar.xml is updated accordingly and all related deployment information is modified and updated.
To reconstruct the JAR, new relationships would have to be created once again using the Relationship Manager or by manually editing the bean sources. To add any removed beans, just compile them in the desk. This will trigger Express Development to add these beans to the ejb-jar.xml.
All deployment information for beans under EJB modules are stored in the following files:
The deployment information are all picked up from the Bean properties. Changes made here all put back in the appropriate Bean Properties Panel. Deployment information can be examined and modified for any target server by opening the module in the Deploy Tool, and then saving this information. To open the module in the Deploy tool, go to Tools > Deploy, and in the Deploy tool that comes up, select Archive > Open > Module name. This opens the EJB Module as an archive file, where all deployment information can be modified.
The EJB Module can be configured to include or exclude sub-components to be deployed. To do this, right click on the module and select Properties. In the Properties panel that comes up, select the Deploy tab.
Here the Beans option in the Include field, allows beans to be marked as deployable or non-deployable. Non-deployable beans are ignored by Express Development. Un-checking a bean marks it as non-deployable and removes the bean from the packaging information. Other properties that can be configured are files and folders.
Un-checking a CMP 2.0 bean affects all other beans in the relationship (CMR) graph.
Information on all queries for EJB 1.1 modules are stored in the file queries.props. This information is also available in the Finders node in Bean Properties Panel. To modify any query, use this panel.
Note for 2.5 users: The Queries are all created and maintained by Express Development.
Export as archive asks the user to choose the destination. The following files are available in the exported Java archive -
Options in 3 and 4 can be used to override option 2.
The exported Java archive can be used in the Desk like any other ejb-jar created through Packaging tool. It is enabled for updation so a right click update will pick up new packaging information. However, as per Packaging tool's Update Operation semantics, the deployment information does not get updated.
Files can be filtered to be excluded when an EJB 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.
Example
To exclude all CVS files from an exported archive, edit the module's file for filters by adding the entry <ModuleName>.<filterNum>=*CVS/* as the pattern to exclude.
Always use / to indicate path names.The default patterns that are used for EJB Modules are *.java
The Filter files can be edited any time. The changes then get picked up the next time the operation, Export as Archive is performed.
A Web Module is a folder directly under the Desk node in the Desk tree hierarchy and is always in a ready-to-be-deployed state. The Web Module represents the archive view of the WAR in the Desk and provides the user with all the added functions of Express Development.
There can be more than one Web Module in a Desk but no two Web Modules can 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 in a certain way. The classes directory is defined by the J2EE Specification and cannot be modified. It is constructed by <Web Module Location>/WEB-INF/classes.
Note: Update the supportingClasses.jar file before deploying the Web Module, for the file to pick up changes made to interfaces, which effect JSP files in the Web Module.
Web Modules can be deployed by right clicking on them and selecting Deploy. If the deployment information is incomplete and reasonable defaults are not available for that option, the Deploy tool opens, where all the pending tasks can be completed. The changes made are saved back to the module and also to the corresponding Web Module files.
Changes made to the JSP Pages are immediately reflected when they are saved, and the module need not be re-deployed. If the interfaces of the referenced beans are modified, the module must be re-deployed to reflect these changes. This is especially important when References are auto-packaged into supportingClasses.jar as this JAR is updated only on deployment.
Use the Deploy tab in the Properties dialog to pick up Servlets/Filters from a Web Module's classpath and then add them to the web.xml file.
Clicking on the button, Filters... allows picking up of Servlets from a JAR under WEB-INF/lib.
Note 1: Loose classes from WEB-INF/classes are not scanned and picked up. Only Servlets/Filters in the jar files are picked up.
Note 2: Once a Servlet is added to the Include table it will not be removed from that list even if it is unchecked.
The option Export as Archive is used to convert the Web Module into a physical archive visible in the Desk. This can be done by right clicking on the Web Module > Export as Archive. Before exporting into an archive, ensure that a war archive node exists on the Desk. Selecting Export as archive prompts the user for the destination. The following are the files that are added to the archived WAR:
3 and 4 can be used to overrule 2, if needed.
The exported archive can be used in the Desk like any other WAR created through Packaging 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, follow one of the given methods:
Method 1
The first method involves creating a new Web Module with the name as the context root's name, and then deploying it.
Method 2
This method involves creating a WAR using the Export As Archive option, and changing the context root of the WAR file created.
Alternatively, right click on the JSP file node in the Explore Panel and select Run. This method allows the new Web Module to take advantage of all the Express Development features
Method 3
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.
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 un-check 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 |
|