1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.capabilities;
18
19 import java.util.Collection;
20 import java.util.Iterator;
21
22 /***
23 * Capabilities Component Interface
24 *
25 * @author <a href="mailto:roger.ruttimann@earthlink.net">Roger Ruttimann</a>
26 * @version $Id: Capabilities.java 516448 2007-03-09 16:25:47Z ate $
27 */
28 public interface Capabilities
29 {
30
31 /***
32 * Creates a Capability Map with Capabilities, Mimetypes and mediaTypes for the given UserAgentPattern
33 * @param userAgent Agent from the request
34 * @return CapabilityMap populated with Capabilities, Mimetypes and Mediatype
35 * that match the userAgent. Never returns <code>null</code>
36 * @throws UnableToBuildCapabilityMapException If a capability could not be created
37 */
38 CapabilityMap getCapabilityMap(String userAgent) throws UnableToBuildCapabilityMapException;
39
40 /***
41 * Obtain an iterator of all existing clients.
42 * @return Returns an iterator for all existing Clients
43 */
44 Iterator getClients();
45
46 /***
47 * Finds a client for a given userAgentPattern
48 * @param userAgent
49 * @return Client that matches agent or null if no match is found
50 *
51 */
52 Client findClient(String userAgent);
53
54 /***
55 * Returns a collection of MediaTypes that matches the MimeTypes defined in the mimetype parameter
56 * @param Mimetype
57 *
58 * @return Collection of Mediatypes that matches the mimetypes
59 */
60 Collection getMediaTypesForMimeTypes(Iterator mimetypes);
61
62 /***
63 * Clears CapabilityMap cache
64 * TODO: Roger, why is this on the public interface. It seems to be impl specific
65 */
66 void deleteCapabilityMapCache();
67
68 /***
69 * Given a media type string, look up the corresponding media type object.
70 *
71 * @param mediaType The string representation of a media type.
72 * @return The found media type object or if not found, null.
73 */
74 MediaType getMediaType(String mediaType);
75
76 /***
77 * Given a Mimetype string lookup the corresponding media type object
78 * @param mimeTypeName to use for lookup
79 * @return MediaTypeEntry that matches the lookup in the MEDIATYPE_TO_MIMETYPE table
80 */
81 public MediaType getMediaTypeForMimeType(String mimeTypeName);
82
83 /***
84 * Given a capability string, look up the corresponding capability object.
85 *
86 * @param capability The string representation of a capability.
87 * @return The found capability object or if not found, null.
88 */
89 Capability getCapability(String capability);
90
91 /***
92 * Given a mime type string, look up the corresponding mime type object.
93 *
94 * @param mimeType The string representation of a mime type.
95 * @return The found mime type object or if not found, null.
96 */
97 MimeType getMimeType(String mimeType);
98 /***
99 * Given a client name, look up the corresponding client object.
100 *
101 * @param clientName The name of the client.
102 * @return The found client object or if not found, null.
103 */
104 Client getClient(String clientName);
105
106 /***
107 * Obtain an iterator of all existing capabilities.
108 * @return Returns an iterator for all existing Capabilities of type <code>Capability</code>
109 */
110 Iterator getCapabilities();
111
112 /***
113 * Obtain an iterator of all existing mime types.
114 * @return Returns an iterator for all existing Mime Types of type <code>MimeType</code>
115 */
116 Iterator getMimeTypes();
117
118 /***
119 * Obtain an iterator of all existing media types.
120 * @return Returns an iterator for all existing media types of type <code>MediaType</code>
121 */
122 Iterator getMediaTypes();
123
124
125 /***
126 * Obtain the name of the CapabilityBean reference
127 * @return ref-id of the capability bean
128 */
129 public String getCapabilityBeanName();
130
131 /***
132 * Set the name of the CapabilityBean reference - used exclusively in IoC
133 * @param capabilityBeanName The ref-id of the capability bean.
134 */
135 public void setCapabilityBeanName(String capabilityBeanName);
136
137
138 /***
139 * Obtain the name of the ClientBean reference
140 * @return ref-id of the client bean
141 */
142 public String getClientBeanName();
143
144 /***
145 * Set the name of the ClientBean reference - used exclusively in IoC
146 * @param clientBeanName The ref-id of the client bean.
147 */
148 public void setClientBeanName(String clientBeanName);
149
150 /***
151 * Obtain the name of the Media Type reference
152 * @return ref-id of the media type bean
153 */
154 public String getMediaTypeBeanName();
155
156 /***
157 * Set the name of the MediaType bean reference - used exclusively in IoC
158 * @param mediaTypeBeanName The ref-id of the mediaType bean.
159 */
160 public void setMediaTypeBeanName(String mediaTypeBeanName);
161
162 /***
163 * Obtain the name of the Mime Type reference
164 * @return ref-id of the mime type bean
165 */
166 public String getMimeTypeBeanName();
167
168 /***
169 * Set the name of the MimeType bean reference - used exclusively in IoC
170 * @param mimeTypeBeanName The ref-id of the mimeType bean.
171 */
172 public void setMimeTypeBeanName(String mimeTypeBeanName);
173
174
175 /***
176 * Create a new capability in the system or return the existing one if already exists
177 * @param capabilityName The string describing the capability
178 * @return A new (or existing) capability
179 */
180 public Capability createCapability(String capabilityName) throws ClassNotFoundException;
181
182
183 /***
184 * Create a new mimetype in the system or return the existing one if already exists
185 * @param mimeTypeName The string describing the mimeType
186 * @return A new (or existing) MimeType
187 */
188 public MimeType createMimeType(String mimeTypeName)throws ClassNotFoundException;
189
190 /***
191 * Create a new mediaType in the system or return the existing one if already exists
192 * @param mediaTypeName The string describing the mediaType
193 * @return A new (or existing) MediaType
194 */
195 public MediaType createMediaType(String mediaTypeName)throws ClassNotFoundException;
196
197 /***
198 * Create a new client in the system or return the existing one if already exists
199 * @param clientName The string describing the client
200 * @return A new (or existing) client
201 */
202 public Client createClient(String clientName)throws ClassNotFoundException;
203
204
205
206 /***
207 * Save media type to backend storage
208 *
209 * @param mediaType valid mediatype object
210 */
211 public void storeMediaType(MediaType mediaType) throws CapabilitiesException;
212
213
214 /***
215 * delete existing media type from backend storage
216 *
217 * @param mediaType valid mediatype object
218 */
219 public void deleteMediaType(MediaType mediaType)
220 throws CapabilitiesException;
221
222
223 /***
224 * Save capability to backend storage
225 *
226 * @param capability valid capability object
227 */
228 public void storeCapability(Capability capability) throws CapabilitiesException;
229
230 /***
231 * delete existing capability from backend storage
232 *
233 * @param capability valid capability object
234 */
235 public void deleteCapability(Capability capability)
236 throws CapabilitiesException;
237
238 /***
239 * Save mime type to backend storage
240 *
241 * @param mimeType valid mimetype object
242 */
243 public void storeMimeType(MimeType mimeType) throws CapabilitiesException;
244
245 /***
246 * delete existing mime type from backend storage
247 *
248 * @param mimeType valid mimetype object
249 */
250 public void deleteMimeType(MimeType mimeType)
251 throws CapabilitiesException;
252
253
254
255 /***
256 * Save client to backend storage
257 *
258 * @param client valid Client object
259 */
260 public void storeClient(Client client) throws CapabilitiesException;
261
262 /***
263 * delete existing client from backend storage
264 *
265 * @param client valid client object
266 */
267 public void deleteClient(Client client)
268 throws CapabilitiesException;
269
270 }