Performing a batch update from a file system to a repository

You can create assets or update assets that exist on your file system to a Rational® Asset Manager repository. You can define the asset metadata in your file system using files and directories which follow specific rules as asset source. Rational Asset Manager Eclipse client can perform batch asset import or update according to asset source.

About this task

To upload assets directly from your file system to a repository:
  1. Find the directories on your local file system that you want to create assets from.
  2. Create rules that define how the directories and their files will map to an asset. For example, you must define what files are artifacts and what value to assign as the community and asset version. You can define these rules in two ways:
    • Specify a series of rules
    • Create a manifest.rmd file that contains definitions.
      Note: If you create a manifest.rmd file, you must place it in the root directory of an asset or asset archive before you add the directory as the asset source.
      File directory structure.
  3. Correct all problems that exist with the new assets, select the destination repository, and update the assets to the repository.

Procedure

To perform a batch update via Eclipse client from file system:

  1. Expand the menu in the Asset Search view and select Batch Update.
    Batch Update menu
  2. In the Find Assets section of the Batch Editor, remove the repository you do not need from source repository space.
    Delete repository in the Find assets section
  3. Specify the destination repository you want to import asset to or create a repository connection.
    Select the repository connection for these updates
  4. Right click in the source repository space and click Add Asset Source > File System.
    Add Asset Source > File System
  5. Right click Asset source root folder in the folder picker and click Add rule....
    Attention: You should put all asset root folders under root folder. Here is an example:
    Four asset root folders under root folder

    Asset metadata (like Manifest.rmd) are included in their respective asset root folders.

  6. Select Asset as rule type and click Next.
  7. Select Create assets using all archives and folders to fetch all asset root folders under root folder, or select Create assets using archives and folders matching this filter and specify a filter to customize asset root folders. Then click Finish.
  8. After asset validation completes, go through the list in destination space and resolve validation problems of assets.
  9. Click Update all assets to complete batch update.

Example

This example describes how to perform a batch update. In this example, there are four asset root folders for you to import four assets. These folders are shown as below:

Four folders: bin asset, doc asset, source code asset and source code2 asset under Asset source folder
Source code asset and source code2 asset are for assets which contain source code as artifact. Bin asset contains binary jar files. Documentation is stored in doc asset.

The purpose is to import these asset metadata from file system to repository Rational Asset Manager and set communities and asset types, according to artifact usage.

Configure the manifest and artifact of the four assets

In this example, you want to set the community of bin asset to DevOps Community and doc asset to Documentation. Before you start batch update, you should configure the manifest and artifact of the four assets like below:
  • Folder structure and manifest of bin asset:
    Directory of C:\Asset source\bin asset
    
    09/29/2014  01:24 PM    <DIR>          .
    09/29/2014  01:24 PM    <DIR>          ..
    03/20/2012  11:54 AM           350,627 log4j-1.2.11.jar
    09/29/2014  01:30 PM               475 manifest.rmd

    Manifest file (you will upload .jar file as artifact):

    <?xml version="1.0" encoding="UTF-8"?>
    <defaultprofile:Asset xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 
    xmlns:defaultprofile="http:///defaultprofile.ecore" 
       name="log4j bin" version="1.2.11" shortDescription="log4j jar file">
     <classification>
      <descriptorGroup name="AssetType">
       <nodeDescriptor href="executable jar" />
      </descriptorGroup>
     </classification>
    <solution>
      <artifact name="log4j-1.2.11.jar">
       <reference><value>log4j-1.2.11.jar</value></reference>
      </artifact>
     </solution>
     </description><value>Longer description</value></description>
    </defaultprofile:Asset>
  • Folder structure and manifest of doc asset:
    Directory of C:\Asset source\doc asset
    09/29/2014  01:24 PM    <DIR>          .
    09/29/2014  01:24 PM    <DIR>          ..
    09/29/2014  01:30 PM               560 manifest.rmd

    Manifest file which contains a URL artifact to the online documentation:

    <?xml version="1.0" encoding="UTF-8"?>
    <defaultprofile:Asset xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
    xmlns:defaultprofile="http:///defaultprofile.ecore" 
       name="doc asset" version="1.0" shortDescription="short description">  
      <classification>
       <descriptorGroup name="AssetType">
        <nodeDescriptor href="documentation"/>
      </descriptorGroup>
     </classification>
    <solution>
     <artifact name="API reference" type="url">
         <reference value="http://logging.apache.org/log4j/1.2/apidocs/index.html">
            <referenceKind name="url"/>
         </reference>
       </artifact>
     </solution>
     <description><value>Longer description</value></description>
    </defaultprofile:Asset>
  • Folder structure and manifest of source code asset:
    Directory of C:\Asset source\source code asset
    
    09/29/2014  01:30 PM    <DIR>          .
    09/29/2014  01:30 PM    <DIR>          ..
    09/29/2014  11:17 AM    <DIR>          folder
    09/29/2014  01:38 PM               536 manifest.rmd
    
    Directory of C:\Asset source\source code asset\folder
    
    09/29/2014  11:17 AM    <DIR>          .
    09/29/2014  11:17 AM    <DIR>          ..
    09/29/2014  11:16 AM            27,008 log4j-1.2.11.zip

    Manifest file which contains source code compressed in .zip file (source code is placed in a folder):

    <?xml version="1.0" encoding="UTF-8"?>
    <defaultprofile:Asset xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 
    xmlns:defaultprofile="http:///defaultprofile.ecore" 
        name="log4j-src" version="1.2.11" shortDescription="short description">
       <classification>
        <descriptorGroup name="AssetType">
          <nodeDescriptor href="source code" />
        </descriptorGroup>
       </classification>
       <solution>
         <artifact name="folder" type="folder">
          <artifact name="log4j-1.2.11.zip" type="application/zip"/>
        <reference value="log4j-1.2.11.zip"/>
       </artifact>
      </artifact>
     </solution>
     <description><value>Longer description</value></description>
    </defaultprofile:Asset>
  • Folder structure and manifest of source code2 asset:
    Directory of C:\Asset source\source code2 asset
    
    09/29/2014  01:32 PM    <DIR>          .
    09/29/2014  01:32 PM    <DIR>          ..
    09/29/2014  11:16 AM            27,008 log4j-1.2.11.zip
    09/29/2014  11:17 AM               911 manifest.rmd

    Manifest file which contains source code compressed in .zip file:

    <?xml version="1.0" encoding="UTF-8"?>
    <defaultprofile:Asset xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" 
    xmlns:defaultprofile="http:///defaultprofile.ecore"
         name="log4j-src" version="1.2.11" shortDescription="short description">
      <classification>
        <descriptorGroup name="AssetType">
          <nodeDescriptor href="source code" />
        </descriptorGroup>
      </classification>
      <solution>
        <artifact name="log4j-12.11.zip" type="text/plain">
          <reference><value>log4j-12.11.zip</value></reference>
        </artifact>
      </solution>
    </defaultprofile:Asset>
You have to specify the metadata for the artifact of each asset and place the artifacts in the same directory with manifest.rmd file. Note that in manifest file, metadata for asset type is a must. Below is an example:
<classification>
  <descriptorGroup name="AssetType">
   <!-- specify the asset type url, or set a value here and map it to a existing asset type url in batch update later -->
    <nodeDescriptor href="source code" />
    </descriptorGroup>
  </classification>

Set asset communities in the Batch editor

As you have not set the communities for all assets, you can use asset rule in the Batch editor to help set asset communities according to asset name. Take the following steps:
  1. In the Batch editor, import the root folder which contains all four asset root folders and specify destination repository.
  2. To add asset rule for source code asset, select Create assets using archives and folders matching this filter and type source code* in the Filter field. Then click Finish. An asset rule for two source code assets is now created, and the Eclipse client will pick two folders whose names match source code* under root asset source folder.
  3. To create community rule for source assets, right click asset rule and click Add rule.... In the pop-up window, click Community > Next.
  4. Specify an existing community in the destination repository and click Finish.
    Type in Sample Open Source in the Community field

    A new community rule is added under Asset rule for source assets, and the community of source asset is set as Sample Open Source.

    Community is under Asset and Sample Open Source is under Communities(1)
  5. A validation warning message appears as there is not an asset type named source code.
    Warning under Asset Types: file:/C:/Asset%20source/source%20code%20asset/source code and warning under Assets (2): An asset type is required
    You have two ways to fix this problem:
    • Create an asset type rule which is like rule for community. Specify an existing asset type to overwrite the asset type of the two source assets.
    • Map the missing asset type of each asset to an existing type in repository, or create the asset type in repository.
      • To map asset types:
        1. Right click the asset type in destination repository space and click Map Asset Types....
          Map Asset Types
        2. Specify an asset type in the pop-up window and click Ok.
      • To create asset types, right click the asset type in destination repository space and click Create Asset Types.
  6. To continue to add asset rule for the other two source assets, use community rule to add them to different communities. Fix the validation warning for them and make sure there is no validation warning message for assets.
    Fix the validation warning
  7. Click the Update All Assets button and batch update is complete.
    Batch update complete and four assets show up
To learn more about performing a batch update from a file system to a repository, see the following topics:

Feedback