X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fmapping%2Foperations%2FDefaultStartExi.java;fp=opendaylight%2Fnetconf%2Fnetconf-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fimpl%2Fmapping%2Foperations%2FDefaultStartExi.java;h=6de185ac1c1da4948fc343a4be19759362af03f0;hp=cccb1a3ac362e35c6f0efcd5836b3c5a51e1a320;hb=1d93ecc01128662ba439d35bf81fe664c7766165;hpb=8e2e93256e7fec40d1cb462ecb1058188d82b91b diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java index cccb1a3ac3..6de185ac1c 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java @@ -1,71 +1,71 @@ -/* - * 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.impl.mapping.operations; - -import org.opendaylight.controller.netconf.api.NetconfDocumentedException; -import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity; -import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag; -import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType; -import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.impl.NetconfServerSession; -import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution; -import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation; -import org.opendaylight.controller.netconf.util.xml.XmlElement; -import org.opendaylight.controller.netconf.util.xml.XmlUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation { - public static final String START_EXI = "start-exi"; - - private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class); - private NetconfServerSession netconfSession; - - public DefaultStartExi(String netconfSessionIdForReporting) { - super(netconfSessionIdForReporting); - } - - @Override - public Document handle(Document message, - NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException { - logger.debug("Received start-exi message {} ", XmlUtil.toString(message)); - - try { - netconfSession.startExiCommunication(new NetconfMessage(message)); - } catch (IllegalArgumentException e) { - throw new NetconfDocumentedException("Failed to parse EXI parameters", ErrorType.protocol, - ErrorTag.operation_failed, ErrorSeverity.error); - } - - return super.handle(message, subsequentOperation); - } - - @Override - protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException { - Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK); - logger.trace("{} operation successful", START_EXI); - return getSchemaResult; - } - - @Override - protected String getOperationName() { - return START_EXI; - } - - @Override - protected String getOperationNamespace() { - return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0; - } - - @Override - public void setNetconfSession(NetconfServerSession s) { - netconfSession = s; - } -} +/* + * 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.impl.mapping.operations; + +import org.opendaylight.controller.netconf.api.NetconfDocumentedException; +import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity; +import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag; +import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType; +import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants; +import org.opendaylight.controller.netconf.api.NetconfMessage; +import org.opendaylight.controller.netconf.impl.NetconfServerSession; +import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution; +import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation; +import org.opendaylight.controller.netconf.util.xml.XmlElement; +import org.opendaylight.controller.netconf.util.xml.XmlUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation { + public static final String START_EXI = "start-exi"; + + private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class); + private NetconfServerSession netconfSession; + + public DefaultStartExi(String netconfSessionIdForReporting) { + super(netconfSessionIdForReporting); + } + + @Override + public Document handle(Document message, + NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException { + logger.debug("Received start-exi message {} ", XmlUtil.toString(message)); + + try { + netconfSession.startExiCommunication(new NetconfMessage(message)); + } catch (IllegalArgumentException e) { + throw new NetconfDocumentedException("Failed to parse EXI parameters", ErrorType.protocol, + ErrorTag.operation_failed, ErrorSeverity.error); + } + + return super.handle(message, subsequentOperation); + } + + @Override + protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException { + Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK); + logger.trace("{} operation successful", START_EXI); + return getSchemaResult; + } + + @Override + protected String getOperationName() { + return START_EXI; + } + + @Override + protected String getOperationNamespace() { + return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0; + } + + @Override + public void setNetconfSession(NetconfServerSession s) { + netconfSession = s; + } +}