xref: /illumos-gate/usr/src/lib/libslp/javalib/com/sun/slp/ServiceURLV1.java (revision 2aeafac3612e19716bf8164f89c3c9196342979c)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright (c) 1999 by Sun Microsystems, Inc.
23  * All rights reserved.
24  *
25  */
26 
27 //  ServiceURLV1.java: SLPv1 Service URL class.
28 //  Author:           James Kempf
29 //  Created On:       Fri Oct  9 19:08:53 1998
30 //  Last Modified By: James Kempf
31 //  Last Modified On: Wed Oct 14 17:00:08 1998
32 //  Update Count:     3
33 //
34 
35 package com.sun.slp;
36 
37 import java.util.*;
38 import java.io.*;
39 
40 /**
41  * ServiceURLV1 enforces no abstract types and no non-service: URL types for
42  * SLPv1 queries.
43  *
44  * @author James Kempf
45  */
46 
47 class ServiceURLV1 extends ServiceURL implements Serializable {
48 
49     ServiceURLV1(String URL, int iLifetime) throws IllegalArgumentException {
50 	super(URL, iLifetime);
51 
52 	ServiceType serviceType = this.getServiceType();
53 
54 	// Check for illegal service types.
55 
56 	if (serviceType.isAbstractType()) {
57 	    throw
58 		new IllegalArgumentException(
59 		SLPConfig.getSLPConfig().formatMessage("v1_abstract_type",
60 						       new Object[0]));
61 
62 	}
63 
64 	if (!serviceType.isServiceURL()) {
65 	    throw
66 		new IllegalArgumentException(
67 			SLPConfig.getSLPConfig().formatMessage("v1_not_surl",
68 							       new Object[0]));
69 
70 	}
71     }
72 }
73