1 7 8 package com.sun.corba.se.impl.ior; 9 10 import org.omg.CORBA_2_3.portable.OutputStream ; 11 12 import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; 13 14 import com.sun.corba.se.spi.orb.ORB ; 15 16 import com.sun.corba.se.spi.ior.ObjectId ; 17 import com.sun.corba.se.spi.ior.ObjectKey ; 18 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; 19 20 import com.sun.corba.se.impl.encoding.EncapsOutputStream ; 21 22 25 public class ObjectKeyImpl implements ObjectKey 26 { 27 private ObjectKeyTemplate oktemp; 28 private ObjectId id; 29 30 public boolean equals( Object obj ) 31 { 32 if (obj == null) 33 return false ; 34 35 if (!(obj instanceof ObjectKeyImpl)) 36 return false ; 37 38 ObjectKeyImpl other = (ObjectKeyImpl)obj ; 39 40 return oktemp.equals( other.oktemp ) && 41 id.equals( other.id ) ; 42 } 43 44 public int hashCode() 45 { 46 return oktemp.hashCode() ^ id.hashCode() ; 47 } 48 49 public ObjectKeyTemplate getTemplate() 50 { 51 return oktemp ; 52 } 53 54 public ObjectId getId() 55 { 56 return id ; 57 } 58 59 public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id ) 60 { 61 this.oktemp = oktemp ; 62 this.id = id ; 63 } 64 65 public void write( OutputStream os ) 66 { 67 oktemp.write( id, os ) ; 68 } 69 70 public byte[] getBytes( org.omg.CORBA.ORB orb ) 71 { 72 EncapsOutputStream os = new EncapsOutputStream( (ORB)orb ) ; 73 write( os ) ; 74 return os.toByteArray() ; 75 } 76 77 public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb ) 78 { 79 return oktemp.getServerRequestDispatcher( orb, id ) ; 80 } 81 } 82 | Popular Tags |