-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.controller.netconf.impl.mapping.operations;\r
-\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorSeverity;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorTag;\r
-import org.opendaylight.controller.netconf.api.NetconfDocumentedException.ErrorType;\r
-import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;\r
-import org.opendaylight.controller.netconf.api.NetconfMessage;\r
-import org.opendaylight.controller.netconf.impl.NetconfServerSession;\r
-import org.opendaylight.controller.netconf.mapping.api.NetconfOperationChainedExecution;\r
-import org.opendaylight.controller.netconf.util.mapping.AbstractSingletonNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.w3c.dom.Element;\r
-public class DefaultStartExi extends AbstractSingletonNetconfOperation implements DefaultNetconfOperation {\r
- public static final String START_EXI = "start-exi";\r
-\r
- private static final Logger logger = LoggerFactory.getLogger(DefaultStartExi.class);\r
- private NetconfServerSession netconfSession;\r
-\r
- public DefaultStartExi(String netconfSessionIdForReporting) {\r
- super(netconfSessionIdForReporting);\r
- }\r
-\r
- @Override\r
- public Document handle(Document message,\r
- NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {\r
- logger.debug("Received start-exi message {} ", XmlUtil.toString(message));\r
-\r
- try {\r
- netconfSession.startExiCommunication(new NetconfMessage(message));\r
- } catch (IllegalArgumentException e) {\r
- throw new NetconfDocumentedException("Failed to parse EXI parameters", ErrorType.protocol,\r
- ErrorTag.operation_failed, ErrorSeverity.error);\r
- }\r
-\r
- return super.handle(message, subsequentOperation);\r
- }\r
-\r
- @Override\r
- protected Element handleWithNoSubsequentOperations(Document document, XmlElement operationElement) throws NetconfDocumentedException {\r
- Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);\r
- logger.trace("{} operation successful", START_EXI);\r
- return getSchemaResult;\r
- }\r
-\r
- @Override\r
- protected String getOperationName() {\r
- return START_EXI;\r
- }\r
-\r
- @Override\r
- protected String getOperationNamespace() {\r
- return XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_EXI_1_0;\r
- }\r
-\r
- @Override\r
- public void setNetconfSession(NetconfServerSession s) {\r
- netconfSession = s;\r
- }\r
-}\r
+/*
+ * 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.NetconfMessage;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
+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 LOG = LoggerFactory.getLogger(DefaultStartExi.class);
+ private NetconfServerSession netconfSession;
+
+ public DefaultStartExi(final String netconfSessionIdForReporting) {
+ super(netconfSessionIdForReporting);
+ }
+
+ @Override
+ public Document handle(final Document message,
+ final NetconfOperationChainedExecution subsequentOperation) throws NetconfDocumentedException {
+ if (LOG.isDebugEnabled()) {
+ LOG.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(final Document document, final XmlElement operationElement) throws NetconfDocumentedException {
+ Element getSchemaResult = document.createElementNS( XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0, XmlNetconfConstants.OK);
+ LOG.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(final NetconfServerSession s) {
+ netconfSession = s;
+ }
+}