@Override protected void executeWriteAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); }
@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); try { if ((PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) || RuntimeResourceDefinition.RUNTIME_READ_ATTRIBUTES.contains(name) || RuntimeResourceDefinition.RUNTIME_METRICS.contains(name)) { storeResult(name, context.getResult()); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } } catch (SecurityException | UnsupportedOperationException e) { throw new OperationFailedException(e.toString()); } }
final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException ignored) { final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException ignored) { RuntimeMXBeanAttributeHandler.storeResult(PlatformMBeanConstants.OBJECT_NAME, store);
RuntimeMXBeanAttributeHandler.INSTANCE.register(runtime);
@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); try { if ((PlatformMBeanConstants.OBJECT_NAME.getName().equals(name)) || RuntimeResourceDefinition.RUNTIME_READ_ATTRIBUTES.contains(name) || RuntimeResourceDefinition.RUNTIME_METRICS.contains(name)) { storeResult(name, context.getResult()); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } } catch (SecurityException | UnsupportedOperationException e) { throw new OperationFailedException(e.toString()); } }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode result = context.getResult(); for (String attribute : RuntimeResourceDefinition.RUNTIME_READ_ATTRIBUTES) { final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException | UnsupportedOperationException ignored) { // just leave it undefined } } for (String attribute : RuntimeResourceDefinition.RUNTIME_METRICS) { final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException | UnsupportedOperationException ignored) { // just leave it undefined } } final ModelNode store = result.get(PlatformMBeanConstants.OBJECT_NAME.getName()); RuntimeMXBeanAttributeHandler.storeResult(PlatformMBeanConstants.OBJECT_NAME.getName(), store); } }
@Override protected void executeReadAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { final String name = operation.require(ModelDescriptionConstants.NAME).asString(); try { if ((PlatformMBeanUtil.JVM_MAJOR_VERSION > 6 && PlatformMBeanConstants.OBJECT_NAME.equals(name)) || PlatformMBeanConstants.RUNTIME_READ_ATTRIBUTES.contains(name) || PlatformMBeanConstants.RUNTIME_METRICS.contains(name)) { storeResult(name, context.getResult()); } else { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); } } catch (SecurityException e) { throw new OperationFailedException(new ModelNode().set(e.toString())); } catch (UnsupportedOperationException e) { throw new OperationFailedException(new ModelNode().set(e.toString())); } }
@Override protected void executeWriteAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); }
@Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { final ModelNode result = context.getResult(); for (String attribute : RuntimeResourceDefinition.RUNTIME_READ_ATTRIBUTES) { final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException | UnsupportedOperationException ignored) { // just leave it undefined } } for (String attribute : RuntimeResourceDefinition.RUNTIME_METRICS) { final ModelNode store = result.get(attribute); try { RuntimeMXBeanAttributeHandler.storeResult(attribute, store); } catch (SecurityException | UnsupportedOperationException ignored) { // just leave it undefined } } final ModelNode store = result.get(PlatformMBeanConstants.OBJECT_NAME.getName()); RuntimeMXBeanAttributeHandler.storeResult(PlatformMBeanConstants.OBJECT_NAME.getName(), store); } }
@Override protected void executeWriteAttribute(OperationContext context, ModelNode operation) throws OperationFailedException { // Shouldn't happen; the global handler should reject throw unknownAttribute(operation); }