Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Developer's Guide

- Previous: server
- Next: fileset

## component

Specifies a J2EE component. Allows a single task to act on multiple components. The `component` attributes override corresponding attributes in the parent task; therefore, the parent task attributes function as default values.

### Subelements

none

### Attributes

The following table describes attributes for the `component` element.

Table 3–18 `component` Attributes

Attribute | Default | Description
--- | --- | ---
`file` | none | (optional if the parent task is sun-appserv-undeploy or sun-appserv-component) The target component. If this attribute refers to a file, it must be a valid archive. If this attribute refers to a directory, it must contain a valid archive in which all components have been exploded. If `upload` is set to `false`, this must be an absolute path on the server machine.
`name` | file name without extension | (optional) The display name for the component.
`type` | determined by extension | (optional) Deprecated.
`force` | `true` | (applies to sun-appserv-deploy only, optional) If `true`, the component is overwritten if it already exists on the server. If `false`, the containing element’s operation fails if the component exists.
`precompilejsp` | `false` | (applies to sun-appserv-deploy only, optional) If `true`, all JSP files found in an enterprise application (`.ear`) or web application (`.war`) are precompiled. This attribute is ignored for other component types.
`retrievestubs` | client stubs not saved | (applies to sun-appserv-deploy only, optional) The directory where client stubs are saved.
`contextroot` | file name without extension | (applies to sun-appserv-deploy only, optional) The context root for a web module (WAR file). This attribute is ignored if the component is not a WAR file.
`verify` | `false` | (applies to sun-appserv-deploy only, optional) If `true`, syntax and semantics for all deployment descriptors is automatically verified for correctness.

### Examples

You can deploy multiple components using a single task. This example deploys each component to the same Application Server instance running on a remote server.

    <sun-appserv-deploy passwordfile="${passwordfile}" host="greg.sun.com"
    	 asinstalldir="/opt/s1as8" >
    <component file="${assemble}/simpleapp.ear"/>
    <component file="${assemble}/simpleservlet.war"
    	 contextroot="test"/>
    <component file="${assemble}/simplebean.jar"/>
    </sun-appserv-deploy>

You can also undeploy multiple components using a single task. This example demonstrates using the archive files (EAR and WAR, in this case) and the component name (for the EJB component).

    <sun-appserv-undeploy passwordfile="${passwordfile}">
    <component file="${assemble}/simpleapp.ear"/
    <component file="${assemble}/simpleservlet.war"/>
    <component name="simplebean" />
    </sun-appserv-undeploy>

You can deploy multiple components to multiple servers. This example deploys each component to two instances running on remote servers. Both servers use the same password.

    <sun-appserv-deploy passwordfile="${passwordfile}" asinstalldir="/opt/s1as8" >
    <server host="greg.sun.com"/>
    <server host="joe.sun.com"/>
    <component file="${assemble}/simpleapp.ear"/>
    <component file="${assemble}/simpleservlet.war"
    	contextroot="test"/>
    <component file="${assemble}/simplebean.jar"/>
    </sun-appserv-deploy>

You can also undeploy multiple components to multiple servers. This example shows the same three components being removed from two different instances. Both servers use the same password.

    <sun-appserv-undeploy passwordfile="${passwordfile}">
    <server host="greg.sun.com"/>
    <server host="joe.sun.com"/>
    <component file="${assemble}/simpleapp.ear"/>
    <component file="${assemble}/simpleservlet.war"/>
    <component name="simplebean" />
    </sun-appserv-undeploy>

You can enable or disable multiple components. This example demonstrates disabling multiple components using the archive files (EAR and WAR, in this case) and the component name (for the EJB component).

    <sun-appserv-component action="disable" passwordfile="${passwordfile}">
    <component file="${assemble}/simpleapp.ear"/>
    <component file="${assemble}/simpleservlet.war"/>
    <component name="simplebean" />
    </sun-appserv-component>

You can enable or disable multiple components on multiple servers. This example shows the same three components being enabled on two different instances. Both servers use the same password.

    <sun-appserv-component action="enable" passwordfile="${passwordfile}">
    <server host="greg.sun.com"/>
    <server host="joe.sun.com"/>
    <component file="${assemble}/simpleapp.ear"/>
    <component file="${assemble}/simpleservlet.war"/>
    <component name="simplebean" />
    </sun-appserv-component>

- Previous: server
- Next: fileset

- © 2010, Oracle Corporation and/or its affiliates