Operations.setPathAddress(operation, address); Operations.setPathAddress(binaryTableOperation, address.append(BinaryTableResourceDefinition.PATH)); Operations.setPathAddress(operation, address); Operations.setPathAddress(stringTableOperation, address.append(StringTableResourceDefinition.PATH));
@Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { ModelNode legacyOperation = operation.clone(); Operations.setPathAddress(legacyOperation, this.addressTransformer.transform(address)); InitialAttributeValueOperationContextAttachment attachment = context.getAttachment(InitialAttributeValueOperationContextAttachment.INITIAL_VALUES_ATTACHMENT); if (attachment != null) { ModelNode value = attachment.getInitialValue(address, Operations.getAttributeName(operation)); if (value != null) { attachment.putIfAbsentInitialValue(this.addressTransformer.transform(address), Operations.getAttributeName(operation), value); } } return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@Override public OperationStepHandler apply(OperationStepHandler handler) { return (context, operation) -> { if (this.legacy.test(operation)) { PathElement path = context.getCurrentAddress().getLastElement(); // This is a legacy add operation - process it using the generic handler OperationStepHandler genericHandler = context.getResourceRegistration().getParent().getOperationHandler(PathAddress.pathAddress(ProtocolResourceDefinition.WILDCARD_PATH), ModelDescriptionConstants.ADD); Operations.setPathAddress(operation, context.getCurrentAddress().getParent().append(GenericProtocolResourceDefinition.pathElement(path.getValue()))); // Process this step first to preserve protocol order context.addStep(operation, genericHandler, OperationContext.Stage.MODEL, true); } else { handler.execute(context, operation); } }; } }
@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); } }
Operations.setPathAddress(operation, address); Operations.setPathAddress(binaryTableOperation, address.append(BinaryTableResourceDefinition.PATH)); Operations.setPathAddress(operation, address); Operations.setPathAddress(stringTableOperation, address.append(StringTableResourceDefinition.PATH));
@Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { ModelNode legacyOperation = operation.clone(); Operations.setPathAddress(legacyOperation, this.addressTransformer.transform(address)); InitialAttributeValueOperationContextAttachment attachment = context.getAttachment(InitialAttributeValueOperationContextAttachment.INITIAL_VALUES_ATTACHMENT); if (attachment != null) { ModelNode value = attachment.getInitialValue(address, Operations.getAttributeName(operation)); if (value != null) { attachment.putIfAbsentInitialValue(this.addressTransformer.transform(address), Operations.getAttributeName(operation), value); } } return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@Override public OperationStepHandler apply(OperationStepHandler handler) { return (context, operation) -> { if (this.legacy.test(operation)) { PathElement path = context.getCurrentAddress().getLastElement(); // This is a legacy add operation - process it using the generic handler OperationStepHandler genericHandler = context.getResourceRegistration().getParent().getOperationHandler(PathAddress.pathAddress(ProtocolResourceDefinition.WILDCARD_PATH), ModelDescriptionConstants.ADD); Operations.setPathAddress(operation, context.getCurrentAddress().getParent().append(GenericProtocolResourceDefinition.pathElement(path.getValue()))); // Process this step first to preserve protocol order context.addStep(operation, genericHandler, OperationContext.Stage.MODEL, true); } else { handler.execute(context, operation); } }; } }
@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); } }