xref: /illumos-gate/usr/src/lib/libslp/javalib/com/sun/slp/TemplateRegistry.java (revision 2983dda76a6d296fdb560c88114fe41caad1b84f)
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 //  TemplateRegistry.java:
28 //  Author:           James Kempf
29 //  Created On:       Fri Jul  4 11:38:39 1997
30 //  Last Modified By: James Kempf
31 //  Last Modified On: Mon Jun  1 13:41:07 1998
32 //  Update Count:     26
33 //
34 
35 package com.sun.slp;
36 
37 import java.util.*;
38 
39 /**
40  * Classes subclassing the <b>TemplateRegistry</b> class register and
41  * unregister service templates, look up the template URL's based on the
42  * service type name, and return attribute verifiers for verifying
43  * template attributes.
44  *
45  * @author James Kempf
46  *
47  */
48 
49 public abstract class TemplateRegistry extends Object {
50 
51     protected static TemplateRegistry templateRegistry = null;
52 
53     /**
54      * The property accessor for the TemplateRegistry.
55      *
56      * @return The TemplateRegistry object.
57      * @exception ServiceLocationException If the registry can't be created.
58      */
59 
60     public static TemplateRegistry getTemplateRegistry()
61 	throws ServiceLocationException
62     {
63 
64 	if (templateRegistry == null) {
65 	    templateRegistry = new SLPTemplateRegistry();
66 
67 	}
68 
69 	return templateRegistry;
70     }
71 
72     /**
73      * Register the new service.
74      *
75      * @param <i>serviceType</i>		Name of the service.
76      * @param <i>documentURL</i>		URL of the template document.
77      * @param <i>languageLocale</i>	Locale of the template langugae.
78      * @param <i>version</i>		Version number of template document.
79      * @exception ServiceLocationException If the registration fails.
80      * @exception IllegalArgumentException Thrown if any parameters are null.
81      *
82      */
83 
84     abstract public void
85 	registerServiceTemplate(ServiceType serviceType,
86 				String documentURL,
87 				Locale languageLocale,
88 				String version)
89 	throws ServiceLocationException;
90 
91     /**
92      * Deregister the template for service type.
93      *
94      * @param <i>serviceType</i>	Name of service.
95      * @param <i>languageLocale</i> Language locale of template.
96      * @param <i>version</i> Version of the template, null for latest.
97      * @exception ServiceLocationException Thrown if the template
98      *	 		is not registered.
99      * @exception IllegalArgumentException Thrown if the serviceType or
100      *					  languageLocale parameter is null.
101      *
102      */
103 
104     abstract public void
105 	deregisterServiceTemplate(ServiceType serviceType,
106 				  Locale languageLocale,
107 				  String version)
108 	throws ServiceLocationException;
109 
110     /**
111      * Find the document URL for the service.
112      *
113      * @param <i>serviceType</i>		Name of service.
114      * @param <i>languageLocale</i> Language locale of template.
115      * @param <i>version</i> Version of the template, null for latest.
116      * @return <b>String</b> for the service's template document.
117      *         If the service doesn't exist, returns null.
118      * @exception ServiceLocationException If more than one template
119      *					  document URL is returned.
120      *</blockquote>
121      * @exception IllegalArgumentException Thrown if the service type or
122      *					  languageLocal parameter is null.
123      *
124      */
125 
126     abstract public String
127 	findTemplateURL(ServiceType serviceType,
128 			Locale languageLocale,
129 			String version)
130 	throws ServiceLocationException;
131 
132     /**
133      * Create an attribute verifier for the template document URL.
134      *
135      * @param <i>documentURL</i> A URL for the template document.
136      * @return An attribute verifier for the service
137      * @exception ServiceLocationException If a parse error occurs or
138      *					  if the document can't be found.
139      * @exception IllegalArgumentException Thrown if any parameters are null.
140      *
141      */
142 
143     abstract public
144 	ServiceLocationAttributeVerifier attributeVerifier(String documentURL)
145 	throws ServiceLocationException;
146 }
147