WAS v8.5 > Administer applications and their environment > Manage applications through programming

Prepare an application for installation using programming

WAS v8.5 application management architecture provides a set of classes that allows application developers to collect WebSphere Application Server-specific deployment information, hereafter called binding information, and store it in the application EAR file. Such an EAR file can then be installed into a WAS configuration, using application management interfaces that are described in the topic Installing an application through programming. This topic uses a programming example to explain how an EAR file can be populated with binding information.

This task assumes a basic familiarity with WAS programming interfaces and MBean programming. Read about WAS programming interfaces and MBean programming in the application programming interfaces documentation. Complete the following tasks to prepare an application for installation through programming.

  1. Create an AppDeploymentController.

    The AppDeploymentController takes an EAR file as an argument and creates a sequence of steps, represented by AppDeploymentTask objects (hereafter called tasks). The tasks are typically presented to the deployer to collect binding information, or are manipulated programmatically. The following code excerpt shows how to create an AppDeploymentController instance:

    // create preferences to pass in the locale information 
    Hashtable prefs = new Hashtable(); 
    prefs.put(AppConstants.APPDEPL_LOCALE, Locale.getDefault()); 
    
    
    // create a controller instance for EAR file 
    // specified by a fully-qualified path in earName 
    AppDeploymentController flowController =
    AppManagementFactory.readArchive (earName, prefs); 
  2. Obtain AppDeploymentTask instances. After creating AppDeploymentController, we can iterate over the task objects that it creates. Each task collects a specific kind of binding information for various modules in the application or for the application itself. A task can have the following attributes, and corresponding getters/setters, as applicable. See the javadoc for the AppDeploymentTask API for more information about these attributes.

    Task attributes. The following table describes the attributes that an AppDeploymentController task might have.

    Name Description Value
    appController A controller instance that manages tasks. AppDeploymentController
    colNames The task column names java.lang.String[]
    hasHiddenColumns Whether the task has any hidden columns. boolean
    HiddenColumns An array of boolean that indicates these columns should not be shown by the tool that displays the tasks to the end user. boolean[]
    HIGHEST_VERSION Public static final java.lang.String HIGHEST_VERSION static java.lang.String
    isSufficientlyDone Whether the task has any required data not specified. boolean
    isTaskDisabled Whether the task should be shown or changed. boolean
    isTaskEmpty Whether the task has any data in it. boolean
    isValidationEnabled Whether the task should be validated boolean
    mutables An array of boolean indicating if the task data in a specific column index can be changed by the person who is deploying the application. boolean[]
    name A unique task name java.lang.String
    requiredColumns An array of boolean indicating if a task column must have a non-null value. boolean[]
    taskData A 2-dimensional array (table) of strings. The first row of the table contains the column headings for the task (e.g. name of the module, module URI, JNDI name etc). The rest of the rows represent application-specific information. java.lang.String[]
    taskValidateErrorMessages The error messages that are generated when a task is validated java.lang.String[]
    VERSION_HIGHEST public static final int VERSION_HIGHEST static int

    The following table lists various task names that are typically created by the AppDeploymentController for a J2EE 1.2, J2EE 1.3, or a Java EE 5 or later application. You might notice more tasks if the application contains WAS enterprise extensions.

    Task names that are typically created by the AppDeploymentController for a J2EE 1.2, J2EE 1.3, or a Java EE 5 or later application. The following table provides the names of the tasks that are typically created by the AppDeploymentController for a J2EE 1.2, J2EE 1.3, or a Java EE 5 or later application. It also provides a description of each tasks and the task column names.

    AppDeploymentTask name Description Task column names
    MapRolesToUsers Allows you to specify users or groups for a security role. You must map each role defined in the application or module to a user or group from the domain user registry. Each row of task data represents a single security role. We can specify multiple users or groups for a single role by separating them with a quotation mark (").

    • role- lists the specific capabilities that are given to a user. Role privileges give users and groups permission to run as specified. For example, you might map the user Joe to the administrator role, which enables user Joe to perform all of the tasks associated with the administrator role. The authorization policy is only enforced when global security is enabled.
    • everyone - specifies whether to map everyone to a specified role.
    • allAuthenticatedUsers - specifies whether to map all authenticated users regardless of the realm to a specified role
    • mappedUsers - lists the users that are mapped to the specified role within this application.
    • mappedGroups - lists the groups that are mapped to this specified role within this application.
    • allAuthenticatedUsersInRealms - specifies whether to map all users in the trusted realms to a specified role.
    • userAccessIds - specifies the user information used for Java Platform, Enterprise Edition authorization when using the WAS default authorization engine. The format for the user accessIds is user:realm/uniqueUserID.
    • groupAccessIds - specifies the group information. The format for the group accessIds is group:realm/uniqueGroupID.

    MapRunAsRolesToUsers Allows you to specify credentials for a run-as role. The enterprise beans that you install contain predefined RunAs roles. Enterprise beans that need to run as a particular role for recognition while interacting with another enterprise bean use RunAs roles. Each row of task data represents a single run-as role.

    • role - maps specific capabilities to a user. The authorization policy is only enforced when global security is enabled.
    • userName - specifies a user name for the RunAs role user. This user already maps to a role specified for the MapRolesToUsers task. We can map the user to its appropriate role by either mapping the user to that role directly or mapping a group containing the user to that role.
    • password - specifies the password for the RunAs user.

    BindJndiForEJBNonMessageBinding Allows you to specify JNDI names for enterprise java beans (EJBs). This JNDI name is used to look up EJB Homes from client programs. A row of task data specifies a single EJB for which a JNDI name can be supplied.

    • EJBModule - specifies the EJB module containing the enterprise beans that bind to the JNDI name.
    • EJB - specifies the name of an enterprise bean contained by the module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JNDI - specifies the JNDI name associated with the enterprise bean in an EJB module.

    BindJndiForEJBMessageBinding Allows you to specify a listener port name or JNDI of an activation specification for message-driven beans (MDBs). Ensure each MDB in the application or module is bound to a listener port name or JNDI of an activation specification. Each row of task data represents a single message-driven bean.

    • EJBModule - specifies the Enterprise JavaBeans module containing the enterprise bean.
    • EJB - specifies the name of an MDB in the application.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • listenerPort - specifies a listener port namefor the MDB.
    • actSpecJNDI - specifies an activation specification JNDI name for the MDB. When a MDB is bound to an activation specification JNDI name we can also specify the destination JNDI name and the authentication alias.
    • actSpecDestinationJNDI - specifies a destination JNDI name for the activation specification.
    • actSpecAuth - specifies a authentication alias used to access the user name and password that are set on the configured J2C activation specification.

    BindJndiForEJBBusiness Allows you to specify JNDI name bindings for each enterprise bean with a business interface in an EJB module. Each enterprise bean with a business interface in an EJB module must be bound to a JNDI name. A row of task data specifies a single enterprise bean for which a JNDI name can be supplied.

    • EJBModule - specifies the EJB module containing the enterprise beans that bind to the JNDI name.
    • EJB - specifies the name of an enterprise bean that binds to the JNDI name..
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • businessInterface - specifies the enterprise bean business interface in an EJB module.
    • JNDI - specifies the JNDI name associated with the enterprise bean business interface in an EJB module.

    MapEJBRefToEJB Allows you to specify JNDI names of EJBs that are bound to ejb-refs. Each row of task data represents a single ejb-ref defined in a module,

    An EJB 3.0 module cannot contain container-managed or bean-managed persistence entity beans. Installation fails when a container-managed or bean-managed persistence entity bean is packaged in a EJB 3.0 module of a Java EE application. We can only package container-managed or bean-managed persistence in an EJB 2.1 or earlier module.

    If the EJB reference is from an EJB 3.0, Web 2.4, or Web 2.5 module, the JNDI name is optional. If the Allow EJB reference targets to resolved automatically option is enabled, the JNDI name is optional for all modules. The runtime provides a container default or automatically resolves the EJB reference if a binding is not provided.

    • EJB - specifies the name of an enterprise bean contained by the module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • referenceBinding - specifies the name of the EJB reference used in the enterprise bean.
    • class - Name of a Java class associated with this enterprise bean.
    • JNDI - specifies the JNDI name associated with the enterprise bean in an EJB module

    MapResRefToEJB Allows you to specify JNDI names of resources defined in WAS configuration that are bound to resource-refs. Each row of task data represents a single resource-ref defined in a module.

    • AppVersion - specifies the version of the application.
    • ModuleVersion - specifies the version of the module.
    • Module - specifies the name of a module in the application.
    • EJB - specifies the name of an enterprise bean containing the resource reference. (Only applies for an EJB module)
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • referenceBinding - specifies the name of a resource reference contained by the module.
    • targetResourceJNDI - specifies the JNDI name of the resource that is the mapping target of the resource reference.
    • Login configuration - this column applies to data sources and connection factories only, and refers to the authentication method for securing the resource.

      Java 2 Connectors (J2C) use the DefaultPrincipalMapping login configuration to map users to principals that are defined in the J2C authentication data entries. If the login.config.name is set to DefaultPrincipalMapping, a property is created with the name com.ibm.mapping.authDataAlias . The value of the property is set by the authentication props. If the login.config name is not set to DefaultPrincipalMapping, the authentication props can specify multiple properties.

    • authentication properties - specifies properties used by login configuration. The string format is:
      websphere:name= <name1>,value=
      <value1>,description=<desc1>

      We can use the plus sign (+) to specify multiple properties.

    • Resource authorization - specifies the authorization type for securing the resource.
    • Extended data source properties - specifies the extended data source properties for a DB2 database. We can use these properties to allow an application to extend the custom properties for a data source, or override any non-core properties that already exist for that data source.

    MapResEnvRefToRes Allows you to specify the JNDI names of resources defined in the WAS configuration that are bound to resource-env-refs. Each row of task data represents a single resource-env-ref defined in a module.

    • Module - specifies the name of a module in the application.
    • EJB - specifies the name of an enterprise bean containing the resource environment reference. (Only applies for an EJB module).
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • referenceBinding - specifies the name of a resource environment reference. The reference corresponds to a resource that is bound as a resource environment entry into the JNDI name space of the application server.
    • resEnvRef.type - specifies the type associated with the resource environment reference.
    • JNDI- specifies the JNDI name of the resource environment entry that is the mapping target of the resource environment reference.

    MapSharedLibForMod Allows you to associate defined shared libraries with an application or Web module. A shared library is an external JAR file used by one or more applications. Using shared libraries enables multiple applications deployed on a server to use a single library, rather than use multiple copies of the same library. After you associate shared libraries with an application or module, the application or module class loader loads classes represented by the shared libraries and makes those classes available to the application or module. Each row of task data represents a single application or Web module.

    • application - specifies the name of the application that you are installing.
    • module - specifies the name of the module associated with the shared libraries.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • sharedLibraries - Name of the shared library files associated with the application or module

    SharedLibRelationship Allows you to specify relationship identifiers and composition unit names for shared libraries that modules in your enterprise application reference. When installing your enterprise application, the product creates a composition unit for each shared library relationship in the business-level application that you specified. Each row of task data represents a single application or Web module.

    CtxRootForWebMod Allows you to specify the context root for Web modules during or after installation of an application onto a WAS deployment target. Each row of task data represents a single Web module.

    • webModule - specifies the name of a Web module in the application that you are installing or that you are viewing after installation.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • contextRoot - specifies the context root of the Web application (WAR). A context root for each Web module is defined in the application deployment descriptor during application assembly. The context root is combined with the defined servlet mapping (from the WAR file) to compose the full URL that users type to access the servlet. For example, if the context root is /gettingstarted and the servlet mapping is MySession, then the URL is http://host:port/gettingstarted/MySession.

    MapInitParamForServlet Allows you to specify initial parameter values for servlets in Web modules during or after installation of an application onto a WAS deployment target. The <param-value> values specified in <init-param> statements in web.xml of Web modules are used by default. Each row of task data represents a single servlet.

    • module - specifies the name of a module in the application that you are installing or that you are viewing after installation.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • servlet - specifies a unique name for the servlet within the application. You must package servlets in a Web archive (WAR) file or Web module for deployment to an application server. Servlets run on a Java-enabled Web server and extend the capabilities of a Web server, similar to the way applets run on a browser and extend the capabilities of a browser.
    • name - specifies the name of the initial parameter passed to the init method of the Web module servlet filter. The following example servlet filter statement in a web.xml file specifies an initial parameter name of attribute:
      <init-param>    <param-name>attribute</param-name>    <param-value>tests.Filter.
      DoFilter_Filter.SERVLET_MAPPED
      </param-value> </init-param>
    • value - specifies the value assigned to an initial parameter passed to the init method of the Web module servlet filter. The following example servlet filter statement in a web.xml file specifies an initial parameter value of tests.Filter.DoFilter_Filter.SERVLET_MAPPED for the init parameter attribute:
      <init-param>    <param-name>attribute</param-name>    <param-value>tests.Filter.
      DoFilter_Filter.SERVLET_MAPPED
      </param-value> </init-param>
    • description - specifies information about the initial parameter.

    MapEnvEntryForEJBMod Allows you to configure the environment entries of Enterprise JavaBeans™ (EJB) modules such as entity, session, or message driven beans. Each row of task data represents a single environment entry in an EJB module.

    • module - specifies the name of an EJB module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • EJB - specifies the name of an enterprise bean contained by the module.
    • name - specifies the name of the environment entry that you are editing or viewing. The environment entry is the env-entry property in the EJB module.
    • type - specifies a data type for the environment entry defined by the env-entry property in the EJB module.
    • description - specifies information on the environment entry.
    • value - specifies an editable value for the environment entry defined by the env-entry property in the EJB module.

    MapEnvEntryForWebMod Allows you to configure the environment entries of Web modules such as servlets and JSP files. Each row of task data represents a single environment entry in a Web module.

    • module - specifies the name of an Web module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • name - specifies the name of the environment entry that you are editing or viewing. The environment entry is the env-entry property in the Web module.
    • type - specifies a data type for the environment entry defined by the env-entry property in the Web module.
    • description - specifies information on the environment entry.
    • value - specifies an editable value for the environment entry defined by the env-entry property in the Web module.

    MapMessageDestinationRefToEJB Allows you to specify the JNDI name of the J2C administered object to bind the message destination reference to the message driven beans. Each row of task data represents a single message destination reference in a module.

    • module - specifies the name of an EJB module.
    • EJB - specifies the name of message-driven beans (MDBs) contained by the module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • messageDestinationObject - specifies the name of the message destination reference or message destination link if a destination link is provided
    • JNDI - specifies the target JNDI of the referenced message destination bean. If a message destination link is provided, this field defaults to the destination JNDI of the message driven bean the message destination link references.

    DataSourceFor10EJBModules Allows you to specify JNDI name of the default data source used for an EJB module containing EJB1.x beans. Each row of task data represents a single EJB module.

    • EJBModule - specifies the name of the module containing the 1.x enterprise beans.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JNDI - specifies the JNDI name default data source for the EJB module.
    • userName - specifies the user name that, along with the password, comprises the authentication alias for securing the data source.
    • password- specifies the password that, along with the user name, comprises the authentication alias for securing the data source.
    • Login configuration - specifies to the authentication method for securing the data source.
    • authentication properties - specifies properties used by login configuration. The string format is:
      websphere:name= <name1>,value=<value1>,
      description=<desc1>

      We can use the plus sign (+) to specify multiple properties.

    DataSourceFor20EJBModules Allows you to specify JNDI name of the default connection factory used for an EJB module containing EJB2.x beans. Each row of task data represents a single EJB module.

    • EJBModule - specifies the name of the module containing the 1.x enterprise beans.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JNDI - specifies the JNDI name default data source for the EJB module.
    • Resource authorization - specifies the authorization type for securing the resource. The valid values are
      AppConstants.APPDEPL_CMPBINDING_
      RESAUTHTYPE_CONTAINER
      and
      AppConstants.APPDEPL_CMPBINDING_
      RESAUTHTYPE_PER_CONNECTION_FACTORY
      .
    • Login configuration - specifies to the authentication method for securing the data source.
    • authentication properties - specifies properties used by login configuration. The string format is:
      websphere:name= <name1>,value=<value1>,
      description=<desc1>

      We can use the plus sign (+) to specify multiple properties.

    • Extended data source properties - specifies the extended data source properties for a DB2 database.

      We can use these properties to allow an application to extend the custom properties for a data source, or override any non-core properties that already exist for that data source.

    DataSourceFor10CMPBeans Allows you to specify JNDI name of the data source to be used for an EJB1.x bean with container managed persistence. A row of task data represents a single EJB.

    • EJBModule - specifies the name of the module containing the 1.x enterprise beans.
    • EJB - specifies the name of an enterprise bean contained by the module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JNDI - specifies the JNDI name default data source for the EJB module.
    • userName - specifies the user name that, along with the password, comprises the authentication alias for securing the data source.
    • password- specifies the password that, along with the user name, comprises the authentication alias for securing the data source.
    • Login configuration - specifies to the authentication method for securing the data source.
    • authentication properties - specifies properties used by login configuration. The string format is:
      websphere:name= <name1>,value=<value1>,
      description=<desc1>

      We can use the plus sign (+) to specify multiple properties.

    DataSourceFor20CMPBeans Allows you to specify JNDI name of the connection factory to be used for an EJB2.x bean with container managed persistence. A row of task data represents a single EJB.

    • EJBModule - specifies the name of the module containing the 1.x enterprise beans.
    • EJB - specifies the name of an enterprise bean contained by the module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JNDI - specifies the JNDI name default data source for the EJB module.
    • Resource authorization - specifies the authorization type for securing the resource. The valid values are
      AppConstants.APPDEPL_CMPBINDING_
      RESAUTHTYPE_CONTAINER
      and
      AppConstants.APPDEPL_CMPBINDING_
      RESAUTHTYPE_PER_CONNECTION_FACTORY
      .
    • Login configuration - specifies to the authentication method for securing the data source.
    • authentication properties - specifies properties used by login configuration. The string format is:
      websphere:name= <name1>,value=<value1>,
      description=<desc1>

      We can use the plus sign (+) to specify multiple properties.

    • Extended data source properties - specifies the extended data source properties for a DB2 database.

      We can use these properties to allow an application to extend the custom properties for a data source, or override any non-core properties that already exist for that data source.

    MapWebModToVH Allows you to specify virtual hosts for Web modules. Each row of task data represents a Web module in the application for which virtual host information is to be collected. Web modules can be installed on the same virtual host or dispersed among several virtual hosts. Each row of task data represents a single Web module.

    • webModule - specifies the name of a Web module in the application that you are installing or that you are viewing after installation.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • virtualHost - specifies the name of the virtual host to which the Web module is currently mapped.

      Do not specify the same virtual host for different Web modules that have the same context root and are deployed on targets belonging to the same node even if the Web modules are contained in different applications. Specifying the same virtual host causes a validation error.

    EnsureMethodProtectionFor10EJB Allows you to specify if all unprotected methods of an EJB1.x module should be made inaccessible. Each task row represents a single EJB1.x module.

    • EJBModule - specifies the name of the module containing the EJB2.x beans.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • method.denyAllAccessPermission - specifies one of the following access permissions:

      • AAppConstants.YES_KEY, which indicates to protect this EJB module by making it inaccessible to users regardless of their access permissions.
      • AppConstants.NO_KEY, which indicates to make this EJB module accessible to users that have the appropriate access permissions.

    EnsureMethodProtectionFor20EJB Allows you to specify protection level for unprotected methods of EJB2.x beans in EJB modules. Each row of task data specifies method protection per EJB module.

    • EJBModule - specifies the name of the module containing the EJB2.x beans.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • method.protectionType - specifies one of the following protection methods:

      • AppConstants.APPDEPL_METHOD_PROTECTION_UNCHECK, which indicates that we do not want the application server to verify the access permissions for the EJB module. Everyone can access the EJB module.
      • AppConstants.APPDEPL_METHOD_PROTECTION_EXCLUDE, which indicates to protect this EJB module by making it inaccessible to users regardless of their access permissions.

    AppDeploymentOptions Allows you to specify various deployment-specific options. This task has only 2 rows. The first row specifies the option name and the second row has the corresponding option value. The following values are the valid values for these options unless otherwise indicated in the option description:

    • AppConstants.YES_KEY, which indicates to use this deployment option.
    • AppConstants.NO_KEY, which indicates that we do not want to use this deployment option.

    The options names that can be specified are:

    • preCompileJSPs - indicates whether the JSP files are recompiled.
    • installed.ear.destination - specifies the directory to which you want the EAR file installed. The value for this option is a fully-qualified directory path such as profile_root/installedApps/mycell/myapp.ear
    • distributeApp - indicates whether the application management component distributes application binaries.
    • useMetaDataFromBinary - indicates whether the metadata used at run time, such as deployment descriptors, bindings, and extensions, come from the EAR file.
    • deployejb - specifies whether to run the EJBDeploy tool during installation.
    • appname - specifies the name of the application you are deploying with these options.
    • createMBeansForResources - indicates whether MBeans are created for all resources, such as servlets, JSP files, and enterprise beans, that are defined in an application when the application starts on a deployment target.
    • reloadEnabled - indicates whether the file system of the application is scanned for updated files so that changes reload dynamically.
    • reloadInterval - specifies, in seconds, the length of time the file system of the application will be scanned for updated files. The value specified for this option is an integer greater than zero.
    • eployws - specifies whether to run the wsdeploy tool during deployment.
    • validateinput - Whether the product examines the application references specified during application installation or updating and, if validation is enabled, warns you of incorrect references or fails the operation. Valid values are AppConstants.APPDEPL_VALIDATE_INSTALL_OFF, AppConstants.APPDEPL_VALIDATE_INSTALL_WARM, and AppConstants.APPDEPL_VALIDATE_INSTALL_FAIL.
    • processEmbeddedConfig - specifies whether the embedded configuration should be processed. An embedded configuration consists of files such as resource.xml and variables.xml.
    • filepermission - specifies access permissions for application binaries for installed applications that are expanded to the specified directory.
    • blaname - specifies whether the product creates a new business-level application with the enterprise application that you are installing, or makes the enterprise application a composition unit of an existing business-level application
    • autolink - specifies whether the product assigns default JNDI values for any incomplete EJB reference targets, or automatically resolves any incomplete EJB reference targets.

    JSPReloadForWebMod Allows you to configure the class reloading of Web modules such as JSP files and to select a JSF implementation to use with this application. Each row of task data represents a single Web module.

    • webModule - specifies the name of a Web module in the application that you are installing or that you are viewing after installation.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • enableJSPClassReloading - specifies whether to enable class reloading when JSP files are updated.
    • JSPReloadInterval - specifies, in seconds, how frequently the product scans the file system for the application to check for updated JSP files.

    EJBDeployOptions Allows you to specify options for the EJB deployment tool. The tool generates code needed to run enterprise bean files. We can specify extra class paths, Remote Method Invocation compiler (RMIC) options, database types, and database schema names to be used while running the EJB deployment tool.

    • deployejb.classpath - specifies the class path of one or more zipped or JAR files on which the JAR or EAR file being installed depends.
    • deployejb.rmic - specifies whether the EJB deployment tool passes RMIC options to the Remote Method Invocation compiler. Refer to RMI Tools documentation for information on the options. The following values are valid for this column:

      • AAppConstants.YES_KEY, which enables the EJB deployment tool to pass RMIC options to the Remote Method Invocation compiler.
      • AppConstants.NO_KEY, which prevents the EJB deployment tool from passing RMIC options to the Remote Method Invocation compiler.

    • deployejb.dbtype - specifies the name of the database vendor, which is used to determine database column types, mapping information, Table.sql, and other information. If we specify a database type, previously defined backend IDs for all of the EJB modules are overwritten by the chosen database type. To enable backend IDs for individual EJB modules, do no specify a value for this column.
    • deployejb.dbschema - specifies the name of the schema to create. he EJB deployment tool saves database information in the schema document in the JAR or EAR file, which means the options do not need to be specified again. It also means that when a JAR or EAR is generated, the correct database must be defined at that point because it cannot be changed later. If the name of the schema contains any spaces, the entire name must be enclosed in double quotes. For example:

        "my schema"
    • deployejb.dbaccesstype - specifies the database access type for a DB2 database that supports Structured Query Language for Java (SQLJ). Use SQLJ to develop data access applications that connect to DB2 databases. SQLJ is a set of programming extensions that support use of the Java programming language to embed statements that provide SQL (Structured Query Language) database requests.
    • deployejb.SQLJclasspath - specifies the classpath of the DB2 SQLJ tool sqlj.zip file. WAS v8.5 uses this class path to run the DB2 SQLJ tool during application installation and generate SQLJ profiles (.ser files).
    • deployejb.JDKcompliancelevel - specifies the Java developer kit compiler compliance level when we include application source files for compilation.

    JSPCompileOptions Allows you to specify various options to be used by the JSP compiler.

    • webModule - specifies the name of a Web module in the application.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JSPclasspath - specifies a temporary classpath for the JSP compiler to use when compiling JSP files during application installation. This classpath is not saved when the application installation is complete and is not used when the application is running. This classpath is used only to identify resources outside of the application which are necessary for JSP compilation and which will be identified by other means (such as shared libraries) after the application is installed.

      In network deployment configurations, this class path is specific to the deployment manager machine.

    • useFullPackageNames - specifies whether the JSP engine generates and loads JSP classes using full package names. When full package names are used, precompiled JSP class files can be configured as servlets in web.xml, without having to use the jsp-file attribute. When full package names are not used, all JSP classes are generated in the same package, which has the benefit of smaller file-system paths.
    • JDKSourceLevel - specifies the source level at which the Java compiler compiles JSP Java sources. When specifying the value for this column, omit the decimal point in the level number. For example, specify 15 for JDK level 1.5.
    • disableJSPRuntimeCompilation - specifies whether a JSP file should never be translated or compiled at run time, even when a .class file does not exist. The following values are valid for this column:

      • AAppConstants.YES_KEY, which indicates to disable JSP runtime compilation.
      • AppConstants.NO_KEY, which indicates that we do not want to disable JSP runtime compilation.

    MapModulesToServers Allows you to specify the target servers or clusters for modules in an application. Each row of task data represents one module in the application. The server target is specified as WebSphere:cell=cellName,node=nodeName,server=serveName, and the cluster target is specified as WebSphere:cell=cellName,cluster=clusterName. Multiple targets can be specified for a given module by delimiting them with "+". Each row of task data represents a single module.

    • Module - specifies the name of a module in the application.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • server- specifies the target server or cluster for this module.

    CorrectUseSystemIdentity Allows you to manage the system identity properties for the Enterprise JavaBeans™ (EJB) method in the application.

    • role - specifies the RunAs role used for this EJB method.
    • userName - specifies a user name for the RunAs role user. The user name is used in conjunction with the RunAs role that you select for the role.
    • password - specifies the password associated with the user name in the user registry.

    CorrectOracleIsolationLevel Allows you to specify the isolation level for the Oracle type provider for resource references that map to resources that are using an Oracle database that is doing backend processing. Each row represents one resource reference that maps to an Oracle database resource.

    • Module - specifies the name of a module in the application.
    • resourceRef - specifies the name of a resource reference
    • JNDI - the JNDI name of the resource that is the mapping target of the resource reference.
    • isolationLevel - specifies the isolation level to use for the Oracle type provider. The two values that can be specified for this column are:

    ActSpecJNDI Allow you to provide JNDI names for JCA objects of embedded resource adapter modules.

    • Module - specifies the name of a module in the application.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • JCA object - specifies the name of a JCA object for J2C connection factory, administered object, or activation specification.
    • JNDI- specifies the JNDI name for the JCA object.

    BackendIdSelection Allows you to change the backend ID for the enterprise bean JAR modules that have container-managed persistence beans. An enterprise bean JAR module can support multiple backend configurations as specified using an application assembly tool. This task is useful if the application has EJB modules for which deployment code has been generated for multiple backend databases using an assembly tool.

    • Module - specifies the name of an EJB module in the application.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • ID - the existing backend ID that represents a backend database.
    • currentID - specifies the new backend ID representing the backend database to be used

    MetadataCompleteForModules Allows each EJB 3.0 module or Web 2.5 module to write out the complete deployment descriptor including deployment information from annotations. Then the system marks the deployment descriptor for the module as complete. Each row of task data represents a single module.

    • module - specifies the name of an EJB 3.0 or Web 2.5 module.
    • uri - the Uniform Resource Identifier (URI) specifies the location of the module archive relative to the root of the application EAR.
    • metadataComplete- specifies whether to write the complete module deployment descriptor including deployment information from annotation to XML format. When the metadata complete of a module is set to true, WebSphere writes out the complete deployment descriptor including deployment information from annotations. The following values are valid for this column:

      • AppConstants.YES_KEY, which indicates that EJB 3.0 modules or Web 2.5 modules can write out the complete deployment descriptor including deployment information from annotations.
      • AppConstants.NO_KEY, which indicates that EJB 3.0 modules or Web 2.5 modules cannot write out the complete deployment descriptor including deployment information from annotations.

    The URI column in various tasks uniquely identifies a module in the application using the format as its value, where moduleURI is the module file name defined in the application's deployment descriptor, and ddURI is the URI of the deployment descriptor within the module (for standard deployment descriptor) or the URI of the alternate deployment descriptor for the module, as defined in the application's deployment descriptor. For example, if an application has a Web module in MyWeb.war and the module uses a standard deployment descriptor, then the value of the URI column in various tasks for this module is MyWeb.war,WEB-INF/web.xml. Thus the URI column value always guarantees a unique identification of a module.

    The following code excerpt shows how to obtain tasks from AppDeploymentController:

    AppDeploymentTask task =flowController.getFirstTask(); 
    while (task != null) 
    {
    // manipulate task data as necessary
    task = flowController.getNextTask();} 
  3. Manipulate task data

    Using task name, task column names, and the J2EE artifact for which binding information is to be supplied, the task data can be modified if the corresponding column is marked as mutable. The following sample code shows how binding information can be supplied for a specific task. In this example, we are specifying users for a security role: consider the application has a security role named Role1, and needed to assign users User1 and User2 to that role:

    if (task.getName().equals ("MapRolesToUsers") && !task. isTaskDisabled()) 
    { 
    // find out column index for role and user column 
    // refer to the table above to find the column names 
    int roleColumn = -1;
    int userColumn = -1;
    String[] colNames = task.getColumnNames();
    for (int i=0; i < colNames.length; i++)
    { 
    if (colNames[i].equals ("role"))
    roleColumn = i;
    else if (colNames[i].equals ("role.user"))
    userColumn = i; } 
    
    // iterate over task data starting at row 1 as row0 is // column names String[][]data = task.getTaskData();
    for (int i=1; i < data.length; i++)
    {
    if (data[i][roleColumn].equals ("Role1")) 
    {
    data[i][userColumn]="User1|User2";
    break;}} 
    
    // now the task data is changed, save it back task.setTaskData (data);} 
    

    Similar logic can be used to specify all other types of binding information, such as JNDI names for EJBs, virtual host names for Web modules, etc., in various tasks. The task information and the sample code above do not allow us to collect binding information for application client modules. You need to use the Client Configuration tool shipped with WAS to configure application clients.

  4. Save the EAR file and obtain install options.

    After all the necessary binding information has been supplied in various tasks, the task data should be saved back into the EAR file so the populated EAR file can be installed into the WAS configuration. In addition to the binding information stored in the EAR file, there are several other deployment options that are collected by tasks, such as AppDeploymentOptions, EJBDeployOptions, and MapModulesToServers. These options are not saved in the EAR file but should be passed when the application is installed into the WAS configuration. After the task data is manipulated as necessary and the EAR file is saved, these options can be obtained from AppDeploymentController as a hash table. Alternately, these options can be passed directly during application installation, as explained in the Installing applications section below, and in the javadoc for installApplication API of com.ibm.websphere.management.application.AppManagement interface.

    The following code shows how to save the task data into the EAR file and get generated installation options:

    // the following line of code saves the task data // in the EAR file specified as earName in step 1
    flowController.saveAndClose();
    
    
    // get the installation options Hashtable options = flowController.getAppDeploymentSavedResults();

Use programming to install the application.


Related concepts:

Application management
Additional Application Programming Interfaces (APIs)


Related


Install an application through programming


+

Search Tips   |   Advanced Search