1. /*
  2. * @(#)JIDLObjectKeyTemplate.java 1.21 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 org.omg.CORBA_2_3.portable.InputStream ;
  9. import org.omg.CORBA_2_3.portable.OutputStream ;
  10. import org.omg.CORBA.OctetSeqHolder ;
  11. import com.sun.corba.se.spi.ior.ObjectId ;
  12. import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
  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.impl.ior.ObjectKeyFactoryImpl ;
  17. /**
  18. * @author Ken Cavanaugh
  19. */
  20. public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase
  21. {
  22. /** This constructor reads the template ONLY from the stream.
  23. */
  24. public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
  25. {
  26. super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
  27. setORBVersion( is ) ;
  28. }
  29. /** This constructor reads a complete ObjectKey (template and Id)
  30. * from the stream.
  31. */
  32. public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
  33. OctetSeqHolder osh )
  34. {
  35. super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
  36. osh.value = readObjectKey( is ) ;
  37. setORBVersion( is ) ;
  38. }
  39. public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid )
  40. {
  41. super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid,
  42. JIDL_ORB_ID, JIDL_OAID ) ;
  43. setORBVersion( ORBVersionFactory.getORBVersion() ) ;
  44. }
  45. protected void writeTemplate( OutputStream os )
  46. {
  47. os.write_long( getMagic() ) ;
  48. os.write_long( getSubcontractId() ) ;
  49. os.write_long( getServerId() ) ;
  50. }
  51. }