From: Robert Varga Date: Fri, 24 Jan 2014 10:57:06 +0000 (+0100) Subject: Remove dependency on Exificient due to licensing incompatibility X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-4^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=fdbc91710543cdac880f87bda9793c46582f1618 Remove dependency on Exificient due to licensing incompatibility Exificient is licensed under GPLv2 with no intention to add the classpath exception (witnessed in at http://sourceforge.net/p/exificient/discussion/856595/thread/6017013e/). Remove all dependencies on it, pending reimplementation using a more open library (OpenEXI looks like a good candidate). Change-Id: I589367be593ebc275c7551d9e6008b74d8461de5 Signed-off-by: Robert Varga --- diff --git a/opendaylight/commons/opendaylight/pom.xml b/opendaylight/commons/opendaylight/pom.xml index 64c873b347..eb7800fd5b 100644 --- a/opendaylight/commons/opendaylight/pom.xml +++ b/opendaylight/commons/opendaylight/pom.xml @@ -120,7 +120,6 @@ 1.7 1.3.1 - 0.9.2-SNAPSHOT @@ -639,11 +638,6 @@ org.openflow.openflowj 1.0.2 - - org.opendaylight.controller.thirdparty - exificient - ${exi.version} - org.opendaylight.controller.thirdparty com.sun.jersey.jersey-servlet diff --git a/opendaylight/distribution/opendaylight/pom.xml b/opendaylight/distribution/opendaylight/pom.xml index cdb4e35cdd..d3be9160f1 100644 --- a/opendaylight/distribution/opendaylight/pom.xml +++ b/opendaylight/distribution/opendaylight/pom.xml @@ -312,11 +312,6 @@ config-persister-impl ${netconf.version} - - org.opendaylight.controller.thirdparty - exificient - ${exi.version} - org.apache.servicemix.bundles org.apache.servicemix.bundles.xerces diff --git a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java index c0dec7c029..b4f6beaa45 100644 --- a/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java +++ b/opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java @@ -69,8 +69,6 @@ public class TestHelper { mavenBundle("io.netty", "netty-transport").versionAsInProject(), // mavenBundle("io.netty", "netty-common").versionAsInProject(), // - mavenBundle("org.opendaylight.controller.thirdparty", "exificient", "0.9.2-SNAPSHOT"), // - mavenBundle("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.xerces", "2.11.0_1"), mavenBundle("org.eclipse.birt.runtime.3_7_1", "org.apache.xml.resolver", "1.2.0"), diff --git a/opendaylight/md-sal/test/sal-rest-connector-it/pom.xml b/opendaylight/md-sal/test/sal-rest-connector-it/pom.xml index c03833d72b..64ca5aeb9b 100644 --- a/opendaylight/md-sal/test/sal-rest-connector-it/pom.xml +++ b/opendaylight/md-sal/test/sal-rest-connector-it/pom.xml @@ -121,11 +121,6 @@ 1.0-SNAPSHOT test - - org.opendaylight.controller.thirdparty - exificient - 0.9.2 - org.ops4j.pax.exam pax-exam-container-native diff --git a/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java b/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java index 8763724560..b5ab8a982a 100644 --- a/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java +++ b/opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java @@ -227,8 +227,6 @@ public class ServiceProviderController { mavenBundle(YANG, "yang-parser-impl").versionAsInProject(), mavenBundle(YANG, "binding-type-provider").versionAsInProject(), - mavenBundle("org.opendaylight.controller.thirdparty", "exificient", "0.9.2"), - mavenBundle("equinoxSDK381", "javax.servlet").versionAsInProject(), mavenBundle("equinoxSDK381", "javax.servlet.jsp").versionAsInProject(), mavenBundle("equinoxSDK381", "org.eclipse.equinox.ds").versionAsInProject(), diff --git a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java index eb7235f044..6c747dbe24 100644 --- a/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java +++ b/opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java @@ -8,25 +8,16 @@ package org.opendaylight.controller.netconf.api; import io.netty.channel.Channel; -import io.netty.channel.ChannelHandler; import org.opendaylight.protocol.framework.AbstractProtocolSession; -import org.opendaylight.protocol.framework.ProtocolMessageDecoder; -import org.opendaylight.protocol.framework.ProtocolMessageEncoder; import org.opendaylight.protocol.framework.SessionListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.Map; public abstract class NetconfSession extends AbstractProtocolSession { - - private ChannelHandler exiEncoder; - private String exiEncoderName; - private String removeAfterMessageSentname; - private String pmeName,pmdName; - protected final Channel channel; - private final SessionListener sessionListener; + protected final Channel channel; + private final SessionListener sessionListener; private final long sessionId; private boolean up = false; private static final Logger logger = LoggerFactory.getLogger(NetconfSession.class); @@ -36,18 +27,6 @@ public abstract class NetconfSession extends AbstractProtocolSession entry:channel.pipeline().toMap().entrySet()){ - if (entry.getValue().equals(pmd)){ - pmdName = entry.getKey(); - } - if (entry.getValue().equals(pme)){ - pmeName = entry.getKey(); - } - } } @Override public void close() { @@ -64,15 +43,6 @@ public abstract class NetconfSession extends AbstractProtocolSession T remove(Class handlerType) { - return channel.pipeline().remove(handlerType); - } - - public T getHandler(Class handlerType) { - return channel.pipeline().get(handlerType); - } - - public void addFirst(ChannelHandler handler, String name){ - channel.pipeline().addFirst(name, handler); - } - public void addLast(ChannelHandler handler, String name){ - channel.pipeline().addLast(name, handler); - } - - public void addExiDecoder(String name,ChannelHandler handler){ - if (channel.pipeline().get(name)== null){ - channel.pipeline().addBefore(pmdName, name, handler); - } - } - public void addExiEncoderAfterMessageSent(String name, ChannelHandler handler){ - this.exiEncoder = handler; - this.exiEncoderName = name; - } - - public void addExiEncoder(String name, ChannelHandler handler){ - channel.pipeline().addBefore(pmeName, name, handler); - } - - public void removeAfterMessageSent(String handlerName){ - this.removeAfterMessageSentname = handlerName; - } - } diff --git a/opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml b/opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml index 520627a098..46f6f76412 100644 --- a/opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml +++ b/opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml @@ -2,6 +2,5 @@ urn:ietf:params:netconf:base:1.0 urn:ietf:params:netconf:base:1.1 - urn:ietf:params:netconf:capability:exi:1.0 - \ No newline at end of file + diff --git a/opendaylight/netconf/netconf-impl/pom.xml b/opendaylight/netconf/netconf-impl/pom.xml index 766772b1e9..2d56883e30 100644 --- a/opendaylight/netconf/netconf-impl/pom.xml +++ b/opendaylight/netconf/netconf-impl/pom.xml @@ -138,7 +138,6 @@ org.w3c.dom, org.xml.sax, org.opendaylight.controller.netconf.util.messages, - com.siemens.ct.exi.exceptions, io.netty.util.internal, org.opendaylight.controller.netconf.api.monitoring, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924, diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiDecoderHandler.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiDecoderHandler.java deleted file mode 100644 index 721c0c28be..0000000000 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiDecoderHandler.java +++ /dev/null @@ -1,48 +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.impl.mapping; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.ByteToMessageDecoder; - -import java.util.List; - -import org.opendaylight.controller.netconf.util.xml.ExiParameters; -import org.opendaylight.controller.netconf.util.xml.ExiUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class ExiDecoderHandler extends ByteToMessageDecoder { - - public static final String HANDLER_NAME; - - static { - HANDLER_NAME = "exiDecoder"; - } - - private final static Logger logger = LoggerFactory - .getLogger(ExiDecoderHandler.class); - - private ExiParameters parameters; - - public ExiDecoderHandler(ExiParameters parameters) { - this.parameters = parameters; - } - - @Override - protected void decode(ChannelHandlerContext ctx, ByteBuf in, - List out) { - try { - ExiUtil.decode(in, out, this.parameters); - } catch (Exception e) { - throw new IllegalStateException("Unable to decode exi message."); - } - } - -} diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiEncoderHandler.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiEncoderHandler.java deleted file mode 100644 index e7a5917d6c..0000000000 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiEncoderHandler.java +++ /dev/null @@ -1,39 +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.impl.mapping; - -import io.netty.buffer.ByteBuf; -import io.netty.channel.ChannelHandlerContext; -import io.netty.handler.codec.MessageToByteEncoder; - -import org.opendaylight.controller.netconf.util.xml.ExiParameters; -import org.opendaylight.controller.netconf.util.xml.ExiUtil; - -public class ExiEncoderHandler extends MessageToByteEncoder { - - public static final String HANDLER_NAME; - static { - HANDLER_NAME = "exiEncoder"; - } - - private ExiParameters parameters; - - public ExiEncoderHandler(ExiParameters parameters) { - this.parameters = parameters; - } - - @Override - protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) - throws Exception { - try { - ExiUtil.encode(msg, out, this.parameters); - } catch (Exception e) { - throw new IllegalStateException("Unable to encode exi message."); - } - } -} 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 679e280ba2..38c1a447e4 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 @@ -10,12 +10,9 @@ package org.opendaylight.controller.netconf.impl.mapping.operations; import org.opendaylight.controller.netconf.api.NetconfSession; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfOperationRouter; -import org.opendaylight.controller.netconf.impl.mapping.ExiDecoderHandler; -import org.opendaylight.controller.netconf.impl.mapping.ExiEncoderHandler; 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.xml.ExiParameters; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; import org.opendaylight.controller.netconf.util.xml.XmlUtil; @@ -24,8 +21,6 @@ import org.slf4j.LoggerFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; -import com.siemens.ct.exi.exceptions.EXIException; - public class DefaultStartExi extends AbstractNetconfOperation implements DefaultNetconfOperation { public static final String START_EXI = "start-exi"; @@ -61,6 +56,9 @@ public class DefaultStartExi extends AbstractNetconfOperation implements Default XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0); + throw new UnsupportedOperationException("Not implemented"); + + /* try { ExiParameters exiParams = new ExiParameters(); exiParams.setParametersFromXmlElement(operationElement); @@ -76,7 +74,7 @@ public class DefaultStartExi extends AbstractNetconfOperation implements Default logger.trace("{} operation successful", START_EXI); logger.debug("received start-exi message {} ", XmlUtil.toString(document)); return getSchemaResult; - + */ } @Override diff --git a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java index d841a6619e..6ea5deb645 100644 --- a/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java +++ b/opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java @@ -10,14 +10,11 @@ package org.opendaylight.controller.netconf.impl.mapping.operations; import org.opendaylight.controller.netconf.api.NetconfSession; import org.opendaylight.controller.netconf.api.NetconfDocumentedException; import org.opendaylight.controller.netconf.api.NetconfOperationRouter; -import org.opendaylight.controller.netconf.impl.mapping.ExiDecoderHandler; -import org.opendaylight.controller.netconf.impl.mapping.ExiEncoderHandler; 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.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants; -import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.w3c.dom.Document; @@ -50,7 +47,8 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN @Override protected Element handle(Document document, XmlElement operationElement, NetconfOperationRouter opRouter) throws NetconfDocumentedException { - + throw new UnsupportedOperationException("Not implemented"); + /* netconfSession.remove(ExiDecoderHandler.class); netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME); @@ -60,6 +58,7 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN logger.trace("{} operation successful", STOP_EXI); logger.debug("received stop-exi message {} ", XmlUtil.toString(document)); return getSchemaResult; + */ } @Override @@ -70,4 +69,4 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN public NetconfSession getNetconfSession() { return netconfSession; } -} \ No newline at end of file +} diff --git a/opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml b/opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml index eb4b4b9225..6a3f911cd4 100644 --- a/opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml +++ b/opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml @@ -2,7 +2,6 @@ urn:ietf:params:netconf:base:1.0 - urn:ietf:params:netconf:capability:exi:1.0 1 diff --git a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java index 73eb608f0b..d7beb5df9b 100644 --- a/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java +++ b/opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java @@ -8,20 +8,10 @@ package org.opendaylight.controller.netconf.impl; import static junit.framework.Assert.assertNotNull; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; - -import java.util.ArrayList; -import java.util.List; import org.junit.Test; import org.opendaylight.controller.netconf.api.NetconfMessage; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; -import org.opendaylight.controller.netconf.util.xml.ExiParameters; -import org.opendaylight.controller.netconf.util.xml.ExiUtil; -import org.opendaylight.controller.netconf.util.xml.XmlElement; - - public class ExiEncodeDecodeTest { @Test @@ -33,6 +23,7 @@ public class ExiEncodeDecodeTest { NetconfMessage startExiMessage = XmlFileLoader.xmlFileToNetconfMessage(("netconfMessages/startExi.xml")); assertNotNull(startExiMessage); + /* ExiParameters exiParams = new ExiParameters(); exiParams.setParametersFromXmlElement(XmlElement.fromDomElement(startExiMessage.getDocument().getDocumentElement())); assertNotNull(exiParams); @@ -47,5 +38,6 @@ public class ExiEncodeDecodeTest { ByteBuf decodedBuf = (ByteBuf)newOut.get(0); String decodedString = new String(decodedBuf.array(),"UTF-8"); assertNotNull(decodedString); + */ } } diff --git a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java index 36f30dd328..5f4bcecff0 100644 --- a/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java +++ b/opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java @@ -41,8 +41,6 @@ import org.opendaylight.controller.netconf.impl.NetconfServerDispatcher; import org.opendaylight.controller.netconf.impl.NetconfServerSessionListenerFactory; import org.opendaylight.controller.netconf.impl.NetconfServerSessionNegotiatorFactory; import org.opendaylight.controller.netconf.impl.SessionIdProvider; -import org.opendaylight.controller.netconf.impl.mapping.ExiDecoderHandler; -import org.opendaylight.controller.netconf.impl.mapping.ExiEncoderHandler; import org.opendaylight.controller.netconf.impl.osgi.NetconfMonitoringServiceImpl; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener; import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListenerImpl; @@ -51,7 +49,6 @@ import org.opendaylight.controller.netconf.mapping.api.NetconfOperationService; import org.opendaylight.controller.netconf.ssh.NetconfSSHServer; import org.opendaylight.controller.netconf.ssh.authentication.AuthProvider; import org.opendaylight.controller.netconf.util.test.XmlFileLoader; -import org.opendaylight.controller.netconf.util.xml.ExiParameters; import org.opendaylight.controller.netconf.util.xml.XmlElement; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.slf4j.Logger; @@ -301,8 +298,8 @@ public class NetconfITTest extends AbstractConfigTest { } } + /* @Test -// @Ignore public void testStartExi() throws Exception { try (NetconfClient netconfClient = createSession(tcpAddress, "1")) { @@ -327,6 +324,7 @@ public class NetconfITTest extends AbstractConfigTest { } } + */ @Test public void testCloseSession() throws Exception { diff --git a/opendaylight/netconf/netconf-util/pom.xml b/opendaylight/netconf/netconf-util/pom.xml index 71b7fa6eac..3c96897a2c 100644 --- a/opendaylight/netconf/netconf-util/pom.xml +++ b/opendaylight/netconf/netconf-util/pom.xml @@ -48,10 +48,10 @@ netty-handler ${netconf.netty.version} - + org.opendaylight.controller.thirdparty ganymed @@ -102,12 +102,6 @@ org.slf4j, org.w3c.dom, org.xml.sax, - com.siemens.ct.exi, - com.siemens.ct.exi.api.sax, - com.siemens.ct.exi.grammars, - com.siemens.ct.exi.helpers, - com.siemens.ct.exi.exceptions, - com.siemens.ct.exi.api.dom, org.xml.sax.helpers, org.opendaylight.controller.config.api, diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java deleted file mode 100644 index 7109971b5d..0000000000 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java +++ /dev/null @@ -1,135 +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.util.xml; - -import com.siemens.ct.exi.CodingMode; -import com.siemens.ct.exi.FidelityOptions; -import com.siemens.ct.exi.GrammarFactory; -import com.siemens.ct.exi.exceptions.EXIException; -import com.siemens.ct.exi.grammars.Grammars; - -public class ExiParameters { - - private static final String EXI_PARAMETER_ALIGNMENT = "alignment"; - private static final String EXI_PARAMETER_BYTE_ALIGNED = "byte-aligned"; - private static final String EXI_PARAMETER_COMPRESSED = "compressed"; - - private static final String EXI_PARAMETER_FIDELITY = "fidelity"; - private static final String EXI_FIDELITY_DTD = "dtd"; - private static final String EXI_FIDELITY_LEXICAL_VALUES = "lexical-values"; - private static final String EXI_FIDELITY_COMMENTS = "comments"; - private static final String EXI_FIDELITY_PIS = "pis"; - private static final String EXI_FIDELITY_PREFIXES = "prefixes"; - - private static final String EXI_PARAMETER_SCHEMA = "schema"; - private static final String EXI_PARAMETER_SCHEMA_NONE = "none"; - private static final String EXI_PARAMETER_SCHEMA_BUILT_IN = "builtin"; - private static final String EXI_PARAMETER_SCHEMA_BASE_1_1 = "base:1.1"; - - private static final String NETCONF_XSD_LOCATION = ""; - - private FidelityOptions fidelityOptions; - private Grammars grammars; - private CodingMode codingMode = CodingMode.BIT_PACKED; - - public void setParametersFromXmlElement(XmlElement operationElement) - throws EXIException { - - if (operationElement.getElementsByTagName(EXI_PARAMETER_ALIGNMENT) - .getLength() > 0) { - - if (operationElement.getElementsByTagName( - EXI_PARAMETER_BYTE_ALIGNED) - .getLength() > 0) { - this.codingMode = CodingMode.BYTE_PACKED; - } - - if (operationElement.getElementsByTagName( - EXI_PARAMETER_BYTE_ALIGNED).getLength() > 0) { - this.codingMode = CodingMode.BYTE_PACKED; - } - if (operationElement.getElementsByTagName(EXI_PARAMETER_COMPRESSED) - .getLength() > 0) { - this.codingMode = CodingMode.COMPRESSION; - } - } - - if (operationElement.getElementsByTagName(EXI_PARAMETER_FIDELITY) - .getLength() > 0) { - - this.fidelityOptions = FidelityOptions.createDefault(); - - if (operationElement.getElementsByTagName(EXI_FIDELITY_DTD) - .getLength() > 0) { - this.fidelityOptions.setFidelity(FidelityOptions.FEATURE_DTD, - true); - } - if (operationElement.getElementsByTagName( - EXI_FIDELITY_LEXICAL_VALUES) - .getLength() > 0) { - this.fidelityOptions.setFidelity( - FidelityOptions.FEATURE_LEXICAL_VALUE, true); - } - - if (operationElement.getElementsByTagName(EXI_FIDELITY_COMMENTS) - .getLength() > 0) { - this.fidelityOptions.setFidelity( - FidelityOptions.FEATURE_COMMENT, true); - } - - if (operationElement.getElementsByTagName(EXI_FIDELITY_PIS) - .getLength() > 0) { - this.fidelityOptions.setFidelity(FidelityOptions.FEATURE_PI, - true); - } - - if (operationElement.getElementsByTagName(EXI_FIDELITY_PREFIXES) - .getLength() > 0) { - this.fidelityOptions.setFidelity( - FidelityOptions.FEATURE_PREFIX, true); - } - - } - - if (operationElement.getElementsByTagName(EXI_PARAMETER_SCHEMA) - .getLength() > 0) { - - GrammarFactory grammarFactory = GrammarFactory.newInstance(); - if (operationElement - .getElementsByTagName(EXI_PARAMETER_SCHEMA_NONE) - .getLength() > 0) { - this.grammars = grammarFactory.createSchemaLessGrammars(); - } - - if (operationElement.getElementsByTagName( - EXI_PARAMETER_SCHEMA_BUILT_IN).getLength() > 0) { - this.grammars = grammarFactory.createXSDTypesOnlyGrammars(); - } - - if (operationElement.getElementsByTagName( - EXI_PARAMETER_SCHEMA_BASE_1_1).getLength() > 0) { - this.grammars = grammarFactory - .createGrammars(NETCONF_XSD_LOCATION); - } - - } - } - - public FidelityOptions getFidelityOptions() { - return fidelityOptions; - } - - public Grammars getGrammars() { - return grammars; - } - - public CodingMode getCodingMode() { - return codingMode; - } - -} diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java deleted file mode 100644 index 82bbb66c02..0000000000 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java +++ /dev/null @@ -1,98 +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.util.xml; - -import io.netty.buffer.ByteBuf; -import io.netty.buffer.EmptyByteBuf; -import io.netty.buffer.Unpooled; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.w3c.dom.Document; -import org.xml.sax.SAXException; - -import com.siemens.ct.exi.EXIFactory; -import com.siemens.ct.exi.api.dom.DOMBuilder; -import com.siemens.ct.exi.api.dom.DOMWriter; -import com.siemens.ct.exi.exceptions.EXIException; -import com.siemens.ct.exi.helpers.DefaultEXIFactory; - -public class ExiUtil { - - private final static Logger logger = LoggerFactory.getLogger(ExiUtil.class); - - - - public static void encode(final Object msg, final ByteBuf out, - ExiParameters parameters) - throws EXIException, IOException, SAXException { - final byte[] bytes = toExi(msg, parameters); - out.writeBytes(bytes); - } - - public static void decode(ByteBuf in, List out, - ExiParameters parameters) throws ParserConfigurationException, EXIException, IOException - { - if (in instanceof EmptyByteBuf){ - return; - } - - EXIFactory exiFactory = DefaultEXIFactory.newInstance(); - if (parameters.getGrammars() != null) { - exiFactory.setGrammars(parameters.getGrammars()); - } - - if (parameters.getFidelityOptions() != null) { - exiFactory.setFidelityOptions(parameters.getFidelityOptions()); - } - - exiFactory.setCodingMode(parameters.getCodingMode()); - try (ByteArrayInputStream exiIS = new ByteArrayInputStream(((ByteBuf)in).readBytes(((ByteBuf)in).readableBytes()).array())){ - DOMBuilder domBuilder = new DOMBuilder(exiFactory); - ByteBuf result = Unpooled.copiedBuffer(XmlUtil.toString(domBuilder.parse(exiIS)).getBytes()); - exiIS.close(); - out.add(result); - } - } - - private static byte[] toExi(Object msg, ExiParameters parameters) throws EXIException, IOException, - SAXException { - - if (!(msg instanceof ByteBuf)){ - return Unpooled.EMPTY_BUFFER.array(); - } - - EXIFactory exiFactory = DefaultEXIFactory.newInstance(); - if (parameters.getGrammars() != null) { - exiFactory.setGrammars(parameters.getGrammars()); - } - - if (parameters.getFidelityOptions() != null) { - exiFactory.setFidelityOptions(parameters.getFidelityOptions()); - } - - Document doc = XmlUtil.readXmlToDocument(new String( ((ByteBuf)msg).readBytes(((ByteBuf)msg).readableBytes()).array(),"UTF-8")); - exiFactory.setCodingMode(parameters.getCodingMode()); - - try (ByteArrayOutputStream exiOS = new ByteArrayOutputStream()){ - DOMWriter domWriter = new DOMWriter(exiFactory); - domWriter.setOutput(exiOS); - domWriter.encode(doc) ; - exiOS.close(); - return exiOS.toByteArray(); - } - } - -} diff --git a/opendaylight/netconf/pom.xml b/opendaylight/netconf/pom.xml index 3a96b42263..b70586f432 100644 --- a/opendaylight/netconf/pom.xml +++ b/opendaylight/netconf/pom.xml @@ -28,7 +28,6 @@ netconf-client netconf-ssh ../../third-party/ganymed - ../../third-party/com.siemens.ct.exi netconf-monitoring ietf-netconf-monitoring ietf-netconf-monitoring-extension @@ -51,7 +50,6 @@ 2.4.0 1.7.2 4.0.10.Final - 0.9.2 @@ -203,11 +201,6 @@ logback-config ${config.version} - - com.siemens.ct.exi - exificient - ${ct.exi.version} -