Customizing modules using DConfigBeans

You 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).

Before you begin

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

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

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

About this task

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 WebSphere Application Server 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.

Procedure

  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)});
       }
    }
    



In this information ...


IBM Redbooks, demos, education, and more

(Index)

Use IBM Suggests to retrieve related content from ibm.com and beyond, identified for your convenience.

This feature requires Internet access.

Task topic Task topic    

Terms of Use | Feedback

Last updatedLast updated: Sep 19, 2011 7:16:32 PM CDT
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=matt&product=was-express-iseries&topic=trun_app_jsr88_config
File name: trun_app_jsr88_config.html