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