Usage examples
Tcl example:
switch -exact -- $mode {
global smatdbTest
start {
if {![info exists smatdbTest]} {
set smatdbTest [smatdbopen test.smatdb user_defined]
}
}
run {
keylget args MSGID mh
set retCode [smatdbinsert $ smatdbTest $mh]
if { retCode != 0 } {
set errorContext “Failed to insert msg. Error code is $retCode”
lappend dispList "ERROR {{$mh $ errorContext}}”
} else {
set cycleRet [smatdbcycle $ smatdbTest ]
if { $ cycleRet == -1} {
puts “ cycle failed”
} else {
puts “ cycle success”
}
set searchRet [smatdbsearch $ smatdbTest “Time > 1456914420000 offset 0 limit 3”] lappend dispList "CONTINUE $mh"
}
}
time {
}
shutdown {
smatdbclose $smatdbTest
}
}
Java UPoC example:
public DispositionList process (CloverEnv cloverEnv, String context, String mode, Message msg) throws CloverleafException {
DispositionList dl = new DispositionList();
if (mode.equalsIgnoreCase("start")) {
SMATDB smatdbTest = new SMATDB(CloverEnv, "test.smatdb");
smatdbTest.open();
} else if (mode.equalsIgnoreCase("run")) {
if (smatdbTest.insert(msg) !=0 ) {
String errorContext = “failed to insert a message”
dl.add( DispositionList.ERROR, msg, errorContext);
} else {
smatdbTest.cycle();
String searchRet = smatdbTest.search(" Time > 1456914420000 offset 0 limit 3");
dl.add( DispositionList.CONTINUE, msg);
}
} else if (mode.equalsIgnoreCase("shutdown")) {
smatdbTest.close();
}
return dl;}
}