use of org.jboss.as.controller.capability.RuntimeCapability in project wildfly by wildfly.
the class CachedConnectionManagerRemove method execute.
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
// This is an odd case where we do not actually do a remove; we just reset state to
// what it would be following parsing if the xml element does not exist.
// See discussion on PR with fix for WFLY-2640 .
ModelNode model = context.readResourceForUpdate(PathAddress.EMPTY_ADDRESS).getModel();
for (JcaCachedConnectionManagerDefinition.CcmParameters param : JcaCachedConnectionManagerDefinition.CcmParameters.values()) {
AttributeDefinition ad = param.getAttribute();
if (param == INSTALL || param == DEBUG || param == ERROR || param == IGNORE_UNKNOWN_CONNECTIONS) {
model.get(ad.getName()).clear();
} else {
// Someone added a new param since wFLY-2640/WFLY-8141 and did not account for it above
throw new IllegalStateException();
}
}
// At the time of WFLY-2640 there were no capabilities associated with this resource,
// but if anyone adds one, part of the task is to deal with deregistration.
// So here's an assert to ensure that is considered
Set<RuntimeCapability> capabilitySet = context.getResourceRegistration().getCapabilities();
assert capabilitySet.isEmpty();
if (context.isDefaultRequiresRuntime()) {
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext operationContext, ModelNode modelNode) throws OperationFailedException {
context.reloadRequired();
context.completeStep(new OperationContext.RollbackHandler() {
@Override
public void handleRollback(OperationContext operationContext, ModelNode modelNode) {
context.revertReloadRequired();
}
});
}
}, OperationContext.Stage.RUNTIME);
}
}
use of org.jboss.as.controller.capability.RuntimeCapability in project wildfly by wildfly.
the class HandlerAdd method performRuntime.
@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR));
final String name = address.getLastElement().getValue();
final HandlerService service = new HandlerService(handler.createHandler(context, model), name);
final ServiceTarget target = context.getServiceTarget();
ServiceBuilder<HttpHandler> builder = target.addService(UndertowService.HANDLER.append(name), service).setInitialMode(ServiceController.Mode.ON_DEMAND);
final RuntimeCapability newCapability = Handler.CAPABILITY.fromBaseCapability(name);
if (context.hasOptionalCapability(Handler.REQUEST_CONTROLLER, newCapability.getName(), null)) {
builder.addDependency(RequestController.SERVICE_NAME, RequestController.class, service.getRequestControllerInjectedValue());
}
builder.install();
}
Aggregations