I looked into this myself and decompiled DfSession
. In the apiExec()
method DFC uses some internal calls that are available to "outsiders", and this enables the possibility of creating your own "apiExec() equivalent".
Here's a simple example from within a BOF class (a TBO implementation, for instance):
import static com.google.common.base.Strings.isNullOrEmpty;
...
import com.documentum.dmcl.impl.DmclApi;
...
public class MyBofClass extends MyBofInterface {
...
private boolean execSql(String sql) throws DfException {
return execApi("execsql", sql);
}
private boolean execApi(String command, String args) throws DfException {
return execApi(getSession(), command, args);
}
private boolean execApi(IDfSession session, String command, String args) throws DfException {
StringBuilder apiBuilder = new StringBuilder(command);
apiBuilder.append(',');
apiBuilder.append(session.getSessionId());
if (!isNullOrEmpty(args)) {
apiBuilder.append(',');
apiBuilder.append(args);
}
return DmclApi.getInstance().exec(apiBuilder.toString());
}
...
}
(One should probably restructure this into static util classes or whatever is preferred.)
The crucial part here is of course the DmclApi.getInstance().exec()
call. This is an ugly hack, but no worse than the original apiExec()
in my opinion. It's a reimplementation, really.