Remove dependency on Exificient due to licensing incompatibility 01/4701/2
authorRobert Varga <rovarga@cisco.com>
Fri, 24 Jan 2014 10:57:06 +0000 (11:57 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 24 Jan 2014 13:54:34 +0000 (14:54 +0100)
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 <rovarga@cisco.com>
19 files changed:
opendaylight/commons/opendaylight/pom.xml
opendaylight/distribution/opendaylight/pom.xml
opendaylight/md-sal/sal-binding-it/src/main/java/org/opendaylight/controller/test/sal/binding/it/TestHelper.java
opendaylight/md-sal/test/sal-rest-connector-it/pom.xml
opendaylight/md-sal/test/sal-rest-connector-it/src/test/java/org/opendaylight/controller/test/restconf/it/ServiceProviderController.java
opendaylight/netconf/netconf-api/src/main/java/org/opendaylight/controller/netconf/api/NetconfSession.java
opendaylight/netconf/netconf-client/src/main/resources/client_hello.xml
opendaylight/netconf/netconf-impl/pom.xml
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiDecoderHandler.java [deleted file]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/ExiEncoderHandler.java [deleted file]
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStartExi.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultStopExi.java
opendaylight/netconf/netconf-impl/src/main/resources/server_hello.xml
opendaylight/netconf/netconf-impl/src/test/java/org/opendaylight/controller/netconf/impl/ExiEncodeDecodeTest.java
opendaylight/netconf/netconf-it/src/test/java/org/opendaylight/controller/netconf/it/NetconfITTest.java
opendaylight/netconf/netconf-util/pom.xml
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiParameters.java [deleted file]
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/ExiUtil.java [deleted file]
opendaylight/netconf/pom.xml

index 64c873b..eb7800f 100644 (file)
     <java.version.target>1.7</java.version.target>
     <!-- enforcer version -->
     <enforcer.version>1.3.1</enforcer.version>
-    <exi.version>0.9.2-SNAPSHOT</exi.version>
   </properties>
 
   <dependencyManagement>
         <artifactId>org.openflow.openflowj</artifactId>
         <version>1.0.2</version>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller.thirdparty</groupId>
-        <artifactId>exificient</artifactId>
-        <version>${exi.version}</version>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller.thirdparty</groupId>
         <artifactId>com.sun.jersey.jersey-servlet</artifactId>
index cdb4e35..d3be916 100644 (file)
           <artifactId>config-persister-impl</artifactId>
           <version>${netconf.version}</version>
         </dependency>
-        <dependency>
-          <groupId>org.opendaylight.controller.thirdparty</groupId>
-          <artifactId>exificient</artifactId>
-          <version>${exi.version}</version>
-        </dependency>
         <dependency>
             <groupId>org.apache.servicemix.bundles</groupId>
             <artifactId>org.apache.servicemix.bundles.xerces</artifactId>
index c0dec7c..b4f6bea 100644 (file)
@@ -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"),
 
index c03833d..64ca5ae 100644 (file)
             <version>1.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-        <groupId>org.opendaylight.controller.thirdparty</groupId>
-        <artifactId>exificient</artifactId>
-        <version>0.9.2</version>
-        </dependency>
         <dependency>
             <groupId>org.ops4j.pax.exam</groupId>
             <artifactId>pax-exam-container-native</artifactId>
index 8763724..b5ab8a9 100644 (file)
@@ -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(),
index eb7235f..6c747db 100644 (file)
@@ -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<NetconfMessage> {
-
-    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<NetconfMess
         this.channel = channel;
         this.sessionId = sessionId;
         logger.debug("Session {} created", toString());
-
-        ChannelHandler pmd = channel.pipeline().get(ProtocolMessageDecoder.class);
-        ChannelHandler pme = channel.pipeline().get(ProtocolMessageEncoder.class);
-
-        for (Map.Entry<String, ChannelHandler> 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<NetconfMess
 
     public void sendMessage(NetconfMessage netconfMessage) {
         channel.writeAndFlush(netconfMessage);
-        if (exiEncoder!=null){
-            if (channel.pipeline().get(exiEncoderName)== null){
-                channel.pipeline().addBefore(pmeName, exiEncoderName, exiEncoder);
-            }
-        }
-        if (removeAfterMessageSentname!=null){
-            channel.pipeline().remove(removeAfterMessageSentname);
-            removeAfterMessageSentname = null;
-        }
     }
 
     @Override
@@ -106,39 +76,5 @@ public abstract class NetconfSession extends AbstractProtocolSession<NetconfMess
     public long getSessionId() {
         return sessionId;
     }
-
-    public <T extends ChannelHandler> T remove(Class<T> handlerType) {
-        return channel.pipeline().remove(handlerType);
-    }
-
-    public <T extends ChannelHandler> T getHandler(Class<T> 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;
-    }
-
 }
 
index 520627a..46f6f76 100644 (file)
@@ -2,6 +2,5 @@
     <capabilities>
         <capability>urn:ietf:params:netconf:base:1.0</capability>
         <capability>urn:ietf:params:netconf:base:1.1</capability>
-        <capability>urn:ietf:params:netconf:capability:exi:1.0</capability>
     </capabilities>
-</hello>
\ No newline at end of file
+</hello>
index 766772b..2d56883 100644 (file)
                             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 (file)
index 721c0c2..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*\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;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.handler.codec.ByteToMessageDecoder;\r
-\r
-import java.util.List;\r
-\r
-import org.opendaylight.controller.netconf.util.xml.ExiParameters;\r
-import org.opendaylight.controller.netconf.util.xml.ExiUtil;\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-\r
-public class ExiDecoderHandler extends ByteToMessageDecoder {\r
-\r
-    public static final String HANDLER_NAME;\r
-\r
-    static {\r
-        HANDLER_NAME = "exiDecoder";\r
-    }\r
-\r
-    private final static Logger logger = LoggerFactory\r
-            .getLogger(ExiDecoderHandler.class);\r
-\r
-    private ExiParameters parameters;\r
-\r
-    public ExiDecoderHandler(ExiParameters parameters) {\r
-        this.parameters = parameters;\r
-    }\r
-\r
-    @Override\r
-    protected void decode(ChannelHandlerContext ctx, ByteBuf in,\r
-            List<Object> out) {\r
-        try {\r
-            ExiUtil.decode(in, out, this.parameters);\r
-        } catch (Exception e) {\r
-            throw new IllegalStateException("Unable to decode exi message.");\r
-        }\r
-    }\r
-\r
-}\r
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 (file)
index e7a5917..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*\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;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.channel.ChannelHandlerContext;\r
-import io.netty.handler.codec.MessageToByteEncoder;\r
-\r
-import org.opendaylight.controller.netconf.util.xml.ExiParameters;\r
-import org.opendaylight.controller.netconf.util.xml.ExiUtil;\r
-\r
-public class ExiEncoderHandler extends MessageToByteEncoder<Object> {\r
-\r
-    public static final String HANDLER_NAME;\r
-    static {\r
-        HANDLER_NAME = "exiEncoder";\r
-    }\r
-\r
-    private ExiParameters parameters;\r
-\r
-    public ExiEncoderHandler(ExiParameters parameters) {\r
-        this.parameters = parameters;\r
-    }\r
-\r
-    @Override\r
-    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out)\r
-            throws Exception {\r
-        try {\r
-            ExiUtil.encode(msg, out, this.parameters);\r
-        } catch (Exception e) {\r
-            throw new IllegalStateException("Unable to encode exi message.");\r
-        }\r
-    }\r
-}\r
index 679e280..38c1a44 100644 (file)
@@ -10,12 +10,9 @@ package org.opendaylight.controller.netconf.impl.mapping.operations;
 import org.opendaylight.controller.netconf.api.NetconfSession;\r
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;\r
-import org.opendaylight.controller.netconf.impl.mapping.ExiDecoderHandler;\r
-import org.opendaylight.controller.netconf.impl.mapping.ExiEncoderHandler;\r
 import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;\r
 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;\r
 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;\r
-import org.opendaylight.controller.netconf.util.xml.ExiParameters;\r
 import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;\r
 import org.opendaylight.controller.netconf.util.xml.XmlUtil;\r
@@ -24,8 +21,6 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;\r
 import org.w3c.dom.Element;\r
 \r
-import com.siemens.ct.exi.exceptions.EXIException;\r
-\r
 public class DefaultStartExi extends AbstractNetconfOperation implements DefaultNetconfOperation {\r
 \r
     public static final String START_EXI = "start-exi";\r
@@ -61,6 +56,9 @@ public class DefaultStartExi extends AbstractNetconfOperation implements Default
                 XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);\r
 \r
 \r
+        throw new UnsupportedOperationException("Not implemented");\r
+\r
+        /*\r
         try {\r
             ExiParameters exiParams = new ExiParameters();\r
             exiParams.setParametersFromXmlElement(operationElement);\r
@@ -76,7 +74,7 @@ public class DefaultStartExi extends AbstractNetconfOperation implements Default
         logger.trace("{} operation successful", START_EXI);\r
         logger.debug("received start-exi message {} ", XmlUtil.toString(document));\r
         return getSchemaResult;\r
-\r
+        */\r
     }\r
 \r
     @Override\r
index d841a66..6ea5deb 100644 (file)
@@ -10,14 +10,11 @@ package org.opendaylight.controller.netconf.impl.mapping.operations;
 import org.opendaylight.controller.netconf.api.NetconfSession;\r
 import org.opendaylight.controller.netconf.api.NetconfDocumentedException;\r
 import org.opendaylight.controller.netconf.api.NetconfOperationRouter;\r
-import org.opendaylight.controller.netconf.impl.mapping.ExiDecoderHandler;\r
-import org.opendaylight.controller.netconf.impl.mapping.ExiEncoderHandler;\r
 import org.opendaylight.controller.netconf.mapping.api.DefaultNetconfOperation;\r
 import org.opendaylight.controller.netconf.mapping.api.HandlingPriority;\r
 import org.opendaylight.controller.netconf.util.mapping.AbstractNetconfOperation;\r
 import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
 import org.opendaylight.controller.netconf.util.xml.XmlNetconfConstants;\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
@@ -50,7 +47,8 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN
     @Override\r
     protected Element handle(Document document, XmlElement operationElement,\r
             NetconfOperationRouter opRouter) throws NetconfDocumentedException {\r
-\r
+        throw new UnsupportedOperationException("Not implemented");\r
+        /*\r
         netconfSession.remove(ExiDecoderHandler.class);\r
         netconfSession.removeAfterMessageSent(ExiEncoderHandler.HANDLER_NAME);\r
 \r
@@ -60,6 +58,7 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN
         logger.trace("{} operation successful", STOP_EXI);\r
         logger.debug("received stop-exi message {} ", XmlUtil.toString(document));\r
         return getSchemaResult;\r
+        */\r
     }\r
 \r
     @Override\r
@@ -70,4 +69,4 @@ public class DefaultStopExi extends AbstractNetconfOperation implements DefaultN
     public NetconfSession getNetconfSession() {\r
         return netconfSession;\r
     }\r
-}
\ No newline at end of file
+}\r
index eb4b4b9..6a3f911 100644 (file)
@@ -2,7 +2,6 @@
 <hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <capabilities>
         <capability>urn:ietf:params:netconf:base:1.0</capability>
-        <capability>urn:ietf:params:netconf:capability:exi:1.0</capability>
     </capabilities>
     <session-id>1</session-id>
 </hello>
index 73eb608..d7beb5d 100644 (file)
@@ -8,20 +8,10 @@
 package org.opendaylight.controller.netconf.impl;\r
 \r
 import static junit.framework.Assert.assertNotNull;\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.Unpooled;\r
-\r
-import java.util.ArrayList;\r
-import java.util.List;\r
 \r
 import org.junit.Test;\r
 import org.opendaylight.controller.netconf.api.NetconfMessage;\r
 import org.opendaylight.controller.netconf.util.test.XmlFileLoader;\r
-import org.opendaylight.controller.netconf.util.xml.ExiParameters;\r
-import org.opendaylight.controller.netconf.util.xml.ExiUtil;\r
-import org.opendaylight.controller.netconf.util.xml.XmlElement;\r
-\r
-\r
 \r
 public class ExiEncodeDecodeTest  {\r
     @Test\r
@@ -33,6 +23,7 @@ public class ExiEncodeDecodeTest  {
         NetconfMessage startExiMessage = XmlFileLoader.xmlFileToNetconfMessage(("netconfMessages/startExi.xml"));\r
         assertNotNull(startExiMessage);\r
 \r
+        /*\r
         ExiParameters exiParams = new ExiParameters();\r
         exiParams.setParametersFromXmlElement(XmlElement.fromDomElement(startExiMessage.getDocument().getDocumentElement()));\r
         assertNotNull(exiParams);\r
@@ -47,5 +38,6 @@ public class ExiEncodeDecodeTest  {
         ByteBuf decodedBuf = (ByteBuf)newOut.get(0);\r
         String decodedString = new String(decodedBuf.array(),"UTF-8");\r
         assertNotNull(decodedString);\r
+        */\r
     }\r
 }\r
index 36f30dd..5f4bcec 100644 (file)
@@ -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 {
index 71b7fa6..3c96897 100644 (file)
             <artifactId>netty-handler</artifactId>
             <version>${netconf.netty.version}</version>
         </dependency>
-        <dependency>
+        <!--dependency>
             <groupId>com.siemens.ct.exi</groupId>
             <artifactId>exificient</artifactId>
-        </dependency>
+        </dependency-->
         <dependency>
             <groupId>org.opendaylight.controller.thirdparty</groupId>
             <artifactId>ganymed</artifactId>
                             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,
                         </Import-Package>
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 (file)
index 7109971..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*\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.util.xml;\r
-\r
-import com.siemens.ct.exi.CodingMode;\r
-import com.siemens.ct.exi.FidelityOptions;\r
-import com.siemens.ct.exi.GrammarFactory;\r
-import com.siemens.ct.exi.exceptions.EXIException;\r
-import com.siemens.ct.exi.grammars.Grammars;\r
-\r
-public class ExiParameters {\r
-\r
-    private static final String EXI_PARAMETER_ALIGNMENT = "alignment";\r
-    private static final String EXI_PARAMETER_BYTE_ALIGNED = "byte-aligned";\r
-    private static final String EXI_PARAMETER_COMPRESSED = "compressed";\r
-\r
-    private static final String EXI_PARAMETER_FIDELITY = "fidelity";\r
-    private static final String EXI_FIDELITY_DTD = "dtd";\r
-    private static final String EXI_FIDELITY_LEXICAL_VALUES = "lexical-values";\r
-    private static final String EXI_FIDELITY_COMMENTS = "comments";\r
-    private static final String EXI_FIDELITY_PIS = "pis";\r
-    private static final String EXI_FIDELITY_PREFIXES = "prefixes";\r
-\r
-    private static final String EXI_PARAMETER_SCHEMA = "schema";\r
-    private static final String EXI_PARAMETER_SCHEMA_NONE = "none";\r
-    private static final String EXI_PARAMETER_SCHEMA_BUILT_IN = "builtin";\r
-    private static final String EXI_PARAMETER_SCHEMA_BASE_1_1 = "base:1.1";\r
-\r
-    private static final String NETCONF_XSD_LOCATION = "";\r
-\r
-    private FidelityOptions fidelityOptions;\r
-    private Grammars grammars;\r
-    private CodingMode codingMode = CodingMode.BIT_PACKED;\r
-\r
-    public void setParametersFromXmlElement(XmlElement operationElement)\r
-            throws EXIException {\r
-\r
-        if (operationElement.getElementsByTagName(EXI_PARAMETER_ALIGNMENT)\r
-                .getLength() > 0) {\r
-\r
-            if (operationElement.getElementsByTagName(\r
-                    EXI_PARAMETER_BYTE_ALIGNED)\r
-                    .getLength() > 0) {\r
-                this.codingMode = CodingMode.BYTE_PACKED;\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(\r
-                    EXI_PARAMETER_BYTE_ALIGNED).getLength() > 0) {\r
-                this.codingMode = CodingMode.BYTE_PACKED;\r
-            }\r
-            if (operationElement.getElementsByTagName(EXI_PARAMETER_COMPRESSED)\r
-                    .getLength() > 0) {\r
-                this.codingMode = CodingMode.COMPRESSION;\r
-            }\r
-        }\r
-\r
-        if (operationElement.getElementsByTagName(EXI_PARAMETER_FIDELITY)\r
-                .getLength() > 0) {\r
-\r
-            this.fidelityOptions = FidelityOptions.createDefault();\r
-\r
-            if (operationElement.getElementsByTagName(EXI_FIDELITY_DTD)\r
-                    .getLength() > 0) {\r
-                this.fidelityOptions.setFidelity(FidelityOptions.FEATURE_DTD,\r
-                        true);\r
-            }\r
-            if (operationElement.getElementsByTagName(\r
-                    EXI_FIDELITY_LEXICAL_VALUES)\r
-                    .getLength() > 0) {\r
-                this.fidelityOptions.setFidelity(\r
-                        FidelityOptions.FEATURE_LEXICAL_VALUE, true);\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(EXI_FIDELITY_COMMENTS)\r
-                    .getLength() > 0) {\r
-                this.fidelityOptions.setFidelity(\r
-                        FidelityOptions.FEATURE_COMMENT, true);\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(EXI_FIDELITY_PIS)\r
-                    .getLength() > 0) {\r
-                this.fidelityOptions.setFidelity(FidelityOptions.FEATURE_PI,\r
-                        true);\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(EXI_FIDELITY_PREFIXES)\r
-                    .getLength() > 0) {\r
-                this.fidelityOptions.setFidelity(\r
-                        FidelityOptions.FEATURE_PREFIX, true);\r
-            }\r
-\r
-        }\r
-\r
-        if (operationElement.getElementsByTagName(EXI_PARAMETER_SCHEMA)\r
-                .getLength() > 0) {\r
-\r
-            GrammarFactory grammarFactory = GrammarFactory.newInstance();\r
-            if (operationElement\r
-                    .getElementsByTagName(EXI_PARAMETER_SCHEMA_NONE)\r
-                    .getLength() > 0) {\r
-                this.grammars = grammarFactory.createSchemaLessGrammars();\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(\r
-                    EXI_PARAMETER_SCHEMA_BUILT_IN).getLength() > 0) {\r
-                this.grammars = grammarFactory.createXSDTypesOnlyGrammars();\r
-            }\r
-\r
-            if (operationElement.getElementsByTagName(\r
-                    EXI_PARAMETER_SCHEMA_BASE_1_1).getLength() > 0) {\r
-                this.grammars = grammarFactory\r
-                        .createGrammars(NETCONF_XSD_LOCATION);\r
-            }\r
-\r
-        }\r
-    }\r
-\r
-    public FidelityOptions getFidelityOptions() {\r
-        return fidelityOptions;\r
-    }\r
-\r
-    public Grammars getGrammars() {\r
-        return grammars;\r
-    }\r
-\r
-    public CodingMode getCodingMode() {\r
-        return codingMode;\r
-    }\r
-\r
-}\r
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 (file)
index 82bbb66..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-/*\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.util.xml;\r
-\r
-import io.netty.buffer.ByteBuf;\r
-import io.netty.buffer.EmptyByteBuf;\r
-import io.netty.buffer.Unpooled;\r
-\r
-import java.io.ByteArrayInputStream;\r
-import java.io.ByteArrayOutputStream;\r
-import java.io.IOException;\r
-import java.util.List;\r
-\r
-import javax.xml.parsers.ParserConfigurationException;\r
-\r
-import org.slf4j.Logger;\r
-import org.slf4j.LoggerFactory;\r
-import org.w3c.dom.Document;\r
-import org.xml.sax.SAXException;\r
-\r
-import com.siemens.ct.exi.EXIFactory;\r
-import com.siemens.ct.exi.api.dom.DOMBuilder;\r
-import com.siemens.ct.exi.api.dom.DOMWriter;\r
-import com.siemens.ct.exi.exceptions.EXIException;\r
-import com.siemens.ct.exi.helpers.DefaultEXIFactory;\r
-\r
-public class ExiUtil {\r
-\r
-    private final static Logger logger = LoggerFactory.getLogger(ExiUtil.class);\r
-\r
-\r
-\r
-    public static void encode(final Object msg, final ByteBuf out,\r
-            ExiParameters parameters)\r
-            throws EXIException, IOException, SAXException {\r
-        final byte[] bytes = toExi(msg, parameters);\r
-        out.writeBytes(bytes);\r
-    }\r
-\r
-    public static void decode(ByteBuf in, List<Object> out,\r
-            ExiParameters parameters) throws ParserConfigurationException, EXIException, IOException\r
-             {\r
-        if (in instanceof EmptyByteBuf){\r
-            return;\r
-        }\r
-\r
-        EXIFactory exiFactory = DefaultEXIFactory.newInstance();\r
-        if (parameters.getGrammars() != null) {\r
-            exiFactory.setGrammars(parameters.getGrammars());\r
-        }\r
-\r
-        if (parameters.getFidelityOptions() != null) {\r
-            exiFactory.setFidelityOptions(parameters.getFidelityOptions());\r
-        }\r
-\r
-        exiFactory.setCodingMode(parameters.getCodingMode());\r
-        try (ByteArrayInputStream exiIS = new ByteArrayInputStream(((ByteBuf)in).readBytes(((ByteBuf)in).readableBytes()).array())){\r
-            DOMBuilder domBuilder = new DOMBuilder(exiFactory);\r
-            ByteBuf result = Unpooled.copiedBuffer(XmlUtil.toString(domBuilder.parse(exiIS)).getBytes());\r
-            exiIS.close();\r
-            out.add(result);\r
-        }\r
-    }\r
-\r
-    private static byte[] toExi(Object msg, ExiParameters parameters) throws EXIException, IOException,\r
-            SAXException {\r
-\r
-        if (!(msg instanceof ByteBuf)){\r
-              return Unpooled.EMPTY_BUFFER.array();\r
-        }\r
-\r
-        EXIFactory exiFactory = DefaultEXIFactory.newInstance();\r
-        if (parameters.getGrammars() != null) {\r
-            exiFactory.setGrammars(parameters.getGrammars());\r
-        }\r
-\r
-        if (parameters.getFidelityOptions() != null) {\r
-            exiFactory.setFidelityOptions(parameters.getFidelityOptions());\r
-        }\r
-\r
-        Document doc = XmlUtil.readXmlToDocument(new String( ((ByteBuf)msg).readBytes(((ByteBuf)msg).readableBytes()).array(),"UTF-8"));\r
-        exiFactory.setCodingMode(parameters.getCodingMode());\r
-\r
-        try (ByteArrayOutputStream exiOS = new ByteArrayOutputStream()){\r
-            DOMWriter domWriter = new DOMWriter(exiFactory);\r
-            domWriter.setOutput(exiOS);\r
-            domWriter.encode(doc) ;\r
-            exiOS.close();\r
-            return exiOS.toByteArray();\r
-        }\r
-    }\r
-\r
-}\r
index 3a96b42..b70586f 100644 (file)
@@ -28,7 +28,6 @@
         <module>netconf-client</module>
         <module>netconf-ssh</module>
         <module>../../third-party/ganymed</module>
-        <module>../../third-party/com.siemens.ct.exi</module>
         <module>netconf-monitoring</module>
         <module>ietf-netconf-monitoring</module>
         <module>ietf-netconf-monitoring-extension</module>
@@ -51,7 +50,6 @@
         <maven.bundle.version>2.4.0</maven.bundle.version>
         <slf4j.version>1.7.2</slf4j.version>
         <netconf.netty.version>4.0.10.Final</netconf.netty.version>
-        <ct.exi.version>0.9.2</ct.exi.version>
     </properties>
 
     <dependencies>
                 <artifactId>logback-config</artifactId>
                 <version>${config.version}</version>
             </dependency>
-            <dependency>
-                <groupId>com.siemens.ct.exi</groupId>
-                <artifactId>exificient</artifactId>
-                <version>${ct.exi.version}</version>
-            </dependency>
         </dependencies>
     </dependencyManagement>