001 package railo.runtime; 002 003 import java.util.Iterator; 004 import java.util.Set; 005 006 import railo.commons.lang.types.RefBoolean; 007 import railo.runtime.component.Member; 008 import railo.runtime.component.Property; 009 import railo.runtime.dump.DumpData; 010 import railo.runtime.dump.DumpProperties; 011 import railo.runtime.exp.ExpressionException; 012 import railo.runtime.exp.PageException; 013 import railo.runtime.type.Collection; 014 import railo.runtime.type.KeyImpl; 015 import railo.runtime.type.Objects; 016 import railo.runtime.type.Struct; 017 import railo.runtime.type.UDF; 018 import railo.runtime.type.UDFProperties; 019 import railo.runtime.type.cfc.ComponentAccess; 020 import railo.runtime.type.dt.DateTime; 021 import railo.runtime.type.util.ComponentUtil; 022 import railo.runtime.type.util.StructSupport; 023 024 public final class ComponentWrap extends StructSupport implements ComponentPro, Objects { 025 026 private int access; 027 private ComponentAccess component; 028 //private ComponentImpl ci; 029 030 /** 031 * constructor of the class 032 * @param access 033 * @param component 034 * @throws ExpressionException 035 */ 036 public ComponentWrap(int access, ComponentAccess component) { 037 this.access=access; 038 this.component=component; 039 } 040 041 public static ComponentWrap toComponentWrap(int access, Component component) throws ExpressionException { 042 return new ComponentWrap(access, ComponentUtil.toComponentAccess(component)); 043 } 044 045 @Override 046 public PageSource getPageSource(){ 047 return component.getPageSource(); 048 } 049 050 @Override 051 public Set keySet() { 052 return component.keySet(access); 053 } 054 055 @Override 056 public String getDisplayName() { 057 return component.getDisplayName(); 058 } 059 060 @Override 061 public String getExtends() { 062 return component.getExtends(); 063 } 064 065 @Override 066 public String getHint() { 067 return component.getHint(); 068 } 069 070 @Override 071 public String getName() { 072 return component.getName(); 073 } 074 075 @Override 076 public String getCallName() { 077 return component.getCallName(); 078 } 079 080 @Override 081 public String getAbsName() { 082 return component.getAbsName(); 083 } 084 085 @Override 086 public String getBaseAbsName() { 087 return component.getBaseAbsName(); 088 } 089 090 public boolean isBasePeristent() { 091 return component.isPersistent(); 092 } 093 094 @Override 095 public boolean getOutput() { 096 return component.getOutput(); 097 } 098 099 @Override 100 public boolean instanceOf(String type) { 101 return component.instanceOf(type); 102 } 103 104 @Override 105 public boolean isValidAccess(int access) { 106 return component.isValidAccess(access); 107 } 108 109 @Override 110 public Struct getMetaData(PageContext pc) throws PageException { 111 return component.getMetaData(pc); 112 } 113 114 @Override 115 public Object call(PageContext pc, String key, Object[] args) throws PageException { 116 return call(pc, KeyImpl.init(key), args); 117 } 118 119 @Override 120 public Object call(PageContext pc, Collection.Key key, Object[] args) throws PageException { 121 return component.call(pc,access,key,args); 122 } 123 124 @Override 125 public Object callWithNamedValues(PageContext pc, String key, Struct args)throws PageException { 126 return callWithNamedValues(pc,KeyImpl.init(key),args); 127 } 128 129 @Override 130 public Object callWithNamedValues(PageContext pc, Collection.Key key, Struct args) throws PageException { 131 return component.callWithNamedValues(pc,access,key,args); 132 } 133 134 @Override 135 public int size() { 136 return component.size(access); 137 } 138 139 @Override 140 public Collection.Key[] keys() { 141 return component.keys(access); 142 } 143 144 @Override 145 public Object remove(Collection.Key key) throws PageException { 146 return component.remove(key); 147 } 148 149 150 @Override 151 public Object removeEL(Collection.Key key) { 152 return component.removeEL(key); 153 } 154 155 @Override 156 public void clear() { 157 component.clear(); 158 } 159 160 @Override 161 public Object get(Collection.Key key) throws PageException { 162 return component.get(access,key); 163 } 164 165 @Override 166 public Object get(Collection.Key key, Object defaultValue) { 167 return component.get(access,key, defaultValue); 168 } 169 170 @Override 171 public Object set(Collection.Key key, Object value) throws PageException { 172 return component.set(key,value); 173 } 174 175 @Override 176 public Object setEL(Collection.Key key, Object value) { 177 return component.setEL(key,value); 178 } 179 180 @Override 181 public Iterator<Collection.Key> keyIterator() { 182 return component.keyIterator(access); 183 } 184 185 @Override 186 public Iterator<String> keysAsStringIterator() { 187 return component.keysAsStringIterator(access); 188 } 189 190 @Override 191 public Iterator<Entry<Key, Object>> entryIterator() { 192 return component.entryIterator(access); 193 } 194 195 @Override 196 public Iterator<Object> valueIterator() { 197 return component.valueIterator(access); 198 } 199 200 @Override 201 public boolean containsKey(Collection.Key key) { 202 return component.get(access,key,null)!=null; 203 } 204 205 @Override 206 public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) { 207 return component.toDumpData(pageContext,maxlevel,dp,access); 208 } 209 210 @Override 211 public String castToString() throws PageException { 212 return component.castToString(); 213 } 214 215 @Override 216 public String castToString(String defaultValue) { 217 return component.castToString(defaultValue); 218 } 219 220 @Override 221 public boolean castToBooleanValue() throws PageException { 222 return component.castToBooleanValue(); 223 } 224 225 @Override 226 public Boolean castToBoolean(Boolean defaultValue) { 227 return component.castToBoolean(defaultValue); 228 } 229 230 @Override 231 public double castToDoubleValue() throws PageException { 232 return component.castToDoubleValue(); 233 } 234 235 @Override 236 public double castToDoubleValue(double defaultValue) { 237 return component.castToDoubleValue(defaultValue); 238 } 239 240 @Override 241 public DateTime castToDateTime() throws PageException { 242 return component.castToDateTime(); 243 } 244 245 @Override 246 public DateTime castToDateTime(DateTime defaultValue) { 247 return component.castToDateTime(defaultValue); 248 } 249 250 251 @Override 252 public int compareTo(boolean b) throws PageException { 253 return component.compareTo(b); 254 } 255 256 @Override 257 public int compareTo(DateTime dt) throws PageException { 258 return component.compareTo(dt); 259 } 260 261 @Override 262 public int compareTo(String str) throws PageException { 263 return component.compareTo(str); 264 } 265 266 @Override 267 public int compareTo(double d) throws PageException { 268 return component.compareTo(d); 269 } 270 271 /*public Object get(PageContext pc, String key, Object defaultValue) { 272 return get(pc,KeyImpl.init(key),defaultValue); 273 }*/ 274 275 @Override 276 public Object get(PageContext pc, Collection.Key key, Object defaultValue) { 277 return component.get(access,key,defaultValue); 278 } 279 280 /*public Object get(PageContext pc, String key) throws PageException { 281 return get(pc,KeyImpl.init(key)); 282 }*/ 283 284 @Override 285 public Object get(PageContext pc, Collection.Key key) throws PageException { 286 return component.get(access,key); 287 } 288 289 @Override 290 public Collection duplicate(boolean deepCopy) { 291 return new ComponentWrap(access,(ComponentAccess) component.duplicate(deepCopy)); 292 } 293 294 /*public Object set(PageContext pc, String propertyName, Object value) throws PageException { 295 return component.set(propertyName,value); 296 }*/ 297 298 @Override 299 public Object set(PageContext pc, Collection.Key propertyName, Object value) throws PageException { 300 return component.set(propertyName,value); 301 } 302 303 /*public Object setEL(PageContext pc, String propertyName, Object value) { 304 return component.setEL(propertyName,value); 305 }*/ 306 307 @Override 308 public Object setEL(PageContext pc, Key propertyName, Object value) { 309 return component.setEL(propertyName,value); 310 } 311 312 public int getAccess() { 313 return access; 314 } 315 316 @Override 317 public Class getJavaAccessClass(RefBoolean isNew) throws PageException { 318 return component.getJavaAccessClass(isNew); 319 } 320 321 public String getWSDLFile() { 322 return component.getWSDLFile(); 323 } 324 325 @Override 326 public Property[] getProperties(boolean onlyPeristent) { 327 return component.getProperties(onlyPeristent); 328 } 329 330 @Override 331 public Property[] getProperties(boolean onlyPeristent, boolean includeBaseProperties, boolean overrideProperties, boolean inheritedMappedSuperClassOnly) { 332 return ((ComponentPro)component).getProperties(onlyPeristent,includeBaseProperties, overrideProperties, inheritedMappedSuperClassOnly); 333 } 334 335 @Override 336 public ComponentScope getComponentScope(){ 337 return component.getComponentScope(); 338 } 339 340 public ComponentAccess getComponentAccess() { 341 return component; 342 } 343 344 @Override 345 public boolean contains(PageContext pc, Key key) { 346 return component.contains(access,key); 347 } 348 349 public Member getMember(int access, Key key, boolean dataMember,boolean superAccess) { 350 return component.getMember(access, key, dataMember, superAccess); 351 } 352 353 @Override 354 public void setProperty(Property property) throws PageException { 355 component.setProperty(property); 356 } 357 358 public boolean equalTo(String type) { 359 return component.equalTo(type); 360 } 361 362 @Override 363 public void registerUDF(String key, UDF udf){ 364 component.registerUDF(key, udf); 365 } 366 367 @Override 368 public void registerUDF(Collection.Key key, UDF udf){ 369 component.registerUDF(key, udf); 370 } 371 372 @Override 373 public void registerUDF(String key, UDFProperties props){ 374 component.registerUDF(key, props); 375 } 376 377 @Override 378 public void registerUDF(Collection.Key key, UDFProperties props){ 379 component.registerUDF(key, props); 380 } 381 }