2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
 
   6  * ================================================================================
 
   7  * Licensed under the Apache License, Version 2.0 (the "License");
 
   8  * you may not use this file except in compliance with the License.
 
   9  * You may obtain a copy of the License at
 
  11  *      http://www.apache.org/licenses/LICENSE-2.0
 
  13  * Unless required by applicable law or agreed to in writing, software
 
  14  * distributed under the License is distributed on an "AS IS" BASIS,
 
  15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
  16  * See the License for the specific language governing permissions and
 
  17  * limitations under the License.
 
  18  * ============LICENSE_END=========================================================
 
  21 package org.onap.ccsdk.sli.plugins.yangserializers.pnserializer;
 
  23 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
 
  28  * Abstraction of an entity to enable encoding and decoding of properties
 
  29  * to an abstract properties node tree using YANG based schema.
 
  30  * This serializer will be used by other data format serializers and will keep
 
  31  * them abstract from properties nuances thereby enabling quick addition of any
 
  32  * new data format serializer.
 
  34  * @param <T> type of schema node
 
  35  * @param <P> schema context of the model
 
  37 public abstract class PropertiesNodeSerializer<T, P> {
 
  40      * Schema node from which the property is made.
 
  45      * Schema context of the model.
 
  50      * URL pointing to the schema node.
 
  55      * Creates the properties node serializer.
 
  57      * @param schemaNode schema node.
 
  58      * @param schemaCtx schema context
 
  59      * @param uri URL of the request
 
  61     public PropertiesNodeSerializer(T schemaNode, P schemaCtx, String uri) {
 
  62         this.schemaNode = schemaNode;
 
  63         this.schemaCtx = schemaCtx;
 
  68      * Encodes from properties to properties-node tree.
 
  70      * @param paramMap parameter map
 
  71      * @throws SvcLogicException fails to encode properties to properties node
 
  72      * @return properties node
 
  74     public abstract PropertiesNode encode(Map<String, String> paramMap) throws SvcLogicException;
 
  77      * Decodes from properties-node to properties map.
 
  79      * @param propertiesNode properties-node
 
  80      * @throws SvcLogicException fails to decode properties node to properties
 
  81      * @return parameter map
 
  83     public abstract Map<String, String> decode(PropertiesNode propertiesNode) throws SvcLogicException;
 
  86      * Returns the schema node of the property
 
  90     public T schemaNode(){
 
  95      * Returns the schema context
 
  99     public P schemaCtx() {
 
 108     public String uri() {