X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2FNetconfEXICodec.java;fp=opendaylight%2Fnetconf%2Fnetconf-util%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Futil%2Fhandler%2FNetconfEXICodec.java;h=0000000000000000000000000000000000000000;hp=a6e2e52ea5d2808bef21ce2f0aa08f59a1e0f2a4;hb=c3108b4e80ec9f6ee6c8cf96df3009bb91dc8bc0;hpb=04a788d2df5303c60cdbcff02254291f411566bd diff --git a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEXICodec.java b/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEXICodec.java deleted file mode 100644 index a6e2e52ea5..0000000000 --- a/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/handler/NetconfEXICodec.java +++ /dev/null @@ -1,59 +0,0 @@ -package org.opendaylight.controller.netconf.util.handler; - -import com.google.common.base.Preconditions; -import org.openexi.proc.HeaderOptionsOutputType; -import org.openexi.proc.common.EXIOptions; -import org.openexi.proc.common.EXIOptionsException; -import org.openexi.proc.common.GrammarOptions; -import org.openexi.proc.grammars.GrammarCache; -import org.openexi.sax.EXIReader; -import org.openexi.sax.Transmogrifier; - -public final class NetconfEXICodec { - /** - * NETCONF is XML environment, so the use of EXI cookie is not really needed. Adding it - * decreases efficiency of encoding by adding human-readable 4 bytes "EXI$" to the head - * of the stream. This is really useful, so let's output it now. - */ - private static final boolean OUTPUT_EXI_COOKIE = true; - private final EXIOptions exiOptions; - - public NetconfEXICodec(final EXIOptions exiOptions) { - this.exiOptions = Preconditions.checkNotNull(exiOptions); - } - - private GrammarCache getGrammarCache() { - short go = GrammarOptions.DEFAULT_OPTIONS; - if (exiOptions.getPreserveComments()) { - go = GrammarOptions.addCM(go); - } - if (exiOptions.getPreserveDTD()) { - go = GrammarOptions.addDTD(go); - } - if (exiOptions.getPreserveNS()) { - go = GrammarOptions.addNS(go); - } - if (exiOptions.getPreservePIs()) { - go = GrammarOptions.addPI(go); - } - - return new GrammarCache(null, go); - } - - EXIReader getReader() throws EXIOptionsException { - final EXIReader r = new EXIReader(); - r.setPreserveLexicalValues(exiOptions.getPreserveLexicalValues()); - r.setGrammarCache(getGrammarCache()); - return r; - } - - Transmogrifier getTransmogrifier() throws EXIOptionsException { - final Transmogrifier transmogrifier = new Transmogrifier(); - transmogrifier.setAlignmentType(exiOptions.getAlignmentType()); - transmogrifier.setBlockSize(exiOptions.getBlockSize()); - transmogrifier.setGrammarCache(getGrammarCache()); - transmogrifier.setOutputCookie(OUTPUT_EXI_COOKIE); - transmogrifier.setOutputOptions(HeaderOptionsOutputType.all); - return transmogrifier; - } -}