bloritsch 01/10/31 12:50:45 Modified: src/scratchpad/org/apache/avalon/excalibur/i18n DefaultBundleLoader.java Log: remove logging dependencies Revision Changes Path 1.3 +13 -25 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/DefaultBundleLoader.java Index: DefaultBundleLoader.java =================================================================== RCS file: /home/cvs/jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/DefaultBundleLoader.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- DefaultBundleLoader.java 2001/10/31 19:56:47 1.2 +++ DefaultBundleLoader.java 2001/10/31 20:50:45 1.3 @@ -9,8 +9,8 @@ import java.util.Locale; -import org.apache.log.Logger; import org.apache.avalon.framework.logger.Loggable; +import org.apache.avalon.framework.logger.AbstractLoggable; import org.apache.avalon.framework.configuration.Configurable; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; @@ -21,10 +21,10 @@ * Used to map locale information to URI space, to find the relevant bundle. * * @author <a href="mailto:[EMAIL PROTECTED]">Neeme Praks</a> - * @version CVS $Revision: 1.2 $ $Date: 2001/10/31 19:56:47 $ $Author: neeme $ + * @version CVS $Revision: 1.3 $ $Date: 2001/10/31 20:50:45 $ $Author: bloritsch $ */ -public class DefaultBundleLoader implements BundleLoader, Loggable, Composable { +public class DefaultBundleLoader extends AbstractLoggable implements BundleLoader, Composable { /** Constants for configuration keys */ public static class ConfigurationKeys { @@ -56,22 +56,10 @@ /** bundle selector */ protected BundleSelector selector; - /** The logger */ - protected Logger logger; - /** Component Manager */ protected ComponentManager manager = null; /** - * Set the logger. - * - * @param logger the logger - */ - public void setLogger(final Logger logger) { - this.logger = logger; - } - - /** * Set the bundle selector. * * @param selector the selector @@ -98,19 +86,19 @@ this.prefix = configuration.getChild(ConfigurationKeys.PREFIX, true).getValue(); } catch (ConfigurationException e) { - if (logger.isWarnEnabled()) logger.warn("Prefix not provided in configuration, using none."); + if (getLogger().isWarnEnabled()) getLogger().warn("Prefix not provided in configuration, using none."); this.prefix = ""; } try { this.suffix = configuration.getChild(ConfigurationKeys.SUFFIX, true).getValue(); } catch (ConfigurationException e) { - if (logger.isWarnEnabled()) logger.warn("Suffix not provided in configuration, using none."); + if (getLogger().isWarnEnabled()) getLogger().warn("Suffix not provided in configuration, using none."); this.suffix = ""; } - if (logger.isDebugEnabled()) { - logger.debug( + if (getLogger().isDebugEnabled()) { + getLogger().debug( "BundleLoader configured with bundle=" + this.bundleClassName + ", mapper=" + this.bundleInfoMapperClassName + ", prefix='" + this.prefix + @@ -130,7 +118,7 @@ return (Bundle) Class.forName(this.bundleClassName).newInstance(); } catch (Exception e) { - logger.error("could not create bundle instance", e); + getLogger().error("could not create bundle instance", e); } return null; } @@ -176,17 +164,17 @@ * @return the bundle */ public Bundle loadBundle(BundleInfo bundleInfo) { - if (logger.isDebugEnabled()) logger.debug("Mapping bundle: " + bundleInfo); + if (getLogger().isDebugEnabled()) getLogger().debug("Mapping bundle: " + bundleInfo); String uri = getPrefix() + getMapper().map(bundleInfo) + getSuffix(); Bundle bundle = null; Bundle parentBundle = null; BundleInfo parentBundleInfo = bundleInfo.getParent(); try { - if (logger.isDebugEnabled()) logger.debug("Loading bundle from URI: " + uri); + if (getLogger().isDebugEnabled()) getLogger().debug("Loading bundle from URI: " + uri); if (parentBundleInfo != null) parentBundle = (Bundle) selector.select(parentBundleInfo); bundle = getBundleInstance(); - if (bundle instanceof Loggable) ((Loggable)bundle).setLogger(logger); + if (bundle instanceof Loggable) ((Loggable)bundle).setLogger(getLogger()); bundle.setBundleInfo(bundleInfo); bundle.setParent(parentBundle); if (bundle instanceof Composable) ((Composable)bundle).compose(this.manager); @@ -195,8 +183,8 @@ bundle.setLastModified(System.currentTimeMillis()); } catch (Exception e) { - logger.error("Error while loading bundle: " + bundleInfo + ", uri " + uri, e); - bundle = null; + getLogger().error("Error while loading bundle: " + bundleInfo + ", uri " + uri, e); + bundle = null; } return bundle; }
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>