/** * Set up the services to create a channel listener and operation handler service. * * @param serviceTarget the service target to install the services into * @param endpointName the endpoint name to install the services into * @param channelName the name of the channel * @param verificationHandler * @param newControllers list to add the new services to */ public static void installManagementChannelServices( final ServiceTarget serviceTarget, final ServiceName endpointName, final AbstractModelControllerOperationHandlerFactoryService operationHandlerService, final ServiceName modelControllerName, final String channelName, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers) { final OptionMap options = OptionMap.create(RemotingOptions.RECEIVE_WINDOW_SIZE, ProtocolChannelClient.Configuration.WINDOW_SIZE, RemotingOptions.TRANSMIT_WINDOW_SIZE, ProtocolChannelClient.Configuration.WINDOW_SIZE); final ServiceName operationHandlerName = endpointName.append(channelName).append(ModelControllerClientOperationHandlerFactoryService.OPERATION_HANDLER_NAME_SUFFIX); final ServiceBuilder<?> builder = serviceTarget.addService(operationHandlerName, operationHandlerService) .addDependency(modelControllerName, ModelController.class, operationHandlerService.getModelControllerInjector()) .setInitialMode(ACTIVE); addController(newControllers, verificationHandler, builder); installManagementChannelOpenListenerService(serviceTarget, endpointName, channelName, operationHandlerName, options, verificationHandler, newControllers, false); }
/** * Set up the services to create a channel listener. This assumes that an endpoint service called {@code endpointName} exists. * * @param serviceTarget the service target to install the services into * @param endpointName the name of the endpoint to install a channel listener into * @param channelName the name of the channel * @param operationHandlerName the name of the operation handler to handle request for this channel * @param options the remoting options * @param verificationHandler * @param newControllers list to add the new services to * @param onDemand whether to install the services on demand */ public static void installManagementChannelOpenListenerService( final ServiceTarget serviceTarget, final ServiceName endpointName, final String channelName, final ServiceName operationHandlerName, final OptionMap options, final ServiceVerificationHandler verificationHandler, final List<ServiceController<?>> newControllers, final boolean onDemand) { final ManagementChannelOpenListenerService channelOpenListenerService = new ManagementChannelOpenListenerService(channelName, options); final ServiceBuilder<?> builder = serviceTarget.addService(channelOpenListenerService.getServiceName(endpointName), channelOpenListenerService) .addDependency(endpointName, Endpoint.class, channelOpenListenerService.getEndpointInjector()) .addDependency(operationHandlerName, ManagementChannelInitialization.class, channelOpenListenerService.getOperationHandlerInjector()) .addDependency(ManagementChannelRegistryService.SERVICE_NAME, ManagementChannelRegistryService.class, channelOpenListenerService.getRegistry()) .setInitialMode(onDemand ? ON_DEMAND : ACTIVE); addController(newControllers, verificationHandler, builder); }