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