4.3 Application Metadata Management Commands

Use the commands in Table 4-3 to manage application metadata.


Table 4-3 Application Metadata Commands

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

deleteMetadata

Deletes the metadata in the application repository.

Online

exportMetadata

Exports metadata for an application.

Online

importMetadata

Imports metadata for an application.

Online

purgeMetadata

Purge metadata.

Online


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

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

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

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

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

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

This argument can be used as temporary file system for transferring metadata from one server to another. For more information, see "Moving Metadata from a Test System to a Production System" in Administering Oracle Fusion Middleware.

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

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

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.

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

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

This argument can be used as a temporary file system location for transferring metadata from one server to another. For more information, see "Moving Metadata from a Test System to a Production System" in Administering Oracle Fusion Middleware

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

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

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.

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