1 55 56 package org.apache.bsf.engines.activescript; 57 58 import java.util.Vector ; 59 import org.apache.bsf.*; 60 import org.apache.bsf.debug.util.DebugLog; 61 62 public final class COMIDispatchBean implements Cloneable 63 { 64 65 66 private byte[] IDispatchInterface; 68 private COMIDispatchBean(){return;} public COMIDispatchBean( byte[] pInterface) 70 { 71 IDispatchInterface= new byte[pInterface.length]; 72 System.arraycopy(pInterface,0,IDispatchInterface,0, pInterface.length); 73 } 74 public Object clone() throws CloneNotSupportedException 75 { 76 COMIDispatchBean d = null; 77 DebugLog.stdoutPrintln("cloning: " + this, DebugLog.BSF_LOG_L3); 78 try 79 { 80 81 d= (COMIDispatchBean) this.getClass().newInstance(); 82 d.IDispatchInterface= new byte[this.IDispatchInterface.length]; 83 System.arraycopy(this.IDispatchInterface,0,d.IDispatchInterface,0, this.IDispatchInterface.length); 84 ActiveScriptEngine.nativeIdispatchAddRef(d.IDispatchInterface); 85 } catch( Exception e) 86 { 87 throw new CloneNotSupportedException (); 88 } 89 DebugLog.stdoutPrintln("cloning: returned : " + d, DebugLog.BSF_LOG_L3); 90 return d; 91 } 92 public static COMIDispatchBean COMIDispatchBeanFactory( byte[] s) { 94 return new COMIDispatchBean(s); 95 96 } 97 protected void finalize() throws Throwable 98 { 99 100 if(null != IDispatchInterface) 101 { 102 byte[] x= IDispatchInterface ; 103 IDispatchInterface = null; 104 ActiveScriptEngine.nativeIdispatchDeleteRef(x); 105 } 106 } 107 public byte[] getIDispatchInterface() throws BSFException 108 { 109 ActiveScriptEngine.nativeIdispatchAddRef(IDispatchInterface); 110 return IDispatchInterface; 111 } 112 public String toString() 113 { 114 return this.getClass().toString() + ":" + this.hashCode() + IDispatchInterface[3] + IDispatchInterface[2] + IDispatchInterface[1] + IDispatchInterface[0]; 115 } 116 } 117 | Popular Tags |