1 package com.atlassian.seraph.config; 2 3 6 public class SecurityConfigFactory 7 { 8 private static SecurityConfig instance; 9 10 14 public static SecurityConfig getInstance() 15 { 16 if (instance == null) 17 loadInstance(SecurityConfigImpl.DEFAULT_CONFIG_LOCATION); 18 return instance; 19 } 20 21 27 public static SecurityConfig getInstance(final String configFileLocation) 28 { 29 if (instance == null) 30 loadInstance(configFileLocation); 31 return instance; 32 } 33 34 35 36 public static void setSecurityConfig(final SecurityConfig securityConfig) 37 { 38 instance = securityConfig; 39 } 40 41 42 private static void loadInstance(final String configFileLocation) 43 { 44 try 45 { 46 instance = new SecurityConfigImpl(configFileLocation); 47 } 48 catch (ConfigurationException e) 49 { 50 e.printStackTrace(); 51 throw new RuntimeException ("Could not load security config '"+configFileLocation+"': " + e.getMessage()); 52 } 53 } 54 55 private SecurityConfigFactory() {} 57 58 } 59 | Popular Tags |