/** * Close client connection. */ protected static synchronized void closeClientConnection() { if (isConnectionActive) { log.debug("Request for stopping lens cli received"); getClientWrapper().getClient().closeConnection(); isConnectionActive = false; } }
public static LensClientSingletonWrapper getClientWrapper() { return LensClientSingletonWrapper.instance(); }
/** * Explain failed attempt. * * @param e the e */ public void explainFailedAttempt(LensClientServerConnectionException e) { log.error("failed login attempt", e); switch (e.getErrorCode()) { case 401: printError("username/password combination incorrect."); break; case 500: printError("server unresponsive, Returned error code 500"); break; default: printError("ERROR: " + e.getMessage()); } } private void printError(String error) {
public LensClient getClient() { if (client == null) { try { client = new LensClient(); } catch (LensClientServerConnectionException e) { if (e.getErrorCode() != 401) { explainFailedAttempt(e); throw e; } // Connecting without password prompt failed. for (int i = 0; i < MAX_RETRIES; i++) { try { client = new LensClient(Credentials.prompt()); break; } catch (LensClientServerConnectionException lensClientServerConnectionException) { explainFailedAttempt(lensClientServerConnectionException); if (i == MAX_RETRIES - 1) { throw lensClientServerConnectionException; } } } } } return client; }
/** * Close client connection. */ protected static synchronized void closeClientConnection() { if (isConnectionActive) { log.debug("Request for stopping lens cli received"); getClientWrapper().getClient().closeConnection(); isConnectionActive = false; } }
public static LensClientSingletonWrapper getClientWrapper() { return LensClientSingletonWrapper.instance(); }
/** * Explain failed attempt. * * @param e the e */ public void explainFailedAttempt(LensClientServerConnectionException e) { log.error("failed login attempt", e); switch (e.getErrorCode()) { case 401: printError("username/password combination incorrect."); break; case 500: printError("server unresponsive, Returned error code 500"); break; default: printError("ERROR: " + e.getMessage()); } } private void printError(String error) {
public LensClient getClient() { if (client == null) { try { client = new LensClient(); } catch (LensClientServerConnectionException e) { if (e.getErrorCode() != 401) { explainFailedAttempt(e); throw e; } // Connecting without password prompt failed. for (int i = 0; i < MAX_RETRIES; i++) { try { client = new LensClient(Credentials.prompt()); break; } catch (LensClientServerConnectionException lensClientServerConnectionException) { explainFailedAttempt(lensClientServerConnectionException); if (i == MAX_RETRIES - 1) { throw lensClientServerConnectionException; } } } } } return client; }
public LensClient getClient() { if (lensClient == null) { setClient(getClientWrapper().getClient()); isConnectionActive = true; } return lensClient; }
public LensClient getClient() { if (lensClient == null) { setClient(getClientWrapper().getClient()); isConnectionActive = true; } return lensClient; }
/** * Instantiates a new sample queries. * * @throws JAXBException the JAXB exception */ public SampleQueries() throws JAXBException { metaClient = new LensMetadataClient(LensClientSingletonWrapper.instance().getClient().getConnection()); queryClient = new LensStatement(LensClientSingletonWrapper.instance().getClient().getConnection()); }