1. /*
  2. * @(#)ObjectKey.java 1.15 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. //Source file: J:/ws/serveractivation/src/share/classes/com.sun.corba.se.internal.ior/ObjectKey.java
  8. package com.sun.corba.se.internal.ior;
  9. import com.sun.corba.se.internal.ior.Writeable ;
  10. import com.sun.corba.se.internal.ior.ObjectKeyTemplate ;
  11. import com.sun.corba.se.internal.ior.ObjectId ;
  12. import org.omg.CORBA_2_3.portable.OutputStream ;
  13. import org.omg.CORBA.ORB ;
  14. import com.sun.corba.se.internal.corba.EncapsOutputStream ;
  15. /**
  16. * @author
  17. */
  18. public class ObjectKey implements Writeable
  19. {
  20. private ObjectKeyTemplate template;
  21. private ObjectId id;
  22. public boolean equals( Object obj )
  23. {
  24. if (obj == null)
  25. return false ;
  26. if (!(obj instanceof ObjectKey))
  27. return false ;
  28. ObjectKey other = (ObjectKey)obj ;
  29. return template.equals( other.template ) &&
  30. id.equals( other.id ) ;
  31. }
  32. public ObjectKeyTemplate getTemplate()
  33. {
  34. return template ;
  35. }
  36. public ObjectId getId()
  37. {
  38. return id ;
  39. }
  40. public ObjectKey( ObjectKeyTemplate template, ObjectId id )
  41. {
  42. this.template = template ;
  43. this.id = id ;
  44. }
  45. public void write( OutputStream os )
  46. {
  47. template.write( id, os ) ;
  48. }
  49. public byte[] getBytes( ORB orb )
  50. {
  51. EncapsOutputStream os = new EncapsOutputStream( orb ) ;
  52. write( os ) ;
  53. return os.toByteArray() ;
  54. }
  55. }