use of org.jboss.as.webservices.service.ConfigService in project wildfly by wildfly.
the class EndpointConfigAdd method performRuntime.
@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
//modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
if (context.isBooting()) {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
//get the server config object from the ServerConfigService (service installed but not started yet, but the object is fine for our needs here)
final ServerConfig serverConfig = ASHelper.getMSCService(WSServices.CONFIG_SERVICE, ServerConfig.class, context);
if (serverConfig == null) {
throw WSLogger.ROOT_LOGGER.serviceNotAvailable(WSServices.CONFIG_SERVICE.getCanonicalName());
}
final ServiceName serviceName = getEndpointConfigServiceName(name);
final ConfigService endpointConfigService = new ConfigService(serverConfig, name, false);
final ServiceTarget target = context.getServiceTarget();
final ServiceBuilder<?> serviceBuilder = target.addService(serviceName, endpointConfigService);
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PROPERTY)) {
//get a new injector instance each time
serviceBuilder.addDependency(sn, PropertyService.class, endpointConfigService.getPropertiesInjector());
}
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PRE_HANDLER_CHAIN)) {
//get a new injector instance each time
serviceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, endpointConfigService.getPreHandlerChainsInjector());
}
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.POST_HANDLER_CHAIN)) {
//get a new injector instance each time
serviceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, endpointConfigService.getPostHandlerChainsInjector());
}
serviceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
} else {
context.reloadRequired();
}
}
use of org.jboss.as.webservices.service.ConfigService in project wildfly by wildfly.
the class ClientConfigAdd method performRuntime.
@Override
protected void performRuntime(final OperationContext context, final ModelNode operation, final ModelNode model) throws OperationFailedException {
//modify the runtime if we're booting, otherwise set reload required and leave the runtime unchanged
if (context.isBooting()) {
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final String name = address.getLastElement().getValue();
//get the server config object from the ServerConfigService (service installed and not started yet, but the object is fine for our needs here)
final ServerConfig serverConfig = ASHelper.getMSCService(WSServices.CONFIG_SERVICE, ServerConfig.class, context);
if (serverConfig == null) {
throw WSLogger.ROOT_LOGGER.serviceNotAvailable(WSServices.CONFIG_SERVICE.getCanonicalName());
}
final ServiceName serviceName = getClientConfigServiceName(name);
final ConfigService clientConfigService = new ConfigService(serverConfig, name, true);
final ServiceTarget target = context.getServiceTarget();
final ServiceBuilder<?> clientServiceBuilder = target.addService(serviceName, clientConfigService);
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PROPERTY)) {
//get a new injector instance each time
clientServiceBuilder.addDependency(sn, PropertyService.class, clientConfigService.getPropertiesInjector());
}
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.PRE_HANDLER_CHAIN)) {
//get a new injector instance each time
clientServiceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, clientConfigService.getPreHandlerChainsInjector());
}
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, serviceName, address, Constants.POST_HANDLER_CHAIN)) {
//get a new injector instance each time
clientServiceBuilder.addDependency(sn, UnifiedHandlerChainMetaData.class, clientConfigService.getPostHandlerChainsInjector());
}
clientServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
} else {
context.reloadRequired();
}
}
Aggregations