X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fnode%2FNormalizedNodeToNodeCodec.java;h=8ca0e76b014961fed6232839570cc23b71c97ee1;hb=a58c23b491f665e6d5449e97d430a7e15d1ecda6;hp=6669e48627b6b782327684fcc9a13818b867816a;hpb=3f25afcf0f3faa4d372329faf1a3c90c6711edbd;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java index 6669e48627..8ca0e76b01 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodec.java @@ -1,11 +1,9 @@ /* + * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others. All rights reserved. * - * 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 - * + * 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.cluster.datastore.node; @@ -18,7 +16,6 @@ import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessa import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class NormalizedNodeToNodeCodec { public interface Encoded { @@ -33,13 +30,10 @@ public class NormalizedNodeToNodeCodec { YangInstanceIdentifier getDecodedPath(); } - private final SchemaContext ctx; - - public NormalizedNodeToNodeCodec(final SchemaContext ctx){ - this.ctx = ctx; + public NormalizedNodeToNodeCodec() { } - public NormalizedNodeMessages.Container encode(NormalizedNode node){ + public NormalizedNodeMessages.Container encode(NormalizedNode node) { return encode(null, node).getEncodedNode(); } @@ -52,8 +46,8 @@ public class NormalizedNodeToNodeCodec { // Note: parent path is no longer used builder.setParentPath(""); - if(node != null) { - if(path == null) { + if (node != null) { + if (path == null) { builder.setNormalizedNode(NormalizedNodeSerializer.serialize(node)); } else { Serializer serializer = NormalizedNodeSerializer.newSerializer(node); @@ -66,13 +60,13 @@ public class NormalizedNodeToNodeCodec { } - public NormalizedNode decode(NormalizedNodeMessages.Node node){ + public NormalizedNode decode(NormalizedNodeMessages.Node node) { return decode(null, node).getDecodedNode(); } public Decoded decode(NormalizedNodeMessages.InstanceIdentifier path, NormalizedNodeMessages.Node node) { - if(node.getIntType() < 0 || node.getSerializedSize() == 0){ + if (node.getIntType() < 0 || node.getSerializedSize() == 0) { return new DecodedImpl(null, null); } @@ -86,7 +80,7 @@ public class NormalizedNodeToNodeCodec { private final NormalizedNode decodedNode; private final YangInstanceIdentifier decodedPath; - public DecodedImpl(NormalizedNode decodedNode, YangInstanceIdentifier decodedPath) { + DecodedImpl(NormalizedNode decodedNode, YangInstanceIdentifier decodedPath) { this.decodedNode = decodedNode; this.decodedPath = decodedPath; }