use of org.jboss.as.webservices.service.HandlerChainService in project wildfly by wildfly.
the class HandlerChainAdd 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 String protocolBindings = getAttributeValue(operation, PROTOCOL_BINDINGS);
final PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
final PathElement confElem = address.getElement(address.size() - 2);
final String configType = confElem.getKey();
final String configName = confElem.getValue();
final String handlerChainType = address.getElement(address.size() - 1).getKey();
final String handlerChainId = address.getElement(address.size() - 1).getValue();
final ServiceName configServiceName = getConfigServiceName(configType, configName);
if (context.getServiceRegistry(false).getService(configServiceName) == null) {
throw WSLogger.ROOT_LOGGER.missingConfig(configName);
}
final ServiceName handlerChainServiceName = getHandlerChainServiceName(configServiceName, handlerChainType, handlerChainId);
final HandlerChainService service = new HandlerChainService(handlerChainType, handlerChainId, protocolBindings);
final ServiceTarget target = context.getServiceTarget();
final ServiceBuilder<?> handlerChainServiceBuilder = target.addService(handlerChainServiceName, service);
for (ServiceName sn : PackageUtils.getServiceNameDependencies(context, handlerChainServiceName, address, HANDLER)) {
//get a new injector instance each time
handlerChainServiceBuilder.addDependency(sn, UnifiedHandlerMetaData.class, service.getHandlersInjector());
}
handlerChainServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
} else {
context.reloadRequired();
}
}
Aggregations