1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/classes/org/omg/CORBA/NVList.java Sat Dec 01 00:00:00 2007 +0000 1.3 @@ -0,0 +1,178 @@ 1.4 +/* 1.5 + * Copyright 1996-2000 Sun Microsystems, Inc. All Rights Reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Sun designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Sun in the LICENSE file that accompanied this code. 1.13 + * 1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 + * version 2 for more details (a copy is included in the LICENSE file that 1.18 + * accompanied this code). 1.19 + * 1.20 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or 1.26 + * have any questions. 1.27 + */ 1.28 + 1.29 +package org.omg.CORBA; 1.30 + 1.31 +/** 1.32 + * A modifiable list containing <code>NamedValue</code> objects. 1.33 + * <P> 1.34 + * The class <code>NVList</code> is used as follows: 1.35 + * <UL> 1.36 + * <LI>to describe arguments for a <code>Request</code> object 1.37 + * in the Dynamic Invocation Interface and 1.38 + * the Dynamic Skeleton Interface 1.39 + * <LI>to describe context values in a <code>Context</code> object 1.40 + * </UL> 1.41 + * <P> 1.42 + * Each <code>NamedValue</code> object consists of the following: 1.43 + * <UL> 1.44 + * <LI>a name, which is a <code>String</code> object 1.45 + * <LI>a value, as an <code>Any</code> object 1.46 + * <LI>an argument mode flag 1.47 + * </UL> 1.48 + * <P> 1.49 + * An <code>NVList</code> object 1.50 + * may be created using one of the following 1.51 + * <code>ORB</code> methods: 1.52 + * <OL> 1.53 + * <LI><code>org.omg.CORBA.ORB.create_list</code> 1.54 + * <PRE> 1.55 + * org.omg.CORBA.NVList nv = orb.create_list(3); 1.56 + * </PRE> 1.57 + * The variable <code>nv</code> represents a newly-created 1.58 + * <code>NVList</code> object. The argument is a memory-management 1.59 + * hint to the orb and does not imply the actual length of the list. 1.60 + * If, for example, you want to use an <code>NVList</code> object 1.61 + * in a request, and the method being invoked takes three parameters, 1.62 + * you might optimize by supplying 3 to the method 1.63 + * <code>create_list</code>. Note that the new <code>NVList</code> 1.64 + * will not necessarily have a length of 3; it 1.65 + * could have a length of 2 or 4, for instance. 1.66 + * Note also that you can add any number of 1.67 + * <code>NamedValue</code> objects to this list regardless of 1.68 + * its original length. 1.69 + * <P> 1.70 + * <LI><code>org.omg.CORBA.ORB.create_operation_list</code> 1.71 + * <PRE> 1.72 + * org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef); 1.73 + * </PRE> 1.74 + * The variable <code>nv</code> represents a newly-created 1.75 + * <code>NVList</code> object that contains descriptions of the 1.76 + * arguments to the method described in the given 1.77 + * <code>OperationDef</code> object. 1.78 + * </OL> 1.79 + * <P> 1.80 + * The methods in the class <code>NVList</code> all deal with 1.81 + * the <code>NamedValue</code> objects in the list. 1.82 + * There are three methods for adding a <code>NamedValue</code> object, 1.83 + * a method for getting the count of <code>NamedValue</code> objects in 1.84 + * the list, a method for retrieving a <code>NamedValue</code> object 1.85 + * at a given index, and a method for removing a <code>NamedValue</code> object 1.86 + * at a given index. 1.87 + * 1.88 + * @see org.omg.CORBA.Request 1.89 + * @see org.omg.CORBA.ServerRequest 1.90 + * @see org.omg.CORBA.NamedValue 1.91 + * @see org.omg.CORBA.Context 1.92 + * 1.93 + * @since JDK1.2 1.94 + */ 1.95 + 1.96 +public abstract class NVList { 1.97 + 1.98 + /** 1.99 + * Returns the number of <code>NamedValue</code> objects that have 1.100 + * been added to this <code>NVList</code> object. 1.101 + * 1.102 + * @return an <code>int</code> indicating the number of 1.103 + * <code>NamedValue</code> objects in this <code>NVList</code>. 1.104 + */ 1.105 + 1.106 + public abstract int count(); 1.107 + 1.108 + /** 1.109 + * Creates a new <code>NamedValue</code> object initialized with the given flag 1.110 + * and adds it to the end of this <code>NVList</code> object. 1.111 + * The flag can be any one of the argument passing modes: 1.112 + * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or 1.113 + * <code>ARG_INOUT.value</code>. 1.114 + * 1.115 + * @param flags one of the argument mode flags 1.116 + * @return the newly-created <code>NamedValue</code> object 1.117 + */ 1.118 + 1.119 + public abstract NamedValue add(int flags); 1.120 + 1.121 + /** 1.122 + * Creates a new <code>NamedValue</code> object initialized with the 1.123 + * given name and flag, 1.124 + * and adds it to the end of this <code>NVList</code> object. 1.125 + * The flag can be any one of the argument passing modes: 1.126 + * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or 1.127 + * <code>ARG_INOUT.value</code>. 1.128 + * 1.129 + * @param item_name the name for the new <code>NamedValue</code> object 1.130 + * @param flags one of the argument mode flags 1.131 + * @return the newly-created <code>NamedValue</code> object 1.132 + */ 1.133 + 1.134 + public abstract NamedValue add_item(String item_name, int flags); 1.135 + 1.136 + /** 1.137 + * Creates a new <code>NamedValue</code> object initialized with the 1.138 + * given name, value, and flag, 1.139 + * and adds it to the end of this <code>NVList</code> object. 1.140 + * 1.141 + * @param item_name the name for the new <code>NamedValue</code> object 1.142 + * @param val an <code>Any</code> object containing the value 1.143 + * for the new <code>NamedValue</code> object 1.144 + * @param flags one of the following argument passing modes: 1.145 + * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or 1.146 + * <code>ARG_INOUT.value</code> 1.147 + * @return the newly created <code>NamedValue</code> object 1.148 + */ 1.149 + 1.150 + public abstract NamedValue add_value(String item_name, Any val, int flags); 1.151 + 1.152 + /** 1.153 + * Retrieves the <code>NamedValue</code> object at the given index. 1.154 + * 1.155 + * @param index the index of the desired <code>NamedValue</code> object, 1.156 + * which must be between zero and the length of the list 1.157 + * minus one, inclusive. The first item is at index zero. 1.158 + * @return the <code>NamedValue</code> object at the given index 1.159 + * @exception org.omg.CORBA.Bounds if the index is greater than 1.160 + * or equal to number of <code>NamedValue</code> objects 1.161 + */ 1.162 + 1.163 + public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds; 1.164 + 1.165 + /** 1.166 + * Removes the <code>NamedValue</code> object at the given index. 1.167 + * Note that the indices of all <code>NamedValue</code> objects following 1.168 + * the one removed are shifted down by one. 1.169 + * 1.170 + * @param index the index of the <code>NamedValue</code> object to be 1.171 + * removed, which must be between zero and the length 1.172 + * of the list minus one, inclusive. 1.173 + * The first item is at index zero. 1.174 + * @exception org.omg.CORBA.Bounds if the index is greater than 1.175 + * or equal to number of <code>NamedValue</code> objects in 1.176 + * the list 1.177 + */ 1.178 + 1.179 + public abstract void remove(int index) throws org.omg.CORBA.Bounds; 1.180 + 1.181 +}