@Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { if (operation != null && !(operation.hasDefined(OPERATION_HEADERS) && operation.get(OPERATION_HEADERS, "push-to-servers").asBoolean(false)) ){ String originalAttribute = Operations.getAttributeName(operation); if (renames.containsKey(originalAttribute)){ operation = operation.clone(); operation.get(NAME).set(renames.get(originalAttribute)); } } return new TransformedOperation(operation, OperationResultTransformer.ORIGINAL_RESULT); }
@Override public ModelNode transformOperation(ModelNode operation) { String attributeName = Operations.getAttributeName(operation); if (Attribute.ALIASES.getName().equals(attributeName)) { ModelNode value = Operations.getAttributeValue(operation); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createOperation(ALIAS_ADD, address); transformedOperation.get(ALIAS.getName()).set(value); return transformedOperation; } return operation; } };
@Override public ModelNode transformOperation(ModelNode operation) { String attributeName = Operations.getAttributeName(operation); if (Attribute.ALIASES.getName().equals(attributeName)) { ModelNode value = Operations.getAttributeValue(operation); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createOperation(ALIAS_REMOVE, address); transformedOperation.get(ALIAS.getName()).set(value); return transformedOperation; } return operation; } };
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) { String name = Operations.getAttributeName(operation); Metric<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createUndefineAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createReadAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@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); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode value = Operations.getAttributeValue(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createWriteAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name, value); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { String name = Operations.getAttributeName(operation); try { Protocol protocol = this.locator.findProtocol(context); if (protocol != null) { Attribute attribute = getAttribute(protocol.getClass(), name); if (attribute != null) { FieldType type = FieldType.valueOf(attribute.getType()); try { ModelNode result = new ModelNode(); Object value = attribute.read(protocol); if (value != null) { type.setValue(result, value); } context.getResult().set(result); } catch (Exception e) { context.getFailureDescription().set(JGroupsLogger.ROOT_LOGGER.privilegedAccessExceptionForAttribute(name)); } } else { context.getFailureDescription().set(JGroupsLogger.ROOT_LOGGER.unknownMetric(name)); } } } catch (ClassNotFoundException | ModuleLoadException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } finally { context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
ModelNode initialValue = attachment.getInitialValue(resolvedAddress, Operations.getAttributeName(operation)); ModelNode newValue = context.readResourceFromRoot(resolvedAddress).getModel().get(PROPERTIES).clone();
@Override public ModelNode transformOperation(ModelNode operation) { String attributeName = Operations.getAttributeName(operation); if (Attribute.ALIASES.getName().equals(attributeName)) { ModelNode value = Operations.getAttributeValue(operation); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createOperation(ALIAS_REMOVE, address); transformedOperation.get(ALIAS.getName()).set(value); return transformedOperation; } return operation; } };
@Override public ModelNode transformOperation(ModelNode operation) { String attributeName = Operations.getAttributeName(operation); if (Attribute.ALIASES.getName().equals(attributeName)) { ModelNode value = Operations.getAttributeValue(operation); PathAddress address = Operations.getPathAddress(operation); ModelNode transformedOperation = Util.createOperation(ALIAS_ADD, address); transformedOperation.get(ALIAS.getName()).set(value); return transformedOperation; } return operation; } };
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) { String name = Operations.getAttributeName(operation); Metric<C> executable = this.executables.get(name); try { ModelNode result = this.executor.execute(context, executable); if (result != null) { context.getResult().set(result); } } catch (OperationFailedException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createReadAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createUndefineAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@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); } }
/** * {@inheritDoc} */ @Override public TransformedOperation transformOperation(TransformationContext context, PathAddress address, ModelNode operation) { String name = Operations.getAttributeName(operation); ModelNode value = Operations.getAttributeValue(operation); ModelNode legacyOperation = org.jboss.as.controller.client.helpers.Operations.createWriteAttributeOperation(this.addressTransformer.transform(address).toModelNode(), name, value); return new TransformedOperation(legacyOperation, OperationResultTransformer.ORIGINAL_RESULT); } }
@Override protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { String name = Operations.getAttributeName(operation); try { Protocol protocol = this.locator.findProtocol(context); if (protocol != null) { Attribute attribute = getAttribute(protocol.getClass(), name); if (attribute != null) { FieldType type = FieldType.valueOf(attribute.getType()); try { ModelNode result = new ModelNode(); Object value = attribute.read(protocol); if (value != null) { type.setValue(result, value); } context.getResult().set(result); } catch (Exception e) { context.getFailureDescription().set(JGroupsLogger.ROOT_LOGGER.privilegedAccessExceptionForAttribute(name)); } } else { context.getFailureDescription().set(JGroupsLogger.ROOT_LOGGER.unknownMetric(name)); } } } catch (ClassNotFoundException | ModuleLoadException e) { context.getFailureDescription().set(e.getLocalizedMessage()); } finally { context.completeStep(OperationContext.ResultHandler.NOOP_RESULT_HANDLER); } }
ModelNode initialValue = attachment.getInitialValue(resolvedAddress, Operations.getAttributeName(operation)); ModelNode newValue = context.readResourceFromRoot(resolvedAddress).getModel().get(PROPERTIES).clone();