private MBeanServerConnection getConnection() { try { final HashMap<String, Object> env = new HashMap<String, Object>(); env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); connector = JMXConnectorFactory.connect(getRemoteJMXURL(), env); connection = connector.getMBeanServerConnection(); } catch (IOException e) { throw new RuntimeException(e); } return connection; } }
private MBeanServerConnection getConnection() { try { final HashMap<String, Object> env = new HashMap<String, Object>(); env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); connector = JMXConnectorFactory.connect(getRemoteJMXURL(), env); connection = connector.getMBeanServerConnection(); } catch (IOException e) { throw new RuntimeException(e); } return connection; } }
private MBeanServerConnection reconnect() { try { final Map<String, Object> env = new HashMap<>(); env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); final JMXConnector connector = ManagementClient.this.connector = JMXConnectorFactory.connect(getRemoteJMXURL(), env); connection = connector.getMBeanServerConnection(); } catch (IOException e) { throw new RuntimeException(e); } return connection; } }
private MBeanServerConnection reconnect() { try { final Map<String, Object> env = new HashMap<>(); env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); final JMXConnector connector = ManagementClient.this.connector = JMXConnectorFactory.connect(getRemoteJMXURL(), env); connection = connector.getMBeanServerConnection(); } catch (IOException e) { throw new RuntimeException(e); } return connection; } }
private MBeanServerConnection getConnection() { if (connection == null) { try { final HashMap<String, Object> env = new HashMap<String, Object>(); env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); connection = new MBeanConnectionProxy(JMXConnectorFactory.connect(getRemoteJMXURL(), env).getMBeanServerConnection()); } catch (IOException e) { throw new RuntimeException(e); } } return connection; }
private MBeanServerConnection getConnection() { if (connection == null) { try { final HashMap<String, Object> env = new HashMap<String, Object>(); if (Authentication.username != null && Authentication.username.length() > 0) { // Only set this is there is a username as it disabled local authentication. env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); } connector = JMXConnectorFactory.connect(getRemoteJMXURL(), env); connection = new MBeanConnectionProxy(connector.getMBeanServerConnection()); } catch (IOException e) { throw new RuntimeException(e); } } return connection; }
public static ModelControllerClient getModelControllerClient() { try { return ModelControllerClient.Factory.create( InetAddress.getByName(getServerAddress()), TestSuiteEnvironment.getServerPort(), Authentication.getCallbackHandler() ); } catch (UnknownHostException e) { throw new RuntimeException(e); } }
private MBeanServerConnection getConnection() { MBeanServerConnection connection = this.connection; if (connection == null) { try { final Map<String, Object> env = new HashMap<>(); if (Authentication.username != null && !Authentication.username.isEmpty()) { // Only set this is there is a username as it disabled local authentication. env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); } if (config.getAuthenticationConfig() != null) { env.put("wildfly.config.url", config.getAuthenticationConfig()); } final JMXServiceURL serviceURL = getRemoteJMXURL(); final JMXConnector connector = this.connector = JMXConnectorFactory.connect(serviceURL, env); connection = this.connection = new MBeanConnectionProxy(connector.getMBeanServerConnection()); } catch (IOException e) { throw new RuntimeException(e); } } return connection; }
private MBeanServerConnection getConnection() { MBeanServerConnection connection = this.connection; if (connection == null) { try { final Map<String, Object> env = new HashMap<>(); if (Authentication.username != null && !Authentication.username.isEmpty()) { // Only set this is there is a username as it disabled local authentication. env.put(CallbackHandler.class.getName(), Authentication.getCallbackHandler()); } if (config.getAuthenticationConfig() != null) { env.put("wildfly.config.url", config.getAuthenticationConfig()); } final JMXServiceURL serviceURL = getRemoteJMXURL(); final JMXConnector connector = this.connector = JMXConnectorFactory.connect(serviceURL, env); connection = this.connection = new MBeanConnectionProxy(connector.getMBeanServerConnection()); } catch (IOException e) { throw new RuntimeException(e); } } return connection; }
address, port, getCallbackHandler()); current = new ManagementClient(modelControllerClient, address, port);
builder.setHandler(getCallbackHandler());
builder.setHandler(getCallbackHandler());
final URI connectionURI = new URI("remote://" + address + ":" + port); connection = clientConfiguration.createConnection(connectionURI, getCallbackHandler());
containerConfig.getManagementAddress(), containerConfig.getManagementPort(), getCallbackHandler()); } catch (UnknownHostException e) { throw new RuntimeException(e);
containerConfig.getManagementAddress(), containerConfig.getManagementPort(), getCallbackHandler()); } catch (UnknownHostException e) { throw new RuntimeException(e);
@Override public final void start() throws LifecycleException { // Create a client configuration builder from the container configuration final ModelControllerClientConfiguration.Builder clientConfigBuilder = new ModelControllerClientConfiguration.Builder() .setProtocol(containerConfig.getManagementProtocol()) .setHostName(containerConfig.getManagementAddress()) .setPort(containerConfig.getManagementPort()) .setAuthenticationConfigUri(authenticationConfig); // Check for username and password authentication if(containerConfig.getUsername() != null) { Authentication.username = containerConfig.getUsername(); Authentication.password = containerConfig.getPassword(); clientConfigBuilder.setHandler(getCallbackHandler()); } mccProvider.setDelegate(ModelControllerClient.Factory.create(clientConfigBuilder.build())); try { final Properties jndiProps = new Properties(); jndiProps.setProperty(Context.URL_PKG_PREFIXES, JBOSS_URL_PKG_PREFIX); jndiContext.set(new InitialContext(jndiProps)); } catch (final NamingException ne) { throw new LifecycleException("Could not set JNDI Naming Context", ne); } try { startInternal(); } catch (LifecycleException e) { safeCloseClient(); throw e; } }
@Override public final void start() throws LifecycleException { // Create a client configuration builder from the container configuration final ModelControllerClientConfiguration.Builder clientConfigBuilder = new ModelControllerClientConfiguration.Builder() .setProtocol(containerConfig.getManagementProtocol()) .setHostName(containerConfig.getManagementAddress()) .setPort(containerConfig.getManagementPort()) .setAuthenticationConfigUri(authenticationConfig); // Check for username and password authentication if(containerConfig.getUsername() != null) { Authentication.username = containerConfig.getUsername(); Authentication.password = containerConfig.getPassword(); clientConfigBuilder.setHandler(getCallbackHandler()); } mccProvider.setDelegate(ModelControllerClient.Factory.create(clientConfigBuilder.build())); try { final Properties jndiProps = new Properties(); jndiProps.setProperty(Context.URL_PKG_PREFIXES, JBOSS_URL_PKG_PREFIX); jndiContext.set(new InitialContext(jndiProps)); } catch (final NamingException ne) { throw new LifecycleException("Could not set JNDI Naming Context", ne); } try { startInternal(); } catch (LifecycleException e) { safeCloseClient(); throw e; } }