/** * Copyright (c) 2014 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.openflowplugin.openflow.md.core.extension; import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey; import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey; import org.opendaylight.openflowplugin.extension.api.ConvertorActionFromOFJava; import org.opendaylight.openflowplugin.extension.api.ConvertorActionToOFJava; import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava; import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava; import org.opendaylight.openflowplugin.extension.api.TypeVersionKey; import org.opendaylight.openflowplugin.extension.api.path.AugmentationPath; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey; import org.opendaylight.yangtools.concepts.ObjectRegistration; import org.opendaylight.yangtools.yang.binding.DataContainer; /** * @param converter key * @param converter instance */ public abstract class RegistrationCloser implements ObjectRegistration { private ExtensionConverterManagerImpl registrator; private KEY key; private CONVERTER converter; /** * @param registrator the registrator to set */ public void setRegistrator(ExtensionConverterManagerImpl registrator) { this.registrator = registrator; } /** * @param key the key to set */ public void setKey(KEY key) { this.key = key; } /** * @param converter the converter to set */ public void setConverter(CONVERTER converter) { this.converter = converter; } /** * @return the registrator */ public ExtensionConverterManagerImpl getRegistrator() { return registrator; } /** * @return the key */ public KEY getKey() { return key; } /** * @return the converter */ public CONVERTER getConverter() { return converter; } @Override public CONVERTER getInstance() { return getConverter(); } /** * standalone deregistrator * @param target type of wrapped convertor */ public static class RegistrationCloserToOFJava extends RegistrationCloser, ConvertorToOFJava> { @Override public void close() throws Exception { getRegistrator().unregister(getKey(), getConverter()); } } /** * standalone deregistrator * @param source type of wrapped convertor * @param associated augmentation path */ public static class RegistrationCloserFromOFJava extends RegistrationCloser, ConvertorFromOFJava> { @Override public void close() throws Exception { getRegistrator().unregister(getKey(), getConverter()); } } /** * standalone deregistrator * @param target type of wrapped convertor */ public static class RegistrationCloserActionToOFJava extends RegistrationCloser, ConvertorActionToOFJava> { @Override public void close() throws Exception { getRegistrator().unregister(getKey(), getConverter()); } } /** * standalone deregistrator * @param source type of wrapped convertor * @param associated augmentation path */ public static class RegistrationCloserActionFromOFJava extends RegistrationCloser, ConvertorActionFromOFJava> { @Override public void close() throws Exception { getRegistrator().unregister(getKey(), getConverter()); } } }