1 4 5 9 10 package org.openlaszlo.cache; 11 12 import org.apache.log4j.*; 13 14 import java.io.Serializable ; 15 import java.net.URL ; 16 import java.net.MalformedURLException ; 17 18 import org.openlaszlo.utils.ChainedException; 19 20 26 public class CachedInfo implements Serializable { 27 28 29 private static Logger mLogger = Logger.getLogger(CachedInfo.class); 30 31 32 private long mSize = 0; 33 34 35 private long mName = 0; 36 37 38 private Serializable mKey = null; 39 40 41 private Serializable mMetaData = null; 42 43 44 private boolean mInMemory = false; 45 46 48 private long mLastModified = -1; 49 50 54 private String mEncoding = null; 55 56 59 public CachedInfo(Serializable key, String encoding, boolean inMem, long name) { 60 61 mKey = key; 62 if (encoding != null) { 63 mEncoding = new String (encoding); 64 } 65 mName = name; 66 mInMemory = inMem; 67 } 68 69 72 public boolean isInMemory() { 73 return mInMemory; 74 } 75 76 79 public long getName() { 80 return mName; 81 } 82 83 86 public long getSize() { 87 return mSize; 88 } 89 90 93 public long getKeySize() { 94 if (mKey instanceof String ) { 95 return ((String )mKey).length() * 2; 96 } else { 97 return -1; 98 } 99 } 100 101 104 public long getLastModified() { 105 return mLastModified; 106 } 107 108 111 public Serializable getKey() { 112 return mKey; 113 } 114 115 118 public String getEncoding() { 119 return mEncoding; 120 } 121 122 125 Serializable getMetaData() { 126 return mMetaData; 127 } 128 129 130 133 public void setInMemory(boolean inMem) { 134 mInMemory = inMem; 135 } 136 137 140 public void setLastModified(long lm) { 141 mLastModified = lm; 142 } 143 144 147 public void setMetaData(Serializable md) { 148 mMetaData = md; 149 } 150 151 154 public void setSize(long sz) { 155 mSize = sz; 156 } 157 } 158 | Popular Tags |