Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to create and update assets via iRAM web-service interface not using iRAM API method ?

Please give any helper Link [OR] sample program about how to create and update assets via iRAM web-service interface not using iRAM API method ?

And one additional question if artifacts can be created in asset

(like RAMFolderArtifact, LocalFileArtifact, LocalFolderArtifact, LocalArchiveFolderArtifact and RAMURLArtifact can be added to the artifact root (or any other RAMFolder artifact) by using RAMFolderArtifact.addArtifact(Artifact) or RAMFolderArtifact.addArtifact(String path, Artifact in jav API).

Thank you
Bakiyaraj Arul
bakiyaraj.arul@in.ibm.com
iRAM Central Support Team

0 votes



One answer

Permanent link
Webservices are internal APIs ...

The following is a sample Java Code:

public class UploadArtifacts {
   
    private static void addFile(RAMFolderArtifact rroot, File f) {
        LocalFileArtifact fileArtifact = new LocalFileArtifact(f);
        System.out.println(new Date()+" - Adding: "+f.getName());
        rroot.addArtifact(fileArtifact);
    }
   
    public static void main(String[] args) {
        RAMSession session = new RAMSession("some url,  "uid",  "passwd");
        session.setWebServiceTimeout(60000000);

        
        // see http://publib.boulder.ibm.com/infocenter/ramhelp/v7r5m0/topic/com.ibm.ram.doc/topics/r_api_createmodifyordeleteassets.html
        
        String GUID = "some guid";
        String Version = "some version";
        String SrcDir = "/fromdir";
        int skip = 19;
            
        
        RAMAsset asset = session.getAsset(new AssetIdentification(GUID, Version));
        System.out.println("Processing: "+asset.getName()+" ["+asset.getIdentification().getVersion()+"]");
        
        RAMFolderArtifact RamRoot = (RAMFolderArtifact)asset.getArtifactsRoot();
        File FileRoot = new File (SrcDir);
        
        if (FileRoot.isDirectory()) {
            try {
                File[] toUpload = FileRoot.listFiles();
                for (int i = 0; i < toUpload.length; i++) {
                    if (i>=skip) {
                        addFile(RamRoot, toUpload[i]);
                        session.put(asset, new NullProgressMonitor());
                    }
                }
            }
            catch (Throwable t) {
                t.printStackTrace();
            }
            finally {
                session.release();
            }
            
        }
        else {
            System.out.println("Source Directory is not a directory: "+SrcDir);
        }
        
        
    }                   



















































0 votes

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,938

Question asked: Sep 30 '13, 6:08 a.m.

Question was seen: 5,255 times

Last updated: Sep 30 '13, 8:38 a.m.

Confirmation Cancel Confirm