10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7298SMark.J.Nelson@Sun.COM  * Common Development and Distribution License (the "License").
6*7298SMark.J.Nelson@Sun.COM  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
220Sstevel@tonic-gate  * Copyright (c) 1999 by Sun Microsystems, Inc.
230Sstevel@tonic-gate  * All rights reserved.
240Sstevel@tonic-gate  *
250Sstevel@tonic-gate  */
260Sstevel@tonic-gate 
270Sstevel@tonic-gate //  ServiceLocationEnumerator.java: Class implementing SLP enumerator.
280Sstevel@tonic-gate //  Author:           James Kempf
290Sstevel@tonic-gate //  Created On:       Thu May 21 14:36:55 1998
300Sstevel@tonic-gate //  Last Modified By: James Kempf
310Sstevel@tonic-gate //  Last Modified On: Thu May 21 14:37:21 1998
320Sstevel@tonic-gate //  Update Count:     1
330Sstevel@tonic-gate //
340Sstevel@tonic-gate 
350Sstevel@tonic-gate package com.sun.slp;
360Sstevel@tonic-gate 
370Sstevel@tonic-gate import java.util.*;
380Sstevel@tonic-gate 
390Sstevel@tonic-gate /**
400Sstevel@tonic-gate  * The ServiceLocationEnumerator class implements an enumeration.
410Sstevel@tonic-gate  * Besides the standard Enumeration classes, it implements a next()
420Sstevel@tonic-gate  * method that can (but not in this implementation) throw a
430Sstevel@tonic-gate  * ServiceLocationException.
440Sstevel@tonic-gate  *
450Sstevel@tonic-gate  * @author James Kempf
460Sstevel@tonic-gate  */
470Sstevel@tonic-gate 
480Sstevel@tonic-gate class ServiceLocationEnumerator extends Object
490Sstevel@tonic-gate     implements ServiceLocationEnumeration {
500Sstevel@tonic-gate 
510Sstevel@tonic-gate     // The base enumerator.
520Sstevel@tonic-gate 
530Sstevel@tonic-gate     Enumeration base;
540Sstevel@tonic-gate 
550Sstevel@tonic-gate     /**
560Sstevel@tonic-gate      * The constructor simply takes an enumerator on the vector.
570Sstevel@tonic-gate      */
580Sstevel@tonic-gate 
ServiceLocationEnumerator(Vector v)590Sstevel@tonic-gate     public ServiceLocationEnumerator(Vector v) {
600Sstevel@tonic-gate 
610Sstevel@tonic-gate 	if (v != null) {
620Sstevel@tonic-gate 	    base = v.elements();
630Sstevel@tonic-gate 	} else {
640Sstevel@tonic-gate 	    base = (new Vector()).elements();
650Sstevel@tonic-gate 	}
660Sstevel@tonic-gate     }
670Sstevel@tonic-gate 
680Sstevel@tonic-gate     /**
690Sstevel@tonic-gate      * Pass through to the Enumerator method.
700Sstevel@tonic-gate      */
710Sstevel@tonic-gate 
hasMoreElements()720Sstevel@tonic-gate     public boolean hasMoreElements() {
730Sstevel@tonic-gate 	return base.hasMoreElements();
740Sstevel@tonic-gate     }
750Sstevel@tonic-gate 
760Sstevel@tonic-gate     /**
770Sstevel@tonic-gate      * Pass through to the Enumerator method.
780Sstevel@tonic-gate      */
790Sstevel@tonic-gate 
nextElement()800Sstevel@tonic-gate     public Object nextElement() throws NoSuchElementException {
810Sstevel@tonic-gate 	return base.nextElement();
820Sstevel@tonic-gate     }
830Sstevel@tonic-gate 
840Sstevel@tonic-gate     /**
850Sstevel@tonic-gate      * Pass through to the Enumerator method.
860Sstevel@tonic-gate      */
870Sstevel@tonic-gate 
next()880Sstevel@tonic-gate     public Object next() throws ServiceLocationException {
890Sstevel@tonic-gate 	return base.nextElement();
900Sstevel@tonic-gate     }
910Sstevel@tonic-gate 
920Sstevel@tonic-gate }
93