Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/artifacts/cache/CacheFactory.java @ 171:7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
gnv-artifacts/trunk@208 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 09 Oct 2009 07:54:48 +0000 |
parents | bb45c5097cb6 |
children | 9a828e5a2390 |
comparison
equal
deleted
inserted
replaced
170:7be22e76c270 | 171:7fb9441dd8af |
---|---|
8 | 8 |
9 import org.apache.log4j.Logger; | 9 import org.apache.log4j.Logger; |
10 | 10 |
11 /** | 11 /** |
12 * @author Tim Englich <tim.englich@intevation.de> | 12 * @author Tim Englich <tim.englich@intevation.de> |
13 * | 13 * |
14 */ | 14 */ |
15 public class CacheFactory { | 15 public class CacheFactory { |
16 | 16 |
17 /** | 17 /** |
18 * the logger, used to log exceptions and additonaly information | 18 * the logger, used to log exceptions and additonaly information |
19 */ | 19 */ |
20 private static Logger log = Logger.getLogger(CacheFactory.class); | 20 private static Logger log = Logger.getLogger(CacheFactory.class); |
21 | 21 |
22 private final static String CACHENAME = "artifactdata"; | 22 private final static String CACHENAME = "artifactdata"; |
23 | 23 |
24 | |
25 /** | 24 /** |
26 * The singleton Instance of this Factory. | 25 * The singleton Instance of this Factory. |
27 */ | 26 */ |
28 private static CacheFactory instance = null; | 27 private static CacheFactory instance = null; |
29 | 28 |
39 super(); | 38 super(); |
40 } | 39 } |
41 | 40 |
42 /** | 41 /** |
43 * This Method provides an singleton Instance of this Class. | 42 * This Method provides an singleton Instance of this Class. |
43 * | |
44 * @return an singleton Instance of this Class | 44 * @return an singleton Instance of this Class |
45 */ | 45 */ |
46 public static CacheFactory getInstance(){ | 46 public static CacheFactory getInstance() { |
47 if (instance == null){ | 47 if (instance == null) { |
48 instance = new CacheFactory(); | 48 instance = new CacheFactory(); |
49 } | 49 } |
50 return instance; | 50 return instance; |
51 } | 51 } |
52 | 52 |
53 | |
54 /** | 53 /** |
55 * Getting the ConnectionPool | 54 * Getting the ConnectionPool |
55 * | |
56 * @return the ConnectionPool | 56 * @return the ConnectionPool |
57 */ | 57 */ |
58 public Cache getCache(){ | 58 public Cache getCache() { |
59 return this.cacheManager.getCache(CACHENAME); | 59 return this.cacheManager.getCache(CACHENAME); |
60 } | 60 } |
61 | 61 |
62 /** | 62 /** |
63 * Initializes the ConnectionPool. | 63 * Initializes the ConnectionPool. Should only be called once on system |
64 * Should only be called once on system startup | 64 * startup |
65 * @param properties the Properties for the Individual Configuration of the ConnectionPool | 65 * |
66 * @param properties | |
67 * the Properties for the Individual Configuration of the | |
68 * ConnectionPool | |
66 */ | 69 */ |
67 public void initializeCache(String configurationFileName){ | 70 public void initializeCache(String configurationFileName) { |
68 if (cacheManager == null){ | 71 if (cacheManager == null) { |
69 cacheManager = new CacheManager(configurationFileName); | 72 cacheManager = new CacheManager(configurationFileName); |
70 cacheManager.addCache(CACHENAME); | 73 cacheManager.addCache(CACHENAME); |
71 } | 74 } |
72 } | 75 } |
73 | 76 |
74 /** | 77 /** |
75 * Checks if the ConnectionPool has already been initialized. | 78 * Checks if the ConnectionPool has already been initialized. |
79 * | |
76 * @return true if the ConnectionPool is initialized. | 80 * @return true if the ConnectionPool is initialized. |
77 */ | 81 */ |
78 public boolean isInitialized(){ | 82 public boolean isInitialized() { |
79 return this.cacheManager != null; | 83 return this.cacheManager != null; |
80 } | 84 } |
81 | 85 |
82 } | 86 } |