1. /*
  2. * @(#)ContextList.java 1.24 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package org.omg.CORBA;
  8. /**
  9. * An object containing a modifiable list of <code>String</code> objects
  10. * that represent property names.
  11. * This class is used in <code>Request</code> operations to
  12. * describe the contexts that need to be resolved and sent with the
  13. * invocation. (A context is resolved by giving a property name
  14. * and getting back the value associated with it.) This is done
  15. * by calling the <code>Context</code> method
  16. * <code>get_values</code> and supplying a string from a
  17. * <code>ContextList</code> object as the third parameter.
  18. * The method <code>get_values</code> returns an <code>NVList</code>
  19. * object containing the <code>NamedValue</code> objects that hold
  20. * the value(s) identified by the given string.
  21. * <P>
  22. * A <code>ContextList</code> object is created by the ORB, as
  23. * illustrated here:
  24. * <PRE>
  25. * ORB orb = ORB.init(args, null);
  26. * org.omg.CORBA.ContextList ctxList = orb.create_context_list();
  27. * </PRE>
  28. * The variable <code>ctxList</code> represents an empty
  29. * <code>ContextList</code> object. Strings are added to
  30. * the list with the method <code>add</code>, accessed
  31. * with the method <code>item</code>, and removed with the
  32. * method <code>remove</code>.
  33. *
  34. * @see Context
  35. * @version 1.2, 09/09/97
  36. * @since JDK1.2
  37. */
  38. public abstract class ContextList {
  39. /**
  40. * Returns the number of <code>String</code> objects in this
  41. * <code>ContextList</code> object.
  42. *
  43. * @return an <code>int</code> representing the number of
  44. * <code>String</code>s in this <code>ContextList</code> object
  45. */
  46. public abstract int count();
  47. /**
  48. * Adds a <code>String</code> object to this <code>ContextList</code>
  49. * object.
  50. *
  51. * @param ctx the <code>String</code> object to be added
  52. */
  53. public abstract void add(String ctx);
  54. /**
  55. * Returns the <code>String</code> object at the given index.
  56. *
  57. * @param index the index of the string desired, with 0 being the
  58. index of the first string
  59. * @return the string at the given index
  60. * @exception org.omg.CORBA.Bounds if the index is greater than
  61. * or equal to the number of strings in this
  62. * <code>ContextList</code> object
  63. */
  64. public abstract String item(int index) throws org.omg.CORBA.Bounds;
  65. /**
  66. * Removes the <code>String</code> object at the given index. Note that
  67. * the indices of all strings following the one removed are
  68. * shifted down by one.
  69. *
  70. * @param index the index of the <code>String</code> object to be removed,
  71. * with 0 designating the first string
  72. * @exception org.omg.CORBA.Bounds if the index is greater than
  73. * or equal to the number of <code>String</code> objects in
  74. * this <code>ContextList</code> object
  75. */
  76. public abstract void remove(int index) throws org.omg.CORBA.Bounds;
  77. }