1 17 package org.apache.excalibur.source.impl; 18 19 import java.io.IOException ; 20 import java.io.InputStream ; 21 22 import org.apache.excalibur.source.Source; 23 import org.apache.excalibur.source.SourceException; 24 import org.apache.excalibur.source.SourceValidity; 25 26 32 33 public abstract class AbstractSource 34 implements Source 35 { 36 private boolean m_gotInfos; 37 private long m_lastModificationDate; 38 private long m_contentLength; 39 private String m_systemId; 40 41 private String m_scheme; 42 43 48 protected void getInfos() 49 { 50 this.m_contentLength = -1; 51 this.m_lastModificationDate = 0; 52 } 53 54 protected void checkInfos() 55 { 56 if( !m_gotInfos ) 57 { 58 getInfos(); 59 m_gotInfos = true; 60 } 61 } 62 63 70 public InputStream getInputStream() 71 throws IOException , SourceException 72 { 73 return null; 74 } 75 76 79 public String getURI() 80 { 81 return m_systemId; 82 } 83 84 87 public String getScheme() 88 { 89 return this.m_scheme; 90 } 91 92 98 public SourceValidity getValidity() 99 { 100 return null; 101 } 102 103 107 public void refresh() 108 { 109 m_gotInfos = false; 110 } 111 112 117 public String getMimeType() 118 { 119 return null; 120 } 121 122 126 public long getContentLength() 127 { 128 checkInfos(); 129 return this.m_contentLength; 130 } 131 132 136 public long getLastModified() 137 { 138 checkInfos(); 139 return this.m_lastModificationDate; 140 } 141 145 protected void setContentLength(long contentLength) 146 { 147 m_contentLength = contentLength; 148 } 149 150 154 protected void setLastModified(long lastModificationDate) 155 { 156 m_lastModificationDate = lastModificationDate; 157 } 158 159 163 protected void setScheme(String scheme) 164 { 165 m_scheme = scheme; 166 } 167 168 172 protected void setSystemId(String systemId) 173 { 174 m_systemId = systemId; 175 } 176 177 } 178 | Popular Tags |