1. /*
  2. * @(#)POAObjectKeyTemplate.java 1.24 04/03/01
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.corba.se.impl.ior;
  8. import java.util.Iterator ;
  9. import org.omg.CORBA_2_3.portable.InputStream ;
  10. import org.omg.CORBA_2_3.portable.OutputStream ;
  11. import org.omg.CORBA.OctetSeqHolder ;
  12. import com.sun.corba.se.spi.activation.POANameHelper ;
  13. import com.sun.corba.se.spi.orb.ORB ;
  14. import com.sun.corba.se.spi.orb.ORBVersion ;
  15. import com.sun.corba.se.spi.orb.ORBVersionFactory ;
  16. import com.sun.corba.se.spi.ior.ObjectAdapterId ;
  17. import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
  18. /**
  19. * @author
  20. */
  21. public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase
  22. {
  23. /** This constructor reads the template ONLY from the stream.
  24. */
  25. public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
  26. {
  27. super( orb, magic, scid, is.read_long(), is.read_string(),
  28. new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
  29. setORBVersion( is ) ;
  30. }
  31. /** This constructor reads a complete ObjectKey (template and Id)
  32. * from the stream.
  33. */
  34. public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
  35. OctetSeqHolder osh )
  36. {
  37. super( orb, magic, scid, is.read_long(), is.read_string(),
  38. new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
  39. osh.value = readObjectKey( is ) ;
  40. setORBVersion( is ) ;
  41. }
  42. public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid,
  43. ObjectAdapterId objectAdapterId)
  44. {
  45. super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid,
  46. objectAdapterId ) ;
  47. setORBVersion( ORBVersionFactory.getORBVersion() ) ;
  48. }
  49. public void writeTemplate(OutputStream os)
  50. {
  51. os.write_long( getMagic() ) ;
  52. os.write_long( getSubcontractId() ) ;
  53. os.write_long( getServerId() ) ;
  54. os.write_string( getORBId() ) ;
  55. getObjectAdapterId().write( os ) ;
  56. }
  57. }