1 package org.apache.velocity.runtime.resource.loader; 2 3 18 19 import java.io.InputStream ; 20 21 import org.apache.velocity.runtime.RuntimeServices; 22 23 import org.apache.velocity.runtime.resource.Resource; 24 25 import org.apache.velocity.exception.ResourceNotFoundException; 26 27 import org.apache.commons.collections.ExtendedProperties; 28 29 37 public abstract class ResourceLoader 38 { 39 43 protected boolean isCachingOn = false; 44 45 49 protected long modificationCheckInterval = 2; 50 51 55 protected String className = null; 56 57 protected RuntimeServices rsvc = null; 58 59 64 public void commonInit( RuntimeServices rs, ExtendedProperties configuration) 65 { 66 this.rsvc = rs; 67 68 75 76 isCachingOn = configuration.getBoolean("cache", false); 77 modificationCheckInterval = configuration.getLong("modificationCheckInterval", 0); 78 79 82 83 className = configuration.getString("class"); 84 } 85 86 90 public abstract void init( ExtendedProperties configuration); 91 92 96 public abstract InputStream getResourceStream( String source ) 97 throws ResourceNotFoundException; 98 99 103 public abstract boolean isSourceModified(Resource resource); 104 105 111 public abstract long getLastModified(Resource resource); 112 113 116 public String getClassName() 117 { 118 return className; 119 } 120 121 127 public void setCachingOn(boolean value) 128 { 129 isCachingOn = value; 130 } 131 132 138 public boolean isCachingOn() 139 { 140 return isCachingOn; 141 } 142 143 147 public void setModificationCheckInterval(long modificationCheckInterval) 148 { 149 this.modificationCheckInterval = modificationCheckInterval; 150 } 151 152 156 public long getModificationCheckInterval() 157 { 158 return modificationCheckInterval; 159 } 160 } 161 | Popular Tags |