3 Configuring Applications for Deployment

This chapter describes how to configure an application or deployable resource for deployment to a WebLogic Server instance using deployment descriptors. Certain elements in these descriptors refer to external objects and may require special handling depending on the server vendor. WebLogic Server uses descriptor extensions—WebLogic Server specific deployment descriptors. The mapping between standard descriptors and WebLogic Server descriptors is managed using DDBeans and DConfigBeans.

This chapter includes the following sections:

Overview of the Configuration Process

This section provides information on the basic steps a deployment tool must implement to configure an application for deployment:

  1. Application Evaluation—Inspection and evaluation of application files to determine the structure of the application and content of the embedded descriptors.

    • Initialize a deployment session by obtaining a WebLogicDeploymentManager. See Application Evaluation.

    • Create a WebLogicJ2eeApplicationObject or WebLogicDeployableObject to represent the Java EE Configuration of an enterprise application (EAR) or stand-alone module (WAR, EAR, RAR, or CAR). If the object is an EAR, child objects are generated. See Java EE Deployment API standard (JSR-88) at http://jcp.org/en/jsr/detail?id=88 and Create a Deployable Object.

  2. Front-end Configuration—Creation of configuration information based on content embedded within the application. This content may be in the form of WebLogic Server descriptors, defaults, and user provided deployment plans.

    • Create a WebLogicDeploymentConfiguration object to represent the WebLogic Server configuration of an application. This is the first step in creating a deployment plan for this object. See Deployment Configuration.

    • Restore existing WebLogic Server configuration values from an existing deployment plan, if available. See Perform Front-end Configuration.

  3. Deployment Configuration—Modification of individual WebLogic Server configuration values based on user inputs and the selected WebLogic Server targets.

    A deployment tool must provide the ability to modify individual WebLogic Server configuration values based on user inputs and selected WebLogic Server targets. See Customizing Deployment Configuration.

  4. Deployment Preparation—Generation of the final deployment plan and preliminary client-side validation of the application.

    A deployment tool must have the ability to save the modified WebLogic Server configuration information to a new deployment plan or to variable definitions in an existing Deployment Plan.

Types of Configuration Information

The following sections provide background information on the types of configuration information, how it is represented, and the relationship between Java EE and WebLogic Server descriptors:

Java EE Configuration

The Java EE configuration for an application defines the basic semantics and run-time behavior of the application, as well as the external resources that are required for the application to function. This configuration information is stored in the standard Java EE deployment descriptor files associated with the application, as listed in Table 3-1.

Table 3-1 Standard Java EE Deployment Descriptors

Application or Standalone Module Java EE Descriptor

Enterprise Application


Web Application


Enterprise JavaBean


Resource Adapter


Client Application Archive


Complete and valid Java EE deployment descriptors are a required input to any application configuration session.

Because the Java EE configuration controls the fundamental behavior of an application, the Java EE descriptors are typically defined only during the application development phase, and are not modified when the application is later deployed to a different environment. For example, when you deploy an application to a testing or production domain, the application's behavior (and therefore its Java EE configuration) should remain the same as when application was deployed in the development domain. See Perform Front-end Configuration for more information.

WebLogic Server Configuration

The WebLogic Server descriptors provide for enhanced features, resolution of external resources, and tuning associated with application semantics. Applications may or may not have these descriptors embedded in the application. The WebLogic Server configuration for an application:

  • Binds external resource names to resource definitions in the Java EE deployment descriptor so that the application can function in a given WebLogic Server domain

  • Defines tuning parameters for the application containers

  • Provides enhanced features for Java EE applications and stand-alone modules

The attributes and values of a WebLogic Server configuration are stored in the WebLogic Server deployment descriptor files, as shown in Table 3-2.

Table 3-2 WebLogic Server Deployment Descriptors

Application or Standalone Module WebLogic Server Descriptor

Enterprise Application


Web Application


Enterprise JavaBean


Resource Adapter


Client Archive


Because different WebLogic Server domains provide different types of external resources and different levels of service for the application, the WebLogic Server configuration for an application typically changes when the application is deployed to a new environment. For example, a production staging domain might use a different database vendor and provide more usable memory than a development domain. Therefore, when moving the application from development to the staging domain, the application's WebLogic Server descriptor values need to be updated in order to make use of the new database connection and available memory.

The primary job of a deployment configuration tool is to ensure that an application's WebLogic Server configuration is valid for the selected WebLogic targets.

Representing Java EE and WebLogic Server Configuration Information

Both the Java EE deployment descriptors and any available WebLogic Server descriptors are used as inputs to the application configuration process. You use the deployment API to represent both the Java EE configuration and WebLogic Server configuration as Java objects.

The Java EE configuration for an application is obtained by creating either a WebLogicJ2eeApplicationObject for an EAR, or a WeblogicDeployableObject for a stand-alone module. (A WebLogicJ2eeApplicationObject contains multiple DeployableObject instances to represent individual modules included in the EAR.)

Each WebLogicJ2eeApplicationObject or WeblogicDeployableObject contains a DDBeanRoot to represent a corresponding Java EE deployment descriptor file. Java EE descriptor properties for EARs and modules are represented by one or more DDBean objects that reside beneath the DDBeanRoot. DDBean components provide standard getter methods to access individual deployment descriptor properties, values, and nested descriptor elements.


DDBeans are described by the javax.enterprise.deploy.model package. These objects provide a generic interface to elements in standard deployment descriptors, but can also be used as an XPath based mechanism to access arbitrary XML files that follow the basic form of the standard descriptors. Examples of such files would be WebLogic Server descriptors and Web services descriptors.

The DDBean representation of a descriptor is a tree of DDBeans, with a specialized DDBean, a DDBeanRoot, at the root of the tree. DDBeans provide accessors for the element name, ID attribute, root, and text of the descriptor element they represent.

The DDBeans for an application are populated by the model plug-in, the tool provider implementation of javax.enterprise.deploy.model. An application is represented by the DeployableObject interface. The WebLogic Server implementation of this interface is a public class, weblogic.deploy.api.model.WebLogicDeployableObject. A WebLogic Server based deployment tool acquires an instance of WebLogicDeployableObject object for an application using the createDeployableObject factory methods. This results in the DDBean tree for the application being created and populated by the elements in the Java EE descriptors embedded in the application. If the application is an EAR, multiple WebLogicDeployableObject objects are created. The root WebLogicDeployableObject, extended as WebLogicJ2eeApplicationObject, would represent the EAR module, with its child WebLogicDeployableObject instances being the modules contained within the application, such as WARs, EJBs, RARs and CARs.

The Relationship Between Java EE and WebLogic Server Descriptors

Java EE descriptors and WebLogic Server descriptors are directly related in the configuration of external resources. A Java EE descriptor defines the types of resources that the application requires to function, but it does not identify the actual resource names to use. The WebLogic Server descriptor binds the resource definition in the Java EE descriptor name to the name of an actual resource in the target domain.

The process of binding external resources is a required part of the configuration process. Binding resources to the target domain ensures that the application can locate resources and successfully deploy.

Java EE descriptors and WebLogic Server descriptors are also indirectly related in the configuration of tuning parameters for WebLogic Server. Although no elements in the standard Java EE descriptors require tuning parameters to be set in WebLogic Server, the presence of individual descriptor files indicates which tuning parameters are of interest during the configuration of an application. For example, although the ejb.xml descriptor does not contain elements related to tuning the WebLogic Server EJB container, the presence of an ejb.xml file in the Java EE configuration indicates that tuning properties can be configured before deployment.


DConfigBeans (config beans) are the objects used to convey server configuration requirements to a deployment tool, and are also the primary source of information used to create deployment plans. Config beans are Java Beans and can be introspected for their properties. They also provide basic property editing capabilities.

DConfigBeans are created from information in embedded WebLogic Server descriptors, deployment plans, and input from an IDE deployment tool.

A DConfigBean is potentially created for every weblogic Descriptor element that is associated with a dependency of the application. Descriptors are entities that describe resources that are available to the application, represented by a JNDI name provided by the server.

Descriptors are parsed into memory as a typed bean tree while setting up a configuration session. The DConfigBean implementation classes delegate to the WebLogic Server descriptor beans. Only beans with dependency properties, such as resource references, have a DConfigBean. The root of descriptor always has a DConfigBeanRoot.

Bean Property accessors return a child DConfigBean for elements that require configuration or a descriptor bean for those that do not. Property accessors return data from the descriptor beans.

Modifications to bean properties result in plan overrides. Plan overrides for existing descriptors are handled using variable assignments. If the application does not come with the relevant WebLogic Server descriptors, they are automatically created and placed in an external plan directory. For external deployment descriptors, the change is made directly to the descriptor. Embedded descriptors are never modified on disk.

Application Evaluation

Application evaluation consists of obtaining a deployment manager and a deployable object container for your application. Use the following steps:

  1. Obtain a deployment factory class by specifying its name, weblogic.deployer.spi.factories.internal.DeploymentFactoryImpl.
  2. Register the factory class with a javax.enterprise.deploy.spi.DeploymentFactoryManager instance.

    For instance:

    Class WlsFactoryClass =   Class.forname("weblogic.deployer.spi.factories.internal.DeploymentFactoryImpl");
    DeploymentFactory myDeploymentFactory =
       (DeploymentFactory) WlsFactoryClass.newInstance();
  3. Obtain a Deployment Manager
  4. Create a Deployable Object

Obtain a Deployment Manager

The following sections provide information on how to obtain a deployment manager:

Types of Deployment Managers

WebLogic Server provides a single implementation for javax.enterprise.deploy.spi.DeploymentManager that behaves differently depending on the URI specified when instantiating the class from a factory. WebLogic Server provides two basic types of deployment manager:

  • A disconnected deployment manager has no connection to a WebLogic Server instance. Use a disconnected deployment manager to configure an application on a remote client machine. It cannot be used it to perform deployment operations. (For example, a deployment tool cannot use a disconnected deployment manager to distribute an application.)

  • A connected deployment manager has a connection to the Administration Server for the WebLogic Server domain, and by a deployment tool to both to configure and deploy applications.

A connected deployment manager is further classified as being either local to the Administration Server, or running on a remote machine that is connected to the Administration Server. The local or remote classification determines whether file references are treated as being local or remote to the Administration Server.

Table 3-3 summarizes deployment manager types.

Table 3-3 WebLogic Server Deployment Manager Usage

Deployment Manager Connectivity Type Usage Notes



Configuration tools only

Cannot perform deployment operations



Configuration and deployment tools local to the Administration Server

All files are local to the Administration Server machine



Configuration and Deployment for Tools on a remote machine (not on the Administration Server)

Distribution and Deployment operations cause local files to be uploaded to the Administration Server

Connected and Disconnected Deployment Manager URIs

Each DeploymentManager obtained from the WebLogicDeploymentFactory supports WebLogic Server extensions. When creating deployment tools, obtain a specific type of deployment manager by calling the correct method on the deployment factory instance and supplying a string constant defined in weblogic.deployer.spi.factories.WebLogicDeploymentFactory that describes the type of deployment manager required. Connected deployment managers require a valid server URI and credentials to the method in order to obtain a connection to the Administration Server.

Table 3-4 summarizes the method signatures and constants used to obtain the different types of deployment managers.

Table 3-4 URIs for Obtaining a WebLogic Server Deployment Manager

Type of Deployment Manager Method Argument



String value of WebLogicDeploymentFactory.LOCAL_DM_URI

connected, local


URI consisting of:

  • WebLogicDeploymentFactory.LOCAL_DM_URI

  • Administration Server host name

  • Administration Server port

  • Administrator username

  • Administrator password

connected, remote


URI consisting of:

  • WebLogicDeploymentFactory.REMOTE_DM_URI

  • Administration Server host name

  • Administration Server port

  • Administrator username

  • Administrator password

The sample code in Example 3-1 shows how to obtain a disconnected deployment manager.

Example 3-1 Obtaining a Disconnected Deployment Manager

Class WlsFactoryClass = Class.forname("weblogic.deployer.spi.factories.internal.DeploymentFactoryImpl");
DeploymentFactory myDeploymentFactory = (DeploymentFactory) WlsFactoryClass.newInstance();
WebLogicDeploymentManager myDisconnectedManager = 

The deployment factory contains a helper method, createUri() to help you form the URI argument for creating connected deployment managers. For example, to create a disconnected remote deployment manager, replace the final line of code with:

(WebLogicDeploymentManager)myDeploymentFactory.getDeploymentManager(myDeploymentFactory.createUri(WebLogicDeploymentFactory.REMOTE_DM_URI, "localhost", "7001", "weblogic", "weblogic"));

Using SessionHelper to Obtain a Deployment Manager

The SessionHelper helper class provides several convenience methods to help you easily obtain a deployment manager without manually creating and registering the deployment factories as shown in Example 3-1. The SessionHelper code required to obtain a disconnected deployment manager consists of a single line:

   DeploymentManager myDisconnectedManager = SessionHelper.getDisconnectedDeploymentManager();

You can use the SessionHelper to obtain a connected deployment manager, as shown below:

   DeploymentManager myConnectedManager = SessionHelper.getDeploymentManager("adminhost", "7001", "weblogic", "weblogic"));

This method assumes a remote connection to an Administration Server (adminhost). See the Javadocs for more information about SessionHelper.

Create a Deployable Object

The following sections provide information on how to create a deployable object, which is the container your deployment tool uses to deploy applications. Once you have initialized a configuration session by Obtain a Deployment Manager, create a deployable object for your deployment tool in one of the following ways:

Using the WebLogicDeployableObject class

The direct approach uses the WebLogicDeployableObject class of the model package as shown below:

   WebLogicDeployableObject myDeployableObject = WebLogicDeployableObject.createWebLogicDeployableObject("myAppFileName");

Once the deployable object is created, a configuration can be created for the applications deployment.

Using SessionHelper to obtain a Deployable Object

The SessionHelper helper class provides a convenient method to obtain a deployable object. The SessionHelper code required to obtain a deployable object is shown below:

   WebLogicDeployableObject myDeployableObject = SessionHelper.getDeployableObject();

There is no application specified in the getDeployableObject() call. SessionHelper uses the application in the root directory set by setApplicationRoot(). Once the application root directory is set, SessionHelper can be used to perform other operations, such as explicitly naming the dispatch file location or the deployment plan location.

You can also set the application file name using the setApplication method as shown below:


This method allows you to continue using SessionHelper independent of the directory structure. The getDeployableObject method returns the application specified.

Perform Front-end Configuration

Front-end configuration involves creating a WebLogicDeploymentPlan and populating it and its associated bean trees with configuration information:

What is Front-end Configuration

Front-end configuration phase consists of two logical operations:

  • Loading information from a deployment plan to a deployment configuration. If a deployment configuration does not yet exist, this includes creating a WebLogicDeploymentConfiguration object to represent the WebLogic Server configuration of an application. This is the first step in the process of process of creating a deployment plan for this object.

  • Restoring any existing WebLogic Server configuration values from an existing deployment plan.

A deployment tool must be able to:

  • Extract information from a deployment configuration. The deployment configuration is the active Java object that is used by the Deployment Manager to obtain configuration information. The deployment plan exists outside of the application so that it can be changed without manipulating the application.

A deployment plan is an XML document that contains the environmental configuration for an application and is sometimes referred to as an application's front-end configuration. A deployment plan:

  • Separates the environment specific details of an application from the logic of the application.

  • Is not required for every application. However, a deployment plan typically exists for each environment an application is deployed to.

  • Describes the application structure, such as what modules are in the application.

  • Allows developers and administrators to update the configuration of an application without modifying the application archive.

  • Contains environment-specific descriptor override information (tunables). By modifying a deployment plan, you can provide environment specific values for tunable variables in an application.

Deployment Configuration

The server configuration for an application is encapsulated in the javax.enterprise.deploy.spi.DeploymentConfiguration interface. A DeploymentConfiguration provides an object representation of a deployment plan. A DeploymentConfiguration is associated with a DeployableObject using the DeploymentManager.createConfiguration method. Once a DeploymentConfiguration object is created, a DConfigBean tree representing the configurable and tunable elements contained in any and all WebLogic Server descriptors is available. If there are no WebLogic Server descriptors for an application, then a DConfigBean tree is created using available default values. Binding properties that have no defaults are left unset.

When creating a deployment tool, you must ensure that the DConfigBean tree is fully populated before the tool distributes an application.

Example Code

The following code provides an example on how to populate DConfigBeans:

Example 3-2 Example Code to Populate DConfigBeans

public class DeploymentSession {
  DeploymentManager dm;
  DeployableObject dObject = null;
  DeploymentConfiguration dConfig = null;
  Map beanMap = new HashMap();
  // Assumes app is a Web app.
  public void initializeConfig(File app) throws Throwable {
     * Init the wrapper for the DDBeans for this module. This example assumes
    * it is using the WLS implementation of the model api.
    dObject= WebLogicDeployableObject.createDeployableObject(app);
    //Get basic configuration for the module
    dConfig = dm.createConfiguration(dObject);
     * At this point the DeployableObject is populated. Populate the 
     * DeploymentConfigurationbased on its content.
     * We first ask the DeployableObject for its root.
    DDBeanRoot root = dObject.getDDBeanRoot();
     * The root DDBean is used to start the process of identifying the
     * necessary DConfigBeans for configuring this module.
    System.out.println("Looking up DCB for "+root.getXpath());
    DConfigBeanRoot rootConfig = dConfig.getDConfigBeanRoot(root);
    collectConfigBeans(root, rootConfig);
     * The DeploymentConfiguration is now initialized, although not necessarily
     * completely setup.
    FileOutputStream fos = new FileOutputStream("test.xml");


  // bean and dcb are a related DDBean and DConfigBean.
 private void collectConfigBeans(DDBean bean, DConfigBean dcb) throws Throwable{
    DConfigBean configBean;
    DDBean[] beans;
    if (dcb == null) return;
     * Maintain some sort of mapping between DDBeans and DConfigBeans
     * for later processing.
     * The config bean advertises xpaths into the web.xml descriptor it
     * needs to know about.
    String[] xpaths = dcb.getXpaths();
    if (xpaths == null) return;
     * For each xpath get the associated DDBean and collect its associated 
     * DConfigBeans. Continue this recursively until we have all DDBeans and 
     * DConfigBeans collected.
    for (int i=0; i<xpaths.length; i++) {
      beans = bean.getChildBean(xpaths[i]);
      for (int j=0; j<beans.length; j++) {
         * Init the DConfigBean associated with each DDBean
        System.out.println("Looking up DCB for "+beans[j].getXpath());
        configBean = dcb.getDConfigBean(beans[j]);
        collectConfigBeans(beans[j], configBean);

This example merely iterates through the DDBean tree, requesting the DConfigBean for each DDBean to be instantiated.

DeploymentConfiguration objects may be persisted as deployment plans using DeploymentConfiguration.save(). A deployment tool may allow the user to import a saved deployment plan into the DeploymentConfiguration object instead of populating it from scratch. DeploymentConfiguration.restore() provides this capability. This supports the idea of having a repository of deployment plans for an application, with different plans being applicable to different environments.

Similarly the DeploymentConfiguration may be pieced together using partial plans, which were presumably saved in a repository from a previous configuration session. A partial plan maps to a module-root of a DConfigBean tree. DeploymentConfiguration.saveDConfigBean() and DeploymentConfiguration.restoreDConfigBean() provide this capability.

Parsing of the WebLogic Server descriptors in an application occurs automatically when a DeploymentConfiguration is created. The descriptors ideally conform to the most current schema. For older applications that include descriptors based on WebLogic Server 8.1 and earlier DTDs, a transformation is performed. Old descriptors are supported but they cannot be modified using a deployment plan. Therefore, any DOCTYPE declarations must be converted to name space references and element specific transformations must be performed.

Reading In Information with SessionHelper

SessionHelper.initializeConfiguration processes all standard and WebLogic Server descriptors in the application.

Prior to invoking initializeConfiguration, you can specify an existing deployment plan to associate with the application using the SessionHelper.setPlan() method. With a plan set, you can read in a deployment plan using the DeploymentConfiguration.restore() method. In addition, the DeploymentConfiguration.initializeConfiguration() method automatically restores configuration information once a plan is set.

When initiating a configuration session with the SessionHelper class, you can easily initiate and fill a deploymentConfiguration object with deployment plan information as illustrated below:

    DeploymentManager dm = SessionHelper.getDisconnectedDeploymentManager();
 SessionHelper helper = SessionHelper.getInstance(dm);
 // specify location of archive
 // specify location of existing deployment plan
 // initialize the configuration session
 DeploymentConfiguration dc = helper.getConfiguration();

The above code produces the deployment configuration and its associated WebLogicDDBeanTree.

Validating a Configuration

Validation of the configuration occurs mostly during the parsing of the descriptors which occurs when an application's descriptors are processed. Validation consists of ensuring the descriptors are valid XML documents and that the descriptors conform to their respective schemas.

Customizing Deployment Configuration

The Customizing Deployment Configuration phase involves modifying individual WebLogic Server configuration values based on user inputs and the selected WebLogic Server targets.

Modifying Configuration Values

In this phase, a configuration is only as good as the descriptors or pre-existing plan associated with the application. The DConfigBeans are designed as Java Beans and can be introspected, allowing a tool to present their content in some meaningful way. The properties of a DConfigBean are, for the most part, those that are configurable. Key properties (those that provide uniqueness) are also exposed. Setters are only exposed on those properties that can be safely modified. In general, properties that describe application behavior are not modifiable. All properties are typed as defined by the descriptor schemas.

The property getters return subordinate DConfigBeans, arrays of DConfigBeans, descriptor beans, arrays of descriptor beans, simple values (primitives and java.lang objects), or arrays of simple values. Descriptor beans represent descriptor elements that, while modifiable, do not require DConfigBean features, meaning there are no standard descriptor elements they are directly related to. Editing a configuration is accomplished by invoking the property setters.

The Java JSR-88 DConfigBean class allows a tool to access beans using the getDConfigBean(DDBean) method or introspection. The former approach is convenient for a tool that presents the standard descriptor based on the DDBeans in the application's DeployableObject and provides direct access to each DDBean's configuration (its DConfigBean). This provides configuration of the essential resource requirements an application may have. Introspection allows a tool to present the application's entire configuration, while highlighting the required resource requirements.

Introspection is required in both approaches in order to present or modify descriptor properties. The difference is in how a tool presents the information:

  • Driven by standard descriptor content or

  • WebLogic Server descriptor content.

A system of modifying configuration information must include a user interface to ask for configuration changes. See Example 3-3.

Example 3-3 Code Example to Modify Configuration Information

// Introspect the DConfigBean tree and ask for input on properties with setters
  private  void processBean(DConfigBean dcb) throws Exception {
    if (dcb instanceof DConfigBeanRoot) {
      System.out.println("Processing configuration for descriptor: "+dcb.getDDBean().getRoot().getFilename());
    // get property descriptor for the bean
    BeanInfo info =
    PropertyDescriptor[] props = info.getPropertyDescriptors();
    String bean = info.getBeanDescriptor().getDisplayName();
    PropertyDescriptor prop;
    for (int i=0;i<props.length;i++) {
      prop = props[i];
      // only allow primitives to be updated
      Method getter = prop.getReadMethod();
      if (isPrimitive(getter.getReturnType())) // see isPrimitive method below
        writeProperty(dcb,prop,bean); //see writeProperty method below
      // recurse on child properties
      Object child = getter.invoke(dcb,new Object[]{});
      if (child == null) continue;
      // traversable if child is a DConfigBean.
      Class cc = child.getClass();
      if (!isPrimitive(cc)) {
        if (cc.isArray()) {
          Object[] cl = (Object[])child;
          for (int j=0;j<cl.length;j++) {
                   if (cl[j] instanceof DConfigBean) processBean((DConfigBean) cl[j]);
        } else {
          if (child instanceof DConfigBean) processBean((DConfigBean) child);

   // if the property has a setter then invoke it with user input
     private void writeProperty(DConfigBean dcb, PropertyDescriptor prop, String bean)
    throws Exception {
    Method getter = prop.getReadMethod();
    Method setter = prop.getWriteMethod();
    if (setter != null) {
      PropertyEditor pe =
      if (pe == null &&
String[].class.isAssignableFrom(getter.getReturnType())) pe = 
new StringArrayEditor();  // see StringArrayEditor class below
      if (pe != null) {
        Object oldValue = getter.invoke(dcb,new Object[0]);
        String val =
        // see getUserInput method below
        if (val == null || val.length() == 0) return;
        Object newValue = pe.getValue();
        prop.getWriteMethod().invoke(dcb,new Object[]{newValue});

  private String getUserInput(String element, String property, String curr) {
    try {
      System.out.println("Enter value for "+element+"."+property+". Current value is: "+curr);
      return br.readLine();
    } catch (IOException ioe) {
      return null;
  // Primitive means a java primitive or String object here
  private  boolean isPrimitive(Class cc) {
    boolean prim = false;
    if (cc.isPrimitive() || String.class.isAssignableFrom(cc)) prim = true;
    if (!prim) {
      // array of primitives?
      if (cc.isArray()) {
        Class ccc = cc.getComponentType();
        if (ccc.isPrimitive() || String.class.isAssignableFrom(ccc)) prim = true;
    return prim;

   * Custom editor for string arrays. Input text is converted into tokens using
   * commas as delimiters
  private class StringArrayEditor extends PropertyEditorSupport {
    String[] curr = null;

    public StringArrayEditor() {super();}

    // comma separated string
    public String getAsText() {
      if (curr == null) return null;
      StringBuffer sb = new StringBuffer();
      for (int i=0;i<curr.length;i++) {
      if (curr.length > 0) sb.deleteCharAt(sb.length()-1);
      return sb.toString();

    public Object getValue() { return curr; }

    public boolean isPaintable() { return false; }

    public void setAsText(String text) {
      if (text == null) curr = null;
      StringTokenizer st = new StringTokenizer(text,",");
      curr = new String[st.countTokens()];
      for (int i=0;i<curr.length;i++) curr[i] = new String(st.nextToken());

    public void setValue(Object value) {
      if (value == null) {
        curr = null;
      } else {
        String[] v = (String[])value; // let caller handle class cast issues
        curr = new String[v.length];
        for (int i=0;i<v.length;i++) curr[i] = new String(v[i]);

Beyond the mechanics of the rudimentary user interface, any interface that enables changes to the configuration by an administrator or user can use the property setters shown in Example 3-3.


Targets are associated with WebLogic Servers, clusters, Web servers, virtual hosts and JMS servers. See weblogic.deploy.api.spi.WebLogicTarget and Support for Querying WebLogic Target Types.

Application Naming

In WebLogic Server, application names are provided by a deployment tool. Names of modules contained within an application are based on the associated archive or root directory name of the modules. These names are persisted in the configuration MBeans constructed for the application.

In Java EE deployment there is no mention of the configured name of an application or its constituent modules, other than in the TargetModuleID object. Yet TargetModuleIDs exist only for applications that have been distributed to a WebLogic Server domain. Hence there is a need to represent application and module names in a deployment tool prior to distribution. This representation should be consistent with the names assigned by the server when the application is finally distributed.

Your deployment tool plug-in must construct a view of an application using the DeployableObject and J2eeApplicationObject classes. These classes represent stand-alone modules and EARs, respectively. Each of these classes is directly related to a DDBeanRoot object. When presented with a distribution where the name is not configured, the deployment tool must create a name for the distribution. If the distribution is a File object, use the filename of the distribution. If an archive is offered as an input stream, a random name is used for the root module.

Deployment Preparation

The deployment preparation phase involves saving the resulting plan from a configuration session. Use the DeploymentConfiguration.save() method (a standard Java EE Deployment API method). You can also use the SessionHelper.savePlan() method to save a new copy of deployment plan along with any external documents in the plan directory.

The DeploymentConfiguration.save methods creates an XML file based on the deployment plan schema that consists of a serialization of the current collection of DConfigBeans, along with any variable assignments and definitions. DConfigBean trees are always saved as external descriptors. These descriptors are only be saved if they do not already exist in the application archive or the external configuration area, meaning a save operation does not overwrite existing descriptors. The DeploymentConfiguration.saveDConfigBean method does overwrite files. This is does not mean that any changes made to a configuration are lost, it means that they are handled using variable assignments.

As noted before, the DeploymentConfiguration.restore methods are used to create configuration beans based on a previously saved deployment plan (see Perform Front-end Configuration). You can restore an entire collection of configuration beans or you can restore a subset of the configuration beans. It is also possible to save or restore the configuration beans for a specific module in an application.

Session Cleanup

Temporary files are created during a configuration session. Archives are exploded into the temp area and can only be removed after session configuration is complete. There is no standard API defined to close out a session. Use the close() methods to WebLogicDeployableObject and WebLogicDeploymentConfiguration. SessionHelper.close() to clean up after a session. If you do not clean up after closing sessions, the disk containing your temp directories may fill up over time.