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