KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > packtag > cache > PackCache


1 /**
2  * Project pack:tag >> http://packtag.sf.net
3  *
4  * This software is published under the terms of the LGPL
5  * License version 2.1, a copy of which has been included with this
6  * distribution in the 'lgpl.txt' file.
7  *
8  * Creation date: 12.04.2007 - 21:46:36
9  * Last author: $Author: danielgalan $
10  * Last modified: $Date: 2007/05/02 21:38:37 $
11  * Revision: $Revision: 1.2 $
12  *
13  * $Log: PackCache.java,v $
14  * Revision 1.2 2007/05/02 21:38:37 danielgalan
15  * alias to name
16  *
17  * Revision 1.1 2007/04/22 19:04:21 danielgalan
18  * pack.tag moved from subversion to good old CVS
19  *
20  */

21 package net.sf.packtag.cache;
22
23 /**
24  * Singleton to the Cache
25  *
26  * @author Daniel Galán y Martins
27  * @version $Revision: 1.2 $
28  */

29 public class PackCache {
30
31     private static PackCache instance;
32     private ResourceCache resourceCache = new ResourceCache();
33
34
35     private static PackCache getInstance() {
36         if (instance == null) {
37             synchronized (PackCache.class) {
38                 if (instance == null) {
39                     instance = new PackCache();
40                 }
41             }
42         }
43         return instance;
44     }
45
46
47     private ResourceCache getResourceCache() {
48         return resourceCache;
49     }
50
51
52     public static Resource getResourceBySqp(String JavaDoc sqp) {
53         return getInstance().getResourceCache().getResourceBySqp(sqp);
54     }
55
56
57     public static Resource getResourceByFqp(String JavaDoc fqp) {
58         return getInstance().getResourceCache().getResourceByFqp(fqp);
59     }
60
61
62     public static boolean existResource(String JavaDoc sqp) {
63         return getInstance().getResourceCache().existResource(sqp);
64     }
65
66
67     public static void store(Resource resource, boolean clearDependingCombinedResources) {
68         getInstance().getResourceCache().store(resource, clearDependingCombinedResources);
69     }
70
71
72     public static void clearCache() {
73         getInstance().getResourceCache().clearCache();
74     }
75
76 }
77
Popular Tags