It's all about the answers!

Ask a question

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


iRAM Administrator (3152156135) | asked Sep 30 '13, 6:08 a.m.
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

One answer



permanent link
Gili Mendel (1.8k56) | answered Sep 30 '13, 8:38 a.m.
JAZZ DEVELOPER
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);
        }
        
        
    }                   



















































Your answer


Register or 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.