X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-monitoring%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fmonitoring%2FGetSchema.java;h=e2351060193589222d85653045f762720ddb74fd;hb=refs%2Fchanges%2F13%2F23413%2F26;hp=d02cb432cbe7411898d93ecee33afff4206b20bb;hpb=3997099eb61b0f2adc47f7a85952c324e9de223f;p=controller.git diff --git a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/GetSchema.java b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/GetSchema.java index d02cb432cb..e235106019 100644 --- a/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/GetSchema.java +++ b/opendaylight/netconf/netconf-monitoring/src/main/java/org/opendaylight/controller/netconf/monitoring/GetSchema.java @@ -11,19 +11,18 @@ package org.opendaylight.controller.netconf.monitoring; import com.google.common.base.Optional; import com.google.common.collect.Maps; import java.util.Map; -import org.opendaylight.controller.netconf.api.NetconfDocumentedException; +import org.opendaylight.controller.config.util.xml.DocumentedException; +import org.opendaylight.controller.config.util.xml.XmlElement; +import org.opendaylight.controller.config.util.xml.XmlUtil; import org.opendaylight.controller.netconf.api.monitoring.NetconfMonitoringService; import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; -import org.opendaylight.controller.netconf.util.exception.MissingNameSpaceException; -import org.opendaylight.controller.netconf.util.mapping.AbstractLastNetconfOperation; -import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlUtil; +import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -public class GetSchema extends AbstractLastNetconfOperation { +public class GetSchema extends AbstractSingletonNetconfOperation { public static final String GET_SCHEMA = "get-schema"; public static final String IDENTIFIER = "identifier"; public static final String VERSION = "version"; @@ -47,7 +46,7 @@ public class GetSchema extends AbstractLastNetconfOperation { } @Override - protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws NetconfDocumentedException { + protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement xml) throws DocumentedException { final GetSchemaEntry entry; entry = new GetSchemaEntry(xml); @@ -58,10 +57,10 @@ public class GetSchema extends AbstractLastNetconfOperation { } catch (final IllegalStateException e) { final Map errorInfo = Maps.newHashMap(); errorInfo.put(entry.identifier, e.getMessage()); - LOG.warn("Rpc error: {}", NetconfDocumentedException.ErrorTag.operation_failed, e); - throw new NetconfDocumentedException(e.getMessage(), NetconfDocumentedException.ErrorType.application, - NetconfDocumentedException.ErrorTag.operation_failed, - NetconfDocumentedException.ErrorSeverity.error, errorInfo); + LOG.warn("Rpc error: {}", DocumentedException.ErrorTag.operation_failed, e); + throw new DocumentedException(e.getMessage(), DocumentedException.ErrorType.application, + DocumentedException.ErrorTag.operation_failed, + DocumentedException.ErrorSeverity.error, errorInfo); } final Element getSchemaResult; @@ -76,16 +75,16 @@ public class GetSchema extends AbstractLastNetconfOperation { private final String identifier; private final Optional version; - GetSchemaEntry(final XmlElement getSchemaElement) throws NetconfDocumentedException { + GetSchemaEntry(final XmlElement getSchemaElement) throws DocumentedException { getSchemaElement.checkName(GET_SCHEMA); getSchemaElement.checkNamespace(XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_YANG_IETF_NETCONF_MONITORING); XmlElement identifierElement = null; try { identifierElement = getSchemaElement.getOnlyChildElementWithSameNamespace(IDENTIFIER); - } catch (final MissingNameSpaceException e) { + } catch (final DocumentedException e) { LOG.trace("Can't get identifier element as only child element with same namespace due to ",e); - throw NetconfDocumentedException.wrap(e); + throw DocumentedException.wrap(e); } identifier = identifierElement.getTextContent(); final Optional versionElement = getSchemaElement