X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FAbstractNetconfClientNotifySessionListener.java;fp=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FAbstractNetconfClientNotifySessionListener.java;h=0000000000000000000000000000000000000000;hb=490e58f15373444b94642aebb2afbec9a62b9a57;hp=6ae966d1f71b7299ce3b7f444df179a6bbcc4e2a;hpb=1d159b16ac23b4935ed6a0df683558ab42cd6f2c;p=controller.git diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/AbstractNetconfClientNotifySessionListener.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/AbstractNetconfClientNotifySessionListener.java deleted file mode 100644 index 6ae966d1f7..0000000000 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/AbstractNetconfClientNotifySessionListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2013 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.netconf.client; - -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; - -/** - * Class extending {@link NetconfClientSessionListener} to provide notification capability. - */ -public abstract class AbstractNetconfClientNotifySessionListener extends SimpleNetconfClientSessionListener { - /* - * Maybe some capabilities could be expressed as internal NetconfClientSessionListener handlers. - * It would enable NetconfClient functionality to be extended by using namespace handlers. - * So far let just enable notification capability by extending and let parent class intact. - */ - - /** - * As class purpose is to provide notification capability to session listener - * onMessage method is not allowed to be further overridden. - * {@see #onNotification(NetconfClientSession, NetconfMessage)} - * - * @param session {@see NetconfClientSessionListener#onMessage(NetconfClientSession, NetconfMessage)} - * @param message {@see NetconfClientSessionListener#onMessage(NetconfClientSession, NetconfMessage)} - */ - @Override - public final void onMessage(NetconfClientSession session, NetconfMessage message) { - if (isNotification(message)) { - onNotification(session, message); - } else { - super.onMessage(session, message); - } - } - - /** - * Method intended to customize notification processing. - * - * @param session {@see NetconfClientSessionListener#onMessage(NetconfClientSession, NetconfMessage)} - * @param message {@see NetconfClientSessionListener#onMessage(NetconfClientSession, NetconfMessage)} - */ - public abstract void onNotification(NetconfClientSession session, NetconfMessage message); - - private boolean isNotification(NetconfMessage message) { - XmlElement xmle = XmlElement.fromDomDocument(message.getDocument()); - return XmlNetconfConstants.NOTIFICATION_ELEMENT_NAME.equals(xmle.getName()) ; - } -}