X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fmapping%2Foperations%2FDefaultGetSchema.java;h=f50dd3e706e40f60e22457c9f243a489061c4cab;hb=cb98269f3ccd77787672053054910696e4eea470;hp=77042855e6525673a69fcce76344d5ea757b4061;hpb=f467b1de7ed7a25d19d9210c0372bfb8b8fd697f;p=controller.git diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java index 77042855e6..f50dd3e706 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultGetSchema.java @@ -12,12 +12,8 @@ import java.util.HashMap; import java.util.Map; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; -import org.opendaylight.controller.netconf.api.NetconfOperationRouter; -import org.opendaylight.controller.netconf.api.NetconfSession; import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider; -import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation; -import org.opendaylight.controller.netconf.mapping.api.HandlingPriority; -import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation; +import org.opendaylight.controller.netconf.util.mapping.AbstractLastNetconfOperation; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.util.xml.XmlUtil; @@ -29,35 +25,31 @@ import org.w3c.dom.Element; import com.google.common.base.Optional; import com.google.common.collect.Maps; -public final class DefaultGetSchema extends AbstractNetconfOperation implements DefaultNetconfOperation { - - private final CapabilityProvider cap; - private NetconfSession netconfSession; +public final class DefaultGetSchema extends AbstractLastNetconfOperation { + public static final String GET_SCHEMA = "get-schema"; + public static final String IDENTIFIER = "identifier"; + public static final String VERSION = "version"; private static final Logger logger = LoggerFactory.getLogger(DefaultGetSchema.class); + private final CapabilityProvider cap; public DefaultGetSchema(CapabilityProvider cap, String netconfSessionIdForReporting) { super(netconfSessionIdForReporting); this.cap = cap; } - public static final String GET_SCHEMA = "get-schema"; - public static final String IDENTIFIER = "identifier"; - public static final String VERSION = "version"; - @Override - protected HandlingPriority canHandle(String netconfOperationName, String namespace) { - if (netconfOperationName.equals("get-schema") == false) - return HandlingPriority.CANNOT_HANDLE; - if (namespace.equals(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING) == false) - return HandlingPriority.CANNOT_HANDLE; + protected String getOperationName() { + return GET_SCHEMA; + } - return HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY; + @Override + protected String getOperationNamespace() { + return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING; } @Override - protected Element handle(Document document, XmlElement xml, NetconfOperationRouter router) - throws NetconfDocumentedException { + protected Element handleWithNoSubsequentOperations(Document document, XmlElement xml) throws NetconfDocumentedException { GetSchemaEntry entry; try { @@ -91,11 +83,9 @@ public final class DefaultGetSchema extends AbstractNetconfOperation implements } Element getSchemaResult; - getSchemaResult = XmlUtil.createTextElement(document, XmlNetconfConstants.DATA_KEY, schema); - XmlUtil.addNamespaceAttr(getSchemaResult, - XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING); - - logger.info("{} operation successful", GET_SCHEMA); + getSchemaResult = XmlUtil.createTextElement(document, XmlNetconfConstants.DATA_KEY, schema, + Optional.of(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING)); + logger.trace("{} operation successful", GET_SCHEMA); return getSchemaResult; } @@ -117,15 +107,6 @@ public final class DefaultGetSchema extends AbstractNetconfOperation implements } else { version = Optional.absent(); } - } } - - public void setNetconfSession(NetconfSession s) { - this.netconfSession = s; - } - - public NetconfSession getNetconfSession() { - return netconfSession; - } }