Export and import a web content library copy
We can export the contents of a web content library to disk by creating a copy of the web content library. By working with an exported copy, we can import the copied library into the same web content server multiple times, resulting in a new library after each import without affecting previous copies. This is a quick way of creating new libraries that are fully populated with web content that we can adapt for other purposes.
- Prerequisites
- Export and import web content libraries
Although many aspects are the same for the standard export and import and the copy export and import, there are some important differences:
- When you export a library as a copy, new IDs are generated for all items in the library. This ensures that there are no conflicts with existing libraries or items when you import the copy into a web content server that already contains the original library. In this way, we can perform multiple imports to the same web content server, resulting in a new library for each import.
- The configuration tasks (export-library-copy and import-library-copy) that work on library copies use properties that can either be added to the wkplc.properties file or manually appended to the command line, for easier scripting.
Follow these steps to export or import a copy of a web content library. The server that the data is being exported from is called the source server, and the server that the data is being imported into is called the target server.
- Exporting:
- Open a command prompt on the source server.
- Run the export-library-copy task from the WP_PROFILE/ConfigEngine.
- Windows
- ConfigEngine.bat export-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_export -DWasPassword=foo -DPortalAdminPwd=foo
- UNIX
- ./ConfigEngine.sh export-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_export -DWasPassword=foo -DPortalAdminPwd=foo
- IBM i
- ConfigEngine.sh export-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_export -DWasPassword=foo -DPortalAdminPwd=foo
The following properties must be specified either on the command line or in the wkplc.properties file.
If we are specifying properties in the wkplc.properties file, it is not necessary to put quotation marks (") around values containing spaces. These quotation marks are only required when specifying property values on the command line.
- LibraryPath
- The directory path and file name used to store the exported library. The export process creates a compressed archive file, so IBM recommends that we specify a file extension such as .zip. If we are exporting and importing across a network, this location can be a network drive accessible by both the source and target servers.
- LibraryName
- The name of the web content library to copy. If we are exporting multiple libraries, separate each library name by a semi-colon (;). For example, LibraryName="Web Content;Samples".
- WasUserid
- The administrator ID for WebSphere Application Server.
- WasPassword
- The administrator password for WebSphere Application Server.
- PortalAdminId
- The administrator ID for WebSphere Portal.
- PortalAdminPwd
- The administrator password for WebSphere Portal.
By default, this task is performed on the default virtual portal. To run this task on a different virtual portal, identify the virtual portal by adding one of the following parameters to the command line. Each parameter requires the prefix -D on the command line.
- VirtualPortalHost
- Specify the host name of the virtual portal. For example, vp.example.com.
Important: If the host name of the virtual portal is the same as the host name of the default virtual portal, also specify the VirtualPortalContext property. We can specify the VirtualPortalHost property by itself only if the host name is unique.
- VirtualPortalContext
- Specify the virtual portal context that identifies the virtual portal. For example, vp1.
Example commands:
- Windows: ConfigEngine.bat export-library-copy -DLibraryPath=C:\wcm_export\webcontent.zip -DLibraryName="Web Content" -DWasPassword=mypassword -DPortalAdminPwd=mypassword -DVirtualPortalHost=vp.example.com
- UNIX: ./ConfigEngine.sh export-library-copy -DLibraryPath=/opt/wcm_export/webcontent.zip -DLibraryName="Web Content" -DWasPassword=mypassword -DPortalAdminPwd=mypassword -DVirtualPortalHost=vp.example.com
- IBM i: ConfigEngine.sh export-library-copy -DLibraryPath=/opt/wcm_export/webcontent.zip -DLibraryName="Web Content" -DWasPassword=mypassword -DPortalAdminPwd=mypassword -DVirtualPortalHost=vp.example.com
- Verify that this transfer step completed without errors. If any errors occurred, check the portal logs on the source server for extended diagnostic information.
- Importing:
- Open a command prompt on the target server.
- Run the import-library-copy task from the WP_PROFILE/ConfigEngine.
- Windows
- ConfigEngine.bat import-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_import -DWasPassword=foo -DPortalAdminPwd=foo
- UNIX
- ./ConfigEngine.sh import-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_import -DWasPassword=foo -DPortalAdminPwd=foo
- IBM i
- ConfigEngine.sh import-library-copy -DLibraryPath=path_to_export_file -DLibraryName=library_name_to_import -DWasPassword=foo -DPortalAdminPwd=foo
The following properties must be specified either on the command line or in the wkplc.properties file.
If we are specifying properties in the wkplc.properties file, it is not necessary to put quotation marks (") around values containing spaces. These quotation marks are only required when specifying property values on the command line.
Differences in paths between versions:
When exporting from a version 6.1 system, we can specify a folder to export the library to:
/opt/61/folder/jcr_rootWhen importing into version 8.0 from version 6.1, the jcr_root is not required to be specified in the import path:
/opt/61/folder/When exporting from versions 7.0 or higher, the following structure is used:
/opt/70/folder1/folder2When exported, folder2 is automatically generated.When importing into version 8.0 from version 7.0 or higher, folder2 is not required to be specified in the import path:
/opt/70/folder1/
- LibraryPath
- The directory path and file name containing the library to be imported. If we are exporting and importing across a network, the value for this property can be the same file path that was used for the LibraryPath property during the export process. Otherwise, copy the exported data to a location accessible by the target server before attempting to import.
- LibraryName
- The name to use for the web content library copy that we are importing. If we are importing multiple libraries, separate each new library name by a semi-colon (;). For example, LibraryName="Web Content Copy;Samples Copy".
- LibraryExportName
- The sequence of library names used during the original export, as defined by the LibraryName property specified for the export process. For example, LibraryExportName="Web Content;Samples".
This property enables the import process to correctly set the new library names for the imported copies, in conjunction with the LibraryName property specified for the import process. The LibraryExportName property is only required if we are importing multiple libraries at one time.
- WasUserid
- The administrator ID for WebSphere Application Server.
- WasPassword
- The administrator password for WebSphere Application Server.
- PortalAdminId
- The administrator ID for WebSphere Portal.
- PortalAdminPwd
- The administrator password for WebSphere Portal.
By default, this task is performed on the default virtual portal. To run this task on a different virtual portal, identify the virtual portal by adding one of the following parameters to the command line. Each parameter requires the prefix -D on the command line.
- VirtualPortalHost
- Specify the host name of the virtual portal. For example, vp.example.com.
Important: If the host name of the virtual portal is the same as the host name of the default virtual portal, also specify the VirtualPortalContext property. We can specify the VirtualPortalHost property by itself only if the host name is unique.
- VirtualPortalContext
- Specify the virtual portal context that identifies the virtual portal. For example, vp1.
The following properties are optional and can be specified either on the command line or in the wkplc.properties file:
- LibraryTitle
- The title to use for the web content library copy that we are importing. If we are importing multiple libraries, separate each new library title by a semi-colon (;). For example, LibraryTitle="Web Content Title;Samples Title".
- LibraryDescription
- The description to use for the web content library copy that we are importing. If we are importing multiple libraries, separate each new library description by a semi-colon (;). For example, LibraryDescription="Copy of Web Content library;Copy of Samples library".
- LibraryNameTextProvider
- The name of the text provider to use to locate the translated title of the library that we are importing. If we are importing multiple libraries with different text providers, separate each provider name by a semi-colon (;). For example, LibraryNameTextProvider=provider1;provider2.
- LibraryNameTextProviderKey
- The key within the associated text provider that identifies the translated title of the library that we are importing. If we are importing multiple libraries with different translated titles, separate each key by a semi-colon (;). For example, LibraryNameTextProviderKey=key1;key2.
- LibraryBaseLocale
- The locale used when importing the web content library copy.
Example commands:
- Windows: ConfigEngine.bat import-library-copy -DLibraryPath=C:\wcm_import\webcontent.zip -DLibraryName="Web Content Copy" -DLibraryTitle="Web Content Copy Title" -DLibraryDescription="Copy of Web Content library" -DLibraryNameTextProvider=provider -DLibraryNameTextProviderKey=key -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- UNIX: ./ConfigEngine.sh import-library-copy -DLibraryPath=/opt/wcm_import/webcontent.zip -DLibraryName="Web Content Copy" -DLibraryTitle="Web Content Copy Title" -DLibraryDescription="Copy of Web Content library" -DLibraryNameTextProvider=provider -DLibraryNameTextProviderKey=key -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- IBM i: ConfigEngine.sh import-library-copy -DLibraryPath=/opt/wcm_import/webcontent.zip -DLibraryName="Web Content Copy" -DLibraryTitle="Web Content Copy Title" -DLibraryDescription="Copy of Web Content library" -DLibraryNameTextProvider=provider -DLibraryNameTextProviderKey=key -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- Verify the imported libraries have been imported by reviewing the list of libraries listed in the web content libraries section of the administration portlet on the target server. If any errors occurred, check the portal logs on the target server for extended diagnostic information.
- Reset the web content event log.
Example commands for exporting and importing multiple libraries
When exporting and importing multiple web content libraries with a single command, the following considerations apply:
- For properties such as LibraryName that reference multiple libraries, separate the respective values for that property with a semi-colon (;).
- The value of the LibraryExportName property must match the value of the LibraryName property used during the export process to indicate the sequence of libraries.
- Windows
- Export: ConfigEngine.bat export-library-copy -DLibraryPath=C:\wcm_export\webcontent.zip -DLibraryName="Web Content;Samples" -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- Import: ConfigEngine.bat import-library-copy -DLibraryPath=C:\wcm_import\webcontent.zip -DLibraryName="Web Content Copy;Samples Copy" -DLibraryExportName="Web Content;Samples" -DLibraryTitle="Web Content Copy Title;Samples Copy Title" -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- UNIX
- Export: ./ConfigEngine.sh export-library-copy -DLibraryPath=/opt/wcm_export/webcontent.zip -DLibraryName="Web Content;Samples" -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- Import: ./ConfigEngine.sh import-library-copy -DLibraryPath=/opt/wcm_import/webcontent.zip -DLibraryName="Web Content Copy;Samples Copy" -DLibraryExportName="Web Content;Samples" -DLibraryTitle="Web Content Copy Title;Samples Copy Title" -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- IBM i
- Export: ConfigEngine.sh export-library-copy -DLibraryPath=/opt/wcm_export/webcontent.zip -DLibraryName="Web Content;Samples" -DWasPassword=mypassword -DPortalAdminPwd=mypassword
- Import: ConfigEngine.sh import-library-copy -DLibraryPath=/opt/wcm_import/webcontent.zip -DLibraryName="Web Content Copy;Samples Copy" -DLibraryExportName="Web Content;Samples" -DLibraryTitle="Web Content Copy Title;Samples Copy Title" -DLibraryBaseLocale=en -DWasPassword=mypassword -DPortalAdminPwd=mypassword