X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fdynamicmbean%2FDynamicReadableWrapper.java;fp=opendaylight%2Fconfig%2Fconfig-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fconfig%2Fmanager%2Fimpl%2Fdynamicmbean%2FDynamicReadableWrapper.java;h=0000000000000000000000000000000000000000;hp=f768731e51b0afc6fc14dca19973d1cca2b78f35;hb=ac6f2699cd0c1e340cc32e8f0d0ca94c8e9c0cc0;hpb=f43b01b81319959b1907e3e04537f5169e7f33d8 diff --git a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dynamicmbean/DynamicReadableWrapper.java b/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dynamicmbean/DynamicReadableWrapper.java deleted file mode 100644 index f768731e51..0000000000 --- a/opendaylight/config/config-manager/src/main/java/org/opendaylight/controller/config/manager/impl/dynamicmbean/DynamicReadableWrapper.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.controller.config.manager.impl.dynamicmbean; - -import javax.management.Attribute; -import javax.management.AttributeList; -import javax.management.AttributeNotFoundException; -import javax.management.InvalidAttributeValueException; -import javax.management.MBeanException; -import javax.management.MBeanServer; -import javax.management.ReflectionException; -import org.opendaylight.controller.config.api.DynamicMBeanWithInstance; -import org.opendaylight.controller.config.api.ModuleIdentifier; -import org.opendaylight.controller.config.api.jmx.ObjectNameUtil; -import org.opendaylight.controller.config.spi.Module; - -/** - * Wraps {@link org.opendaylight.controller.config.spi.Module} in a - * {@link DynamicMBeanWithInstance}. Setting attributes is disabled. - */ -public class DynamicReadableWrapper extends AbstractDynamicWrapper implements - DynamicMBeanWithInstance { - private final AutoCloseable instance; - - public DynamicReadableWrapper(final Module module, final AutoCloseable instance, - final ModuleIdentifier moduleIdentifier, final MBeanServer internalServer, - final MBeanServer configMBeanServer) { - super(module, false, moduleIdentifier, ObjectNameUtil - .createReadOnlyModuleON(moduleIdentifier), - getEmptyOperations(), internalServer, configMBeanServer); - this.instance = instance; - } - - @Override - public Module getModule() { - return module; - } - - @Override - public AutoCloseable getInstance() { - return instance; - } - - @Override - public Object invoke(final String actionName, final Object[] params, final String[] signature) - throws MBeanException, ReflectionException { - if ("getInstance".equals(actionName) - && (params == null || params.length == 0) - && (signature == null || signature.length == 0)) { - return getInstance(); - } - return super.invoke(actionName, params, signature); - } - - @Override - public Object getAttribute(final String attributeName) - throws AttributeNotFoundException, MBeanException, - ReflectionException { - if ("getInstance".equals(attributeName)) { - return getInstance(); - } - return super.getAttribute(attributeName); - } - - @Override - public void setAttribute(final Attribute attribute) - throws AttributeNotFoundException, InvalidAttributeValueException, - MBeanException, ReflectionException { - throw new UnsupportedOperationException( - "setAttributes is not supported on " + moduleIdentifier); - } - - @Override - public AttributeList setAttributes(final AttributeList attributes) { - throw new UnsupportedOperationException( - "setAttributes is not supported on " + moduleIdentifier); - } -}