1 55 56 package org.apache.bsf.engines.javascript; 57 58 import org.apache.bsf.debug.*; 59 import org.apache.bsf.debug.jsdi.*; 60 61 import org.mozilla.javascript.*; 62 import org.mozilla.javascript.debug.*; 63 64 import java.rmi.RemoteException ; 65 66 71 public class JsObjectStub 72 extends org.apache.bsf.debug.util.Skeleton 73 implements JsObject { 74 75 Scriptable m_object; 76 77 RhinoEngineDebugger m_rhinoDbg; 78 79 public JsObjectStub(RhinoEngineDebugger rhinoDbg, Scriptable object) 81 throws RemoteException { 82 super(org.apache.bsf.debug.util.DebugConstants.JS_OBJECT_TID); 83 m_rhinoDbg = rhinoDbg; 84 m_object = object; 85 } 86 public void define(String propertyName, JsObject value, int attributes) { 88 try { 89 Context.enter(); 90 } finally { 91 Context.exit(); 92 } 93 } 94 public void define(String propertyName, Object value, int attributes) { 96 try { 97 Context.enter(); 98 } finally { 99 Context.exit(); 100 } 101 } 102 public void delete(int index) { 104 try { 105 Context.enter(); 106 } finally { 107 Context.exit(); 108 } 109 } 110 public void delete(String name) { 112 try { 113 Context.enter(); 114 } finally { 115 Context.exit(); 116 } 117 } 118 public Object get(int index) throws RemoteException { 120 try { 121 Context.enter(); 122 Object prop = m_object.get(index, m_object); 123 return m_rhinoDbg.marshallProperty(prop); 124 } finally { 125 Context.exit(); 126 } 127 } 128 public Object get(String name) throws RemoteException { 130 try { 131 Context.enter(); 132 Object prop = m_object.get(name, m_object); 133 return m_rhinoDbg.marshallProperty(prop); 134 } finally { 135 Context.exit(); 136 } 137 } 138 public String getClassName() { 140 try { 141 Context.enter(); 142 return null; 143 } finally { 144 Context.exit(); 145 } 146 } 147 public Object getDefaultValue(Class hint) { 149 try { 150 Context.enter(); 151 return null; 152 } finally { 153 Context.exit(); 154 } 155 } 156 public Object [] getIds(boolean all) { 158 try { 159 Context.enter(); 160 Object ids[] = null; 161 if (all) { 162 if (m_object instanceof ScriptableObject) { 163 ScriptableObject so = (ScriptableObject) m_object; 164 ids = so.getAllIds(); 165 } else 166 ids = m_object.getIds(); 167 } else 168 ids = m_object.getIds(); 169 170 return ids; 171 } finally { 172 Context.exit(); 173 } 174 } 175 public JsObject getPrototype() throws RemoteException { 177 try { 178 Context.enter(); 179 Scriptable prot = m_object.getPrototype(); 180 return m_rhinoDbg.marshallScriptable(prot); 181 190 } finally { 191 Context.exit(); 192 } 193 } 194 public JsObject getScope() throws RemoteException { 196 try { 197 Context.enter(); 198 Scriptable obj = m_object.getParentScope(); 199 return m_rhinoDbg.marshallScriptable(obj); 200 } finally { 201 Context.exit(); 202 } 203 } 204 public boolean has(int index) { 206 try { 207 Context.enter(); 208 return false; 209 } finally { 210 Context.exit(); 211 } 212 } 213 public boolean has(String name) { 215 try { 216 Context.enter(); 217 return false; 218 } finally { 219 Context.exit(); 220 } 221 } 222 public boolean hasInstance(JsObject instance) { 224 try { 225 Context.enter(); 226 return false; 227 } finally { 228 Context.exit(); 229 } 230 } 231 public boolean isFunction() { 233 try { 234 Context.enter(); 235 return (m_object instanceof NativeFunction) 236 && !(m_object instanceof NativeScript); 237 } finally { 238 Context.exit(); 239 } 240 } 241 public boolean isScript() { 243 try { 244 Context.enter(); 245 return (m_object instanceof NativeScript); 246 } finally { 247 Context.exit(); 248 } 249 } 250 public boolean isWrapper() { 252 try { 253 Context.enter(); 254 return (m_object instanceof Wrapper); 255 } finally { 256 Context.exit(); 257 } 258 } 259 public void put(int index, Object value) { 261 262 JsObjectStub stub; 263 try { 264 265 Context.enter(); 266 267 if (value instanceof JsObject) { 268 stub = (JsObjectStub)value; 269 value = stub.m_object; 270 } 271 m_object.put(index,m_object,value); 272 } finally { 273 Context.exit(); 274 } 275 } 276 public void put(String name, Object value) { 278 JsObjectStub stub; 279 try { 280 281 Context.enter(); 282 283 if (value instanceof JsObject) { 284 stub = (JsObjectStub)value; 285 value = stub.m_object; 286 } 287 m_object.put(name,m_object,value); 288 } finally { 289 Context.exit(); 290 } 291 } 292 public void setPrototype(JsObject prototype) { 294 JsObjectStub stub; 295 Scriptable prot; 296 try { 297 Context.enter(); 298 stub = (JsObjectStub)prototype; 299 prot = stub.m_object; 300 m_object.setPrototype(prot); 301 } finally { 302 Context.exit(); 303 } 304 } 305 public void setScope(JsObject jsobj) { 307 JsObjectStub stub; 308 Scriptable scope; 309 try { 310 Context.enter(); 311 stub = (JsObjectStub)jsobj; 312 scope = stub.m_object; 313 m_object.setParentScope(scope); 314 } finally { 315 Context.exit(); 316 } 317 } 318 public Object unwrap() { 320 try { 321 Context.enter(); 322 if (m_object instanceof Wrapper) 323 return ((Wrapper) m_object).unwrap(); 324 else 325 return null; 326 } finally { 327 Context.exit(); 328 } 329 } 330 public boolean wrapsJavaObject() { 332 try { 333 Context.enter(); 334 return false; 335 } finally { 336 Context.exit(); 337 } 338 } 339 474 } 475 | Popular Tags |