| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TemplateLoader |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Copyright (C) 1998-2000 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 | package org.webmacro.resource; | |
| 24 | ||
| 25 | import org.webmacro.Broker; | |
| 26 | import org.webmacro.InitException; | |
| 27 | import org.webmacro.ResourceException; | |
| 28 | import org.webmacro.Template; | |
| 29 | import org.webmacro.util.Settings; | |
| 30 | ||
| 31 | /** | |
| 32 | * Interface for template loaders. | |
| 33 | * Template loaders are responsible to search for and load | |
| 34 | * templates from a single location. They are used by | |
| 35 | * DelegatingTemplateProvider to do the actual work. | |
| 36 | * @author Sebastian Kanthak (sebastian.kanthak@muehlheim.de) | |
| 37 | */ | |
| 38 | public interface TemplateLoader | |
| 39 | { | |
| 40 | ||
| 41 | /** | |
| 42 | * Init this template loader* | |
| 43 | */ | |
| 44 | void init (Broker b, Settings settings) throws InitException; | |
| 45 | ||
| 46 | /** | |
| 47 | * Set the config options for this template loader. | |
| 48 | * The config option is the path after the colon (":") in | |
| 49 | * the TemplatePath setting for this loader.<br> | |
| 50 | * This can be an path as well as JDBC settings or something | |
| 51 | * completely different. | |
| 52 | * @param config config options for this template loader | |
| 53 | */ | |
| 54 | void setConfig (String config) throws InitException; | |
| 55 | ||
| 56 | /** | |
| 57 | * Try to load a template. | |
| 58 | * This method will create and return a template found in the location | |
| 59 | * described by query or return null, if no such template exists. If | |
| 60 | * a resource is found at the location, but no template could be created | |
| 61 | * for some reason, a ResourceException is thrown. | |
| 62 | * <br> | |
| 63 | * If the cache element ce is not null, this method should set a reload | |
| 64 | * context on the cache element to enable | |
| 65 | * reload-on-demand for this template. If ce is null, caching is disabled. | |
| 66 | * @param query location to load template from | |
| 67 | * @param ce cache element that will be used for this template or null | |
| 68 | * if no cache is used. | |
| 69 | * @exception ResourceException if an error occured while loading the template | |
| 70 | */ | |
| 71 | Template load (String query, CacheElement ce) throws ResourceException; | |
| 72 | } |