1 29 30 package com.caucho.iiop.orb; 31 32 import org.omg.CORBA.*; 33 34 import java.util.logging.Logger ; 35 import java.io.*; 36 37 import com.caucho.iiop.*; 38 import com.caucho.vfs.*; 39 40 public class StubDelegateImpl extends org.omg.CORBA.portable.Delegate 41 { 42 public static final Logger log 43 = Logger.getLogger(StubDelegateImpl.class.getName()); 44 45 private ORBImpl _orb; 46 47 StubDelegateImpl(ORBImpl orb) 48 { 49 _orb = orb; 50 } 51 52 @Override 53 public org.omg.CORBA.portable.OutputStream 54 request(org.omg.CORBA.Object self, 55 String op, 56 boolean isResponseExpected) 57 { 58 try { 59 Iiop10Writer writer = new Iiop10Writer(); 60 61 ReadWritePair pair = _orb.openReadWrite(); 62 63 MessageWriter out = new StreamMessageWriter(pair.getWriteStream()); 64 65 writer.init(out, new IiopReader(pair.getReadStream())); 66 67 byte []oid = ((StubImpl) self).getOid(); 68 69 writer.startRequest(oid, 0, oid.length, op, 1); 70 71 return writer; 72 } catch (IOException e) { 73 throw new RuntimeException (e); 74 } 75 } 76 77 @Override 78 public org.omg.CORBA.portable.InputStream 79 invoke(org.omg.CORBA.Object self, 80 org.omg.CORBA.portable.OutputStream os) 81 { 82 try { 83 IiopWriter writer = (IiopWriter) os; 84 85 IiopReader reader = writer._call(); 86 87 return reader; 88 } catch (IOException e) { 89 throw new RuntimeException (e); 90 } 91 } 92 93 @Override 94 public Request create_request(org.omg.CORBA.Object obj, 95 Context ctx, 96 String op, 97 NVList argList, 98 NamedValue result) 99 { 100 throw new UnsupportedOperationException (); 101 } 102 103 @Override 104 public Request create_request(org.omg.CORBA.Object obj, 105 Context ctx, 106 String op, 107 NVList argList, 108 NamedValue result, 109 ExceptionList excList, 110 ContextList ctxList) 111 { 112 throw new UnsupportedOperationException (); 113 } 114 115 @Override 116 public org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj) 117 { 118 return obj; 119 } 120 121 @Override 122 public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object self) 123 { 124 throw new UnsupportedOperationException (); 125 } 126 127 @Override 128 public int hash(org.omg.CORBA.Object obj, int max) 129 { 130 throw new UnsupportedOperationException (); 131 } 132 133 @Override 134 public boolean is_a(org.omg.CORBA.Object obj, String repId) 135 { 136 System.out.println("IS-A: " + obj + " " + repId); 137 Thread.dumpStack(); 138 139 return true; 140 } 141 142 @Override 143 public boolean is_equivalent(org.omg.CORBA.Object obj, 144 org.omg.CORBA.Object other) 145 { 146 return obj == other; 147 } 148 149 @Override 150 public boolean non_existent(org.omg.CORBA.Object obj) 151 { 152 throw new UnsupportedOperationException (); 153 } 154 155 @Override 156 public ORB orb(org.omg.CORBA.Object obj) 157 { 158 return _orb; 159 } 160 161 @Override 162 public void release(org.omg.CORBA.Object obj) 163 { 164 throw new UnsupportedOperationException (); 165 } 166 167 @Override 168 public Request request(org.omg.CORBA.Object obj, String op) 169 { 170 throw new UnsupportedOperationException (); 171 } 172 173 public String toString() 174 { 175 return "StubDelegateImpl[]"; 176 } 177 } 178 | Popular Tags |