Software Development Kit (SDK) and API Discussions

Null while getting retention using Zephyr API

HeehyeonLee
454 Views

Hello

 

I need help.

 

I used the snaplock get file retention function using the Vserver API (manageontap-9.8P3.jar) and added the string function.

 

The code below that was used in the existing 7-mode API (manageontap-5.2.2.jar) was added.

string retentionTime =xo.getchlidContent("retantion-time");

However, null phenomenon occurs when using the function.

 

When using Vserver API (manageontap-9.8P3.jar), is there any code that can replace the code below?

string retentionTime =xo.getchlidContent("retantion-time");

 

Attach log - It is okay to be exposed as a test environment

 

public Object getFileRetention(NetAppVo netAppVo) {
boolean success = false;
NaElement xo = null;
NaServer naSvr = null;
try {
String targetPath = netAppVo.getRootDir()+netAppVo.getWormPath();

naSvr = this.getNaServer(netAppVo, false);

NaElement retentionInfo = null;

if(netAppVo.isCheckOs()) {
/* =================================================================================== */
/* 신규 API */
retentionInfo = new NaElement("snaplock-get-file-retention");
NaElement xi = new NaElement("desired-attributes");
retentionInfo.addChildElem(xi);
NaElement xi1 = new NaElement("snaplock-file-retention-info");
xi.addChildElem(xi1);
xi1.addNewChild("file",targetPath);
xi1.addNewChild("formatted-retention-time","<formatted-retention-time>");
xi1.addNewChild("is-wraparound","<is-wraparound>");
xi1.addNewChild("retention-time","<retention-time>");
xi1.addNewChild("vserver",netAppVo.getServerName());
retentionInfo.addNewChild("file",targetPath);


/* =================================================================================== */
} else {
/* =================================================================================== */
/* 기존 API */
retentionInfo = new NaElement("file-get-snaplock-retention-time");
retentionInfo.addNewChild("path", targetPath);
/* =================================================================================== */
}

xo = naSvr.invokeElem(retentionInfo);
System.out.println("result NaElement : " + xo.toPrettyString(""));


String retentionTime = xo.getChildContent("retention-time");
// String retentionTime = getRetentionSecond(netAppVo.getRetention());
System.out.println("Get Retention Time : " + retentionTime);
if(retentionTime != null) {
success = true;
}
} catch(NaProtocolException e) {
e.printStackTrace();
} catch(NaAuthenticationException e) {
e.printStackTrace();
} catch (NaAPIFailedException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
if(naSvr!=null) {
naSvr.close();
}
}

 

 

 

 

[root@localhost shell]# sh getRet.sh
=================================================
Netapp File Get Retention Process Start...
=================================================
localPath : /wormtest/NetAppSDK/shell
resouce : ../conf/config.properties
Properties : {}
properties loading...
Check OS [7-Mode : false, Vserver : true] : true
Server Name : svm01
Server IP : xxx.xxx.xxx.xxx
Server Port : 443
Login User : netappadmin
Login User Password : xxxxxxxx
Source Path : ../temp/test.tif
Target Worm Logical Path : /Nmdata01/vol1/test01
Worm Root Directory(Physical) : /vol
Set Retention(yyyymmddhhmiss) : 20291124235900
Proccess Start ...
Netapp Get File Retention
result NaElement : <results status='passed'>
<attributes>
<snaplock-file-retention-info>
<file>/vol/Nmdata01/vol1/test01</file>
<formatted-retention-time>Sat Nov 24 14:59:00 GMT 2029</formatted-retention-time>
<is-wraparound>false</is-wraparound>
<retention-time>1890226740</retention-time>
<vserver>svm01</vserver>
</snaplock-file-retention-info>
</attributes>
</results>

Get Retention Time : null
result : false
Proccess Ended ...
[Procssing Time] : 0.479
=================================================
Netapp File Get Retention Process finished !!!
=================================================

 

thanks..

0 REPLIES 0
Public