final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder() .setHostName(address) .setPort(port) .setProtocol(protocol); builder.setHandler(getCallbackHandler()); builder.setAuthenticationConfigUri(URI.create(authenticationConfig)); current = new ManagementClient(ModelControllerClient.Factory.create(builder.build()), address, port, protocol);
log.debug(DEBUG_MESSAGE_POM_HAS_CREDS); final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder() .setProtocol(protocol) .setHostName(hostname) .setPort(port) .setConnectionTimeout(timeout * 1000); if (authenticationConfig != null) { try { builder.setAuthenticationConfigUri(authenticationConfig.toURI()); } catch (URISyntaxException e) { throw new RuntimeException("Failed to create URI from " + authenticationConfig, e); return new MavenModelControllerClientConfiguration(builder.build(), username, password);
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used rather than the native remote protocol * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final String hostName, final int port, final CallbackHandler handler, final Map<String, String> saslOptions) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(hostName) .setPort(port) .setProtocol(protocol) .setSaslOptions(saslOptions) .build()); }
@Override public void start() throws LifecycleException { final ModelControllerClientConfiguration.Builder clientConfigBuilder = new ModelControllerClientConfiguration.Builder() .setHostName(containerConfig.getManagementHostName()) .setPort(containerConfig.getManagementPort()); clientConfigBuilder.setHandler(Authentication.getCallbackHandler()); clientConfigBuilder.setAuthenticationConfigUri(URI.create(authenticationConfig)); DomainDelegateProvider.INSTANCE.setDelegate(ModelControllerClient.Factory.create(clientConfigBuilder.build()));
final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder() .setHostName(address) .setPort(port) .setProtocol(protocol); builder.setHandler(getCallbackHandler()); builder.setAuthenticationConfigUri(URI.create(authenticationConfig)); current = new ManagementClient(ModelControllerClient.Factory.create(builder.build()), address, port, protocol);
@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; } }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used rather than the native remote protocol * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @param connectionTimeout maximum time, in milliseconds, to wait for the connection to be established * @param saslOptions Additional options to be passed to the SASL mechanism. * @param clientBindAddress the address to which the client will bind. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout, final Map<String, String> saslOptions, final String clientBindAddress) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setClientBindAddress(clientBindAddress) .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setProtocol(protocol) .setSaslOptions(saslOptions) .setSslContext(sslContext) .build()); }
@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; } }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used rather than the native remote protocol * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @param connectionTimeout maximum time, in milliseconds, to wait for the connection to be established * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout, final Map<String, String> saslOptions) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setProtocol(protocol) .setSaslOptions(saslOptions) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @param connectionTimeout maximum time, in milliseconds, to wait for the connection to be established * @param saslOptions Additional options to be passed to the SASL mechanism. * @param clientBindAddress the address to which the client will bind. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout, final Map<String, String> saslOptions, final String clientBindAddress) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setClientBindAddress(clientBindAddress) .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setSaslOptions(saslOptions) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @param connectionTimeout maximum time, in milliseconds, to wait for the connection to be established * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout, final Map<String, String> saslOptions) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setSaslOptions(saslOptions) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used rather than the native remote protocol * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setProtocol(protocol) .setSslContext(sslContext) .build()); }
/** * Creates a client based on the {@linkplain #getServerAddress() server address} and * {@linkplain #getServerPort() port}. If the {@code authConfigUri} is not {@code null} the it will be used to * authenticate the client. * * @param authConfigUri the path too the authentication configuration or {@code null} * @param address of the server * @param port the management port of the server * * @return the client */ public static ModelControllerClient getModelControllerClient(final URI authConfigUri, String address, int port) { final ModelControllerClientConfiguration.Builder builder = new ModelControllerClientConfiguration.Builder() .setHostName(address) .setPort(port); if (authConfigUri == null) { builder.setHandler(Authentication.getCallbackHandler()); } else { builder.setAuthenticationConfigUri(authConfigUri); } return ModelControllerClient.Factory.create(builder.build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @param connectionTimeout maximum time, in milliseconds, to wait for the connection to be established * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext, final int connectionTimeout) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setConnectionTimeout(connectionTimeout) .setHandler(handler) .setHostName(hostName) .setPort(port) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used rather than the native remote protocol * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(hostName) .setPort(port) .setProtocol(protocol) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String hostName, final int port, final CallbackHandler handler, final Map<String, String> saslOptions) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(hostName) .setPort(port) .setSaslOptions(saslOptions) .build()); }
/** * Create a client instance for a remote address and port and CallbackHandler. * * @param hostName the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param sslContext a pre-initialised SSLContext * @return A model controller client * @throws UnknownHostException if the host cannot be found * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String hostName, final int port, final CallbackHandler handler, final SSLContext sslContext) throws UnknownHostException { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(hostName) .setPort(port) .setSslContext(sslContext) .build()); }
/** * Create a client instance for a remote address and port. * * @param protocol The prototcol to use. If this is remote+http or remote+https http upgrade will be used * @param address the address of the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final String protocol, final InetAddress address, final int port, final CallbackHandler handler, final Map<String, String> saslOptions) { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(address.getHostAddress()) .setPort(port) .setProtocol(protocol) .setSaslOptions(saslOptions) .build()); }
/** * Create a client instance for a remote address and port. * * @param address the address of the remote host * @param port the port * @param handler CallbackHandler to obtain authentication information for the call. * @param saslOptions Additional options to be passed to the SASL mechanism. * @return A model controller client * @deprecated use {@link org.jboss.as.controller.client.ModelControllerClientConfiguration.Builder} and {@link #create(ModelControllerClientConfiguration)} */ @Deprecated public static ModelControllerClient create(final InetAddress address, final int port, final CallbackHandler handler, final Map<String, String> saslOptions) { return create(new ModelControllerClientConfiguration.Builder() .setHandler(handler) .setHostName(address.getHostAddress()) .setPort(port) .setSaslOptions(saslOptions) .build()); }
@Override public ModelControllerClient getClient(ControllerAddress address, CallbackHandler handler, boolean disableLocalAuth, SecurityFactory<SSLContext> sslContextFactory, boolean fallbackSslContext, int connectionTimeout, ConnectionCloseHandler closeHandler, ProtocolTimeoutHandler timeoutHandler, String clientBindAddress) throws IOException { // TODO - Make use of the ProtocolTimeoutHandler Map<String, String> saslOptions = disableLocalAuth ? DISABLED_LOCAL_AUTH : ENABLED_LOCAL_AUTH; ModelControllerClientConfiguration config = new ModelControllerClientConfiguration.Builder() .setProtocol(address.getProtocol()) .setHostName(address.getHost()) .setPort(address.getPort()) .setHandler(handler) .setSslContextFactory(sslContextFactory) .setConnectionTimeout(connectionTimeout) .setSaslOptions(saslOptions) .setClientBindAddress(clientBindAddress) .build(); return ModelControllerClient.Factory.create(config); } };