1 7 8 package com.sun.corba.se.spi.servicecontext; 9 10 import org.omg.CORBA.SystemException ; 11 import org.omg.CORBA.INTERNAL ; 12 import org.omg.CORBA_2_3.portable.InputStream ; 13 import org.omg.CORBA_2_3.portable.OutputStream ; 14 import com.sun.corba.se.spi.ior.iiop.GIOPVersion; 15 import com.sun.corba.se.spi.orb.ORB ; 16 import com.sun.corba.se.impl.encoding.CDRInputStream ; 17 import com.sun.corba.se.impl.encoding.EncapsInputStream ; 18 import com.sun.corba.se.impl.encoding.EncapsOutputStream ; 19 import com.sun.corba.se.impl.orbutil.ORBUtility ; 20 21 44 public abstract class ServiceContext { 45 48 protected ServiceContext() { } 49 50 private void dprint( String msg ) 51 { 52 ORBUtility.dprint( this, msg ) ; 53 } 54 55 62 protected ServiceContext(InputStream s, GIOPVersion gv) throws SystemException 63 { 64 in = s; 65 } 66 67 69 public abstract int getId() ; 70 71 75 public void write(OutputStream s, GIOPVersion gv) throws SystemException 76 { 77 EncapsOutputStream os = new EncapsOutputStream( (ORB)(s.orb()), gv ) ; 78 os.putEndian() ; 79 writeData( os ) ; 80 byte[] data = os.toByteArray() ; 81 82 s.write_long(getId()); 83 s.write_long(data.length); 84 s.write_octet_array(data, 0, data.length); 85 } 86 87 90 protected abstract void writeData( OutputStream os ) ; 91 92 96 protected InputStream in = null ; 97 98 public String toString() 99 { 100 return "ServiceContext[ id=" + getId() + " ]" ; 101 } 102 } 103 | Popular Tags |