KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > spec > ILibrarySpecification


1 // Copyright 2004, 2005 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.spec;
16
17 import java.util.List JavaDoc;
18 import java.util.Map JavaDoc;
19
20 import org.apache.hivemind.LocationHolder;
21 import org.apache.hivemind.Resource;
22 import org.apache.tapestry.util.IPropertyHolder;
23
24 /**
25  * Interface for the Specification for a library.
26  * {@link org.apache.tapestry.spec.ApplicationSpecification}is a specialized kind of library.
27  *
28  * @author Geoffrey Longman
29  * @since 2.2
30  */

31
32 public interface ILibrarySpecification extends IPropertyHolder, LocationHolder
33 {
34
35     /**
36      * Returns the specification path (within the classpath) for an embedded library, or null if no
37      * such library has been defined.
38      */

39
40     public String JavaDoc getLibrarySpecificationPath(String JavaDoc id);
41
42     /**
43      * Sets the specification path for an embedded library.
44      *
45      * @throws IllegalArgumentException
46      * if a library with the given id already exists
47      */

48
49     public void setLibrarySpecificationPath(String JavaDoc id, String JavaDoc path);
50
51     /**
52      * Returns a sorted list of library ids (or the empty list, but not null).
53      */

54
55     public List JavaDoc getLibraryIds();
56
57     public String JavaDoc getPageSpecificationPath(String JavaDoc name);
58
59     public void setPageSpecificationPath(String JavaDoc name, String JavaDoc path);
60
61     /**
62      * Returns a sorted list of page names explicitly defined by this library, or an empty list (but
63      * not null).
64      */

65
66     public List JavaDoc getPageNames();
67
68     public void setComponentSpecificationPath(String JavaDoc type, String JavaDoc path);
69
70     public String JavaDoc getComponentSpecificationPath(String JavaDoc type);
71
72     /**
73      * Returns the simple types of all components defined in this library. Returns a list of strings
74      * in sorted order, or an empty list (but not null).
75      *
76      * @since 3.0
77      */

78
79     public List JavaDoc getComponentTypes();
80
81     /**
82      * @throws UnsupportedOperationException always
83      * @deprecated to be removed in release 4.1
84      */

85     
86     public String JavaDoc getServiceClassName(String JavaDoc name);
87
88     /**
89      * Returns a sorted list of service names (or an empty list, but not null).
90      *
91      * @returns an empty list (as of release 4.0)
92      * @deprecated to be removed in release 4.1
93      */

94
95     public List JavaDoc getServiceNames();
96
97     /**
98      * @deprecated To be removed in release 4.1.
99      * @throws UnsupportedOperationException always
100      */

101     public void setServiceClassName(String JavaDoc name, String JavaDoc className);
102
103     /**
104      * Returns the documentation for this library..
105      */

106
107     public String JavaDoc getDescription();
108
109     /**
110      * Sets the documentation for this library.
111      */

112
113     public void setDescription(String JavaDoc description);
114
115     /**
116      * Returns a Map of extensions; key is extension name, value is
117      * {@link org.apache.tapestry.spec.IExtensionSpecification}. May return null. The returned Map
118      * is immutable.
119      */

120
121     public Map JavaDoc getExtensionSpecifications();
122
123     /**
124      * Adds another extension specification.
125      */

126
127     public void addExtensionSpecification(String JavaDoc name, IExtensionSpecification extension);
128
129     /**
130      * Returns a sorted List of the names of all extensions. May return the empty list, but won't
131      * return null.
132      */

133
134     public List JavaDoc getExtensionNames();
135
136     /**
137      * Returns the named IExtensionSpecification, or null if it doesn't exist.
138      */

139
140     public IExtensionSpecification getExtensionSpecification(String JavaDoc name);
141
142     /**
143      * Returns an instantiated extension. Extensions are created as needed and cached for later use.
144      *
145      * @throws IllegalArgumentException
146      * if no extension specification exists for the given name.
147      */

148
149     public Object JavaDoc getExtension(String JavaDoc name);
150
151     /**
152      * Returns an instantiated extension, performing a check to ensure that the extension is a
153      * subtype of the given class (or extends the given interface).
154      *
155      * @throws IllegalArgumentException
156      * if no extension specification exists for the given name, or if the extension
157      * fails the type check.
158      * @since 3.0
159      */

160
161     public Object JavaDoc getExtension(String JavaDoc name, Class JavaDoc typeConstraint);
162
163     /**
164      * Returns true if the named extension exists (or can be instantiated), returns false if the
165      * named extension has no specification.
166      */

167
168     public boolean checkExtension(String JavaDoc name);
169
170     /**
171      * Invoked after the entire specification has been constructed to instantiate any extensions
172      * marked immediate.
173      */

174
175     public void instantiateImmediateExtensions();
176
177     public String JavaDoc getPublicId();
178
179     public void setPublicId(String JavaDoc value);
180
181     /**
182      * Returns the location from which the specification was read.
183      *
184      * @since 3.0
185      */

186
187     public Resource getSpecificationLocation();
188
189     /** @since 3.0 * */
190
191     public void setSpecificationLocation(Resource specificationLocation);
192 }
Popular Tags