OpenDaylight Controller functional modules.
[controller.git] / opendaylight / usermanager / src / main / java / org / opendaylight / controller / usermanager / internal / ServerConfig.java
1
2 /*
3  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
7  * and is available at http://www.eclipse.org/legal/epl-v10.html
8  */
9
10 package org.opendaylight.controller.usermanager.internal;
11
12 import java.io.Serializable;
13
14 import org.apache.commons.lang3.builder.EqualsBuilder;
15 import org.apache.commons.lang3.builder.HashCodeBuilder;
16
17 /**
18  * Configuration Java Object which represents a Remote AAA server configuration
19  * information for User Manager.
20  */
21 public class ServerConfig implements Serializable {
22     private static final long serialVersionUID = 1L;
23
24     // Order matters: JSP file expects following fields in the following order
25     private String ip;
26     private String secret;
27     private String protocol;
28
29     public ServerConfig() {
30     }
31
32     public String getAddress() {
33         return ip;
34     }
35
36     public String getSecret() {
37         return secret;
38     }
39
40     public String getProtocol() {
41         return protocol;
42     }
43
44     @Override
45     public int hashCode() {
46         return HashCodeBuilder.reflectionHashCode(this);
47     }
48
49     @Override
50     public boolean equals(Object obj) {
51         return EqualsBuilder.reflectionEquals(this, obj);
52     }
53
54     public boolean isValid() {
55         return (ip != null && !ip.isEmpty() && secret != null && !secret
56                 .isEmpty());
57     }
58 }