X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2FXmlMapper.java;fp=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2FXmlMapper.java;h=0000000000000000000000000000000000000000;hp=01a5567004b6e675c958efcf04caecfb5c7b471e;hb=13d48361d8c7b09a61bf6aaa37cda699b14f881a;hpb=cf3c39048445c63710c82c0b3fb86a5694d5644f diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java deleted file mode 100644 index 01a5567004..0000000000 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/XmlMapper.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2014 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.sal.rest.impl; - -import com.google.common.base.Optional; -import javax.activation.UnsupportedDataTypeException; -import org.opendaylight.yangtools.yang.data.api.CompositeNode; -import org.opendaylight.yangtools.yang.data.api.codec.LeafrefCodec; -import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec; -import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlCodecProvider; -import org.opendaylight.yangtools.yang.data.impl.codec.xml.XmlDocumentUtils; -import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; -import org.opendaylight.yangtools.yang.model.api.TypeDefinition; -import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition; -import org.opendaylight.yangtools.yang.model.util.Leafref; -import org.w3c.dom.Document; - -/** - * @deprecated class will be removed for lithium release - */ -@Deprecated -public class XmlMapper { - private static final LeafrefCodecImpl LEAFREF_DEFAULT_CODEC = new LeafrefCodecImpl( - Optional. absent()); - - private static class LeafrefCodecImpl extends TypeDefinitionAwareCodec implements - LeafrefCodec { - - protected LeafrefCodecImpl(final Optional typeDef) { - super(typeDef, Object.class); - } - - @Override - public String serialize(final Object data) { - return String.valueOf(data); - } - - @Override - public Object deserialize(final String data) { - return data; - } - } - - private static class XmlCodecProviderImpl implements XmlCodecProvider { - @Override - public TypeDefinitionAwareCodec> codecFor(final TypeDefinition baseType) { - final TypeDefinitionAwareCodec> codec = TypeDefinitionAwareCodec - .from(baseType); - - if (codec == null) { - if (baseType instanceof Leafref) { - return LEAFREF_DEFAULT_CODEC; - } - } - return codec; - } - } - - private static final XmlCodecProvider XML_CODEC_PROVIDER_IMPL = new XmlCodecProviderImpl(); - - public Document write(final CompositeNode data, final DataNodeContainer schema) throws UnsupportedDataTypeException { - return XmlDocumentUtils.toDocument(data, schema, XML_CODEC_PROVIDER_IMPL); - } -}