1. /*
  2. * @(#)ContextListImpl.java 1.26 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. /*
  8. * Licensed Materials - Property of IBM
  9. * RMI-IIOP v1.0
  10. * Copyright IBM Corp. 1998 1999 All Rights Reserved
  11. *
  12. * US Government Users Restricted Rights - Use, duplication or
  13. * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  14. */
  15. package com.sun.corba.se.impl.corba;
  16. import java.util.Vector;
  17. import org.omg.CORBA.ContextList;
  18. import org.omg.CORBA.Bounds;
  19. import org.omg.CORBA.ORB;
  20. public class ContextListImpl extends ContextList
  21. {
  22. private final int INITIAL_CAPACITY = 2;
  23. private final int CAPACITY_INCREMENT = 2;
  24. private org.omg.CORBA.ORB _orb;
  25. private Vector _contexts;
  26. public ContextListImpl(org.omg.CORBA.ORB orb)
  27. {
  28. // Note: This orb could be an instanceof ORBSingleton or ORB
  29. _orb = orb;
  30. _contexts = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
  31. }
  32. public int count()
  33. {
  34. return _contexts.size();
  35. }
  36. public void add(String ctxt)
  37. {
  38. _contexts.addElement(ctxt);
  39. }
  40. public String item(int index)
  41. throws Bounds
  42. {
  43. try {
  44. return (String) _contexts.elementAt(index);
  45. } catch (ArrayIndexOutOfBoundsException e) {
  46. throw new Bounds();
  47. }
  48. }
  49. public void remove(int index)
  50. throws Bounds
  51. {
  52. try {
  53. _contexts.removeElementAt(index);
  54. } catch (ArrayIndexOutOfBoundsException e) {
  55. throw new Bounds();
  56. }
  57. }
  58. }