Repository Management Commands

Use the MDS commands listed in Table 8-2 to manage the MDS repository. In the Use with WLST column, online means the command can only be used when connected to a running Administration Server. Offline means the command can only be used when not connected to a running server. Online or offline means the command can be used in both situations.

createMetadataPartition

Command Category: Repository Management

Use with WLST: Online

Description

A metadata repository is used as a common repository for managing metadata of different applications. Many applications use the MDS repository to manage their metadata. Each deployed application uses a logical partition in metadata repository. This logical partition also helps in maintaining the metadata lifecycle. Before deploying a application, you create a partition for it in MDS repository. This command creates a partition with the given name in the specified repository.

Syntax

createMetadataPartition(repository, partition)

Argument

Definition

repository

The name of the repository where the partition will be created.

partition

The name of the partition to create in the repository.

Example

The following example creates the metadata partition partition1 in the repository mds-myrepos:

registerMetadataDBRepository

Command Category: Repository Management

Use with WLST: Online

Description

A database metadata repository should be registered with WebLogic Server instances before the application can use it. This command registers a System JDBC data source with the domain for use as database-based metadata repository.

Syntax

The name of the repository to register. If the name you supply does not begin with mds-, the commands adds the prefix mds-.

dbVendor

The database vendor. The acceptable values are ORACLE, MSSQL, IBMDB2, and MYSQL.

host

The host name or the IP address of the database.

port

The port number used by the database.

dbName

The service name of the database. For example, orcl.hostname.com

user

The database user name.

password

The password for the database user.

targetServers

Optional. The WebLogic Server instances to which this repository will be registered. If this argument is not specified, then the repository will be registered only to the Administration Server. To specify multiple servers, separate the names with a comma.

Register the repository with all Managed Servers to which the application will be deployed.

Example

The following example registers the metadata repository myrepos to two servers, and specifies the database parameters:

deleteMetadata

Command Category: Application Metadata

Use with WLST: Online

Description

Deletes the selected documents from the application repository. When this command is run against repositories that support versioning (that is, database-based repositories), delete is logical and marks the tip version (the latest version) of the selected documents as "deleted" in the MDS repository partition.

You may want to delete metadata when the metadata is moved from one repository to another. In such a case, after you have exported the metadata, you can delete the metadata in the original repository.

A list of comma-separated, fully qualified document names or document name patterns, or both. The patterns can have the following wildcard characters: * and **.

The asterisk (*) represents all documents under the current namespace. The double asterisk (**) represents all documents under the current namespace and also recursively includes all documents in subnamespaces.

For example, "/oracle/*" will include all documents under "/oracle/" but not include documents under "/oracle/mds/".

As another example, "/oracle/**" will include all documents under "/oracle/" and also under "/oracle/mds/" and any other documents further in the namespace chain.

restrictCustTo

Optional. Valid values are percent (%) or a list of comma-separated customization layer names used to restrict the delete operation to delete only customization documents that match the specified customization layers. Each customization layer name can contain, within a pair of brackets, optional customization layer values and value patterns separated by commas.

If you do not specify this argument, only customization classes declared in the cust-config element of adf-config.xml are deleted. If there is no cust-config element declared in adf-config.xml, all customization classes are deleted.

If you specify percent (%) as the value of this argument, all customizations are deleted, whether or not they are declared in the cust-config element of adf-config.xml.

Use this option to delete all customizations or a subset of declared customizations. You can also use this option to delete customizations from customization classes that are not declared in the cust-config element of adf-config.xml.

excludeAllCust

Optional. A Boolean value (true or false) that specifies whether or not to delete all customization documents.

This argument defaults to false. It overrides the restrictCustTo option.

excludeBaseDocs

Optional. A Boolean value (true or false) that specifies whether or not to delete base documents. This argument defaults to false.

excludeExtendedMetadata

Optional. A Boolean value (true or false) that specifies whether or not to delete the Extended Metadata documents. This argument defaults to false.

cancelOnException

Optional. A Boolean value (true or false) that specifies whether or not to abort the delete operation when an exception is encountered. On abort, the delete is rolled back if that is supported by the target store. This argument defaults to true.

applicationVersion

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

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Examples

The following example deletes metadata files under the package mypackage from mdsApp deployed in the server server1:

exportMetadata

Command Category: Application Metadata

Use with WLST: Online

Description

Exports application metadata. Use this command and the importMetadata command to transfer application metadata from one server location (for example, testing) to another server location (for example, production).

This command exports application metadata including customizations. However, by default, only those customizations from customization classes that are defined in the cust-config element of adf.config.xml are exported. To export customizations from customization classes not declared, use the restrictCustTo option.

The name of the application from which the metadata is to be exported.

server

The target server on which this application is deployed.

toLocation

The target directory or archive file (.jar, .JAR, .zip or .ZIP) to which documents selected from the source partition will be transferred. If you export to a directory, the directory must be a local or network directory or file where the application is physically deployed. If you export to an archive, the archive can be located on a local or network directory or file where the application is physically deployed, or on the system on which you are executing the command.

If the location does not exist in the file system, a directory will be created except that when the names ends with .jar, .JAR, .zip or .ZIP, an archive file will be created. If the archive file already exists, the exportMetadata operation will overwrite the file.

Optional. A list of comma-separated, fully qualified document names or document name patterns, or both. The patterns can have the following wildcard characters: * and **.

This argument defaults to "/**", which exports all the metadata in the repository.

The asterisk (*) represents all documents under the current namespace. The double asterisk (**) represents all documents under the current namespace and also recursively includes all documents in subnamespaces.

For example, "/oracle/*" will include all documents under "/oracle/" but not include documents under "/oracle/mds/".

"/oracle/**" will include all documents under "/oracle/" and also under "/oracle/mds/" and any other documents further in the namespace chain.

restrictCustTo

Optional. Valid values are percent (%) or a list of comma-separated customization layer names used to restrict the export operation to export only customization documents that match the specified customization layers. Each customization layer name can contain, within a pair of brackets, optional customization layer values and value patterns separated by commas.

If you do not specify this argument, only customization classes declared in the cust-config element of adf-config.xml are exported. If there is no cust-config element declared in adf-config.xml, all customization classes are exported.

If you specify percent (%) as the value of this argument, all customizations are exported, whether or not they are declared in the cust-config element of adf-config.xml.

Use this option to export all customizations or a subset of declared customizations. You can also use this option to export customizations from customization classes that are not declared in the cust-config element of adf-config.xml.

This argument is ignored if the excludeAllCust argument is also specified.

excludeCustFor

Optional. A list of comma-separated customization layer names used to restrict the export operation to exclude customization documents that match the specified customization layers from being exported.

This argument is ignored if the excludeAllCust argument is also specified.

excludeAllCust

Optional. A Boolean value (true or false) that specifies whether or not to export all customization documents. This argument defaults to false. This argument overrides the restrictCustTo and excludeCustFor arguments.

excludeBaseDocs

Optional. A Boolean value (true or false) that specifies whether or not to export base documents. This argument defaults to false.

excludeExtendedMetadata

Optional. A Boolean value (true or false) that specifies whether or not to export the Extended Metadata documents. This argument defaults to false.

excludeSeededDocs

Optional. A Boolean value (true or false) that specifies whether all documents or only non-seeded documents are exported. Seeded documents are those documents that are packaged in a MAR.

To exclude seeded documents, specify true.

The default is false.

fromLabel

Optional. Transfers the documents from the source partition that is associated with this label.

toLabel

Optional. Works with the fromLabel argument to transfer the delta between fromLabel to toLabel from the source partition.

applicationVersion

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

remote

Optional. A Boolean value (true or false) that specifies whether the archive file will be written to a location where the application is deployed (false) or to the system on which you are executing the command (true).

The default is false.

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Examples

The following example exports all metadata files from the application mdsapp deployed in the server server1.

importMetadata

Command Category: Application Metadata

Use with WLST: Online

Description

Imports application metadata. Use the exportMetadata command and this command to transfer application metadata from one server location (for example, testing) to another server location (for example, production).

The source directory or archive file from which documents will be selected for transfer. If you exported to a directory, the directory must be a local or network directory or file where the application is physically deployed. If you exported to an archive, the archive can be located on a local or network directory or file where the application is physically deployed, or on the system on which you are executing the command.

Optional. A list of comma-separated, fully qualified document names or document name patterns, or both. The patterns can have the following wildcard characters: * and **.

This argument defaults to "/**", which imports all of the documents in the repository.

The asterisk (*) represents all documents under the current namespace. The double asterisk (**) represents all documents under the current namespace and also recursively includes all documents in subnamespaces.

For example, "/oracle/*" will include all documents under "/oracle/" but not include documents under "/oracle/mds/".

"/oracle/**" will include all documents under "/oracle/" and also under "/oracle/mds/" and any other documents further in the namespace chain.

restrictCustTo

Optional. Valid values are percent (%) or a list of comma-separated customization layer names used to restrict the import operation to import only customization documents that match the specified customization layers, including customization classes that are not declared in the cust-config element of adf-config.xml. Each customization layer name can contain, within a pair of brackets, optional customization layer values and value patterns separated by commas.

If you do not specify this argument, only customization classes declared in the cust-config element of adf-config.xml are imported. If there is no cust-config element declared in adf-config.xml, all customization classes are imported.

If you specify percent (%) as the value of this argument, all customizations are imported, whether or not they are declared in the cust-config element of adf-config.xml.

Use this option to import all customizations or a subset of declared customizations. You can also use this option to export customizations from customization classes that are not declared in the cust-config element of adf-config.xml.

This argument is ignored if the excludeAllCust argument is also specified.

excludeAllCust

Optional. A Boolean value (true or false) that specifies whether or not to import all customization documents. This argument defaults to false. This argument overrides the restrictCustTo argument.

excludeBaseDocs

Optional. A Boolean value (true or false) that specifies whether or not to import base documents. This argument defaults to false.

excludeExtendedMetadata

Optional. A Boolean value (true or false) that specifies whether or not to import the Extended Metadata documents. This argument defaults to false.

excludeUnmodifiedDocs

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

If you specify true, only changed documents are imported.

The default is false.

cancelOnException

Optional. A Boolean value (true or false) that specifies whether or not to abort the import operation when an exception is encountered.

The default is true.

applicationVersion

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

remote

Optional. A Boolean value (true or false) that specifies whether the archive file is in a location where the application is deployed (false) or on the system on which you are executing the command (true).

The default is false.

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example imports all metadata available in /tmp/myrepos to the application mdsapp deployed in the server server1:

purgeMetadata

Command Category: Application Metadata

Use with WLST: Online

Description

Purges the older (non-tip) versions of unlabeled documents from the application's repository. All unlabeled documents will be purged if they are expired, based on Time-To-Live (the olderThan argument). This command is applicable only for repositories that support versioning, that is, database-based repositories.

Syntax

purgeMetadata(application, server, olderThan [, applicationVersion])

Argument

Definition

application

The name of the application, used to identify the partition in the repository on which the purge operation will be run.

server

The target server on which this application is deployed.

olderThan

Document versions that are older than this value (in seconds) will be purged.

applicationVersion

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

Example

The following example purges the document version history for the application mdsapp deployed in the server server1, if the version is older than 10 seconds:

Sandbox Metadata Management Commands

Use the commands in Table 8-4 to manage metadata in a sandbox. A sandbox is a temporary location for testing changes before moving them to a production system. Sandboxes are not visible to most users until they are applied.

Syntax

The name of the application from which the metadata is to be exported.

server

The target server on which this application is deployed.

toArchive

The target archive file (.jar, .JAR, .zip or .ZIP) to which the sandbox contents will be transferred. The archive can be located on a local or network directory where the application is physically deployed. If you specify the -remote argument, the archive can be located on the system on which you are executing the command.

sandboxName

The name of the sandbox to export.

restrictCustTo

Optional. Valid values are percent (%) or a list of comma-separated customization layer names used to restrict the export operation to export only customization documents that match the specified customization layers. Each customization layer name can contain, within a pair of brackets, optional customization layer values and value patterns separated by commas.

If you do not specify this argument or if you specify percent (%) as the value of this argument, all customizations are exported, whether or not they are declared in the cust-config element of adf-config.xml.

Use this option to export all customizations or a subset of declared customizations. You can also use this option to export customizations from customization classes that are not declared in the cust-config element of adf-config.xml.

This argument is ignored if the excludeAllCust argument is also specified.

applicationVersion

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

remote

Optional. A Boolean value (true or false) that specifies whether the archive file will be written to a location where the application is deployed (false) or to the system on which you are executing the command (true).

The default is false.

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example exports a sandbox from the MDS repository for the application myapp:

importSandboxMetadata

Command Category: Sandbox Metadata Management

Use with WLST: Online

Description

Imports the contents of a sandbox archive to another sandbox in the MDS repository partition of the specified application. It can also update the contents of a given archive to a sandbox in the MDS repository partition of a given application. All customizations are imported, whether or not they are declared in the cust-config element of adf-config.xml.

The source archive file from which documents will be selected for transfer. The archive can be located on a local or network directory where the application is physically deployed. If you specify the -remote argument, the archive can be located on the system on which you are executing the command.

forceSBCreation

Optional. A Boolean value (true or false) that specifies whether the operation will overwrite an existing sandbox with the same name. When the argument is set to true, if the fromArchive argument specifies a sandbox with the same name as one that already exists in the application's partition, the original sandbox is deleted and a new sandbox is created. When the argument is set to false, if a sandbox with the same name exists, an exception is thrown.

The default is false.

useExistingSandbox

Optional. When set to true, the contents of the archive are imported to the sandbox specified with the sandboxName argument. This argument is ignored if there is no value specified for sandboxName.

The default is false.

sandboxName

Optional. The name of the sandbox to update. This argument is ignored if useExistingSandbox is false.

applicationVersion

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

remote

Optional. A Boolean value (true or false) that specifies whether the archive file is in a location where the application is deployed (false) or on the system on which you are executing the command (true).

The default is false.

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Examples

The following example imports the contents of the sandbox sandbox1.jar:

Syntax

The name of the application for which a label will be created in the partition configured for this application.

server

The target server on which this application is deployed. If the application is deployed to multiple Managed Servers in a cluster, you can use the name of any of the server names. You cannot specify multiple server names.

name

The name of the label to create in the repository partition.

applicationVersion

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

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example creates the label label1 for the application mdsapp deployed in the server server1:

Syntax

The name of the application from whose associated partition the label is to be deleted.

server

The target server on which this application is deployed. If the application is deployed to multiple Managed Servers in a cluster, you can use the name of any of the server names. You cannot specify multiple server names.

name

The name of the label to delete in the repository partition.

applicationVersion

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

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example deletes the metadata label label1 from the application mdsapp deployed in the server server1:

Syntax

The name of the application for which all of the labels in the repository partition should be listed.

server

The target server on which this application is deployed. If the application is deployed to multiple Managed Servers in a cluster, you can use the name of any of the server names. You cannot specify multiple server names.

applicationVersion

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

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example lists the metadata labels available for the application mdsapp deployed in the server server1:

promoteMetadataLabel

Command Category: Application Label Management

Use with WLST: Online

Description

Promotes documents associated with a label to the tip version in the repository. This command is useful to achieve rollback capability. This command is applicable only for repositories that support versioning.

Syntax

The name of the application in whose associated repository the metadata is to be promoted to tip.

server

The target server on which this application is deployed. If the application is deployed to multiple Managed Servers in a cluster, you can use the name of any of the server names. You cannot specify multiple server names.

name

The name of the label to promote in the repository partition.

applicationVersion

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

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Example

The following example promotes the metadata label label1 to tip in the application mdsapp deployed in the server server1:

purgeMetadataLabels

Command Category: Application Label Management

Use with WLST: Online

Description

Purges or lists the metadata labels that match the given pattern or age, but does not delete the metadata documents that were part of the label. You can delete the documents by executing the purgeMetadata command.

Syntax

The name of the MDS repository that contains the partition whose metadata labels will be purged or listed.

partition

The name of the partition whose metadata labels will be purged or listed.

namePattern

Optional. A pattern that matches the names of labels. The pattern can contain the following special characters:

The percent (%) character, which matches any number of characters.

The underscore (_) character, which matches exactly one arbitrary character.

The backslash character ('\'), which can be used to escape the percent, the underscore, and the backslash (itself) characters, so they match only %, _, or \.

olderThanInMin

Optional. The age of the labels, in minutes. The default is 525600 (one year).

infoOnly

Optional. Valid values are true or false. If you set it to true, it does not purge the labels, but lists the labels that match the specified pattern.

The default is false.

tenantName

A unique name identifying the tenant to use for this operation. This argument is required for a multitenant application and is not applicable for a non-multitenant application. For a non-multitenant application, any specified value will be ignored.

Examples

The following example lists the labels that match the specified namePattern, but does not delete them:

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.

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.

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.

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: