运行 ObjectManager 命令

运行 ObjectManager 命令导入和导出配置数据。
注意:如果您使用 IBM OpenPages® as a Service 或 Watsonx.governance 作为服务,请参阅 IBM OpenPages CLI (ibmcloud openpages)。 在这些部署类型中,您可以使用 ibmcloud openpages CLI 运行 ObjectManager 命令。

在运行 Microsoft Windows 操作系统的计算机上,ObjectManager 命令文件命名为 ObjectManager.cmd 。 在运行 Linux® 操作系统的计算机上,命令文件命名为 ObjectManager.sh

ObjectManager 命令使用以下语法:
ObjectManager.sh|.cmd <command> config|c <authentication> [parameters]

ObjectManager 命令行必须为:

  • bin 目录运行。
  • 在命令窗口中的单行 (无换行符) 上输入。
重要:使用 ObjectManager 工具时,请确保 OpenPages 服务正在运行。

ObjectManager命令行参数

您可以通过 ObjectManager 工具使用各种命令和参数。

<command>
必需。
值可以是以下命令之一:
  • dumpd:转储(导出)数据。
  • loadl:从单个加载器文件加载(导入)数据。
  • validatev:验证和确认加载器文件中的数据。
  • batch or b: Runs ObjectManager in batch processing mode. 使用批处理模式在一次会话中加载多个加载器文件。 更多信息,请参阅批量加载器文件语法
<authentication>
您需要使用的身份验证方法取决于您使用的部署类型。
IBMOpenPages云IBM OpenPages办公场所
使用 <user><password>

这两个参数都是必需的。 使用用户 ID 和密码。

某些操作需要超级管理员账户。

IBM Cloud Pak® for Data
使用以下组合之一:
  • jwtIBM Cloud Pak for Data JSON Web 令牌 (JWT)
  • 您的IBM Cloud Pak for Data用户名和您的IBM Cloud Pak for DataAPI 密钥

    您可在 IBM Cloud Pak for Data 中生成 API 密钥。 有关详细信息,请参阅生成用于身份验证的 API 密钥

要查看在IBM OpenPages for IBM Cloud Pak for Data 中使用这些参数的示例,请参阅加载命令语法

Watsonx.governance 作为 AWS 上的一项服务
使用 apikey <apikey>

<apikey> 替换为您的 API 密钥。

您可以在 IBM SaaS 控制台中生成 API 密钥。 更多信息,请参阅创建 API 密钥

<loader-file-path>
可选。

单个 XML 加载器文件的文件路径。

如果未指定文件路径,则使用当前目录。

ObjectManager.log 文件将写入该目录。

<loader-file-prefix>
可选。

加载程序文件名的用户自定义部分。

默认情况下,如果没有指定前缀,ObjectManager 工具会尝试从文件 op-config.xml 加载或写入。

<batch-loader-dir>
使用 batch 模式时必须填写。

The file path to the XML loader files that are listed in the <batch-loader-list-file>. 如果加载程序文件位于父目录下的多个子目录中,则可以使用该目录。

<batch-loader-list-file>
使用 batch 模式时必须填写。

文本文件的完整文件路径和名称,该文件包含用于批处理的加载程序文件列表。

加载命令语法

这个基于 Windows 的示例演示了如何使用 data1-op-config.xml 文件夹中名为 c:\import 的加载器文件将数据导入 IBM OpenPages 文件夹。

过程

  1. 打开命令提示符窗口。
  2. 将加载器文件 data1-op-config.xml 放在 c:\import 目录中。
  3. 转到 \bin 目录。
    例如 c:\openpages-tools-client\bin
  4. 单行运行以下命令,加载 data1-op-config.xml 加载器文件:
    ObjectManager.cmd l c <authentication> c:\import data1

    日志文件为 c:\import\ObjectManager.log

    例如:
    IBM OpenPages 楼宇或 IBM OpenPages 云
    在本例中,ComplianceOfficer 账户用于身份验证。 该命令将加载 c:\import\data1-op-config.xml 文件。
    ObjectManager.cmd l c ComplianceOfficer <password> c:\import data1
    IBM OpenPages for IBM Cloud Pak for Data
    使用以下命令之一:
    • 此示例使用 Cloud Pak for Data JSON 网络令牌 (JWT) 进行身份验证。
      ObjectManager.cmd l c jwt <JSON-Web-Token> c:\import data1
    • 此示例使用 Cloud Pak for Data 用户名、ComplianceOfficer 和 API 密钥进行身份验证。
      ObjectManager.cmd l c ComplianceOfficer <API-Key> c:\import data1
    Watsonx.governance 作为 AWS 上的一项服务
    使用 apikey <apikey>
    ObjectManager.cmd l c apikey <API-Key> c:\import data1
    <apikey> 替换为您的 API 密钥。

转储命令语法

这个基于 Windows 的示例展示了如何将数据导出到位于 c:\export 文件夹中名为 config1-op-config.xml prefix 的文件。 如果文件夹不存在,ObjectManager 工具会创建它。

过程

  1. 打开命令提示符窗口。
  2. 转到 \bin 目录。
    例如 c:\openpages-tools-client\bin
  3. 单行运行以下命令,将数据导出到 c:\export\config1-op-config.xml 中:
    ObjectManager.cmd d c <authentication> c:\export config1

    c:\export 文件夹中创建名为 config1-op-config.xml 的文件。

    例如:
    IBM OpenPages 楼宇或 IBM OpenPages 云
    在本例中,ComplianceOfficer 账户用于身份验证。 该命令将加载 c:\import\data1-op-config.xml 文件。
    ObjectManager.cmd d c ComplianceOfficer <password> c:\export config1
    IBM OpenPages for IBM Cloud Pak for Data
    使用以下命令之一:
    • 此示例使用 Cloud Pak for Data JSON 网络令牌 (JWT) 进行身份验证。
      ObjectManager.cmd d c jwt <JSON-Web-Token> c:\export config1
    • 此示例使用 Cloud Pak for Data 用户名、ComplianceOfficer 和 API 密钥进行身份验证。
      ObjectManager.cmd d c ComplianceOfficer <API-Key> c:\export config1
    Watsonx.governance 作为 AWS 上的一项服务
    使用 apikey <apikey>
    ObjectManager.cmd d c apikey <API-Key> c:\export config1
    <apikey> 替换为您的 API 密钥。

批量加载文件语法

批量加载器列表文件通常是一个文本(.txt)文件,其中包含供 ObjectManager 工具批量处理的 XML 加载器文件列表。

ObjectManager 工具使用以下语法批量加载多个加载器文件。
ObjectManager batch|b config|c <authentication> <batch-loader-dir> <batch-loader-list-file>
其中:
  • <batch-loader-dir> 是包含加载程序文件目录的完整路径。 加载器文件可以位于 <batch-loader-dir> 下的子目录中。
  • <batch-loader-list-file> 是批加载器列表文件的完整路径和文件名。 该文件通常是一个 .txt 文件
批量加载器列表文件使用以下规则:
  • 任何以数字符号(#)开头的行都被视为注释。
  • 以大于号(>)开头的任何一行都会被写入屏幕以供显示。
  • 所有其他行均假定为加载程序文件的相对路径。
以下是用文本编辑器创建的批量加载器列表文件示例。 本例演示如何从目录和子目录加载文件。
# If the <batch-loader-dir> was given as 
# c:\temp\myfiles, the following lines would
# write the "Loading…" message and then attempt to load the file
# c:\temp\myfiles\sample-add-user-op-config.xml 
> Loading example 1…
sample-add-user

# The following lines would write the "Loading…" message and then attempt 
# to load the files:
# c:\temp\loaders\samplefxrates-op-config 
# c:\temp\loaders\samplecurrencyfield-op-config 
# c:\temp\loaders\samplecurrencies-op-config 
> Loading examples 2-4…
loaders\samplecurrencyfield
loaders\samplecurrencies
loaders\samplefxrates

示例文件还显示了如何在屏幕上显示信息 loading 消息(以 > 开始的行)。

在本例中,将文件命名为 my_loader_list.txt 并保存在 c:\sample_batch\ 目录中。

以下步骤展示了如何运行示例 my_loader_list.txt 文件来加载或导入数据。
  • <batch-loader-dir> c:\temp\myfiles\myfiles 目录用于 <batch-loader-dir> 参数,因为它包括 sample-add-user-op-config.xml\loaders 子目录,后者包含要加载的其他文件。
  • <batch-loader-list-file> 是批加载器列表文件的完整路径和名称。 在本例中,路径为 c:\sample_batch\my_loader_list.txt

过程

  1. 打开命令提示符窗口。
  2. 转到 \bin 目录。
    例如 c:\openpages-tools-client\bin
  3. 运行以下批处理命令,加载 load-reports.txt 批次加载器列表文件:
    <authentication> 替换为您的环境值。 更多信息,请参阅ObjectManager命令行参数
    ObjectManager.cmd b c <authentication>  c:\temp\myfiles c:\sample_batch\my_loader_list.txt