WAS v8.5 > Deploy applications > Deploy enterprise applications

Customize modules using DConfigBeans

We can configure Java Platform, Enterprise Edition (Java EE) applications or stand-alone modules during deployment using the DConfigBean class in the Java EE Application Deployment API specification (JSR-88).

Deprecated feature: Application installation using the Java EE Application Deployment API specification (JSR-88) was deprecated in WebSphere Application Server v8.0. Use another option to deploy applications to a server. The closest option to using the Java EE Deployment API is using JMX MBean programming. For information on deployment options, see "Ways to install enterprise applications or modules..

This topic assumes that you are deploying (installing) Java EE modules on an application server provided by the product using the WAS support for JSR-88.

Read about the JSR-88 specification and using the DConfigBean class at http://java.sun.com/j2ee/tools/deployment/.

The DConfigBean class in JSR-88 provides JavaBeans-based support for platform-specific configuration of J2EE applications and modules during deployment. Your code can inspect DConfigBean instances to get platform-specific configuration attributes. The DConfigBean instances provided by WAS contain a single attribute which has an array of java.util.Map objects. The map entries contain configuration attributes, for which your code can get and set values.

  1. Write code that installs Java EE modules on an application server using JSR-88.
  2. Write code that accesses DConfigBeans generated by the product during JSR-88 deployment. You (or a deployer) can then customize the accessed DConfigBeans instances.

    The following pseudocode shows how a Java EE tool provider can get DConfigBean instance attributes generated by the product during JSR-88 deployment and set values for the attributes.

    import javax.enterprise.deploy.model.*;
    import javax.enterprise.deploy.spi.*;
    {
    DeploymentConfiguration dConfig = ___; // Get from DeploymentManager
    DDBeanRoot ddRoot = ___;               // Provided by J2EE tool 
    // Obtain root bean.
    DConfigBeanRoot dcRoot = dConfig.getDConfigBeanRoot(dr);
    
    // Configure DConfigBean.
    configureDCBean (dcRoot);}
    
    // Get children from DConfigBeanRoot and configure each child.
    method configureDCBean (DConfigBean dcBean)
    {
       // Get DConfigBean attributes for a given archive.
       BeanInfo bInfo = Introspector.getBeanInfo(dcBean.getClass());
       IndexedPropertyDescriptor ipDesc = 
          (IndexedPropertyDescriptor)bInfo.getPropertyDescriptors()[0];
    
       // Get the 0th map.
       int index = 0;
       Map map = (Map) 
          ipDesc.getIndexedReadMethod().invoke
             (dcBean, new Object[]{new Integer(index)});
    
       while (map != null)
       {
          // Iterate over the map and set values for attributes.
    
          // Set the map back into the DCBean.
          ipDesc.getIndexedWriteMethod().invoke
             (dcBean, new Object[]{new Integer(index), map}); 
    
          // Get the next entry in the indexed property       map = (Map)
             ipDesc.getIndexedReadMethod().invoke
                (dcBean, new Object[]{new Integer(++index)});
       }}


Related concepts:

Ways to install enterprise applications or modules


Related


Install enterprise application files
Install enterprise modules with JSR-88


Related information:

Java EE Application Deployment specification


+

Search Tips   |   Advanced Search