add documentation to the mapping service TELSDN-568: #close
[lispflowmapping.git] / mappingservice / implementation / src / main / java / org / opendaylight / lispflowmapping / implementation / authentication / LispAuthenticationFactory.java
1 /*
2  * Copyright (c) 2013 Contextream, 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.lispflowmapping.implementation.authentication;
9
10 import java.util.HashMap;
11 import java.util.Map;
12
13 public class LispAuthenticationFactory {
14
15     private static Map<LispKeyIDEnum, ILispAuthentication> keyIDToAuthenticationMap;
16
17     private static void initializeMap() {
18         keyIDToAuthenticationMap = new HashMap<LispKeyIDEnum, ILispAuthentication>();
19         keyIDToAuthenticationMap.put(LispKeyIDEnum.NONE, LispNoAuthentication.getInstance());
20         keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA1, new LispMACAuthentication(LispKeyIDEnum.SHA1.getAuthenticationName()));
21         keyIDToAuthenticationMap.put(LispKeyIDEnum.SHA256, new LispMACAuthentication(LispKeyIDEnum.SHA256.getAuthenticationName()));
22         keyIDToAuthenticationMap.put(LispKeyIDEnum.UNKNOWN, LispNoAuthentication.getInstance());
23
24     }
25
26     public static ILispAuthentication getAuthentication(LispKeyIDEnum keyID) {
27         if (keyIDToAuthenticationMap == null) {
28             initializeMap();
29         }
30         return keyIDToAuthenticationMap.get(keyID);
31     }
32
33 }