private void addOpenjdkExtension(final OperationContext context, final Map<PathAddress, ModelNode> migrateOperations) { final PathAddress extensionAddress = PathAddress.EMPTY_ADDRESS.append(OPENJDK_EXTENSION_ELEMENT); OperationEntry addEntry = context.getRootResourceRegistration().getOperationEntry(extensionAddress, ADD); final ModelNode addOperation = Util.createAddOperation(extensionAddress); if (describe) { migrateOperations.put(extensionAddress, addOperation); } else { context.addStep(context.getResult().get(extensionAddress.toString()), addOperation, addEntry.getOperationHandler(), MODEL); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { // If this is a legacy configuration containing a default-stack, but no default-channel, then fabricate a default channel using the default stack // This ensures that the default channel factory capability is available to the /subsystem=infinispan/cache-container=*/transport=jgroups resource, which requires them // We can drop this compatibility workaround after we drop support for model version 3.0. if (!operation.hasDefined(Attribute.DEFAULT_CHANNEL.getName()) && operation.hasDefined(Attribute.DEFAULT_STACK.getName())) { String defaultChannel = "auto"; PathAddress channelAddress = context.getCurrentAddress().append(ChannelResourceDefinition.pathElement(defaultChannel)); ModelNode channelOperation = Util.createAddOperation(channelAddress); channelOperation.get(ChannelResourceDefinition.Attribute.STACK.getName()).set(operation.get(Attribute.DEFAULT_STACK.getName())); context.addStep(channelOperation, context.getRootResourceRegistration().getOperationHandler(channelAddress, ModelDescriptionConstants.ADD), OperationContext.Stage.MODEL); operation.get(Attribute.DEFAULT_CHANNEL.getName()).set(new ModelNode(defaultChannel)); } handler.execute(context, operation); } };
PathElement path = address.getLastElement(); OperationStepHandler parentHandler = context.getRootResourceRegistration().getOperationHandler(parentAddress, ModelDescriptionConstants.ADD); if (parentHandler instanceof DescribedAddStepHandler) { AddStepHandlerDescriptor parentDescriptor = ((DescribedAddStepHandler) parentHandler).getDescriptor(); if (context.readResourceFromRoot(parentAddress, false).hasChild(path)) { context.addStep(Util.createRemoveOperation(address), context.getRootResourceRegistration().getOperationHandler(address, ModelDescriptionConstants.REMOVE), OperationContext.Stage.MODEL); context.addStep(operation, this, OperationContext.Stage.MODEL); return; context.addStep(Util.createRemoveOperation(singletonAddress), context.getRootResourceRegistration().getOperationHandler(singletonAddress, ModelDescriptionConstants.REMOVE), OperationContext.Stage.MODEL);
@Override public void execute(OperationContext context, ModelNode operation) { PathAddress address = context.getCurrentAddress(); JGroupsLogger.ROOT_LOGGER.legacyProtocol(address.getLastElement().getValue(), this.targetName); PathAddress targetAddress = address.getParent().append(pathElement(this.targetName)); Operations.setPathAddress(operation, targetAddress); PathAddress targetRegistrationAddress = address.getParent().append(ProtocolResourceDefinition.WILDCARD_PATH); String operationName = Operations.getName(operation); context.addStep(operation, context.getRootResourceRegistration().getOperationHandler(targetRegistrationAddress, operationName), OperationContext.Stage.MODEL, true); } }
private OperationStepHandler getRemoveHandler(OperationContext context, PathAddress address) { ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration(); return rootResourceRegistration.getOperationHandler(address, REMOVE); } }
static OperationRouting determineRouting(OperationContext context, ModelNode operation, final LocalHostControllerInfo localHostControllerInfo, Set<String> hostNames) throws OperationFailedException { final ImmutableManagementResourceRegistration rootRegistration = context.getRootResourceRegistration(); return determineRouting(operation, localHostControllerInfo, rootRegistration, hostNames); }
private OperationStepHandler getRemoveHandler(OperationContext context, PathAddress address) { ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration(); return rootResourceRegistration.getOperationHandler(address, REMOVE); } }
private OperationStepHandler getRemoveHandler(OperationContext context, PathAddress address) { ImmutableManagementResourceRegistration rootResourceRegistration = context.getRootResourceRegistration(); return rootResourceRegistration.getOperationHandler(address, REMOVE); } }
private void executeWFCORE621(OperationContext context, ModelNode operation) throws OperationFailedException { // Delegate to the local handler to let it handle the "server=*" part OperationStepHandler osh = context.getRootResourceRegistration().getOperationHandler(PathAddress.EMPTY_ADDRESS, operation.get(OP).asString()); osh.execute(context, operation); }
private boolean canReadFailureDescription(OperationContext context, ModelNode bootError) { ModelNode completeOPeration = bootError.get(COMPLETE_OP); OperationEntry operationEntry = context.getRootResourceRegistration().getOperationEntry( PathAddress.pathAddress(completeOPeration.get(OP_ADDR)), completeOPeration.get(OP).asString()); Set<Action.ActionEffect> effects = getEffects(operationEntry); return context.authorize(bootError.get(COMPLETE_OP), effects).getDecision() == AuthorizationResult.Decision.PERMIT; }
private void addOperation(OperationContext context, ModelNode op) { final PathAddress addr = PathAddress.pathAddress(op.require(OP_ADDR)); final OperationStepHandler h = context.getRootResourceRegistration().getOperationHandler(addr, op.get(OP).asString()); context.addStep(op, h, OperationContext.Stage.MODEL, true); } }
private void addOperation(OperationContext context, ModelNode op) { final PathAddress addr = PathAddress.pathAddress(op.require(OP_ADDR)); final OperationStepHandler h = context.getRootResourceRegistration().getOperationHandler(addr, op.get(OP).asString()); context.addStep(op, h, OperationContext.Stage.MODEL, true); } }
private ModelNode transformReadResourceResult(final OperationContext context, ModelNode original, String subsystem) throws OperationFailedException { ModelNode rootData = original.get(ModelDescriptionConstants.RESULT); Map<PathAddress, ModelVersion> subsystemVersions = new HashMap<PathAddress, ModelVersion>(); subsystemVersions.put(PathAddress.EMPTY_ADDRESS.append(ModelDescriptionConstants.SUBSYSTEM, subsystem), subsystemModelVersion); final TransformationTarget target = TransformationTargetImpl.create(transformerRegistry, coreModelVersion, subsystemVersions, null, TransformationTarget.TransformationTargetType.SERVER); final Transformers transformers = Transformers.Factory.create(target); final ImmutableManagementResourceRegistration rr = context.getRootResourceRegistration(); Resource root = TransformerRegistry.modelToResource(rr, rootData, true); Resource transformed = transformers.transformRootResource(context, root); return Resource.Tools.readModel(transformed); }
/** * Creates a new {@code TransformationInputs} from the given operation context. * @param context the operation context. Cannot be {@code null} */ public TransformationInputs(OperationContext context) { this.originalModel = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true); this.registration = context.getRootResourceRegistration(); this.processType = context.getProcessType(); this.runningMode = context.getRunningMode(); this.transformerOperationAttachment = context.getAttachment(TransformerOperationAttachment.KEY); }
private ImmutableManagementResourceRegistration getResourceRegistrationCheckForAlias(OperationContext context, PathAddress opAddr, ReadResourceDescriptionAccessControlContext accessControlContext) { //The direct root registration is only needed if we are doing access-control=true final ImmutableManagementResourceRegistration root = context.getRootResourceRegistration(); final ImmutableManagementResourceRegistration registry = root.getSubModel(opAddr); AliasEntry aliasEntry = registry.getAliasEntry(); if (aliasEntry == null) { return registry; } //Get hold of the real registry if it was an alias return root.getSubModel(aliasEntry.convertToTargetAddress(opAddr)); }
private void addOpenjdkExtension(final OperationContext context, final Map<PathAddress, ModelNode> migrateOperations) { final PathAddress extensionAddress = PathAddress.EMPTY_ADDRESS.append(OPENJDK_EXTENSION_ELEMENT); OperationEntry addEntry = context.getRootResourceRegistration().getOperationEntry(extensionAddress, ADD); final ModelNode addOperation = Util.createAddOperation(extensionAddress); if (describe) { migrateOperations.put(extensionAddress, addOperation); } else { context.addStep(context.getResult().get(extensionAddress.toString()), addOperation, addEntry.getOperationHandler(), MODEL); } }
private ImmutableManagementResourceRegistration getResourceRegistrationCheckForAlias(OperationContext context, PathAddress opAddr, ReadResourceDescriptionAccessControlContext accessControlContext) { //The direct root registration is only needed if we are doing access-control=true final ImmutableManagementResourceRegistration root = context.getRootResourceRegistration(); final ImmutableManagementResourceRegistration registry = root.getSubModel(opAddr); AliasEntry aliasEntry = registry.getAliasEntry(); if (aliasEntry == null) { return registry; } //Get hold of the real registry if it was an alias PathAddress realAddress = aliasEntry.convertToTargetAddress(opAddr, AliasEntry.AliasContext.create(opAddr, context)); assert !realAddress.equals(opAddr) : "Alias was not translated"; return root.getSubModel(realAddress); }
static ResourceTransformationContext create(final OperationContext context, final TransformationTarget target, final PathAddress current, final PathAddress read, boolean skipRuntimeIgnoreCheck) { final Resource root = Resource.Factory.create(); final Resource original = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true); final ImmutableManagementResourceRegistration registration = context.getRootResourceRegistration().getSubModel(PathAddress.EMPTY_ADDRESS); final ExpressionResolver expressionResolver = TransformerExpressionResolver.create(context, target.getTargetType()); final OriginalModel originalModel = new OriginalModel(original, context.getRunningMode(), context.getProcessType(), target, registration, expressionResolver); return new ResourceTransformationContextImpl(root, current, read, originalModel, skipRuntimeIgnoreCheck); }
static ResourceTransformationContext create(final OperationContext context, final TransformationTarget target, final PathAddress current, final PathAddress read) { final Resource root = Resource.Factory.create(); final Resource original = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS, true); final ImmutableManagementResourceRegistration registration = context.getRootResourceRegistration().getSubModel(PathAddress.EMPTY_ADDRESS); final ExpressionResolver expressionResolver = TransformerExpressionResolver.create(context, target.getTargetType()); final OriginalModel originalModel = new OriginalModel(original, context.getRunningMode(), context.getProcessType(), target, registration, expressionResolver); return new ResourceTransformationContextImpl(root, current, read, originalModel); }
@Override public void execute(OperationContext context, ModelNode operation) { PathAddress address = context.getCurrentAddress(); JGroupsLogger.ROOT_LOGGER.legacyProtocol(address.getLastElement().getValue(), this.targetName); PathAddress targetAddress = address.getParent().append(pathElement(this.targetName)); Operations.setPathAddress(operation, targetAddress); PathAddress targetRegistrationAddress = address.getParent().append(ProtocolResourceDefinition.WILDCARD_PATH); String operationName = Operations.getName(operation); context.addStep(operation, context.getRootResourceRegistration().getOperationHandler(targetRegistrationAddress, operationName), OperationContext.Stage.MODEL, true); } }