|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
INamespace.java | - | - | - | - |
|
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;
|
|
16 |
|
|
17 |
import java.util.List;
|
|
18 |
|
|
19 |
import org.apache.hivemind.Locatable;
|
|
20 |
import org.apache.hivemind.Resource;
|
|
21 |
import org.apache.tapestry.spec.IComponentSpecification;
|
|
22 |
import org.apache.tapestry.spec.ILibrarySpecification;
|
|
23 |
|
|
24 |
/**
|
|
25 |
* Organizes different libraries of Tapestry pages, components
|
|
26 |
* and services into "frameworks", used to disambiguate names.
|
|
27 |
*
|
|
28 |
* <p>
|
|
29 |
* Tapestry release 3.0 includes dynamic discovery of pages and components; an application
|
|
30 |
* or library may contain a page or component that won't be "known" until the name
|
|
31 |
* is resolved (because it involves searching for a particular named file).
|
|
32 |
*
|
|
33 |
* @see org.apache.tapestry.resolver.PageSpecificationResolver
|
|
34 |
* @see org.apache.tapestry.resolver.ComponentSpecificationResolver
|
|
35 |
*
|
|
36 |
* @author Howard Lewis Ship
|
|
37 |
* @since 2.2
|
|
38 |
*
|
|
39 |
**/
|
|
40 |
|
|
41 |
public interface INamespace extends Locatable |
|
42 |
{ |
|
43 |
/**
|
|
44 |
* Reserved name of a the implicit Framework library.
|
|
45 |
*
|
|
46 |
**/
|
|
47 |
|
|
48 |
public static final String FRAMEWORK_NAMESPACE = "framework"; |
|
49 |
|
|
50 |
/**
|
|
51 |
* Character used to seperate the namespace prefix from the page name
|
|
52 |
* or component type.
|
|
53 |
*
|
|
54 |
* @since 2.3
|
|
55 |
*
|
|
56 |
**/
|
|
57 |
|
|
58 |
public static final char SEPARATOR = ':'; |
|
59 |
|
|
60 |
/**
|
|
61 |
* Returns an identifier for the namespace. Identifiers
|
|
62 |
* are simple names (they start with a letter,
|
|
63 |
* and may contain letters, numbers, underscores and dashes).
|
|
64 |
* An identifier must be unique among a namespaces siblings.
|
|
65 |
*
|
|
66 |
* <p>The application namespace has a null id; the framework
|
|
67 |
* namespace has an id of "framework".
|
|
68 |
*
|
|
69 |
**/
|
|
70 |
|
|
71 |
public String getId();
|
|
72 |
|
|
73 |
/**
|
|
74 |
* Returns the extended id for this namespace, which is
|
|
75 |
* a dot-seperated sequence of ids.
|
|
76 |
*
|
|
77 |
**/
|
|
78 |
|
|
79 |
public String getExtendedId();
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Returns a version of the extended id appropriate for error
|
|
83 |
* messages. This is the based on
|
|
84 |
* {@link #getExtendedId()}, unless this is the
|
|
85 |
* application or framework namespace, in which case
|
|
86 |
* special strings are returned.
|
|
87 |
*
|
|
88 |
* @since 3.0
|
|
89 |
*
|
|
90 |
**/
|
|
91 |
|
|
92 |
public String getNamespaceId();
|
|
93 |
|
|
94 |
/**
|
|
95 |
* Returns the parent namespace; the namespace which
|
|
96 |
* contains this namespace.
|
|
97 |
*
|
|
98 |
* <p>
|
|
99 |
* The application and framework namespaces return null
|
|
100 |
* as the parent.
|
|
101 |
*
|
|
102 |
**/
|
|
103 |
|
|
104 |
public INamespace getParentNamespace();
|
|
105 |
|
|
106 |
/**
|
|
107 |
* Returns a namespace contained by this namespace.
|
|
108 |
*
|
|
109 |
* @param id either a simple name (of a directly contained namespace),
|
|
110 |
* or a dot-seperarated name sequence.
|
|
111 |
* @return the child namespace
|
|
112 |
* @throws ApplicationRuntimeException if no such namespace exist.
|
|
113 |
*
|
|
114 |
**/
|
|
115 |
|
|
116 |
public INamespace getChildNamespace(String id);
|
|
117 |
|
|
118 |
/**
|
|
119 |
* Returns a sorted, immutable list of the ids of the immediate
|
|
120 |
* children of this namespace. May return the empty list,
|
|
121 |
* but won't return null.
|
|
122 |
*
|
|
123 |
**/
|
|
124 |
|
|
125 |
public List getChildIds();
|
|
126 |
|
|
127 |
/**
|
|
128 |
* Returns the page specification of the named
|
|
129 |
* page (defined within the namespace).
|
|
130 |
*
|
|
131 |
* @param name the name of the page
|
|
132 |
* @return the specification
|
|
133 |
* @throws ApplicationRuntimeException if the page specification
|
|
134 |
* doesn't exist or can't be loaded
|
|
135 |
*
|
|
136 |
**/
|
|
137 |
|
|
138 |
public IComponentSpecification getPageSpecification(String name);
|
|
139 |
|
|
140 |
/**
|
|
141 |
* Returns true if this namespace contains the specified
|
|
142 |
* page name.
|
|
143 |
*
|
|
144 |
**/
|
|
145 |
|
|
146 |
public boolean containsPage(String name); |
|
147 |
|
|
148 |
/**
|
|
149 |
* Returns a sorted list of page names. May return an empty
|
|
150 |
* list, but won't return null. The return list is immutable.
|
|
151 |
*
|
|
152 |
**/
|
|
153 |
|
|
154 |
public List getPageNames();
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Returns the path for the named component (within the namespace).
|
|
158 |
*
|
|
159 |
* @param type the component alias
|
|
160 |
* @return the specification path of the component
|
|
161 |
* @throws ApplicationRuntimeException if the specification
|
|
162 |
* doesn't exist or can't be loaded
|
|
163 |
*
|
|
164 |
**/
|
|
165 |
|
|
166 |
public IComponentSpecification getComponentSpecification(String type);
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Returns true if the namespace contains the indicated component type.
|
|
170 |
*
|
|
171 |
* @param type a simple component type (no namespace prefix is allowed)
|
|
172 |
*
|
|
173 |
**/
|
|
174 |
|
|
175 |
public boolean containsComponentType(String type); |
|
176 |
|
|
177 |
/**
|
|
178 |
* Returns a sorted list of component types. May return
|
|
179 |
* an empty list, but won't return null. The return list
|
|
180 |
* is immutable. Represents just the known component types
|
|
181 |
* (additional types may be discoverred dynamically).
|
|
182 |
*
|
|
183 |
* <p>Is this method even needed?
|
|
184 |
*
|
|
185 |
* @since 3.0
|
|
186 |
*
|
|
187 |
**/
|
|
188 |
|
|
189 |
public List getComponentTypes();
|
|
190 |
|
|
191 |
/**
|
|
192 |
* Returns the class name of a service provided by the
|
|
193 |
* namespace.
|
|
194 |
*
|
|
195 |
* @param name the name of the service.
|
|
196 |
* @return the complete class name of the service, or null
|
|
197 |
* if the namespace does not contain the named service.
|
|
198 |
*
|
|
199 |
**/
|
|
200 |
|
|
201 |
public String getServiceClassName(String name);
|
|
202 |
|
|
203 |
/**
|
|
204 |
* Returns the names of all services provided by the
|
|
205 |
* namespace, as a sorted, immutable list. May return
|
|
206 |
* the empty list, but won't return null.
|
|
207 |
*
|
|
208 |
**/
|
|
209 |
|
|
210 |
public List getServiceNames();
|
|
211 |
|
|
212 |
/**
|
|
213 |
* Returns the {@link org.apache.tapestry.spec.LibrarySpecification} from which
|
|
214 |
* this namespace was created.
|
|
215 |
*
|
|
216 |
**/
|
|
217 |
|
|
218 |
public ILibrarySpecification getSpecification();
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Constructs a qualified name for the given simple page name by
|
|
222 |
* applying the correct prefix (if any).
|
|
223 |
*
|
|
224 |
* @since 2.3
|
|
225 |
*
|
|
226 |
**/
|
|
227 |
|
|
228 |
public String constructQualifiedName(String pageName);
|
|
229 |
|
|
230 |
/**
|
|
231 |
* Returns the location of the resource from which the
|
|
232 |
* specification for this namespace was read.
|
|
233 |
*
|
|
234 |
**/
|
|
235 |
|
|
236 |
public Resource getSpecificationLocation();
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Returns true if the namespace is the special
|
|
240 |
* application namespace (which has special search rules
|
|
241 |
* for handling undeclared pages and components).
|
|
242 |
*
|
|
243 |
* @since 3.0
|
|
244 |
*
|
|
245 |
**/
|
|
246 |
|
|
247 |
public boolean isApplicationNamespace(); |
|
248 |
|
|
249 |
/**
|
|
250 |
* Used to specify additional pages beyond those that came from
|
|
251 |
* the namespace's specification. This is used when pages
|
|
252 |
* in the application namespace are dynamically discovered.
|
|
253 |
*
|
|
254 |
* @since 3.0
|
|
255 |
*
|
|
256 |
**/
|
|
257 |
|
|
258 |
public void installPageSpecification(String pageName, IComponentSpecification specification); |
|
259 |
|
|
260 |
/**
|
|
261 |
* Used to specify additional components beyond those that came from
|
|
262 |
* the namespace's specification. This is used when components
|
|
263 |
* in the application namespace are dynamically discovered.
|
|
264 |
*
|
|
265 |
* @since 3.0
|
|
266 |
*
|
|
267 |
**/
|
|
268 |
|
|
269 |
public void installComponentSpecification(String type, IComponentSpecification specification); |
|
270 |
|
|
271 |
} |
|
272 |
|
|