Just wondering if it can code in java to call an iapi method?
If it's possible, could please tell me which jars it needs to involved in or where is the document?
Great thanks in advance.
Regards,
Hong Yuan
If there are Accepted Answers, those will be shown by default. You can switch to 'All Replies' by selecting the tab below.
Hi,
you could call IDfSession.apiXXX methods, even if they are deprecated, and have been for many years.
However, api methods are implemented in java classes nowadays, and it's definitely more convenient to use these
Regards
Jørg
Thanks a lot, Jørg.
Just wonder an example for me. If I want to implement following method by using java - 'apply,c,NULL,SET_OPTIONS,OPTION,S, rpctrace,VALUE,B,T' - how do I call the apiXXX? many thanks in advance
That would be either apiExec(String cmd, String args) or apiGet(String cmd, String args). I must admit that I'm not sure which one is the correct one.
Again, IDfSession.apply() would certainly be the correct method to use here This method is pretty well described in the javadocs
IDfCollection coll = null;try { coll = sess.apply( null, "SET_OPTIONS", new DfList(new String[]{"OPTION", "VALUE", }), new DfList(new String[]{"S", "B", }), new DfList(new String[]{"rpctrace", "T", })); if (coll.next() && coll.hasAttr("result")) { return coll.getBoolean("result"); } return false;} finally { if (coll !=null) { coll.close(); }}
Many thanks for your answer. I've tried and it does work. Thanks again
Oops, dfc has built-in implementation for some apply commands:
IDfApplySetOptions applyCommand = (IDfApplySetOptions) DfAdminCommand .getCommand(IDfAdminCommand.APPLY_SET_OPTIONS);applyCommand.setOption("rpctrace");applyCommand.setValue(true);applyCommand.execute(session);
WOW, that looks more convinient for me. Great thanks