1 package org.tigris.scarab.util; 2 3 48 49 import org.apache.turbine.RunData; 51 import org.apache.turbine.services.pull.ApplicationTool; 52 import org.apache.fulcrum.pool.InitableRecyclable; 53 54 55 61 public class StaticLink 62 implements InitableRecyclable, ApplicationTool 63 { 64 private RunData data; 65 private String path; 66 67 70 public StaticLink() 71 { 72 } 73 74 81 public void init(Object data) 82 { 83 this.data = (RunData)data; 87 } 88 89 93 public void refresh() 94 { 95 path = null; 96 } 97 98 105 public StaticLink setPath(String t) 106 { 107 path = t; 108 return this; 109 } 110 111 116 public String toString() 117 { 118 String prefix = getPrefix(); 119 return new StringBuffer (prefix.length()+path.length()) 120 .append(prefix).append(path).toString(); 121 } 122 123 129 protected String getPrefix() 130 { 131 return data.getRequest().getContextPath(); 132 } 133 134 138 protected RunData getRunData() 139 { 140 return data; 141 } 142 143 149 private boolean disposed = false; 150 151 154 public void recycle() 155 { 156 disposed = false; 157 } 158 159 162 public void dispose() 163 { 164 data = null; 165 refresh(); 166 disposed = true; 167 } 168 169 174 public boolean isDisposed() 175 { 176 return disposed; 177 } 178 } 179 | Popular Tags |