Working with 7.5.1.1 RAM java api. RAMLibrary is returning null.
![]()
Friends,
I decided to write some custom code to draw out the RAMAttribures and RAMLibrary. We are using RAM 7.5.1.1 with the ifix pack 6.
The code to extract RAMAttributes is working great.
Active code:
public class RamJavaClient implements IAttribute {
private RAMAsset ramAsset;
private RAMSession session;
// private RAMLibrary ramLibary;
public RamJavaClient(String RamServerConnection, String user, String passwd) {
this.session = new RAMSession(RamServerConnection, user, passwd);
}
public RAMAsset getRamAsset() {
return ramAsset;
}
public RAMSession getSession() {
return session;
}
/*
* public RAMLibrary getLibrary() { return ramLibary; }
*
* public void setRamLibrary(String sessionID, String Version) { RAMLibrary
* rlib = session .getLibrary(new
* com.ibm.ram.common.data.AssetIdentification( sessionID, Version));
* this.ramLibary = rlib; }
*/
public void setRamAsset(String sessionID, String Version) {
RAMAsset asset = session
.getAsset(new com.ibm.ram.common.data.AssetIdentification(
sessionID, Version));
this.ramAsset = asset;
}
@Override
public void generateAssetReport(String assetID) {
if (assetID != null) {
AssetAttribute collectionOfAttributes[] = getRamAsset()
.getAssetAttributes();
for (AssetAttribute ac : collectionOfAttributes) {
System.out.println(ramAsset.getAssetAttribute(ac.getName()));
}
}
}
}
@Override
public void generateAssetReport(String assetID) {
if (assetID != null) {
AssetAttribute collectionOfAttributes[] = getRamAsset()
.getAssetAttributes();
for (AssetAttribute ac : collectionOfAttributes) {
System.out.println(ramAsset.getAssetAttribute(ac.getName()));
}
}
}
this gives me all of the assets attributes but no asset version number or description (argggggg). In order to get asset version numbers/description you have to use a different pkg, which is found in the RAMLibrary.
The code to extract RAMLibrary is failing miserably, this is where I need help. Can anyone tell what I'm doing wrong, why am I getting a null pointer for AssetIdentification ai? Please note that this technique has been used successfully when getting RAMAssets attributes, but its not working when I'm trying to capture RAMLibrary information.
Active Code:
public class RAMLibMain {
public void test() {
String assetGUID = "6D0429E3-5134-9B03-4278-14306CDB2230";
String assetVersion = "3.0";
AssetIdentification ai = new AssetIdentification(assetGUID,
assetVersion);
RAMSession rtsession = new RAMSession("http://localhost:9080/ram", "admin", "admin");
try {
String st = rtsession.getLibrary(ai).getVersion();
System.out.println("test: " + st);
}catch (Exception ex) {
ex.getMessage();
ex.printStackTrace();
}
}
public static void main(String[] args) {
System.out
.println("RamLibrary Client Started capturing RAM library Data");
RAMLibMain rlm = new RAMLibMain();
rlm.test();
}
}
|
Accepted answer
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.
Comments
String st = rtsession.getLibrary(ai).getDescription();
I guess getting version does not make much sense since I'm passing it in... but getDescription from the RAMLIbrary is more pratical.