Scripting old-style imports using CatalogMover's command line


For over a decade, WebCenter Sites (FutureTense Content Server, OpenMarket Content Server, FatWire Content Server, etc.) used a text-based import format exclusively for bulk content import and export. The format was HTML-based and essentially exported a database table into a HTML table.  Files were written to disk in folders alongside the HTML file.

A mini Swing Java app was created that allowed you to connect to the UI, and you then had a few tools you could use to list catalog data, select database rows to export, and import one or more files. Lightweight and very basic, it did the job for a very long time. But today we have CSDT, and this has really enabled the use of command line tools more in the import process.

CatalogMover main screen


But what about using the command line for old-style CatalogMover files?  Well, it turns out it is possible.

CatalogMover includes some basic information in the "usage" about its command line operation, but it is really not sufficient for any substantial work.

For starters, I created a handy-dandy convenience script that is located in my PATH. I use this all the time:

#! /bin/ksh
# Start Catalog Mover
ulimit -n 1024
cd $(dirname $0)

java -classpath $CP COM.FutureTense.Apps.CatalogMover $*

Notice how it's designed to take an arbitrary argument. So I call this and pass in -h and get back:

Triton-II:~ tfield$ -h
-p password
-u user name
-s server name (optional)
-b base URL (optional)
-t catalog name (can be repeated, export only)
-x function to perform (import, import_all, export, export_all)
-d directory to export to or import all from
-f file to import
-c catalog data directory (optional)
-a ACL list (optional)
-i ini file(s) to merge (optional)

CatalogMover exited.
Triton-II:~ tfield$

Which, still, is somewhat obscure. Let's focus on two arguments that give us the most control: -f and -c. -f lets you specify the 'file' containing the data you want to import. This almost always refers to a HTML file, since that is the native data format for CatalogMover. The other argument is -c, which stands for "Catalog Data", but really, this is a directory that contains the files that are exported when a catalog is exported. Usually this folder has the same name as the HTML file, and is located beside it. e.g.

-f ElementCatalog.html
-c ElementCatalog/

If you specify these two arguments, you can import a catalog and its data very easily.

CatalogMover Login Screen

Of course, when your'e talking to CatalogMover via the command line, you can't log using a GUI, so you also have to specify the URL (url base) of the host, the username, and password, or (-b, -u, -p respectively):

-b http://localhost:7001/cs/CatalogMover
-u ContentServer
-p password

And the actual command (-x), in this case, import:

-x import

And that's it. Put it all together and you have:


echo Importing elements

cd $ENV_ROOT/FutureTense
CLASSPATH=. #enter the required classpath from from the isntall kit, or above
CM_SHARED_ARGS="-b http://localhost:7001/cs/CatalogManager -u ContentServer -p password -x import"


ulimit -n 1024

echo ...Importing MyProject content
CM_ARGS="-f /Users/tfield/svn/MyProject/Populate/SiteCatalog.html"
java $VM_ARGS -classpath $CLASSPATH COM.FutureTense.Apps.CatalogMover $CM_SHARED_ARGS $CM_ARGS
CM_ARGS="-f /Users/tfield/svn/MyProject/Populate/ElementCatalog.html -c /Users/tfield/svn/MyProject/Populate/ElementCatalog"
java $VM_ARGS -classpath $CLASSPATH COM.FutureTense.Apps.CatalogMover $CM_SHARED_ARGS $CM_ARGS

# note that here, your script might repeat this for a different project, another tool, etc...

echo ...done.

That's it! This feature has been available since 1998. Hope you enjoy it!


Subscribe to Our Newsletter

Stay In Touch