Provide northbound for controller properties
[controller.git] / opendaylight / northbound / controllermanager / src / main / java / org / opendaylight / controller / controllermanager / northbound / ControllerProperties.java
1 package org.opendaylight.controller.controllermanager.northbound;
2
3 import java.util.HashMap;
4 import java.util.HashSet;
5 import java.util.Map;
6 import java.util.Set;
7
8 import javax.xml.bind.annotation.XmlAccessType;
9 import javax.xml.bind.annotation.XmlAccessorType;
10 import javax.xml.bind.annotation.XmlElementRef;
11 import javax.xml.bind.annotation.XmlElementWrapper;
12 import javax.xml.bind.annotation.XmlRootElement;
13
14 import org.codehaus.jackson.annotate.JsonIgnore;
15 import org.codehaus.jackson.annotate.JsonProperty;
16 import org.opendaylight.controller.sal.core.Property;
17
18 /**
19  * The class describes set of properties attached to a controller
20  */
21
22 @XmlRootElement
23 @XmlAccessorType(XmlAccessType.NONE)
24 public class ControllerProperties {
25
26     @XmlElementRef
27     @XmlElementWrapper
28     @JsonIgnore
29     /**
30      * Set to store the controller properties
31      */
32     private Set<Property> properties;
33
34     // JAXB required constructor
35     private ControllerProperties() {
36         this.properties = null;
37     }
38
39     public ControllerProperties(Set<Property> properties) {
40         this.properties = properties;
41     }
42
43     @JsonProperty(value="properties")
44     public Map<String, Property> getMapProperties() {
45         Map<String, Property> map = new HashMap<String, Property>();
46         for (Property p : properties) {
47             map.put(p.getName(), p);
48         }
49         return map;
50     }
51
52     public void setMapProperties(Map<String, Property> propertiesMap) {
53         this.properties = new HashSet<Property>(propertiesMap.values());
54     }
55
56     public Set<Property> getProperties() {
57         return properties;
58     }
59
60     public void setProperties(Set<Property> properties) {
61         this.properties = properties;
62     }
63 }