use of org.jboss.as.webservices.service.HandlerService in project wildfly by wildfly.
the class HandlerAdd 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 PathElement confElem = address.getElement(address.size() - 3);
final String configType = confElem.getKey();
final String configName = confElem.getValue();
final String handlerChainType = address.getElement(address.size() - 2).getKey();
final String handlerChainId = address.getElement(address.size() - 2).getValue();
final String handlerName = address.getElement(address.size() - 1).getValue();
final String handlerClass = operation.require(CLASS).asString();
final HandlerService service = new HandlerService(handlerName, handlerClass, counter.incrementAndGet());
final ServiceTarget target = context.getServiceTarget();
final ServiceName configServiceName = getConfigServiceName(configType, configName);
final ServiceRegistry registry = context.getServiceRegistry(false);
if (registry.getService(configServiceName) == null) {
throw WSLogger.ROOT_LOGGER.missingConfig(configName);
}
final ServiceName handlerChainServiceName = getHandlerChainServiceName(configServiceName, handlerChainType, handlerChainId);
if (registry.getService(handlerChainServiceName) == null) {
throw WSLogger.ROOT_LOGGER.missingHandlerChain(configName, handlerChainType, handlerChainId);
}
final ServiceName handlerServiceName = getHandlerServiceName(handlerChainServiceName, handlerName);
final ServiceBuilder<?> handlerServiceBuilder = target.addService(handlerServiceName, service);
ServiceController<?> controller = handlerServiceBuilder.setInitialMode(ServiceController.Mode.ACTIVE).install();
} else {
context.reloadRequired();
}
}
Aggregations