4 Metadata Services (MDS) Custom WLST Commands

With WLST commands for Oracle Metadata Services (MDS), you can manage the repository and applications that use the repository.

This chapter describes the command syntax and arguments and provides examples of the commands.

For additional details about creating and managing an MDS repository, see Managing the Oracle Metadata Repository in Administering Oracle Fusion Middleware. For information about the roles needed to perform each operation, see Understanding MDS Operations in Administering Oracle Fusion Middleware.

Use the Oracle Metadata Services (MDS) commands in the following topics to manage MDS.

Common Name Pattern Format

Many commands contain arguments that use name patterns. For example, the restrictCustTo argument uses name patterns. The rules for the name patterns are the same for these arguments.

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 \.

For example:

restrictCustTo="user[scott]"
restrictCustTo="site[site1],user[scott]"
restrictCustTo="site[site1, %_2],user[scott, m%]"

Repository Management Commands

The WLST repository management commands let you create and delete a MDS repository and register and deregister the repository.

Note:

In previous releases, the WLST commands, registerMetadataDBRepository and deregisterMetadataDBRepository, or comparable MBeans in a script, have the following behavior:

  1. Starts an Oracle WebLogic Server editing session.

  2. Registers or deregisters the repository.

  3. Activates the changes.

However, you can start an editing session explicitly. If you do, the automatic activation of the changes are deprecated.

Use the MDS commands listed in the following sections to manage your repositories.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

createMetadataPartition

This command is used to create a metadata repository partition.

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 an 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:

wls:/weblogic/serverConfig> createMetadataPartition(repository='mds-myrepos',
                              partition='partition1')
Executing operation: createMetadataPartition
Metadata partition created: partition1
"partition1"

deleteMetadataPartition

This command is used to delete a metadata repository partition.

Command Category: Repository Management

Use with WLST: Online

Description

Deletes a metadata partition in the specified repository. When you delete a repository partition, all of the metadata in that partition is lost.

Syntax

deleteMetadataPartition(repository, partition)
Argument Definition

repository

The name of the repository that contains the partition.

partition

The name of the partition to delete in the repository.

Example

The following example deletes the metadata partition partition1 from the repository mds-myrepos:

wls:/weblogic/serverConfig> deleteMetadataPartition(repository='mds-myrepos',
                                partition='partition1')
Executing operation: deleteMetadataPartition
Metadata partition deleted: partition1

deregisterMetadataDBRepository

This command is used to deregister a database-based MDS repository.

Command Category: Repository Management

Use with WLST: Online

Description

Removes the database metadata repository registration as a System JDBC data source in the domain. After this command completes successfully, applications can no longer use this repository.

Syntax

deregisterMetadataDBRepository(name)
Argument Definition

name

The name of the repository to deregister.

Example

The following example deregisters the metadata repository mds-myrepos:

wls:/weblogic/serverConfig> deregisterMetadataDBRepository('mds-myrepos')
Executing operation: deregisterMetadataDBRepository.
Metadata DB repository "mds-myrepos" was deregistered successfully.

registerMetadataDBRepository

This command is used to register a database-based MDS repository.

Command Category: Repository Management

Use with WLST: Online

Description

A database metadata repository must 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

registerMetadataDBRepository(name, dbVendor, host, port, dbName, user, password  [, targetServers] [,resourceGroup])
Argument Definition

name

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.

To target the repository to a cluster, specify the cluster name, not the server name.

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

resourceGroup

Optional. This argument is required in a multitenant environment with tenant connection. This argument is only supported in multitenant environment, and it cannot be used together with targetServers. If neither targetServers nor resourceGroup is specified, then the repository will be registered only to the Administration Server.

Note:

WebLogic Server Multitenant resource groups are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Examples

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

wls:/weblogic/serverConfig> registerMetadataDBRepository('myrepos','ORACLE',
              'test.oracle.com','1521','mds', 'user1','password','server1, server2')
Executing operation: registerMetadataDBRepository.
Metadata DB repository "mds-myrepos" was registered successfully.
'mds-myrepos'

The following example registers the metadata repository myrepos_clust to a cluster, soa_cluster, and specifies the database parameters:

wls:/weblogic/serverConfig> registerMetadataDBRepository('myrepos_clust','ORACLE',
              'test.oracle.com','1521','mds', 'user1','password','soa_cluster')
Executing operation: registerMetadataDBRepository.
Metadata DB repository "mds-myrepos_clust" was registered successfully.
'mds-myrepos'

Application Metadata Management Commands

The WLST application metadata management commands let you manage application metadata, such as importing or exporting metadata or deleting metadata.

Use the commands in the following sections to manage application metadata.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

deleteMetadata

This command is used to delete the metadata in the application repository.

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.

Syntax

deleteMetadata(application, server, docs [, restrictCustTo] [, excludeAllCust]
 [, excludeBaseDocs] [, excludeExtendedMetadata] [, cancelOnException] [, applicationVersion] [, tenantName])
Argument Definition

application

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

server

The target server on which this application is deployed.

docs

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/*" includes all documents under "/oracle/" but not include documents under "/oracle/mds/".

As another example, "/oracle/**" includes 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.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

For example:

restrictCustTo="user[scott]"
restrictCustTo="site[site1],user[scott]"
restrictCustTo="site[site1, %_2],user[scott, m%]"

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 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 to delete all customization documents.

This argument defaults to false. When excludeAllCust is specified, it overrides the restrictCustTo option.

excludeBaseDocs

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

excludeExtendedMetadata

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

cancelOnException

Optional. A Boolean value (true or false) that specifies whether 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Examples

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

wls:/weblogic/serverConfig> deleteMetadata(application='mdsapp',
           server='server1', docs='/mypackage/*')
Executing operation: deleteMetadata.
"deleteMetadata" operation completed. Summary of "deleteMetadata" operation is:
List of documents successfully deleted:
/mypackage/jobs.xml
/mypackage/mo.xml
/mypackage/mdssys/cust/site/site1/jobs.xml.xml
/mypackage/mdssys/cust/site/site1/mo.xml.xml
4 documents successfully deleted.

The following example deletes metadata files under the package mypackage from mdsApp deployed in the server server1 and excludes extended metadata and all customizations:

wls:/weblogic/serverConfig> deleteMetadata(application='mdsapp',
        server='server1', docs='/mypackage/*', cancelOnException='false',
        excludeExtendedMetadata='true',
        excludeAllCust='true')
Executing operation: deleteMetadata.
"deleteMetadata" operation completed. Summary of "deleteMetadata" operation is:
List of documents successfully deleted:
/mypackage/jobs.xml
/mypackage/mo.xml
2 documents successfully deleted.

The following example deletes metadata files belonging to tenant tenant1 under the package mypackage from the application app1 deployed in the server server1:

wls:/weblogic/serverConfig> deleteMetadata(application='app1', server='server1',
    docs='/mypackage/**', tenantName='tenant1')
Executing operation: deleteMetadata.
deleteMetadata" operation completed. Summary of "deleteMetadata" operation is:
List of documents successfully deleted:
/mypackage/jobs.xml
/mypackage/mdssys/cust/site/site1/jobs.xml.xml
/mypackage/mdssys/cust/site/site2/mo.xml.xml
/mypackage/mdssys/cust/user/user1/mo.xml.xml

exportMetadata

This command is used to export metadata for an application.

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.

Note that if you are using the exportMetadata command in an NFS share, there may be a latency period on appearance of files written on the file system, depending on the NFS mount option. See http://man7.org/linux/man-pages/man5/nfs.5.html.

Syntax

exportMetadata(application, server, toLocation  [, docs]
  [, restrictCustTo] [, excludeCustFor] [, excludeAllCust] [, excludeBaseDocs]
  [, excludeExtendedMetadata] [, excludeSeededDocs]
  [, fromLabel][, toLabel] [, applicationVersion] [, remote] [, tenantName])
Argument Definition

application

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 are 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 is created, except that when the name ends with .jar, .JAR, .zip or .ZIP. In that case, an archive file is created. If the archive file already exists, the exportMetadata operation overwrites the file.

When the remote argument is true, this argument must specify an archive.

This argument can be used as temporary file system for transferring metadata from one server to another.

docs

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/*" includes all documents under "/oracle/" but not include documents under "/oracle/mds/".

"/oracle/**" includes 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.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

For example:

restrictCustTo="user[scott]"
restrictCustTo="site[site1],user[scott]"
restrictCustTo="site[site1, %_2],user[scott, m%]"

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 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 to export all customization documents. This argument defaults to false. When specified, this argument overrides the restrictCustTo and excludeCustFor arguments.

excludeBaseDocs

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

excludeExtendedMetadata

Optional. A Boolean value (true or false) that specifies whether 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 is 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Examples

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

wls:/weblogic/serverConfig> exportMetadata(application='mdsapp', 
               server='server1',toLocation='/tmp/myrepos',docs='/**')
Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.
For more help, use help(domainRuntime)
Executing operation: exportMetadata.
"exportMetadata" operation completed. Summary of "exportMetadata" operation is:
List of documents successfully transferred:
/mypackage/write.xml
/mypackage/write1.xml
/sample1.jspx

The following example exports only the customization documents under the layer user without any base documents from label label1 to label label2:

wls:/weblogic/serverConfig> exportMetadata(application='mdsapp',
                       server='server1',toLocation='/tmp/myrepos',
                       restrictCustTo='user',
                       excludeBaseDocs='true',
                       fromLabel='label1',
                       toLabel='label2',
                       applicationVersion='11.1.1')
List of documents successfully transferred:
/mypackage/mdssys/cust/user/user1/write1.xml.xml
/mypackage/mdssys/cust/user/user2/write2.xml.xml
2 documents successfully transferred.

importMetadata

This command is used to import metadata for an application.

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).

Note that if you are using the importMetadata command in an NFS share, there may be a latency period on appearance of files written on the file system, depending on the NFS mount option. See http://man7.org/linux/man-pages/man5/nfs.5.html.

Syntax

importMetadata(application, server, fromLocation  [, docs]
 [, restrictCustTo] [, excludeAllCust] [, excludeBaseDocs]
 [, excludeExtendedMetadata] [, excludeUnmodifiedDocs] 
  [, cancelOnException] [, applicationVersion] [, remote] [, tenantName])
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.

fromLocation

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

When the remote argument is true, this argument must specify an archive.

This argument can be used as a temporary file system location for transferring metadata from one server to another.

docs

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 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/*" includes all documents under "/oracle/" but not include documents under "/oracle/mds/".

"/oracle/**" includes 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.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

For example:

restrictCustTo="user[scott]"
restrictCustTo="site[site1],user[scott]"
restrictCustTo="site[site1, %_2],user[scott, m%]"

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 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 to import all customization documents. This argument defaults to false. When specified, this argument overrides the restrictCustTo argument.

excludeBaseDocs

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

excludeExtendedMetadata

Optional. A Boolean value (true or false) that specifies whether 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 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

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

wls:/weblogic/serverConfig> importMetadata(application='mdsapp', server='server1',
                             fromLocation='/tmp/myrepos',docs="/**")
Executing operation: importMetadata.
"importMetadata" operation completed. Summary of "importMetadata" operation is:
List of documents successfully transferred:
/app1/jobs.xml
/app1/mo.xml
2 documents successfully transferred.

purgeMetadata

This command is used to purge metadata.

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 are 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. The maximum value is 2147483647 seconds.

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:

wls:/weblogic/serverConfig> purgeMetadata('mdsapp', 'server1', 10)
Executing operation: purgeMetadata.
Metadata purged: Total number of versions: 10.
Number of versions purged: 0.

Sandbox Metadata Management Commands

The WLST sandbox metadata management commands let you 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.

Use the commands in the following sections to manage metadata in a sandbox.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

destroyMDSSandbox

This command is used to destroy an MDS sandbox.

Command Category: Sandbox Metadata Management

Use with WLST: Online

Description

Destroys the sandbox and its contents.

You can only use this command with a database-based MDS repository.

Syntax

destroyMDSSandbox(application, server, sandboxName [, applicationVersion])
Argument Definition

application

The name of the application.

server

The target server on which this application is deployed.

sandboxName

The name of the sandbox to destroy.

applicationVersion

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

Example

The following example destroys the sandbox sandbox1 from the MDS repository for the application myapp:

wls:/weblogic/serverConfig>destroyMDSSandbox('myapp', 'server1',
                    'sandbox1')
Executing operation: destroyMDSSandbox.
 
Sandbox "sandbox1" successfully destroyed. 

exportSandboxMetadata

This command is used to export the metadata from a sandbox.

Command Category: Sandbox Metadata Management

Use with WLST: Online

Description

Exports the changes to the metadata from a sandbox on a test system.

You can only use this command with a database-based MDS repository.

Syntax

exportSandboxMetadata(application, server, toArchive, sandboxName 
          [, restrictCustTo] [, applicationVersion] [, remote] [, tenantName])
Argument Definition

application

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.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

For example:

restrictCustTo="user[scott]"
restrictCustTo="site[site1],user[scott]"
restrictCustTo="site[site1, %_2],user[scott, m%]"

If you do not specify this argument or if you specify percent (%) as the value of this argument, all customizations are exported, whether 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.

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 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

The following example exports sandbox sandbox1 from the MDS repository partition for the application myapp to /tmp/sandbox1.jar:

wls:/weblogic/serverConfig>exportSandboxMetadata('myapp', 'server1',
                    '/tmp/sandbox1.jar', 'sandbox1')

importSandboxMetadata

This command is used to import metadata into a sandbox.

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.

You can only use this command with a database-based MDS repository.

Syntax

importSandboxMetadata(application, server, fromArchive  [, forceSBCreation]
               [, useExistingSandbox] [, sandboxName] [, applicationVersion]
               [, remote] [, tenantName])
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.

fromArchive

The source archive file from which documents are 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 overwrites 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. This argument is ignored if useExistingSandbox is true and sandboxName is not empty.

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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Examples

The following example imports the contents of sandbox1.jar and creates a sandbox in the MDS repository partition for the application myapp:

wls:/weblogic/serverConfig> importSandboxMetadata(application='myapp', 'server1'', 
                             '/tmp/sandbox1.jar')

The following example updates the existing sandbox sandbox1 in the MDS repository partition for the application myapp with the contents of sandbox1.jar:

wls:/weblogic/serverConfig>importSandboxMetadata('myapp', 'server1', '/tmp/sandbox1.jar', useExistingSandbox='true', sandboxName='sandbox1')

listMDSSandboxes

This command lists sandboxes.

Command Category: Sandbox Metadata Management

Use with WLST: Online

Description

Lists sandboxes matching the specified criteria.

You can only use this command with a database-based MDS repository.

Syntax

listMDSSandboxes(application, server [, sbNamePattern] [, applicationVersion])
Argument Definition

application

The name of the application whose sandboxes are listed.

server

The target server on which this application is deployed.

sbNamePattern

Optional. A pattern that matches the names of one or more sandboxes. When you do not specify this argument, all sandboxes associated with the application's metadata repository partition are listed.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

applicationVersion

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

Example

The following example lists all sandboxes for the application myapp and that begin with the characters FlexField:

wls:/weblogic/serverConfig>listMDSSandboxes('myapp', 'server1',
                    'FlexField%')
Executing operation: listMDSSandboxes.
 
Following Sandboxes match the selection criteria:
FlexfieldAutoSandbox_1347601004722                    
FlexfieldAutoSandbox_1347653193237                    
FlexfieldAutoSandbox_1347691996491          

Application Label Management Commands

The WLST application label management commands let you create, delete, and manage labels for applications.

Use the commands in the following sections to manage labels for applications.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

createMetadataLabel

This command is used to create a metadata label.

Command Category: Application Label Management

Use with WLST: Online

Description

Creates a new label for the documents in the application's repository partition. This command is applicable only for repositories that support versioning.

Syntax

createMetadataLabel(application, server, name [, applicationVersion] [, tenantName])
Argument Definition

application

The name of the application for which a label is 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

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

wls:/weblogic/serverConfig> createMetadataLabel('mdsapp','server1','label1')
Executing operation: createMetadataLabel.
Created metadata label "label1".

deleteMetadataLabel

This command is used to delete a metadata label from the repository partition.

Command Category: Application Label Management

Use with WLST: Online

Description

Deletes a label for the documents in the application's repository partition. This command is applicable only for repositories that support versioning.

Syntax

deleteMetadataLabel(application, server, name [, applicationVersion] [, tenantName])
Argument Definition

application

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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

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

wls:/weblogic/serverConfig> deleteMetadataLabel('mdsapp','server1','label1')
Executing operation: deleteMetadataLabel.
Deleted metadata label "label1".

listMetadataLabels

This command is lists metadata labels in the repository partition.

Command Category: Command Category: Application Label Management

Use with WLST: Online

Description

Lists all of the metadata labels in the application's repository partition. This command is applicable only for repositories that support versioning.

Syntax

listMetadataLabels(application, server [, applicationVersion] [, tenantName])
Argument Definition

application

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 servers. 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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

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

wls:/weblogic/serverConfig> listMetadataLabels('mdsapp', 'server1')
Executing operation: listMetadataLabels.
Database Repository partition contains the following labels:
label2
label3

promoteMetadataLabel

This command is used to promote the metadata associated with a label to tip.

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

promoteMetadataLabel(application, server, name [, applicationVersion] [, tenantName])
Argument Definition

application

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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Example

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

wls:/weblogic/serverConfig> promoteMetadataLabel('mdsapp', 'server1','label1')
Executing operation: promoteMetadataLabel.
Promoted metadata label "label1" to tip.

purgeMetadataLabels

This command deletes the labels matching the specified criteria.

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

purgeMetadataLabels(repository, partition [, namePattern] [, olderThanInMin] 
 [, infoOnly] [, tenantName])
Argument Definition

repository

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

partition

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

namePattern

Optional. A pattern that matches the names of labels. If you do not specify this argument, all labels in the partition are purged.

See Common Name Pattern Format for information about the patterns that you can use with this argument.

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 is ignored.

Note:

WebLogic Server Multitenant tenant names are deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Examples

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

wls:/weblogic/serverConfig> purgeMetadataLabels(repository='mds-myRepos',
           partition='partition1', namePattern='mylabel*', infoOnly='true' )

The following example purges the labels that match the specified namePattern and that are older than a year:

wls:/weblogic/serverConfig> purgeMetadataLabels(repository='mds-myRepos',
                    partition='partition1', namePattern='mylabel*')

The following example deletes labels that match the specified namePattern and that are older than 30 minutes:

wls:/weblogic/serverConfig> purgeMetadataLabels(repository='mds-myRepos',
                   partition='partition1', 
                  namePattern='mylabel*', olderThanInMin='30')

Application Deployment Management Commands

The WLST MDS application deployment management commands let you import a MAR file.

Use the commands in the following sections to manage deployment.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

getMDSArchiveConfig

This command is used to return an MDSArchiveConfig object.

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 are stored in the target archive file and the original file remains unchanged. Otherwise, the changes are 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 is not 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 is not 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')

importMAR

This command is used to import an MAR.

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.

Multitenancy Management Commands

The WLST MDS multitenancy commands let you list tenants and deprovision tenants.

Use the commands in the following sections to manage tenants.

Based on use with WLST, the commands can be:

  • Online - Indicates that the command can only be used when connected to a running server.

  • Offline - Indicates that the command can only be used when not connected to a running server.

  • Online or offline - Indicates that the command can be used in both situations.

deprovisionTenant

This command is used to deprovision a tenant from the metadata store.

Command Category: Multitenancy Management

Use with WLST: Online

Note:

WebLogic Server Multitenant deprovisionTenant command is deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Deprovisions a tenant from the metadata store. All metadata associated with the tenant will be removed from the store.

Syntax

deprovisionTenant(repository, partition, tenantName)
Argument Definition

repository

The name of the repository that contains the tenant.

partition

The name of the partition that contains the tenant.

tenantName

A unique name identifying the tenant to use for this operation.

Example

The following example deprovisions the tenant with tenantName tenant1:

wls:/weblogic/serverConfig> deprovisionTenant("mds-myrepos", "part1", "tenant1")
Executing operation: deprovisionTenant.
Tenant "tenant1" has been deprovisioned.

listTenants

This command lists the tenants.

Command Category: Multitenancy Management

Use with WLST: Online

Note:

WebLogic Server Multitenant listTenants command is deprecated in WebLogic Server 12.2.1.4.0 and will be removed in the next release.

Lists all tenants in an MDS Repository partition.

Syntax

listTenants(repository, partition)
Argument Definition

repository

The name of the repository that contains the tenants.

partition

The name of the partition that contains the tenants.

Example

The following example lists all tenants in the specified repository and partition:

wls:/weblogic/serverConfig> listTenants("mds-myrepos", "part1")
Executing operation: listTenants.
0  GLOBAL
1  tenant1
2  tenant2
3  tenant3