1 7 8 package com.sun.corba.se.impl.ior; 9 10 import org.omg.CORBA.OctetSeqHolder ; 11 12 import org.omg.CORBA_2_3.portable.OutputStream ; 13 import org.omg.CORBA_2_3.portable.InputStream ; 14 15 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; 16 17 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; 18 import com.sun.corba.se.spi.ior.ObjectId ; 19 import com.sun.corba.se.spi.ior.ObjectAdapterId ; 20 21 import com.sun.corba.se.spi.orb.ORB ; 22 import com.sun.corba.se.spi.orb.ORBVersion ; 23 import com.sun.corba.se.spi.orb.ORBVersionFactory ; 24 25 import com.sun.corba.se.spi.logging.CORBALogDomains ; 26 27 import com.sun.corba.se.impl.orbutil.ORBConstants ; 28 29 import com.sun.corba.se.impl.encoding.CDRInputStream ; 30 31 import com.sun.corba.se.impl.logging.IORSystemException ; 32 33 36 public class WireObjectKeyTemplate implements ObjectKeyTemplate 37 { 38 private ORB orb ; 39 private IORSystemException wrapper ; 40 41 public boolean equals( Object obj ) 42 { 43 if (obj == null) 44 return false ; 45 46 return obj instanceof WireObjectKeyTemplate ; 47 } 48 49 public int hashCode() 50 { 51 return 53 ; } 54 55 private byte[] getId( InputStream is ) 56 { 57 CDRInputStream cis = (CDRInputStream)is ; 58 int len = cis.getBufferLength() ; 59 byte[] result = new byte[ len ] ; 60 cis.read_octet_array( result, 0, len ) ; 61 return result ; 62 } 63 64 public WireObjectKeyTemplate( ORB orb ) 65 { 66 initORB( orb ) ; 67 } 68 69 public WireObjectKeyTemplate( InputStream is, OctetSeqHolder osh ) 70 { 71 osh.value = getId( is ) ; 72 initORB( (ORB)(is.orb())) ; 73 } 74 75 private void initORB( ORB orb ) 76 { 77 this.orb = orb ; 78 wrapper = IORSystemException.get( orb, 79 CORBALogDomains.OA_IOR ) ; 80 } 81 82 public void write( ObjectId id, OutputStream os ) 83 { 84 byte[] key = id.getId() ; 85 os.write_octet_array( key, 0, key.length ) ; 86 } 87 88 public void write( OutputStream os ) 89 { 90 } 92 93 public int getSubcontractId() 94 { 95 return ORBConstants.DEFAULT_SCID ; 96 } 97 98 103 public int getServerId() 104 { 105 return -1 ; 106 } 107 108 public String getORBId() 109 { 110 throw wrapper.orbIdNotAvailable() ; 111 } 112 113 public ObjectAdapterId getObjectAdapterId() 114 { 115 throw wrapper.objectAdapterIdNotAvailable() ; 116 } 117 118 121 public byte[] getAdapterId() 122 { 123 throw wrapper.adapterIdNotAvailable() ; 124 } 125 126 public ORBVersion getORBVersion() 127 { 128 return ORBVersionFactory.getFOREIGN() ; 129 } 130 131 public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id ) 132 { 133 byte[] bid = id.getId() ; 134 String str = new String ( bid ) ; 135 return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( str ) ; 136 } 137 } 138 | Popular Tags |