Exception for URI /restconf/operations/module_name:rpc ended with slash
[controller.git] / opendaylight / config / config-api / src / main / java / org / opendaylight / controller / config / api / jmx / CommitStatus.java
1 /*
2  * Copyright (c) 2013 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.config.api.jmx;
9
10 import java.beans.ConstructorProperties;
11 import java.util.Collections;
12 import java.util.List;
13
14 import javax.annotation.concurrent.Immutable;
15 import javax.management.ObjectName;
16
17 @Immutable
18 public class CommitStatus {
19     private final List<ObjectName> newInstances, reusedInstances,
20             recreatedInstances;
21
22     /**
23      *
24      * @param newInstances
25      *            newly created instances
26      * @param reusedInstances
27      *            reused instances
28      * @param recreatedInstances
29      *            recreated instances
30      */
31     @ConstructorProperties({ "newInstances", "reusedInstances",
32             "recreatedInstances" })
33     public CommitStatus(List<ObjectName> newInstances,
34             List<ObjectName> reusedInstances,
35             List<ObjectName> recreatedInstances) {
36         this.newInstances = Collections.unmodifiableList(newInstances);
37         this.reusedInstances = Collections.unmodifiableList(reusedInstances);
38         this.recreatedInstances = Collections
39                 .unmodifiableList(recreatedInstances);
40     }
41
42     /**
43      *
44      * @return list of objectNames representing newly created instances
45      */
46     public List<ObjectName> getNewInstances() {
47         return newInstances;
48     }
49
50     /**
51      *
52      * @return list of objectNames representing reused instances
53      */
54     public List<ObjectName> getReusedInstances() {
55         return reusedInstances;
56     }
57
58     /**
59      *
60      * @return list of objectNames representing recreated instances
61      */
62     public List<ObjectName> getRecreatedInstances() {
63         return recreatedInstances;
64     }
65
66     @Override
67     public int hashCode() {
68         final int prime = 31;
69         int result = 1;
70         result = prime * result
71                 + ((newInstances == null) ? 0 : newInstances.hashCode());
72         result = prime
73                 * result
74                 + ((recreatedInstances == null) ? 0 : recreatedInstances
75                         .hashCode());
76         result = prime * result
77                 + ((reusedInstances == null) ? 0 : reusedInstances.hashCode());
78         return result;
79     }
80
81     @Override
82     public boolean equals(Object obj) {
83         if (this == obj)
84             return true;
85         if (obj == null)
86             return false;
87         if (getClass() != obj.getClass())
88             return false;
89         CommitStatus other = (CommitStatus) obj;
90         if (newInstances == null) {
91             if (other.newInstances != null)
92                 return false;
93         } else if (!newInstances.equals(other.newInstances))
94             return false;
95         if (recreatedInstances == null) {
96             if (other.recreatedInstances != null)
97                 return false;
98         } else if (!recreatedInstances.equals(other.recreatedInstances))
99             return false;
100         if (reusedInstances == null) {
101             if (other.reusedInstances != null)
102                 return false;
103         } else if (!reusedInstances.equals(other.reusedInstances))
104             return false;
105         return true;
106     }
107
108     @Override
109     public String toString() {
110         return "CommitStatus [newInstances=" + newInstances
111                 + ", reusedInstances=" + reusedInstances
112                 + ", recreatedInstances=" + recreatedInstances + "]";
113     }
114
115 }