Importing and exporting policy repositories

MCS uses a policy repository held either in a JDBC compliant database (either db2 or oracle) or in multiple XML files. At design time, page authors will work with the policy editors to develop policies for Web projects. When a project is complete and tested, the repository can be imported to a JDBC database to get optimum performance.

MCS uses a policy repository held either in a JDBC compliant database (either db2 or oracle) or in multiple XML files. At design time, page authors will work with the policy editors to develop policies for Web projects. When a project is complete and tested, the repository can be imported to a JDBC database to get optimum performance.

The command line interface commands mcsImport, and mcsExport are used to export and import repositories. mcsImport takes multiple XML files, and loads them into a JDBC repository. mcsExport creates multiple XML files from a JDBC repository.

Both executables are located in the [wp_root]/repository/bin directory when MCS is installed with Mobile Portal Accelerator. The directory [wp_root] is the location where Mobile Portal Accelerator is installed.

It is good practice to take a fresh backup of a repository before an import is performed. If you are using a JDBC repository, refer to the backup procedure recommended by your database vendor.

Note:

Some backup procedures cannot backup database files while there are open connections to the database.

Before using the mcsImport and mcsExport commands:

  1. Set up the Mobile Portal Accelerator environment by running the following command:

    . [was-root]/bin/setupCmdLine.sh
    Note:

    There is a period and then a space before [was-root].

  2. Add the JDBC driver file(s) to the CLASSPATH environment variable. For DB2, you must add db2java.zip and db2jcc.jar to the CLASSPATH. For Oracle, add ojdbc14.jar to the CLASSPATH.

  3. Change to the directory containing the commands.

Note:

If you plan to import a project to a JDBC database, then the name of the project cannot be longer than 160 characters.

Common parameters

The mcsImport and mcsExport commands have a number of common parameters. Individual parameters are listed in the following sections.

In policy, binding, layout and theme lists, multiple values should be space separated. The default is to include all items.

Note:

Before you import/export repositories, you need to edit the scripts and set the JDBC_DRIVER variable. It must point to the JDBC driver to load.

Parameter Description
-all Import or export all policies in the specified -project.
-allcomponents Import or export all policies except themes, layouts and bindings.
-assetgroup One or more asset groups (default all).
-binding One or more bindings.
-host Host machine where the database is running.
-layout One or more layouts.
-password Password for the user accessing the database.
-pluginattribute Plugin attributes. Unlikely to be imported/exported without the other system policies.
-plugindefinitions Plugin definitions. Unlikely to be imported/exported without the other system policies.
-port Port that the database is using.
-project The project name.
-source Source name of the database. For Oracle this is the Oracle SID.
-system Import or export the system policies. This may be required if you are starting a new repository with no policies, layouts or themes.
-theme One or more themes.
-user User ID to be used to access the database.
-useshortnames This option allows you to specify short names in database tables and columns. If you do so, the use-short-names attribute on the jdbc-repository element must be set to 'true' in the mcs-config.xml file.
-vendor

Vendor of the database repository. The allowable values are:

  • 'db2-type4' - for IBM DB2 type 4 driver

  • 'oracle' - for Oracle

  • 'oracle-rac' - for Oracle RAC

-[component_type] One or more policies of [policy-type] such as audio, image, and text. The possible values are:-audio, -button, -chart, -dynvis, -image, -rollover, -script, -text and -link.

mcsImport parameters

Parameter Description
-enableundo Should the import fail, this option will undo all the transfers that have taken place up to the point of failure. In database terms this option will wait until all of the transfers have taken place before issuing a commit of the transaction. Deprecated.
-updateall Replaces individual policies if they are duplicates and the repository already exists. Default behavior is to prompt agreement to all updates through the command line, use of -updateall is similar to responding positively to all these prompt destinations.
-srcdir Required. Gives the source directory for multiple XML files.
Note:

The -device and -devicerepository parameters are deprecated. The drManager CLI utility must be used instead.

mcsImport [-vendor <vendor> -host <host> -port <port>
           -source <source> -user <user>
           -password <password> -project <project>]
          [-all [-devicerepository <repository>]]
          [-allcomponents |
           -assetgroup [<asset-groups>]
           -audio [<audio-components>] 
           -button [<button-components>]
           -chart [<chart-components>] 
           -dynvis [<dynvis-components>] 
           -image [<image-components>] 
           -rollover [<rollover-components>] 
           -script [<script components>] 
           -text [<text-components>] 
           -link [<link-components>]]
          [-theme [<themes>]]
          [-binding [<bindings>]]
          [-pluginattribute]
          [-plugindefinition]
          [-system -devicerepository]
          [-device [<devices>] -devicerepository <repository>]
          [-layout [<layouts>]]
          [-srcdir <name>] 
          [-updateall]
          [-enableundo]
          [-useshortnames] 

mcsExport parameters

Parameter Description
-destdir Required. The destination directory for multiple XML files.
-replace Replaces existing destination directory. -replace will not replace polices within the existing destination directory, but will delete the existing destination directory and all its contents, and replace it.

mcsExport [-vendor <vendor> -host <host> -port <port>
           -source <source> -user <user>
           -password <password> -project <project>]
          [-all | -system | -allcomponents |
           -assetgroup [<asset groups>]
           -audio [<audio components>]
           -chart [<chart components>]
           -dynvis [<dynvis-components>]
           -image [<image components>]
           -rollover [<rollover components>]
           -script [<script components>]
           -text  [<text components>]
           -link [<link components>]]
          [-theme [<themes>]]
          [-binding [<bindings>]]
          [-layout [<layouts>]]
          [-applicationproperties [<application properties>]]
          [-pluginattribute]
          [-plugindefinition]
          [-destdir <name> [-replace]]
          [-useshortnames]

Import/Export API

A simple API is available for developers who wish to incorporate import or export functions into custom code. The com.volantis.mcs.cli.UserInterface interface provides for passing identical parameters to the CLI. Refer to the JavaDocs for details.

Related topics