@Override public IStatus ping(PingType pingType) { String msg = NLS.bind(Messages.cannotConnectToServer, teiidServer.getTeiidAdminInfo().getUsername()); try { if (this.admin == null) throw new Exception(msg); switch (pingType) { case JDBC: return pingJdbc(); case ADMIN: default: return pingAdmin(); } } catch (Exception ex) { return new Status(IStatus.ERROR, PLUGIN_ID, msg, ex); } }
/** * Default Constructor * * @param teiidServer the server this admin belongs to (never <code>null</code>) * @throws Exception if there is a problem connecting the server */ public ExecutionAdmin(ITeiidServer teiidServer) throws Exception { ArgCheck.isNotNull(teiidServer, "server"); // $NON-NLS-1$ ITeiidAdminInfo teiidAdminInfo = teiidServer.getTeiidAdminInfo(); char[] passwordArray = null; if (teiidAdminInfo.getPassword() != null) { passwordArray = teiidAdminInfo.getPassword().toCharArray(); } this.admin = AdminFactory.getInstance() .createAdmin(teiidAdminInfo.getUsername(), passwordArray, teiidAdminInfo.getUrl()); this.teiidServer = teiidServer; this.eventManager = teiidServer.getEventManager(); this.connectionMatcher = new ModelConnectionMatcher(); init(); }