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.cfc.ComponentAccess; 018 import railo.runtime.type.dt.DateTime; 019 import railo.runtime.type.util.ComponentUtil; 020 import railo.runtime.type.util.StructSupport; 021 022 public final class ComponentWrap extends StructSupport implements ComponentPro, Objects { 023 024 private int access; 025 private ComponentAccess component; 026 private ComponentImpl ci; 027 028 /** 029 * constructor of the class 030 * @param access 031 * @param component 032 * @throws ExpressionException 033 */ 034 public ComponentWrap(int access, ComponentAccess component) { 035 this.access=access; 036 this.component=component; 037 } 038 039 public static ComponentWrap toComponentWrap(int access, Component component) throws ExpressionException { 040 return new ComponentWrap(access, ComponentUtil.toComponentAccess(component)); 041 } 042 043 044 public Page getPage(){ 045 return component.getPage(); 046 } 047 048 /** 049 * @see railo.runtime.ComponentPro#getPageSource() 050 */ 051 public PageSource getPageSource(){ 052 return component.getPageSource(); 053 } 054 055 /** 056 * @see railo.runtime.Component#keySet() 057 */ 058 public Set keySet() { 059 return component.keySet(access); 060 } 061 062 /** 063 * @see railo.runtime.Component#getDisplayName() 064 */ 065 public String getDisplayName() { 066 return component.getDisplayName(); 067 } 068 069 /** 070 * @see railo.runtime.Component#getExtends() 071 */ 072 public String getExtends() { 073 return component.getExtends(); 074 } 075 076 /** 077 * @see railo.runtime.Component#getHint() 078 */ 079 public String getHint() { 080 return component.getHint(); 081 } 082 083 /** 084 * @see railo.runtime.Component#getName() 085 */ 086 public String getName() { 087 return component.getName(); 088 } 089 090 /** 091 * @see railo.runtime.Component#getCallName() 092 */ 093 public String getCallName() { 094 return component.getCallName(); 095 } 096 097 /** 098 * @see railo.runtime.Component#getAbsName() 099 */ 100 public String getAbsName() { 101 return component.getAbsName(); 102 } 103 104 /** 105 * @see railo.runtime.ComponentPro#getBaseAbsName() 106 */ 107 public String getBaseAbsName() { 108 return component.getBaseAbsName(); 109 } 110 111 public boolean isBasePeristent() { 112 return component.isPersistent(); 113 } 114 115 /* * 116 * @see railo.runtime.Component#getBase() 117 * / 118 public Component getBase() { 119 return component.getBaseComponent(); 120 }*/ 121 122 /* * 123 * @see railo.runtime.Component#getBaseComponent() 124 * / 125 public Component getBaseComponent() { 126 return component.getBaseComponent(); 127 }*/ 128 129 /** 130 * @see railo.runtime.Component#getOutput() 131 */ 132 public boolean getOutput() { 133 return component.getOutput(); 134 } 135 136 /** 137 * @see railo.runtime.Component#instanceOf(java.lang.String) 138 */ 139 public boolean instanceOf(String type) { 140 return component.instanceOf(type); 141 } 142 143 /** 144 * @see railo.runtime.Component#isValidAccess(int) 145 */ 146 public boolean isValidAccess(int access) { 147 return component.isValidAccess(access); 148 } 149 150 /** 151 * @see railo.runtime.Component#getMetaData(railo.runtime.PageContext) 152 */ 153 public Struct getMetaData(PageContext pc) throws PageException { 154 return component.getMetaData(pc); 155 } 156 157 /** 158 * @see railo.runtime.Component#call(railo.runtime.PageContext, java.lang.String, java.lang.Object[]) 159 */ 160 public Object call(PageContext pc, String key, Object[] args) throws PageException { 161 return call(pc, KeyImpl.init(key), args); 162 } 163 164 /** 165 * @see railo.runtime.type.Objects#call(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object[]) 166 */ 167 public Object call(PageContext pc, Collection.Key key, Object[] args) throws PageException { 168 return component.call(pc,access,key,args); 169 } 170 171 /** 172 * @see railo.runtime.Component#callWithNamedValues(railo.runtime.PageContext, java.lang.String, railo.runtime.type.Struct) 173 */ 174 public Object callWithNamedValues(PageContext pc, String key, Struct args)throws PageException { 175 return callWithNamedValues(pc,KeyImpl.init(key),args); 176 } 177 178 /** 179 * @see railo.runtime.type.Objects#callWithNamedValues(railo.runtime.PageContext, railo.runtime.type.Collection.Key, railo.runtime.type.Struct) 180 */ 181 public Object callWithNamedValues(PageContext pc, Collection.Key key, Struct args) throws PageException { 182 return component.callWithNamedValues(pc,access,key,args); 183 } 184 185 /** 186 * @see railo.runtime.type.Collection#size() 187 */ 188 public int size() { 189 return component.size(access); 190 } 191 192 /** 193 * @see railo.runtime.type.Collection#keysAsString() 194 */ 195 public String[] keysAsString() { 196 return component.keysAsString(access); 197 } 198 199 /** 200 * @see railo.runtime.type.Collection#keys() 201 */ 202 public Collection.Key[] keys() { 203 return component.keys(access); 204 } 205 206 /** 207 * 208 * @see railo.runtime.type.Collection#remove(railo.runtime.type.Collection.Key) 209 */ 210 public Object remove(Collection.Key key) throws PageException { 211 return component.remove(key); 212 } 213 214 215 /** 216 * 217 * @see railo.runtime.type.Collection#removeEL(railo.runtime.type.Collection.Key) 218 */ 219 public Object removeEL(Collection.Key key) { 220 return component.removeEL(key); 221 } 222 223 /** 224 * @see railo.runtime.type.Collection#clear() 225 */ 226 public void clear() { 227 component.clear(); 228 } 229 230 /** 231 * 232 * @see railo.runtime.type.Collection#get(railo.runtime.type.Collection.Key) 233 */ 234 public Object get(Collection.Key key) throws PageException { 235 return component.get(access,key); 236 } 237 238 /** 239 * 240 * @see railo.runtime.type.Collection#get(railo.runtime.type.Collection.Key, java.lang.Object) 241 */ 242 public Object get(Collection.Key key, Object defaultValue) { 243 return component.get(access,key, defaultValue); 244 } 245 246 /** 247 * 248 * @see railo.runtime.type.Collection#set(railo.runtime.type.Collection.Key, java.lang.Object) 249 */ 250 public Object set(Collection.Key key, Object value) throws PageException { 251 return component.set(key,value); 252 } 253 254 /** 255 * 256 * @see railo.runtime.type.Collection#setEL(railo.runtime.type.Collection.Key, java.lang.Object) 257 */ 258 public Object setEL(Collection.Key key, Object value) { 259 return component.setEL(key,value); 260 } 261 262 /** 263 * @see railo.runtime.type.Iteratorable#keyIterator() 264 */ 265 public Iterator keyIterator() { 266 return component.iterator(access); 267 } 268 269 /** 270 * @see railo.runtime.type.Collection#containsKey(railo.runtime.type.Collection.Key) 271 */ 272 public boolean containsKey(Collection.Key key) { 273 return component.get(access,key,null)!=null; 274 } 275 276 /** 277 * @see railo.runtime.dump.Dumpable#toDumpData(railo.runtime.PageContext, int) 278 */ 279 public DumpData toDumpData(PageContext pageContext, int maxlevel, DumpProperties dp) { 280 return component.toDumpData(pageContext,maxlevel,dp,access); 281 } 282 283 /** 284 * @see railo.runtime.op.Castable#castToString() 285 */ 286 public String castToString() throws PageException { 287 return component.castToString(); 288 } 289 290 /** 291 * @see railo.runtime.type.util.StructSupport#castToString(java.lang.String) 292 */ 293 public String castToString(String defaultValue) { 294 return component.castToString(defaultValue); 295 } 296 297 /** 298 * @see railo.runtime.op.Castable#castToBooleanValue() 299 */ 300 public boolean castToBooleanValue() throws PageException { 301 return component.castToBooleanValue(); 302 } 303 304 /** 305 * @see railo.runtime.op.Castable#castToBoolean(java.lang.Boolean) 306 */ 307 public Boolean castToBoolean(Boolean defaultValue) { 308 return component.castToBoolean(defaultValue); 309 } 310 311 /** 312 * @see railo.runtime.op.Castable#castToDoubleValue() 313 */ 314 public double castToDoubleValue() throws PageException { 315 return component.castToDoubleValue(); 316 } 317 318 /** 319 * @see railo.runtime.op.Castable#castToDoubleValue(double) 320 */ 321 public double castToDoubleValue(double defaultValue) { 322 return component.castToDoubleValue(defaultValue); 323 } 324 325 /** 326 * @see railo.runtime.op.Castable#castToDateTime() 327 */ 328 public DateTime castToDateTime() throws PageException { 329 return component.castToDateTime(); 330 } 331 332 /** 333 * @see railo.runtime.op.Castable#castToDateTime(railo.runtime.type.dt.DateTime) 334 */ 335 public DateTime castToDateTime(DateTime defaultValue) { 336 return component.castToDateTime(defaultValue); 337 } 338 339 340 /** 341 * @throws PageException 342 * @see railo.runtime.op.Castable#compare(boolean) 343 */ 344 public int compareTo(boolean b) throws PageException { 345 return component.compareTo(b); 346 } 347 348 /** 349 * @see railo.runtime.op.Castable#compareTo(railo.runtime.type.dt.DateTime) 350 */ 351 public int compareTo(DateTime dt) throws PageException { 352 return component.compareTo(dt); 353 } 354 355 /** 356 * @see railo.runtime.op.Castable#compareTo(String) 357 */ 358 public int compareTo(String str) throws PageException { 359 return component.compareTo(str); 360 } 361 362 /** 363 * @see railo.runtime.op.Castable#compareTo(double) 364 */ 365 public int compareTo(double d) throws PageException { 366 return component.compareTo(d); 367 } 368 369 /** 370 * 371 * @see railo.runtime.type.ContextCollection#get(railo.runtime.PageContext, java.lang.String, java.lang.Object) 372 */ 373 public Object get(PageContext pc, String key, Object defaultValue) { 374 return get(pc,KeyImpl.init(key),defaultValue); 375 } 376 377 /** 378 * 379 * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 380 */ 381 public Object get(PageContext pc, Collection.Key key, Object defaultValue) { 382 return component.get(access,key,defaultValue); 383 } 384 385 /** 386 * @see railo.runtime.type.ContextCollection#get(railo.runtime.PageContext, java.lang.String) 387 */ 388 public Object get(PageContext pc, String key) throws PageException { 389 return get(pc,KeyImpl.init(key)); 390 } 391 392 /** 393 * @see railo.runtime.type.Objects#get(railo.runtime.PageContext, railo.runtime.type.Collection.Key) 394 */ 395 public Object get(PageContext pc, Collection.Key key) throws PageException { 396 return component.get(access,key); 397 } 398 399 /** 400 * @see railo.runtime.type.Collection#duplicate(boolean) 401 */ 402 public Collection duplicate(boolean deepCopy) { 403 return new ComponentWrap(access,(ComponentAccess) component.duplicate(deepCopy)); 404 } 405 406 /** 407 * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, java.lang.String, java.lang.Object) 408 */ 409 public Object set(PageContext pc, String propertyName, Object value) throws PageException { 410 return component.set(propertyName,value); 411 } 412 413 /** 414 * 415 * @see railo.runtime.type.Objects#set(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 416 */ 417 public Object set(PageContext pc, Collection.Key propertyName, Object value) throws PageException { 418 return component.set(propertyName,value); 419 } 420 421 /** 422 * 423 * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext, java.lang.String, java.lang.Object) 424 */ 425 public Object setEL(PageContext pc, String propertyName, Object value) { 426 return component.setEL(propertyName,value); 427 } 428 429 /** 430 * @see railo.runtime.type.Objects#setEL(railo.runtime.PageContext, railo.runtime.type.Collection.Key, java.lang.Object) 431 */ 432 public Object setEL(PageContext pc, Key propertyName, Object value) { 433 return component.setEL(propertyName,value); 434 } 435 436 /** 437 * @see railo.runtime.type.Objects#isInitalized() 438 */ 439 public boolean isInitalized() { 440 return component.isInitalized(); 441 } 442 443 /** 444 * 445 * @see railo.runtime.Component#getAccess() 446 */ 447 public int getAccess() { 448 return access; 449 } 450 451 /** 452 * 453 * @see railo.runtime.Component#getJavaAccessClass(railo.commons.lang.types.RefBoolean) 454 */ 455 public Class getJavaAccessClass(RefBoolean isNew) throws PageException { 456 return component.getJavaAccessClass(isNew); 457 } 458 459 public String getWSDLFile() { 460 return component.getWSDLFile(); 461 } 462 463 /** 464 * @see railo.runtime.ComponentPro#getProperties() 465 */ 466 public Property[] getProperties(boolean onlyPeristent) { 467 return component.getProperties(onlyPeristent); 468 } 469 470 /** 471 * @see railo.runtime.ComponentPro#getComponentScope() 472 */ 473 public ComponentScope getComponentScope(){ 474 return component.getComponentScope(); 475 } 476 477 public ComponentAccess getComponentAccess() { 478 return component; 479 } 480 481 /** 482 * @see railo.runtime.ComponentPro#contains(railo.runtime.PageContext, railo.runtime.type.Collection.Key) 483 */ 484 public boolean contains(PageContext pc, Key key) { 485 return component.contains(access,key); 486 } 487 488 /** 489 * @see railo.runtime.ComponentPro#getMember(int, railo.runtime.type.Collection.Key, boolean, boolean) 490 */ 491 public Member getMember(int access, Key key, boolean dataMember,boolean superAccess) { 492 return component.getMember(access, key, dataMember, superAccess); 493 } 494 495 /** 496 * @see railo.runtime.ComponentPro#setProperty(railo.runtime.component.Property) 497 */ 498 public void setProperty(Property property) throws PageException { 499 component.setProperty(property); 500 } 501 502 public boolean equalTo(String type) { 503 return component.equalTo(type); 504 } 505 }