KickJava   Java API By Example, From Geeks To Geeks.

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


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: 10.04.2007 - 22:49:25
9  * Last author: $Author: danielgalan $
10  * Last modified: $Date: 2007/05/02 21:38:37 $
11  * Revision: $Revision: 1.2 $
12  *
13  * $Log: Resource.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  * Represents a Cached Resource
25  *
26  * @author Daniel Galán y Martins
27  * @version $Revision: 1.2 $
28  */

29 public class Resource {
30
31     private String JavaDoc shortQualifiedPath;
32     private String JavaDoc fullQualifiedPath;
33     private String JavaDoc minifedResource;
34     private byte[] gzippedResource;
35     private int minifiedHashcode;
36     private long fileTimestamp;
37     private boolean combined;
38
39
40     public Resource(boolean combined, int minifiedHashcode) {
41         setCombined(combined);
42         this.minifiedHashcode = minifiedHashcode;
43     }
44
45
46     protected void setCombined(boolean combined) {
47         this.combined = combined;
48     }
49
50
51     public boolean isCombined() {
52         return combined;
53     }
54
55
56     public long getFileTimestamp() {
57         if (isCombined()) {
58             return -1;
59         }
60         return fileTimestamp;
61     }
62
63
64     public void setFileTimestamp(long fileTimestamp) {
65         this.fileTimestamp = fileTimestamp;
66     }
67
68
69     public String JavaDoc getFullQualifiedPath() {
70         return fullQualifiedPath;
71     }
72
73
74     public void setFullQualifiedPath(String JavaDoc fullQualifiedPath) {
75         this.fullQualifiedPath = fullQualifiedPath;
76     }
77
78
79     public byte[] getGzippedResource() {
80         return gzippedResource;
81     }
82
83
84     public void setGzippedResource(byte[] gzippedResource) {
85         this.gzippedResource = gzippedResource;
86     }
87
88
89     public String JavaDoc getMinifedResource() {
90         return minifedResource;
91     }
92
93
94     public void setMinifedResource(String JavaDoc minifedResource) {
95         this.minifedResource = minifedResource;
96         // I don't set the minified hashcode here, because
97
// cachetype "file" doesn't need to pollute the memory
98
// therefore I set the hashcode in the constructor.
99
// And recalculating the hashcode here isn't usefull.
100
}
101
102
103     public int getMinifiedHashcode() {
104         return minifiedHashcode;
105     }
106
107
108     public String JavaDoc getShortQualifiedPath() {
109         return shortQualifiedPath;
110     }
111
112
113     public void setShortQualifiedPath(String JavaDoc shortQualifiedPath) {
114         this.shortQualifiedPath = shortQualifiedPath;
115     }
116
117
118     public String JavaDoc toString() {
119         return getShortQualifiedPath() + "@" + getMinifiedHashcode();
120     }
121 }
122
Popular Tags