Search in sources :

Example 1 with LazySSLCertificateCallback

use of org.jboss.tools.openshift.core.LazySSLCertificateCallback in project jbosstools-openshift by jbosstools.

the class VagrantPoller method checkOpenShiftHealth.

protected boolean checkOpenShiftHealth(String url, int timeout) throws OpenShiftNotReadyPollingException {
    ISSLCertificateCallback sslCallback = new LazySSLCertificateCallback();
    IClient client = new ClientBuilder(url).sslCertificateCallback(sslCallback).withConnectTimeout(timeout, TimeUnit.MILLISECONDS).build();
    Exception e = null;
    try {
        if ("ok".equals(client.getServerReadyStatus()))
            return true;
    } catch (OpenShiftException ex) {
        e = ex;
    }
    String msg = NLS.bind("The CDK VM is up and running, but OpenShift is unreachable at url {0}. " + "The VM may not have been registered successfully. Please check your console output for more information", url);
    throw new OpenShiftNotReadyPollingException(CDKCoreActivator.statusFactory().errorStatus(CDKCoreActivator.PLUGIN_ID, msg, e, OpenShiftNotReadyPollingException.OPENSHIFT_UNREACHABLE_CODE));
}
Also used : ISSLCertificateCallback(com.openshift.restclient.ISSLCertificateCallback) LazySSLCertificateCallback(org.jboss.tools.openshift.core.LazySSLCertificateCallback) OpenShiftException(com.openshift.restclient.OpenShiftException) IClient(com.openshift.restclient.IClient) TimeoutException(java.util.concurrent.TimeoutException) CoreException(org.eclipse.core.runtime.CoreException) OpenShiftException(com.openshift.restclient.OpenShiftException) IOException(java.io.IOException) CommandTimeoutException(org.jboss.tools.openshift.cdk.server.core.internal.adapter.controllers.CommandTimeoutException) ClientBuilder(com.openshift.restclient.ClientBuilder)

Example 2 with LazySSLCertificateCallback

use of org.jboss.tools.openshift.core.LazySSLCertificateCallback in project jbosstools-openshift by jbosstools.

the class MinishiftPoller method checkOpenShiftHealth.

protected boolean checkOpenShiftHealth(String url, int timeout) throws OpenShiftNotReadyPollingException {
    ISSLCertificateCallback sslCallback = new LazySSLCertificateCallback();
    IClient client = new ClientBuilder(url).sslCertificateCallback(sslCallback).withConnectTimeout(timeout, TimeUnit.MILLISECONDS).build();
    Exception e = null;
    try {
        String v = client.getServerReadyStatus();
        if ("ok".equals(v))
            return true;
    } catch (OpenShiftException ex) {
        e = ex;
    }
    String msg = NLS.bind("The CDK VM is up and running, but OpenShift is unreachable at url {0}. " + "The VM may not have been registered successfully. Please check your console output for more information", url);
    throw new OpenShiftNotReadyPollingException(CDKCoreActivator.statusFactory().errorStatus(CDKCoreActivator.PLUGIN_ID, msg, e, OpenShiftNotReadyPollingException.OPENSHIFT_UNREACHABLE_CODE));
}
Also used : ISSLCertificateCallback(com.openshift.restclient.ISSLCertificateCallback) LazySSLCertificateCallback(org.jboss.tools.openshift.core.LazySSLCertificateCallback) OpenShiftException(com.openshift.restclient.OpenShiftException) IClient(com.openshift.restclient.IClient) TimeoutException(java.util.concurrent.TimeoutException) OpenShiftException(com.openshift.restclient.OpenShiftException) IOException(java.io.IOException) CommandTimeoutException(org.jboss.tools.openshift.cdk.server.core.internal.adapter.controllers.CommandTimeoutException) ClientBuilder(com.openshift.restclient.ClientBuilder)

Example 3 with LazySSLCertificateCallback

use of org.jboss.tools.openshift.core.LazySSLCertificateCallback in project jbosstools-openshift by jbosstools.

the class ConnectionFactory method create.

@Override
public Connection create(String url) {
    if (StringUtils.isEmpty(url)) {
        return null;
    }
    try {
        LazySSLCertificateCallback sslCertCallback = new LazySSLCertificateCallback();
        IClient client = new ClientBuilder(url).sslCertificateCallback(sslCertCallback).withMaxRequests(ConnectionProperties.MAX_REQUESTS).withMaxRequestsPerHost(ConnectionProperties.MAX_REQUESTS).build();
        return new Connection(client, new LazyCredentialsPrompter());
    } catch (OpenShiftException e) {
        OpenShiftCoreActivator.pluginLog().logInfo(NLS.bind("Could not create OpenShift connection: Malformed url {0}", url), e);
        return null;
    }
}
Also used : LazySSLCertificateCallback(org.jboss.tools.openshift.core.LazySSLCertificateCallback) OpenShiftException(com.openshift.restclient.OpenShiftException) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) IClient(com.openshift.restclient.IClient) LazyCredentialsPrompter(org.jboss.tools.openshift.core.LazyCredentialsPrompter) ClientBuilder(com.openshift.restclient.ClientBuilder)

Aggregations

ClientBuilder (com.openshift.restclient.ClientBuilder)3 IClient (com.openshift.restclient.IClient)3 OpenShiftException (com.openshift.restclient.OpenShiftException)3 LazySSLCertificateCallback (org.jboss.tools.openshift.core.LazySSLCertificateCallback)3 ISSLCertificateCallback (com.openshift.restclient.ISSLCertificateCallback)2 IOException (java.io.IOException)2 TimeoutException (java.util.concurrent.TimeoutException)2 CommandTimeoutException (org.jboss.tools.openshift.cdk.server.core.internal.adapter.controllers.CommandTimeoutException)2 CoreException (org.eclipse.core.runtime.CoreException)1 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)1 LazyCredentialsPrompter (org.jboss.tools.openshift.core.LazyCredentialsPrompter)1