Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||
ILibrarySpecification |
|
| 1.0;1 |
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; |
|
18 | import java.util.Map; |
|
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 |
|
27 | * kind of library. |
|
28 | * |
|
29 | * @author Geoffrey Longman |
|
30 | * @since 2.2 |
|
31 | */ |
|
32 | ||
33 | public interface ILibrarySpecification extends IPropertyHolder, LocationHolder |
|
34 | { |
|
35 | ||
36 | /** |
|
37 | * Returns the specification path (within the classpath) for an embedded |
|
38 | * library, or null if no such library has been defined. |
|
39 | */ |
|
40 | ||
41 | String getLibrarySpecificationPath(String id); |
|
42 | ||
43 | /** |
|
44 | * Sets the specification path for an embedded library. |
|
45 | * |
|
46 | * @throws IllegalArgumentException |
|
47 | * if a library with the given id already exists |
|
48 | */ |
|
49 | ||
50 | void setLibrarySpecificationPath(String id, String path); |
|
51 | ||
52 | /** |
|
53 | * Returns a sorted list of library ids (or the empty list, but not null). |
|
54 | */ |
|
55 | ||
56 | List getLibraryIds(); |
|
57 | ||
58 | String getPageSpecificationPath(String name); |
|
59 | ||
60 | void setPageSpecificationPath(String name, String path); |
|
61 | ||
62 | /** |
|
63 | * Returns a sorted list of page names explicitly defined by this library, |
|
64 | * or an empty list (but not null). |
|
65 | */ |
|
66 | ||
67 | List getPageNames(); |
|
68 | ||
69 | void setComponentSpecificationPath(String type, String path); |
|
70 | ||
71 | String getComponentSpecificationPath(String type); |
|
72 | ||
73 | /** |
|
74 | * Returns the simple types of all components defined in this library. |
|
75 | * Returns a list of strings in sorted order, or an empty list (but not |
|
76 | * null). |
|
77 | * |
|
78 | * @since 3.0 |
|
79 | */ |
|
80 | ||
81 | List getComponentTypes(); |
|
82 | ||
83 | /** |
|
84 | * Returns the documentation for this library.. |
|
85 | */ |
|
86 | ||
87 | String getDescription(); |
|
88 | ||
89 | /** |
|
90 | * Sets the documentation for this library. |
|
91 | */ |
|
92 | ||
93 | void setDescription(String description); |
|
94 | ||
95 | /** |
|
96 | * Returns a Map of extensions; key is extension name, value is |
|
97 | * {@link org.apache.tapestry.spec.IExtensionSpecification}. May return |
|
98 | * null. The returned Map is immutable. |
|
99 | */ |
|
100 | ||
101 | Map getExtensionSpecifications(); |
|
102 | ||
103 | /** |
|
104 | * Adds another extension specification. |
|
105 | */ |
|
106 | ||
107 | void addExtensionSpecification(String name, |
|
108 | IExtensionSpecification extension); |
|
109 | ||
110 | /** |
|
111 | * Returns a sorted List of the names of all extensions. May return the |
|
112 | * empty list, but won't return null. |
|
113 | */ |
|
114 | ||
115 | List getExtensionNames(); |
|
116 | ||
117 | /** |
|
118 | * Returns the named IExtensionSpecification, or null if it doesn't exist. |
|
119 | */ |
|
120 | ||
121 | IExtensionSpecification getExtensionSpecification(String name); |
|
122 | ||
123 | /** |
|
124 | * Returns an instantiated extension. Extensions are created as needed and |
|
125 | * cached for later use. |
|
126 | * |
|
127 | * @throws IllegalArgumentException |
|
128 | * if no extension specification exists for the given name. |
|
129 | */ |
|
130 | ||
131 | Object getExtension(String name); |
|
132 | ||
133 | /** |
|
134 | * Returns an instantiated extension, performing a check to ensure that the |
|
135 | * extension is a subtype of the given class (or extends the given |
|
136 | * interface). |
|
137 | * |
|
138 | * @throws IllegalArgumentException |
|
139 | * if no extension specification exists for the given name, or |
|
140 | * if the extension fails the type check. |
|
141 | * @since 3.0 |
|
142 | */ |
|
143 | ||
144 | Object getExtension(String name, Class typeConstraint); |
|
145 | ||
146 | /** |
|
147 | * Returns true if the named extension exists (or can be instantiated), |
|
148 | * returns false if the named extension has no specification. |
|
149 | */ |
|
150 | ||
151 | boolean checkExtension(String name); |
|
152 | ||
153 | /** |
|
154 | * Invoked after the entire specification has been constructed to |
|
155 | * instantiate any extensions marked immediate. |
|
156 | */ |
|
157 | ||
158 | void instantiateImmediateExtensions(); |
|
159 | ||
160 | String getPublicId(); |
|
161 | ||
162 | void setPublicId(String value); |
|
163 | ||
164 | /** |
|
165 | * Returns the location from which the specification was read. |
|
166 | * |
|
167 | * @since 3.0 |
|
168 | */ |
|
169 | ||
170 | Resource getSpecificationLocation(); |
|
171 | ||
172 | /** @since 3.0 * */ |
|
173 | ||
174 | void setSpecificationLocation(Resource specificationLocation); |
|
175 | } |