Package J2EE assets for a partial application

 

+

Search Tips   |   Advanced Search

 

Before you deploy your partial application, package it in a format that WAS understands. In a partial application update, many single file assets are combined into a ZIP file in a structure that matches the final deployment. Depending on the type of files, you will take a different approach to packaging the assets for deployment. The result of this package is a ZIP file of all the changed assets packaged for deployment.Packaging for a partial application involves three stages:

The following is more details on each stage. In the examples, c:\ExportTemp\partialApp is used as the directory to collect the partial application assets. Use any directory name you like.

  1. Collecting controller commands, data beans, or Java code

    If you are deploying controller commands, data beans, or Java code:

    1. Export and package the files as a JAR file. You cannot deploy custom commands, data beans, and Java code unless the files are first packaged into a JAR file.

    2. Place the JAR file in the directory that you will be using to build your deployment package. For example, c:\ExportTemp\partialApp. This directory represents the root of the target EAR file. Underneath this directory, the file must be in the correct path as it would be in the EAR.

  2. Collecting store assets

    If you are deploying store assets JSP files, HTML files, images, property files, and other store assets), export the file from your WebSphere Commerce development environment:

    1. Open WebSphere Commerce Developer and switch to the Project Explorer view.

    2. Right-click the Stores folder > Export > Export.

    3. In the Export wizard:

      1. Select File system and click Next.

      2. Select all of the resources that you want to deploy; that is, select all of the JSP files, HTML files, images, property files, and other store assets that need to be deployed.

      3. Select Create directory structure for files.

      4. In the Directory field, enter a temporary directory into which these resources will be placed. For example, enter C:\ExportTemp\partialApp

      5. Click Finish.

    4. On the file system, make the following changes:

      1. Rename the Stores directory to Stores.war.

      2. Move the contents of the WebContent directory up into the Stores.war directory. For example, move this directory and file: Stores.war\WebContent\ ConsumerDirect_name\MyNewJSPTemplate.jsp into Stores.war\ConsumerDirect_name\MyNewJSPTemplate.jsp

      3. Delete the now empty WebContent directory.

      4. Ensure the name of the store directory, for example, ConsumerDirect, matches the name of the store on the target machine.

  3. Collecting assets stored outside of the WebSphere Commerce development environment workspace

    In WebSphere Commerce Developer, all store-related assets are stored in the Stores Web module and any Java or EJB assets are stored in the Rational Application Developer Workspace. Some assets are not stored in the workspace at all. For instance, XML configuration files and properties files are not stored inside the workspace; these files are used for customizing the tools framework. The following table illustrates the location in WebSphere Commerce Developer and the corresponding location inside the WebSphere Commerce Enterprise Application:

    Development environment path EAR path
    WCDE_installdir/xml/ xml/
    WCDE_installdir/properties/ properties/

    If you have customized a file in these directories, copy these assets to the the directory you are using to build your deployment package. The structure under this directory must match the structure that you want inside the EAR, as indicated in the preceding table. For example, if you customized...

    WCDE_installdir/xml/messaging/user_template.xml

    ...deploy it as...

    xml/messaging/user_template.xml

    Deleting assets from the EAR and including META-INF/ibm-partialapp-delete.props in the ZIP file

    You can use either the WAS console to add or update assets. However, deleting application files in a partial application update deployment scenario is accomplished by supplying a special metadata file called...

    META-INF/ibm-partialapp-delete.props

    ...in the partial application ZIP. This file can exist at the application scope or at any embedded archive scope including modules.

    For example, to delete files at the application level (outside of any module) add a file...

    /META-INF/ibm-partialapp-delete.props

    ...in the partial application ZIP file.

    Similarly, to delete files from a module (for example, MyWeb.war), add a file...

    /MyWeb.war/META-INF/ibm-partialapp-delete.props

    ...in the partial application ZIP file.

    To delete files from util.jar inside MyWeb.war, add a file...

    /MyWeb.war/util.jar/META-INF/ibm-partialapp-delete.props

    To delete assets first create and include the metadata file called...

    META-INF/ibm-partialapp-delete.props

    ...in the partial application ZIP:

    1. Identify the files and the modules containing the files that you want to delete.

    2. Create a temporary directory on your file system for the assets to delete, for example, C:\exportTemp\partialApp.

    3. For any EAR level files you want to delete:

      1. Create a file called META-INF/ibm-partialapp-delete.props

      2. For each file you want to delete, add a line to that file giving the relative path to the file, including the file name. For example, to delete WC_demo.ear/mydir/myfile.txt, put mydir/myfile.txt in the file on a line by itself.

    4. For each module that contains files you want to delete:

      1. Create a file called module/META-INF/ibm-partialapp-delete.props

      2. For each file you want to delete from that module, add a line to that file giving the relative path (relative to module) to the file , including the file name. For example, to delete WC_demo.ear/Stores.war/mystore/file.txt, put mystore/file.txt in the file on a line by itself.

  4. Package the assets in a ZIP file

    After you have collected all of the assets, you will have a directory that has a structure underneath it that should match the production EAR file. For example, you can have a structure similar to this:

    C:\exportTemp\partialApp\
    C:\exportTemp\partialApp\WebSphereCommerceServerExtensionsLogic.jar
    C:\exportTemp\partialApp\Stores.war\myStore\index.jsp
    C:\exportTemp\partialApp\Stores.war\WEB-INF\lib\myUtilities.jar
    C:\exportTemp\partialApp\xml\messaging\user_template.xml

    The directory C:\exportTemp\partialApp\ represents the root of the production EAR file.

    Use a ZIP utility to create a zip file of all of the files and directories under C:\exportTemp\partialApp\. This ZIP file will then be used to update your WebSphere Commerce J2EE application.

Related tasks

Deploy J2EE assets for a partial application
Package custom J2EE assets