4.6 Application Management Deployment Commands

Use the commands in Table 4-6 to manage deployment.


Table 4-6 Application Management Deployment Commands

Use this command... To... Use with WLST...

getMDSArchiveConfig

Returns an MDSArchiveConfig object.

Offline

importMAR

Imports an MAR.

Online


4.6.1 getMDSArchiveConfig

Command Category: Application Management Deployment

Use with WLST: Offline

Description

Returns a handle to the MDSArchiveConfig object for the specified archive. The returned MDSArchiveConfig object's methods can be used to change application and shared repository configuration in an archive.

The MDSArchiveConfig object provides the following methods:

  • setAppMetadataRepository—This method sets the connection details for the application metadata repository.

    If the archive's existing adf-config.xml file does not contain any configuration for the application's metadata repository, then you must provide all necessary arguments to define the target repository. To define a database-based repository, provide the repository, partition, type, and jndi arguments. For a file-based repository, provide the path argument instead of jndi.

    If the adf-config.xml file already contains some configuration for the application's metadata repository, you can provide only a subset of arguments that you want to change. You do not need to provide all arguments in such a case. However, if the store type is changed, then the corresponding jndi or path argument is required.

  • setAppSharedMetadataRepository—This method sets the connection details for the shared repository in the application archive that is mapped to specified namespace.

    If the archive's existing adf-config.xml file does not contain any configuration for a shared metadata repository mapped to the specified namespace, you must provide all required arguments (in this case, repository, partition, type, and jndi or path). For a database-based repository, provide the jndi argument. For a file-based repository, path is a required argument.

    If the adf-config.xml file already contains some configuration for a shared metadata repository mapped to the specified namespace and you want to change some specific arguments, you can provide only a subset of those arguments; all others are not needed.

  • save—If you specify the toLocation argument, then the changes will be stored in the target archive file and the original file will remain unchanged. Otherwise, the changes will be saved in the original file itself.

Syntax

archiveConfigObject = getMDSArchiveConfig(fromLocation)

Argument Definition
fromLocation

The name of the ear file, including its complete path.


The syntax for setAppMetadataRepository is:

archiveConfigObject.setAppMetadataRepository([repository] [, partition] 
          [, type] [, jndi] [, path])

Argument Definition
repository

Optional. The name of the application's repository.

partition

Optional. The name of the partition for the application's metadata.

type

Optional. The type of connection, file or database, to the repository. Valid values are 'File' or 'DB' (case insensitive).

jndi

Optional. The JNDI location for the database connection. This argument is required if the type is set to DB. This argument is not considered if the type is set to File.

path

Optional. The directory for the metadata files. This argument is required if the type is set to File. This argument is not considered if the type is set to DB.


The syntax for setAppSharedMetadataRepository is:

archiveConfigObject.setAppSharedMetadataRepository(namespace [, repository] 
          [, partition] [, type] [, jndi] [, path])

Argument Definition
namespace

The namespace used for looking up the shared repository to set connection details.

repository

Optional. The name of the application's shared repository.

partition

Optional. The name of the partition for the application's shared metadata.

type

Optional. The type of connection, file or database, to the repository. Valid values are 'File' or 'DB' (case insensitive).

jndi

Optional. The JNDI location for the database connection. This argument is required if the type is set to DB. This argument will not be considered if the type is set to File.

path

Optional. The location of the file metadata store. This argument is required if the type is set to File. This argument will not be considered if the type is set to DB.


The syntax for save is:

archiveConfigObject.save([toLocation])

Argument Definition
toLocation

Optional. The file name, including the absolute path to store the changes. If this option is not provided, the changes are written to the archive represented by this configuration object.


Examples

In the following example, if the adf-config.xml file in the archive does not have the application and shared metadata repositories defined, then you should provide the complete connection information.

wls:/offline> archive = getMDSArchiveConfig(fromLocation='/tmp/testArchive.ear')

wls:/offline> archive.setAppMetadataRepository(repository='AppRepos1',
        partition='partition1', type='DB', jndi='mds-jndi1') 

wls:/offline> archive.setAppSharedMetadataRepository(namespace='/a',
        repository='SharedRepos1', partition='partition2', type='File',
        path='/temp/dir')
wls:/offline> archive.save() 

In the following example, if the adf-config.xml file in the archive already has the application and shared metadata repositories defined, all arguments are optional. You can set only the arguments you want to change.

wls:/offline> archive = getMDSArchiveConfig(fromLocation='/tmp/testArchive.ear')
wls:/offline> archive.setAppMetadataRepository(partition='MDS-partition2')
wls:/offline> archive.setAppSharedMetadataRepository(namespace='/a',
         repository='SharedRepos2') 
wls:/offline> archive.save(toLocation='/tmp/targetArchive.ear')

4.6.2 importMAR

Command Category: Application Management Deployment

Use with WLST: Online

Description

Imports the metadata from the MAR that is packaged with the application's EAR file. If the MAR had already been imported into the partition, the command deletes the previous version and imports the new version.

Syntax

importMAR(application, server [, force] [, applicationVersion] )

Argument Definition
application

The name of the application for which the metadata is to be imported.

server

The target server on which this application is deployed.

force

Optional. A Boolean value (true or false) that specifies whether only changed documents and MARs are imported.

For a database-based repository, if you set this argument to false, only new or changed documents from changed MARs are imported. The command creates a label for each MAR for which documents are imported. The label has the following format:

postDeploy_application_name_MAR_name_MAR_checksum

For a file-based repository, if you set this argument to false, only changed MARs are imported. The command does not compare individual documents The command creates a file in the repository for each imported MAR.

The default is true.

applicationVersion

Optional. The application version, if multiple versions of the same application are deployed.


Example

The following example imports metadata from the MAR to the application mdsapp:

wls:/weblogic/serverConfig> importMAR('mdsapp','server1')
Executing operation: importMAR.
"importMAR" operation completed. Summary of "importMAR" operation is:
/app1/jobs.xml
/app1/mo.xml
2 documents successfully transferred.