BUG-2218: Keep existing link augmentations during discovery process
[controller.git] / opendaylight / northbound / controllermanager / src / main / java / org / opendaylight / controller / controllermanager / northbound / ControllerProperties.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.controllermanager.northbound;
9
10 import java.util.HashMap;
11 import java.util.HashSet;
12 import java.util.Map;
13 import java.util.Set;
14
15 import javax.xml.bind.annotation.XmlAccessType;
16 import javax.xml.bind.annotation.XmlAccessorType;
17 import javax.xml.bind.annotation.XmlElement;
18 import javax.xml.bind.annotation.XmlElementWrapper;
19 import javax.xml.bind.annotation.XmlRootElement;
20
21 import org.opendaylight.controller.sal.core.Property;
22
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25
26 /**
27  * The class describes set of properties attached to a controller
28  */
29
30 @XmlRootElement
31 @XmlAccessorType(XmlAccessType.NONE)
32 public class ControllerProperties {
33
34     /**
35      * Set to store the controller properties
36      */
37     @XmlElement(name="property")
38     @XmlElementWrapper
39     @JsonIgnore
40     private Set<Property> properties;
41
42     // JAXB required constructor
43     private ControllerProperties() {
44         this.properties = null;
45     }
46
47     public ControllerProperties(Set<Property> properties) {
48         this.properties = properties;
49     }
50
51     @JsonProperty(value="properties")
52     public Map<String, Property> getMapProperties() {
53         Map<String, Property> map = new HashMap<String, Property>();
54         for (Property p : properties) {
55             map.put(p.getName(), p);
56         }
57         return map;
58     }
59
60     public void setMapProperties(Map<String, Property> propertiesMap) {
61         this.properties = new HashSet<Property>(propertiesMap.values());
62     }
63
64     public Set<Property> getProperties() {
65         return properties;
66     }
67
68     public void setProperties(Set<Property> properties) {
69         this.properties = properties;
70     }
71 }