private void forEachLine(String resourceName, Consumer<String> consumer) { InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName); if (in == null) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String line; while ((line = reader.readLine()) != null) { consumer.accept(line.trim()); } } catch (IOException e) { throw new ServiceRegistryException(e); } }
@Override public void activate(ServiceActivatorContext context) throws ServiceRegistryException { ServiceTarget target = context.getServiceTarget(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(TopologyArchive.REGISTRATION_CONF); if (in == null) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String serviceName = null; while ((serviceName = reader.readLine()) != null) { serviceName = serviceName.trim(); if (!serviceName.isEmpty()) { installAdvertiser( target, serviceName, "http" ); installAdvertiser( target, serviceName, "https" ); } } } catch (IOException e) { throw new ServiceRegistryException(e); } }
@Override public void activate(ServiceActivatorContext context) throws ServiceRegistryException { ServiceTarget target = context.getServiceTarget(); InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream(TopologyArchive.REGISTRATION_CONF); if (in == null) { return; } try (BufferedReader reader = new BufferedReader(new InputStreamReader(in))) { String serviceName = null; while ((serviceName = reader.readLine()) != null) { serviceName = serviceName.trim(); if (!serviceName.isEmpty()) { installAdvertiser(target, serviceName, "http"); installAdvertiser(target, serviceName, "https"); } } } catch (IOException e) { throw new ServiceRegistryException(e); } }
@Override public final ServiceRegistryException cannotLocateServerBootstrap(final Throwable t) { final ServiceRegistryException result = new ServiceRegistryException(String.format(getLoggingLocale(), cannotLocateServerBootstrap$str()), t); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String noSSLContext = "DGENDPT10018: Endpoint '%s' requires SSL, but no SSL context is available in realm '%s'";
@Override public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget(); final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT; final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT; try { // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.DEFAULT @SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.DEFAULT, endpointConfig, DEFAULTS); ManagementRemotingServices.installRemotingEndpoint(serviceTarget, endpointName, SecurityActions.getSystemProperty(ServerEnvironment.NODE_NAME), endpointType, options, null, null); // Install the communication services final int port = managementSocket.getPort(); final String host = managementSocket.getAddress().getHostAddress(); HostControllerConnectionService service = new HostControllerConnectionService(host, port, serverName, serverProcessName, authKey, managementSubsystemEndpoint); serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service) .addDependency(endpointName, Endpoint.class, service.getEndpointInjector()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue()) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); } catch (OperationFailedException e) { throw new ServiceRegistryException(e); } }
@Override public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget(); final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT; final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT; try { // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.DEFAULT @SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.DEFAULT, endpointConfig, DEFAULTS); ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options, null, null); // Install the communication services final int port = managementSocket.getPort(); final String host = NetworkUtils.canonize(managementSocket.getAddress().getHostAddress()); HostControllerConnectionService service = new HostControllerConnectionService(host, port, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint); Services.addServerExecutorDependency(serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service), service.getExecutorInjector(), false) .addDependency(endpointName, Endpoint.class, service.getEndpointInjector()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue()) .setInitialMode(ServiceController.Mode.ACTIVE).install(); } catch (OperationFailedException e) { throw new ServiceRegistryException(e); } }
@Override public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget(); final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT; final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT; try { ManagementWorkerService.installService(serviceTarget); // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.SIMPLE @SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.SIMPLE, endpointConfig, DEFAULTS); ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options); // Install the communication services HostControllerConnectionService service = new HostControllerConnectionService(managementURI, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint, sslContextSupplier); Services.addServerExecutorDependency(serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME, service), service.getExecutorInjector()) .addDependency(ServerService.JBOSS_SERVER_SCHEDULED_EXECUTOR, ScheduledExecutorService.class, service.getScheduledExecutorInjector()) .addDependency(endpointName, Endpoint.class, service.getEndpointInjector()) .addDependency(ControlledProcessStateService.SERVICE_NAME, ControlledProcessStateService.class, service.getProcessStateServiceInjectedValue()) .setInitialMode(ServiceController.Mode.ACTIVE).install(); } catch (OperationFailedException e) { throw new ServiceRegistryException(e); } }
@Override public void activate(final ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { final ServiceTarget serviceTarget = serviceActivatorContext.getServiceTarget(); final ServiceName endpointName = managementSubsystemEndpoint ? RemotingServices.SUBSYSTEM_ENDPOINT : ManagementRemotingServices.MANAGEMENT_ENDPOINT; final EndpointService.EndpointType endpointType = managementSubsystemEndpoint ? EndpointService.EndpointType.SUBSYSTEM : EndpointService.EndpointType.MANAGEMENT; try { ManagementWorkerService.installService(serviceTarget); // TODO see if we can figure out a way to work in the vault resolver instead of having to use ExpressionResolver.SIMPLE @SuppressWarnings("deprecation") final OptionMap options = EndpointConfigFactory.create(ExpressionResolver.SIMPLE, endpointConfig, DEFAULTS); ManagementRemotingServices.installRemotingManagementEndpoint(serviceTarget, endpointName, WildFlySecurityManager.getPropertyPrivileged(ServerEnvironment.NODE_NAME, null), endpointType, options); // Install the communication services final ServiceBuilder<?> sb = serviceTarget.addService(HostControllerConnectionService.SERVICE_NAME); final Supplier<ExecutorService> esSupplier = Services.requireServerExecutor(sb); final Supplier<ScheduledExecutorService> sesSupplier = sb.requires(ServerService.JBOSS_SERVER_SCHEDULED_EXECUTOR); final Supplier<Endpoint> eSupplier = sb.requires(endpointName); final Supplier<ControlledProcessStateService> cpssSupplier = sb.requires(ControlledProcessStateService.SERVICE_NAME); sb.setInstance(new HostControllerConnectionService(managementURI, serverName, serverProcessName, authKey, initialOperationID, managementSubsystemEndpoint, sslContextSupplier, esSupplier, sesSupplier, eSupplier, cpssSupplier)); sb.install(); } catch (OperationFailedException e) { throw new ServiceRegistryException(e); } }
throw new ServiceRegistryException(e);