58 Developer Tools: Command-Line Tool

This chapter is for advanced developers and provides information about running and using the command-line tool.

The Developer Tools command-line tool can be used for deployment and other resource movement activities. Unlike the Eclipse integration, which enables you to work only with the Developer Tools workspace, the command-line tool enables you to work with any workspace. The command-line tool also provides import and export features which are not available when working in the Eclipse IDE. For example, developers can create reusable modules, which are workspaces containing resources that can be imported into any site.

This chapter contains the following sections:

58.1 Running and Using the Command-Line Tool

To run the command-line tool:

  1. Unzip csdt.zip, which is located in the WebCenter Sites distribution package. Open the csdt-client folder and place the csdt-client.jar file in the classpath. Make sure you have met all the requirements listed in the Oracle Fusion Middleware WebCenter Sites Certification Matrix available from the Oracle Technology Network at http://otn.oracle.com.

  2. Run the command-line tool (cmd) and type the following command:

    java com.fatwire.csdt.client.main.CSDT  [ContentServer url]   
        username= username   password= password  
        cmd=export|import|listcs|listds    [options] 
    

    Replace the placeholder parameters with the information about your development environment and the desired command you wish to execute:

    • ContentServer url: The URL of your local WebCenter Sites instance, including the ContentServer servlet (for example, http://localhost:8080/cs/ContentServer)

    • username and password: The user name and password of a WebCenter Sites general administrator. This user must be a member of the RestAdmin group (for example, fwadmin/xceladmin).

    • cmd: The command to execute. The following commands are available:

      • export: Export data from WebCenter Sites to a workspace

      • import: Import data into WebCenter Sites from a workspace

      • listcs: List WebCenter Sites content

      • listds: List workspace content

    • options: Specify one of the following to either import or export:

      • resources: Specify which resources you wish to import or export in a semicolon-separated list of resource type and resource ID. To specify multiple resources, use a comma-separated list. To specify all resources of a given type, use the * symbol. If you are exporting a resource (to a workspace), specify the resource's local ID. For example, use resources=Content_C:12345;Product_C:* to export a specific Content_C asset and all Product_C assets.

        If you are importing a resource (to a WebCenter Sites instance), specify the resource's fw_uid. To get the resource's fw_uid, use the listds option.

        The following is a full listing of resource selectors:

        @SITE: Specify the desired sites

        @ROLE: Specify the desired roles

        @ASSET_TYPE: Specify the desired asset types

        @TREETAB: Specify the desired tree tabs

        @STARTMENU: Specify the desired start menu items

        @ELEMENTCATALOG: Specify the desired ElementCatalog entries

        @SITECATALOG: Specify the desired site catalog entries

        @ALL_NONASSETS: Use this short-hand notation to select all non-asset resources

        @ALL_ASSETS: Use this short-hand notation to select all available assets

        asset type: Specify assets of a certain type.

        Note:

        To verify that selectors are picking up the correct resources before import or export, use listcs for export activities and listds for import activities. These commands fine-tune the selectors before execution by providing a list of the resources that will be moved.

        If resources have dependencies, they are exported and imported automatically. However, dependencies are not listed using the listcs and listds commands.

      • fromSites: Select resources from specified sites only.

      • toSites: (Import only) Override the natural site affiliation during import with a comma-separated list of sites. Specified sites must exist on the target system.

      • modifiedSince: (Assets only) Select only resources that have been modified since the specified date. The date format is yyyy-mm-dd hh:MM:ss.

      • datastore: Specify the workspace you wish to either export WebCenter Sites resources to or import WebCenter Sites resources from. If you do not specify a value for this parameter, the main Developer Tools workspace is specified by default. If you are exporting resources and specify a workspace that does not exist, the command-line tool automatically creates the workspace and exports the desired resources to it.

58.2 Example Commands

The following is a list of example commands that can be executed using the command-line tool:

  • This command exports the specified Content_C assets and all Product_C assets that belong to FirstSiteII and were modified since the specified date. Since no workspace is specified, the Developer Tools workspace is used by default:

    java com.fatwire.csdt.client.main.CSDT  http://localhost:8080/cs/ContentServer username=bob password=password resources=Content_C:123432123423,11234234212,111234341234;Product_C:* fromSite=FirstSiteII modifiedSince=2010-08-08 19:14:00 cmd=export
    
  • This command imports the specified Content_C asset and all Product_C assets found in the workspace. Since no workspace is specified, the Developer Tools workspace is used by default:

    java com.fatwire.csdt.client.main.CSDT  http://localhost:8080/cs/ContentServer username=bob password=password resources=Content_C:aad618e9-f04e-4ee4-b902-076224bb6f7b;Product_C:* fromSite=FirstSiteII cmd=import
    
  • This command exports all resources from the site SecondSiteII into a workspace named "TheOutput":

    java com.fatwire.csdt.client.main.CSDT  http://localhost:8080/cs/ContentServer username=bob password=password resources=@ALL_ASSETS:*;@ALL_NONASSETS:*  fromSite=SecondSiteII  datastore=TheOutput cmd=export
    
  • This command imports all assets and tree tabs from the workspace named "TheInput" into the site MySite:

    java com.fatwire.csdt.client.main.CSDT  http://localhost:8080/cs/ContentServer username=bob password=password resources=@ALL_ASSETS:*;@TREETAB:* toSites=MySite  datastore=TheInput cmd=import
    

58.3 Creating Modules

Modules are sets of related resources exported from your WebCenter Sites instance into a given workspace. The datastore parameter enables you to specify the workspace you wish to either export WebCenter Sites resources to or import WebCenter Sites resources from. If you export WebCenter Sites resources to a workspace that does not exist, the command-line tool automatically creates that workspace and exports the desired resources into it.

Modules are reusable, and their content can be imported into any CM sites (even if the site is not listed in the resources' canonical list of sites). To import a module into a CM site, you must execute an import command. In the datastore parameter, specify the workspace that contains the desired resources and in the toSites parameter, specify the site(s) to which you wish to import those resources. This imports the content of the workspace into the specified CM site(s).