Search in sources :

Example 1 with JolokiaConnectionWrapper

use of org.jboss.tools.jmx.jolokia.JolokiaConnectionWrapper in project jbosstools-openshift by jbosstools.

the class OpenshiftJMXConnectionProvider method createConnection.

@Override
protected IConnectionWrapper createConnection(IServer server) {
    IConnection openshiftCon = OpenShiftServerUtils.getConnection(server);
    String url = computeJolokiaURL(server);
    if (url != null) {
        JolokiaConnectionWrapper cw = new JolokiaConnectionWrapper() {

            @Override
            public IConnectionProvider getProvider() {
                return ExtensionManager.getProvider(PROVIDER_ID);
            }
        };
        cw.setId(server.getName());
        cw.setUrl(url);
        cw.setType("POST");
        cw.setIgnoreSSLErrors(true);
        Map<String, String> headers = new HashMap<>();
        headers.put(AUTHORIZATION_HEADER_KEY, AUTHORIZATION_HEADER_VALUE_PREFIX + ((Connection) openshiftCon).getToken());
        cw.setHeaders(headers);
        return cw;
    } else {
        return null;
    }
}
Also used : HashMap(java.util.HashMap) JolokiaConnectionWrapper(org.jboss.tools.jmx.jolokia.JolokiaConnectionWrapper) Connection(org.jboss.tools.openshift.core.connection.Connection) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection) IConnection(org.jboss.tools.openshift.common.core.connection.IConnection)

Aggregations

HashMap (java.util.HashMap)1 JolokiaConnectionWrapper (org.jboss.tools.jmx.jolokia.JolokiaConnectionWrapper)1 IConnection (org.jboss.tools.openshift.common.core.connection.IConnection)1 Connection (org.jboss.tools.openshift.core.connection.Connection)1