1 package com.sslexplorer.vfs.utils; 2 3 import java.util.HashMap ; 4 import java.util.Map ; 5 6 import com.sslexplorer.security.PasswordCredentials; 7 8 15 public class DAVCredentialsCache { 16 17 Map cache; 18 19 22 public DAVCredentialsCache() { 23 this.cache = new HashMap (); 24 } 25 26 34 public void addCredentials(String store, String name, PasswordCredentials credentials) { 35 if (cache.containsKey(store)) { 36 Map storeMap = (Map ) cache.get(store); 37 storeMap.put(name, credentials); 38 } else { 39 cache.put(store, new HashMap ()); 40 this.addCredentials(store, name, credentials); 41 } 42 } 43 44 52 public PasswordCredentials getDAVCredentials(String store, String name) { 53 Map storeMap = (Map ) cache.get(store); 54 if (storeMap != null) 55 return (PasswordCredentials) storeMap.get(name); 56 else 57 return null; 58 } 59 60 } 61 | Popular Tags |