@Override public void execute(OperationContext context, ModelNode operation) { final Resource resource = context.readResourceFromRoot(getBaseAddress()); // Get the model recursively final ModelNode model = Resource.Tools.readModel(resource); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { BufferedOutputStream output = new BufferedOutputStream(baos); configPersister.marshallAsXml(model, output); output.close(); baos.close(); } finally { safeClose(baos); } String xml = new String(baos.toByteArray()); context.getResult().set(xml); } catch (RuntimeException e) { throw e; } catch (Exception e) { // Log this MGMT_OP_LOGGER.failedExecutingOperation(e, operation.require(ModelDescriptionConstants.OP), PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR))); context.getFailureDescription().set(e.toString()); } context.stepCompleted(); }
XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh);
XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh);
XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh);
@Override public void execute(OperationContext context, ModelNode operation) { final PathAddress pa = context.getCurrentAddress(); AuthorizationResult authResult = context.authorize(operation, EFFECTS); if (authResult.getDecision() != AuthorizationResult.Decision.PERMIT) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.require(OP).asString(), pa, authResult.getExplanation()); } final Resource resource = context.readResourceFromRoot(getBaseAddress()); // Get the model recursively final ModelNode model = Resource.Tools.readModel(resource); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { BufferedOutputStream output = new BufferedOutputStream(baos); configPersister.marshallAsXml(model, output); output.close(); baos.close(); } finally { safeClose(baos); } String xml = new String(baos.toByteArray(), StandardCharsets.UTF_8); context.getResult().set(xml); } catch (RuntimeException e) { throw e; } catch (Exception e) { // Log this MGMT_OP_LOGGER.failedExecutingOperation(e, operation.require(ModelDescriptionConstants.OP), pa); context.getFailureDescription().set(e.toString()); } }
XmlMarshallingHandler xmh = new XmlMarshallingHandler(extensibleConfigurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); resourceRegistration.registerOperationHandler(NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE);
@Override public void execute(OperationContext context, ModelNode operation) { final PathAddress pa = context.getCurrentAddress(); AuthorizationResult authResult = context.authorize(operation, EFFECTS); if (authResult.getDecision() != AuthorizationResult.Decision.PERMIT) { throw ControllerLogger.ROOT_LOGGER.unauthorized(operation.require(OP).asString(), pa, authResult.getExplanation()); } final Resource resource = context.readResourceFromRoot(getBaseAddress()); // Get the model recursively final ModelNode model = Resource.Tools.readModel(resource); try { final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { BufferedOutputStream output = new BufferedOutputStream(baos); configPersister.marshallAsXml(model, output); output.close(); baos.close(); } finally { safeClose(baos); } String xml = new String(baos.toByteArray(), StandardCharsets.UTF_8); context.getResult().set(xml); } catch (RuntimeException e) { throw e; } catch (Exception e) { // Log this MGMT_OP_LOGGER.failedExecutingOperation(e, operation.require(ModelDescriptionConstants.OP), pa); context.getFailureDescription().set(e.toString()); } }
XmlMarshallingHandler xmh = new XmlMarshallingHandler(extensibleConfigurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); resourceRegistration.registerOperationHandler(NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE);
final Resource resource = context.readResourceFromRoot(getBaseAddress()); baos.close(); } finally { safeClose(baos);
XmlMarshallingHandler xmh = new XmlMarshallingHandler(configurationPersister); root.registerOperationHandler(XmlMarshallingHandler.OPERATION_NAME, xmh, xmh, false, OperationEntry.EntryType.PUBLIC, readOnly); root.registerOperationHandler(NamespaceAddHandler.OPERATION_NAME, NamespaceAddHandler.INSTANCE, NamespaceAddHandler.INSTANCE, false);
XmlMarshallingHandler xmh = new XmlMarshallingHandler(extensibleConfigurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); resourceRegistration.registerOperationHandler(NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE);
XmlMarshallingHandler xmh = new XmlMarshallingHandler(extensibleConfigurationPersister); resourceRegistration.registerOperationHandler(XmlMarshallingHandler.DEFINITION, xmh); resourceRegistration.registerOperationHandler(NamespaceAddHandler.DEFINITION, NamespaceAddHandler.INSTANCE);