Initializing and Establishing BTT C/S connectivity

Before you begin

About this task

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();
		}
	}
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();
		}