Bug-590: Packet loss on first time ping test
[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 import javax.xml.bind.annotation.XmlAccessType;
15 import javax.xml.bind.annotation.XmlAccessorType;
16 import javax.xml.bind.annotation.XmlElementRef;
17 import javax.xml.bind.annotation.XmlElementWrapper;
18 import javax.xml.bind.annotation.XmlRootElement;
19
20 import com.fasterxml.jackson.annotation.JsonIgnore;
21 import com.fasterxml.jackson.annotation.JsonProperty;
22 import org.opendaylight.controller.sal.core.Property;
23
24 /**
25  * The class describes set of properties attached to a controller
26  */
27
28 @XmlRootElement
29 @XmlAccessorType(XmlAccessType.NONE)
30 public class ControllerProperties {
31
32     @XmlElementRef
33     @XmlElementWrapper
34     @JsonIgnore
35     /**
36      * Set to store the controller properties
37      */
38     private Set<Property> properties;
39
40     // JAXB required constructor
41     private ControllerProperties() {
42         this.properties = null;
43     }
44
45     public ControllerProperties(Set<Property> properties) {
46         this.properties = properties;
47     }
48
49     @JsonProperty(value="properties")
50     public Map<String, Property> getMapProperties() {
51         Map<String, Property> map = new HashMap<String, Property>();
52         for (Property p : properties) {
53             map.put(p.getName(), p);
54         }
55         return map;
56     }
57
58     public void setMapProperties(Map<String, Property> propertiesMap) {
59         this.properties = new HashSet<Property>(propertiesMap.values());
60     }
61
62     public Set<Property> getProperties() {
63         return properties;
64     }
65
66     public void setProperties(Set<Property> properties) {
67         this.properties = properties;
68     }
69 }