1. /*
  2. * @(#)PrincipalHolder.java 1.21 00/02/02
  3. *
  4. * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package org.omg.CORBA;
  11. import org.omg.CORBA.portable.Streamable;
  12. import org.omg.CORBA.portable.InputStream;
  13. import org.omg.CORBA.portable.OutputStream;
  14. /**
  15. * A container class for values of type <code>Principal</code>
  16. * that is used to store "out" and "inout" parameters in IDL methods.
  17. * If an IDL method signature has an IDL <code>Principal</code> as an "out"
  18. * or "inout" parameter, the programmer must pass an instance of
  19. * <code>PrincipalHolder</code> as the corresponding
  20. * parameter in the method invocation; for "inout" parameters, the programmer
  21. * must also fill the "in" value to be sent to the server.
  22. * Before the method invocation returns, the ORB will fill in the
  23. * value corresponding to the "out" value returned from the server.
  24. * <P>
  25. * If <code>myPrincipalHolder</code> is an instance of <code>PrincipalHolder</code>,
  26. * the value stored in its <code>value</code> field can be accessed with
  27. * <code>myPrincipalHolder.value</code>.
  28. *
  29. * @version 1.14, 09/09/97
  30. * @since JDK1.2
  31. * @deprecated Deprecated by CORBA 2.2.
  32. */
  33. public final class PrincipalHolder implements Streamable {
  34. /**
  35. * The <code>Principal</code> value held by this <code>PrincipalHolder</code>
  36. * object.
  37. */
  38. public Principal value;
  39. /**
  40. * Constructs a new <code>PrincipalHolder</code> object with its
  41. * <code>value</code> field initialized to <code>null</code>.
  42. */
  43. public PrincipalHolder() {
  44. }
  45. /**
  46. * Constructs a new <code>PrincipalHolder</code> object with its
  47. * <code>value</code> field initialized to the given
  48. * <code>Principal</code> object.
  49. * @param initial the <code>Principal</code> with which to initialize
  50. * the <code>value</code> field of the newly-created
  51. * <code>PrincipalHolder</code> object
  52. */
  53. public PrincipalHolder(Principal initial) {
  54. value = initial;
  55. }
  56. public void _read(InputStream input) {
  57. value = input.read_Principal();
  58. }
  59. public void _write(OutputStream output) {
  60. output.write_Principal(value);
  61. }
  62. public org.omg.CORBA.TypeCode _type() {
  63. return ORB.init().get_primitive_tc(TCKind.tk_Principal);
  64. }
  65. }