blob: b527c9c3b401233430e6bda43d7541c9d7766316 [file] [log] [blame]
Jian Li712ec052016-11-22 03:23:54 +09001/*
2 * Copyright 2016-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.lisp.msg.authentication;
17
18/**
19 * A singleton class that Stores LISP authentication information.
20 */
21public final class LispAuthenticationConfig {
22
23 private String lispAuthKey;
24 private short lispAuthKeyId;
25
26 /**
27 * Obtains an authentication info singleton instance.
28 *
29 * @return authentication info singleton instance
30 */
31 public static LispAuthenticationConfig getInstance() {
32 return SingletonHelper.INSTANCE;
33 }
34
35 // non-instantiable (except for our Singleton)
36 private LispAuthenticationConfig() {
37 }
38
39 /**
40 * Updates LISP authentication key.
41 *
42 * @param lispAuthKey LISP authentication key
43 */
44 public void updateLispAuthKey(String lispAuthKey) {
45 this.lispAuthKey = lispAuthKey;
46 }
47
48 /**
49 * Updates LISP authentication key identifier.
50 *
51 * @param lispAuthKeyId LISP authentication key identifier
52 */
53 public void updateLispAuthKeyId(int lispAuthKeyId) {
54 this.lispAuthKeyId = (short) lispAuthKeyId;
55 }
56
57 /**
58 * Obtains LISP authentication key.
59 *
60 * @return LISP authentication key
61 */
62 public String lispAuthKey() {
63 return lispAuthKey;
64 }
65
66 /**
67 * Obtains LISP authentication key identifier.
68 *
69 * @return LISP authentication key identifier
70 */
71 public short lispAuthKeyId() {
72 return lispAuthKeyId;
73 }
74
75 /**
76 * Prevents object instantiation from external.
77 */
78 private static class SingletonHelper {
79 private static final LispAuthenticationConfig INSTANCE =
80 new LispAuthenticationConfig();
81 }
82}