Add the following code into your plugin project Activator class to
establish BTT C/S connectivity.
public void start(BundleContext context) throws Exception {
super.start(context);
try {
//init btt configuration files
InitManager.reset("jar:///btt/btt.xml");
//init xml UI engine
XUIEngine.init("jar://btt/xuiengine.xml");
//create root context, the first context which created is the root.
ContextFactory.createContext("branchClientCtx");
//establish Client/Server connectivity
CSClientService cs = CSClient.getCSClient("realCSClient");
cs.setKeepAliveConnection(false);
cs.establishSession();
//send client info to server to create session context,
BTTOperation oper = (BTTOperation) BTTOperation
.readObject("startupClientOp");
oper.execute();
oper.close();
} catch (Exception e) {
e.printStackTrace();
}
}
- InitManager is used to initialize BTT configuration files.
- XUIEngine.init() is used to initialize xml UI engine
from global settings file.
- CSClientService is the key class used to establish, send
and receive information from server side.
- branchClientCtx is the root context in this application.
You can create root context according to your requirement, such as branch
information context, teller information context and so on.
- StartupClientOp is used to create session context in
the server side. According to your requirement, this operation can execute
after login.
Remember to close Client/Server connectivity in Activator class stop
(BundleContext context) method:
try {
//logoff and dispose session context in server side.
BTTOperation oper = (BTTOperation) BTTOperation
.readObject("logoffClientOp");
oper.execute();
oper.close();
//close Client/Server connectivity
CSClientService cs = CSClient.getCSClient("realCSClient");
cs.closeSession();
} catch (Exception e) {
e.printStackTrace();
}