1 7 8 package com.sun.corba.se.impl.ior ; 9 10 import java.util.Iterator ; 11 12 import org.omg.CORBA.portable.InputStream ; 13 import org.omg.CORBA.portable.OutputStream ; 14 import org.omg.CORBA.portable.StreamableValue ; 15 16 import org.omg.CORBA.TypeCode ; 17 18 import org.omg.PortableInterceptor.ObjectReferenceTemplate ; 19 import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ; 20 21 import com.sun.corba.se.spi.oa.ObjectAdapter ; 22 23 import com.sun.corba.se.spi.ior.ObjectId ; 24 import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; 25 import com.sun.corba.se.spi.ior.ObjectAdapterId ; 26 import com.sun.corba.se.spi.ior.IOR; 27 import com.sun.corba.se.spi.ior.IORFactory; 28 import com.sun.corba.se.spi.ior.IORTemplate; 29 import com.sun.corba.se.spi.ior.IORTemplateList; 30 import com.sun.corba.se.spi.ior.IORFactories; 31 32 import com.sun.corba.se.impl.orbutil.ORBUtility ; 33 34 import com.sun.corba.se.spi.orb.ORB ; 35 36 44 public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase 45 implements ObjectReferenceTemplate , StreamableValue 46 { 47 transient private IORTemplate iorTemplate ; 48 49 public ObjectReferenceTemplateImpl( InputStream is ) 50 { 51 super( (ORB)(is.orb()) ) ; 52 _read( is ) ; 53 } 54 55 public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp ) 56 { 57 super( orb ) ; 58 iorTemplate = iortemp ; 59 } 60 61 public boolean equals( Object obj ) 62 { 63 if (!(obj instanceof ObjectReferenceTemplateImpl)) 64 return false ; 65 66 ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ; 67 68 return (iorTemplate != null) && 69 iorTemplate.equals( other.iorTemplate ) ; 70 } 71 72 public int hashCode() 73 { 74 return iorTemplate.hashCode() ; 75 } 76 77 public static final String repositoryId = 83 "IDL:com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl:1.0" ; 84 85 public String [] _truncatable_ids() 86 { 87 return new String [] { repositoryId } ; 88 } 89 90 public TypeCode _type() 91 { 92 return ObjectReferenceTemplateHelper.type() ; 93 } 94 95 98 public void _read( InputStream is ) 99 { 100 org.omg.CORBA_2_3.portable.InputStream istr = 101 (org.omg.CORBA_2_3.portable.InputStream )is ; 102 iorTemplate = IORFactories.makeIORTemplate( istr ) ; 103 orb = (ORB)(istr.orb()) ; 104 } 105 106 108 public void _write( OutputStream os ) 109 { 110 org.omg.CORBA_2_3.portable.OutputStream ostr = 111 (org.omg.CORBA_2_3.portable.OutputStream )os ; 112 113 iorTemplate.write( ostr ) ; 114 } 115 116 public String server_id () 117 { 118 int val = iorTemplate.getObjectKeyTemplate().getServerId() ; 119 return Integer.toString( val ) ; 120 } 121 122 public String orb_id () 123 { 124 return iorTemplate.getObjectKeyTemplate().getORBId() ; 125 } 126 127 public String [] adapter_name() 128 { 129 ObjectAdapterId poaid = 130 iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ; 131 132 return poaid.getAdapterName() ; 133 } 134 135 public IORFactory getIORFactory() 136 { 137 return iorTemplate ; 138 } 139 140 public IORTemplateList getIORTemplateList() 141 { 142 IORTemplateList tl = IORFactories.makeIORTemplateList() ; 143 tl.add( iorTemplate ) ; 144 tl.makeImmutable() ; 145 return tl ; 146 } 147 } 148 | Popular Tags |