Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
ResourceLoader |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (C) 1998-2001 Semiotek Inc. All Rights Reserved. | |
3 | * | |
4 | * Redistribution and use in source and binary forms, with or without | |
5 | * modification, are permitted under the terms of either of the following | |
6 | * Open Source licenses: | |
7 | * | |
8 | * The GNU General Public License, version 2, or any later version, as | |
9 | * published by the Free Software Foundation | |
10 | * (http://www.fsf.org/copyleft/gpl.html); | |
11 | * | |
12 | * or | |
13 | * | |
14 | * The Semiotek Public License (http://webmacro.org/LICENSE.) | |
15 | * | |
16 | * This software is provided "as is", with NO WARRANTY, not even the | |
17 | * implied warranties of fitness to purpose, or merchantability. You | |
18 | * assume all risks and liabilities associated with its use. | |
19 | * | |
20 | * See www.webmacro.org for more information on the WebMacro project. | |
21 | */ | |
22 | ||
23 | ||
24 | package org.webmacro.resource; | |
25 | ||
26 | import org.webmacro.Broker; | |
27 | import org.webmacro.InitException; | |
28 | import org.webmacro.ResourceException; | |
29 | import org.webmacro.util.Settings; | |
30 | ||
31 | /** | |
32 | * Methods to be implemented by a resource loader, which will work with | |
33 | * a cache manager. | |
34 | * @see CachingProvider | |
35 | * @see CacheManager | |
36 | * @since 0.96 | |
37 | * @author Brian Goetz | |
38 | */ | |
39 | public interface ResourceLoader | |
40 | { | |
41 | ||
42 | /** | |
43 | * Load an object from permanent storage (or construct it) on | |
44 | * demand. */ | |
45 | public Object load (String query, CacheElement ce) | |
46 | throws ResourceException; | |
47 | ||
48 | /** | |
49 | * Load an object from permanent storage (or construct it) on | |
50 | * demand. Classes which extend CachingProvider don't need to | |
51 | * supply this, since providers will only be called with String | |
52 | * queries. | |
53 | */ | |
54 | public Object load (Object query, CacheElement ce) | |
55 | throws ResourceException; | |
56 | ||
57 | /** | |
58 | * Initialize this provider based on the specified config. | |
59 | */ | |
60 | public void init (Broker b, Settings config) throws InitException; | |
61 | } |