xref: /onnv-gate/usr/src/lib/libslp/javalib/com/sun/slp/ServiceURLV1.java (revision 7298:b69e27387f74)
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 //  ServiceURLV1.java: SLPv1 Service URL class.
280Sstevel@tonic-gate //  Author:           James Kempf
290Sstevel@tonic-gate //  Created On:       Fri Oct  9 19:08:53 1998
300Sstevel@tonic-gate //  Last Modified By: James Kempf
310Sstevel@tonic-gate //  Last Modified On: Wed Oct 14 17:00:08 1998
320Sstevel@tonic-gate //  Update Count:     3
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 import java.io.*;
390Sstevel@tonic-gate 
400Sstevel@tonic-gate /**
410Sstevel@tonic-gate  * ServiceURLV1 enforces no abstract types and no non-service: URL types for
420Sstevel@tonic-gate  * SLPv1 queries.
430Sstevel@tonic-gate  *
440Sstevel@tonic-gate  * @author James Kempf
450Sstevel@tonic-gate  */
460Sstevel@tonic-gate 
470Sstevel@tonic-gate class ServiceURLV1 extends ServiceURL implements Serializable {
480Sstevel@tonic-gate 
ServiceURLV1(String URL, int iLifetime)490Sstevel@tonic-gate     ServiceURLV1(String URL, int iLifetime) throws IllegalArgumentException {
500Sstevel@tonic-gate 	super(URL, iLifetime);
510Sstevel@tonic-gate 
520Sstevel@tonic-gate 	ServiceType serviceType = this.getServiceType();
530Sstevel@tonic-gate 
540Sstevel@tonic-gate 	// Check for illegal service types.
550Sstevel@tonic-gate 
560Sstevel@tonic-gate 	if (serviceType.isAbstractType()) {
570Sstevel@tonic-gate 	    throw
580Sstevel@tonic-gate 		new IllegalArgumentException(
590Sstevel@tonic-gate 		SLPConfig.getSLPConfig().formatMessage("v1_abstract_type",
600Sstevel@tonic-gate 						       new Object[0]));
610Sstevel@tonic-gate 
620Sstevel@tonic-gate 	}
630Sstevel@tonic-gate 
640Sstevel@tonic-gate 	if (!serviceType.isServiceURL()) {
650Sstevel@tonic-gate 	    throw
660Sstevel@tonic-gate 		new IllegalArgumentException(
670Sstevel@tonic-gate 			SLPConfig.getSLPConfig().formatMessage("v1_not_surl",
680Sstevel@tonic-gate 							       new Object[0]));
690Sstevel@tonic-gate 
700Sstevel@tonic-gate 	}
710Sstevel@tonic-gate     }
720Sstevel@tonic-gate }
73