| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| BrokerTemplateLoader |
|
| 3.5;3.5 |
| 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 | package org.webmacro.resource; | |
| 23 | ||
| 24 | import org.slf4j.Logger; | |
| 25 | import org.slf4j.LoggerFactory; | |
| 26 | import org.webmacro.ResourceException; | |
| 27 | import org.webmacro.Template; | |
| 28 | ||
| 29 | import java.net.URL; | |
| 30 | ||
| 31 | /** | |
| 32 | * @author sk | |
| 33 | * @since 03 Feb 2002 | |
| 34 | */ | |
| 35 | 0 | public class BrokerTemplateLoader extends AbstractTemplateLoader |
| 36 | { | |
| 37 | ||
| 38 | 0 | static Logger _log = LoggerFactory.getLogger(BrokerTemplateLoader.class); |
| 39 | public void setConfig (String config) | |
| 40 | { | |
| 41 | // ignore config | |
| 42 | 0 | if (config != null && config.length() > 0) |
| 43 | { | |
| 44 | 0 | _log.warn("BrokerTemplateProvider: Ignoring configuration options " + config); |
| 45 | } | |
| 46 | 0 | } |
| 47 | ||
| 48 | public final Template load (String query, CacheElement ce) throws ResourceException | |
| 49 | { | |
| 50 | 0 | URL url = broker.getTemplate(query); |
| 51 | 0 | if (url != null && _log.isDebugEnabled()) |
| 52 | { | |
| 53 | 0 | _log.debug("BrokerTemplateLoader: Found Template " + url.toString()); |
| 54 | } | |
| 55 | 0 | return (url != null) ? helper.load(url, ce) : null; |
| 56 | } | |
| 57 | } |