use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class IdentityConfigurationRemoveStepHandler method updateModel.
@Override
protected void updateModel(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress partitionManagerAddress = getParentAddress(context.getCurrentAddress());
Resource partitionManagerResource = context.readResourceFromRoot(partitionManagerAddress);
checkIfLastConfiguration(partitionManagerResource);
ModelNode originalParentModel = Resource.Tools.readModel(partitionManagerResource);
super.updateModel(context, operation);
context.addStep(new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PartitionManagerRemoveHandler.INSTANCE.removeIdentityStoreServices(context, originalParentModel, partitionManagerAddress.getLastElement().getValue(), context.getCurrentAddressValue());
context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER);
}
}, OperationContext.Stage.RUNTIME);
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class IdentityStoreRemoveStepHandler method checkIfLastIdentityStore.
private void checkIfLastIdentityStore(OperationContext context) throws OperationFailedException {
PathAddress parentAddress = Util.getParentAddressByKey(context.getCurrentAddress(), ModelElement.IDENTITY_CONFIGURATION.getName());
Resource resource = context.readResourceFromRoot(parentAddress);
if (resource.getChildTypes().size() == 1) {
throw ROOT_LOGGER.idmNoIdentityStoreProvided(parentAddress.getLastElement().getValue());
}
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class PackageUtils method getServiceNameDependencies.
static List<ServiceName> getServiceNameDependencies(final OperationContext context, final ServiceName baseServiceName, final PathAddress address, final String childType) {
final List<ServiceName> childrenServiceNames = new LinkedList<ServiceName>();
final Resource resource = context.readResourceFromRoot(address);
final ServiceName sn = baseServiceName.append(childType);
for (ResourceEntry re : resource.getChildren(childType)) {
childrenServiceNames.add(sn.append(re.getName()));
}
return childrenServiceNames;
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class WSSubsystemAdd method getServerConfigDependencies.
/**
* Process the model to figure out the name of the services the server config service has to depend on
*
*/
private static List<ServiceName> getServerConfigDependencies(OperationContext context, boolean appclient) {
final List<ServiceName> serviceNames = new ArrayList<ServiceName>();
final Resource subsystemResource = context.readResourceFromRoot(PathAddress.pathAddress(WSExtension.SUBSYSTEM_PATH));
readConfigServiceNames(serviceNames, subsystemResource, Constants.CLIENT_CONFIG);
readConfigServiceNames(serviceNames, subsystemResource, Constants.ENDPOINT_CONFIG);
if (!appclient) {
serviceNames.add(CommonWebServer.SERVICE_NAME);
}
return serviceNames;
}
use of org.jboss.as.controller.registry.Resource in project wildfly by wildfly.
the class ManagementHelper method checkNoOtherSibling.
static OperationStepHandler checkNoOtherSibling(final String childType) {
return new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
PathAddress parentAddress = context.getCurrentAddress().getParent();
Resource parent = context.readResourceFromRoot(parentAddress, false);
Set<String> children = parent.getChildrenNames(childType);
if (children.size() > 1) {
throw MessagingLogger.ROOT_LOGGER.onlyOneChildIsAllowed(childType, children);
}
}
};
}
Aggregations