You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2007/08/27 00:24:07 UTC
svn commit: r569893 [4/6] - in /tapestry/tapestry5/trunk: ./ .settings/
quickstart/src/main/resources/archetype-resources/src/main/java/services/
src/site/ src/site/resources/ src/site/xdoc/ support/ tapestry-core/
tapestry-core/src/main/java/org/apach...
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/AbstractServiceCreator.java Sun Aug 26 15:23:55 2007
@@ -25,10 +25,10 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ServiceBuilderResources;
import org.apache.tapestry.ioc.ServiceResources;
+import org.slf4j.Logger;
/**
* Abstract implementation of {@link ObjectCreator} geared towards the creation of the core service
@@ -43,7 +43,7 @@
protected final ServiceBuilderResources _resources;
- protected final Log _log;
+ protected final Logger _logger;
private final static Map<Class, ConfigurationType> PARAMETER_TYPE_TO_CONFIGURATION_TYPE = newMap();
@@ -61,11 +61,11 @@
_serviceId = resources.getServiceId();
_resources = resources;
_creatorDescription = creatorDescription;
- _log = resources.getServiceLog();
+ _logger = resources.getLogger();
_parameterDefaults.put(String.class, _serviceId);
_parameterDefaults.put(ServiceResources.class, resources);
- _parameterDefaults.put(Log.class, _log);
+ _parameterDefaults.put(Logger.class, _logger);
_parameterDefaults.put(Class.class, resources.getServiceInterface());
}
@@ -90,7 +90,7 @@
if (type != null)
{
- _log.warn(IOCMessages.tooManyConfigurationParameters(_creatorDescription));
+ _logger.warn(IOCMessages.tooManyConfigurationParameters(_creatorDescription));
break;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ConstructorServiceCreator.java Sun Aug 26 15:23:55 2007
@@ -48,8 +48,8 @@
_resources,
getParameterDefaultsWithConfigurations());
- if (_log.isDebugEnabled())
- _log.debug(IOCMessages.invokingConstructor(_creatorDescription));
+ if (_logger.isDebugEnabled())
+ _logger.debug(IOCMessages.invokingConstructor(_creatorDescription));
return _constructor.newInstance(parameters);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/DefaultModuleDefImpl.java Sun Aug 26 15:23:55 2007
@@ -32,7 +32,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.IOCConstants;
import org.apache.tapestry.ioc.MappedConfiguration;
@@ -50,6 +49,7 @@
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
+import org.slf4j.Logger;
/**
* Starting from the Class for a module builder, identifies all the services (service builder
@@ -69,7 +69,7 @@
private final Class _builderClass;
- private final Log _log;
+ private final Logger _logger;
private final ClassFactory _classFactory;
@@ -93,21 +93,21 @@
/**
* @param builderClass
* the class that is responsible for building services, etc.
- * @param log
+ * @param logger
* @param classFactory
* TODO
*/
- public DefaultModuleDefImpl(Class builderClass, Log log, ClassFactory classFactory)
+ public DefaultModuleDefImpl(Class builderClass, Logger logger, ClassFactory classFactory)
{
_builderClass = builderClass;
- _log = log;
+ _logger = logger;
_classFactory = classFactory;
grind();
bind();
}
- /** Identified the module builder class and a list of service ids within the module. */
+ /** Identifies the module builder class and a list of service ids within the module. */
@Override
public String toString()
{
@@ -183,7 +183,7 @@
Class returnType = method.getReturnType();
if (!returnType.equals(void.class))
- _log.warn(IOCMessages.contributionWrongReturnType(method));
+ _logger.warn(IOCMessages.contributionWrongReturnType(method));
ConfigurationType type = null;
@@ -196,7 +196,7 @@
{
if (type != null)
{
- _log.warn(IOCMessages.tooManyContributionParameters(method));
+ _logger.warn(IOCMessages.tooManyContributionParameters(method));
return;
}
@@ -206,7 +206,7 @@
if (type == null)
{
- _log.warn(IOCMessages.noContributionParameter(method));
+ _logger.warn(IOCMessages.noContributionParameter(method));
return;
}
@@ -227,13 +227,13 @@
if (returnType.isPrimitive() || returnType.isArray())
{
- _log.warn(decoratorMethodWrongReturnType(method), null);
+ _logger.warn(decoratorMethodWrongReturnType(method));
return;
}
if (!methodContainsObjectParameter(method))
{
- _log.warn(IOCMessages.decoratorMethodNeedsDelegateParameter(method), null);
+ _logger.warn(IOCMessages.decoratorMethodNeedsDelegateParameter(method));
return;
}
@@ -292,7 +292,7 @@
if (returnType.isPrimitive() || returnType.isArray())
{
- _log.warn(buildMethodWrongReturnType(method), null);
+ _logger.warn(buildMethodWrongReturnType(method));
return;
}
@@ -326,7 +326,7 @@
if (existing != null)
{
- _log.warn(buildMethodConflict(serviceDef.toString(), existing.toString()), null);
+ _logger.warn(buildMethodConflict(serviceDef.toString(), existing.toString()));
return;
}
@@ -350,7 +350,7 @@
return _contributionDefs;
}
- public String getLogName()
+ public String getLoggerName()
{
return _builderClass.getName();
}
@@ -367,7 +367,7 @@
if (!Modifier.isStatic(bindMethod.getModifiers()))
{
- _log.error(IOCMessages.bindMethodMustBeStatic(InternalUtils.asString(
+ _logger.error(IOCMessages.bindMethodMustBeStatic(InternalUtils.asString(
bindMethod,
_classFactory)));
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/InternalRegistry.java Sun Aug 26 15:23:55 2007
@@ -18,7 +18,6 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.AnnotationProvider;
import org.apache.tapestry.ioc.ObjectProvider;
import org.apache.tapestry.ioc.Registry;
@@ -28,6 +27,7 @@
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.RegistryShutdownHub;
+import org.slf4j.Logger;
/**
* Internal view of the module registry, adding additional methods needed by modules.
@@ -118,11 +118,11 @@
String expandSymbols(String input);
/**
- * Returns a log for the service, which consists of the Module's
- * {@link Module#getLogName() log name} suffixed with a period and the service id.
+ * Returns a logger for the service, which consists of the Module's
+ * {@link Module#getLoggerName() log name} suffixed with a period and the service id.
*
* @param serviceId
- * @return the log instance for the service
+ * @return the logger for the service
*/
- Log logForService(String serviceId);
+ Logger getServiceLogger(String serviceId);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LogSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LogSourceImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LogSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/LogSourceImpl.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,29 +12,27 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.tapestry.ioc.LogSource;
-
-/**
- * Simple wrapper around {@link org.apache.commons.logging.LogFactory}. The concept here is that
- * Log implementations could be provided that promote warnings or errors upto thrown exceptions, for
- * people who like their IOC container extra finicky.
- *
- *
- */
-public class LogSourceImpl implements LogSource
-{
- public Log getLog(Class clazz)
- {
- return LogFactory.getLog(clazz);
- }
-
- public Log getLog(String name)
- {
- return LogFactory.getLog(name);
- }
-
-}
+package org.apache.tapestry.ioc.internal;
+
+import org.apache.tapestry.ioc.LogSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Simple wrapper around SLF4J's LoggerFactory. The concept here is that Log implementations could
+ * be provided that promote warnings or errors upto thrown exceptions, for people who like their IOC
+ * container extra finicky. In addition, the extra layer makes things a lot easier to mock.
+ */
+public class LogSourceImpl implements LogSource
+{
+ public Logger getLogger(Class clazz)
+ {
+ return LoggerFactory.getLogger(clazz);
+ }
+
+ public Logger getLogger(String name)
+ {
+ return LoggerFactory.getLogger(name);
+ }
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/Module.java Sun Aug 26 15:23:55 2007
@@ -101,7 +101,7 @@
* Returns the name used to obtain a logger for the module. Services within the module suffix
* this with a period and the service id.
*
- * @return module log name
+ * @return module logger name
*/
- String getLogName();
+ String getLoggerName();
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ModuleImpl.java Sun Aug 26 15:23:55 2007
@@ -32,7 +32,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ObjectLocator;
import org.apache.tapestry.ioc.ServiceBuilderResources;
@@ -48,6 +47,7 @@
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodSignature;
import org.apache.tapestry.ioc.services.TapestryIOCModule;
+import org.slf4j.Logger;
public class ModuleImpl implements Module
{
@@ -57,7 +57,7 @@
private final ClassFactory _classFactory;
- private final Log _log;
+ private final Logger _logger;
// Guarded by MUTEX
private Object _moduleBuilder;
@@ -75,12 +75,12 @@
private boolean _insideConstructor;
public ModuleImpl(InternalRegistry registry, ModuleDef moduleDef, ClassFactory classFactory,
- Log log)
+ Logger logger)
{
_registry = registry;
_moduleDef = moduleDef;
_classFactory = classFactory;
- _log = log;
+ _logger = logger;
}
/** Keyed on fully qualified service id; values are instantiated services (proxies). */
@@ -208,14 +208,14 @@
{
String serviceId = def.getServiceId();
- Log log = _registry.logForService(serviceId);
+ Logger logger = _registry.getServiceLogger(serviceId);
- if (log.isDebugEnabled()) log.debug(IOCMessages.creatingService(serviceId));
+ if (logger.isDebugEnabled()) logger.debug(IOCMessages.creatingService(serviceId));
try
{
ServiceBuilderResources resources = new ServiceResourcesImpl(_registry, this, def,
- _classFactory, log);
+ _classFactory, logger);
// Build up a stack of operations that will be needed to realize the service
// (by the proxy, at a later date).
@@ -240,7 +240,7 @@
// Add a wrapper that checks for recursion.
- creator = new RecursiveServiceCreationCheckWrapper(def, creator, log);
+ creator = new RecursiveServiceCreationCheckWrapper(def, creator, logger);
JustInTimeObjectCreator delegate = new JustInTimeObjectCreator(creator, serviceId);
@@ -300,7 +300,7 @@
Arrays.sort(constructors, comparator);
- _log.warn(IOCMessages.tooManyPublicConstructors(builderClass, constructors[0]));
+ _logger.warn(IOCMessages.tooManyPublicConstructors(builderClass, constructors[0]));
}
Constructor constructor = constructors[0];
@@ -313,7 +313,7 @@
ObjectLocator locator = new ObjectLocatorImpl(_registry, this);
Map<Class, Object> parameterDefaults = newMap();
- parameterDefaults.put(Log.class, _log);
+ parameterDefaults.put(Logger.class, _logger);
parameterDefaults.put(ObjectLocator.class, locator);
Throwable fail = null;
@@ -415,9 +415,9 @@
return _moduleDef.getServiceDef(serviceId);
}
- public String getLogName()
+ public String getLoggerName()
{
- return _moduleDef.getLogName();
+ return _moduleDef.getLoggerName();
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RecursiveServiceCreationCheckWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RecursiveServiceCreationCheckWrapper.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RecursiveServiceCreationCheckWrapper.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RecursiveServiceCreationCheckWrapper.java Sun Aug 26 15:23:55 2007
@@ -14,9 +14,9 @@
package org.apache.tapestry.ioc.internal;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.def.ServiceDef;
+import org.slf4j.Logger;
/**
* Decorator for {@link org.apache.tapestry.ioc.ObjectCreator} that ensures the service is only
@@ -31,15 +31,16 @@
private final ObjectCreator _delegate;
- private final Log _log;
+ private final Logger _logger;
private boolean _locked;
- public RecursiveServiceCreationCheckWrapper(ServiceDef serviceDef, ObjectCreator delegate, Log log)
+ public RecursiveServiceCreationCheckWrapper(ServiceDef serviceDef, ObjectCreator delegate,
+ Logger logger)
{
_serviceDef = serviceDef;
_delegate = delegate;
- _log = log;
+ _logger = logger;
}
/**
@@ -61,7 +62,7 @@
}
catch (RuntimeException ex)
{
- _log.error(IOCMessages.serviceConstructionFailed(_serviceDef, ex), ex);
+ _logger.error(IOCMessages.serviceConstructionFailed(_serviceDef, ex), ex);
// Release the lock on failure; the service is now in an unknown state, but we may
// be able to continue from here.
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/RegistryImpl.java Sun Aug 26 15:23:55 2007
@@ -27,7 +27,6 @@
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.AnnotationProvider;
import org.apache.tapestry.ioc.Configuration;
import org.apache.tapestry.ioc.IOCConstants;
@@ -57,6 +56,7 @@
import org.apache.tapestry.ioc.services.SymbolSource;
import org.apache.tapestry.ioc.services.TapestryIOCModule;
import org.apache.tapestry.ioc.services.ThreadCleanupHub;
+import org.slf4j.Logger;
public class RegistryImpl implements Registry, InternalRegistry
{
@@ -132,9 +132,9 @@
for (ModuleDef def : moduleDefs)
{
- Log log = _logSource.getLog(def.getLogName());
+ Logger logger = _logSource.getLogger(def.getLoggerName());
- Module module = new ModuleImpl(this, def, classFactory, log);
+ Module module = new ModuleImpl(this, def, classFactory, logger);
_modules.add(module);
@@ -156,15 +156,15 @@
addBuiltin(CLASS_FACTORY_SERVICE_ID, ClassFactory.class, _classFactory);
- Log log = logForBuiltinService(THREAD_CLEANUP_HUB_SERVICE_ID);
+ Logger logger = loggerForBuiltinService(THREAD_CLEANUP_HUB_SERVICE_ID);
- _cleanupHub = new ThreadCleanupHubImpl(log);
+ _cleanupHub = new ThreadCleanupHubImpl(logger);
addBuiltin(THREAD_CLEANUP_HUB_SERVICE_ID, ThreadCleanupHub.class, _cleanupHub);
- log = logForBuiltinService(REGISTRY_SHUTDOWN_HUB_SERVICE_ID);
+ logger = loggerForBuiltinService(REGISTRY_SHUTDOWN_HUB_SERVICE_ID);
- _registryShutdownHub = new RegistryShutdownHubImpl(log);
+ _registryShutdownHub = new RegistryShutdownHubImpl(logger);
addBuiltin(
REGISTRY_SHUTDOWN_HUB_SERVICE_ID,
@@ -190,18 +190,18 @@
cleanupThread();
}
- public Log logForService(String serviceId)
+ public Logger getServiceLogger(String serviceId)
{
Module module = _serviceIdToModule.get(serviceId);
assert module != null;
- return _logSource.getLog(module.getLogName() + "." + serviceId);
+ return _logSource.getLogger(module.getLoggerName() + "." + serviceId);
}
- private Log logForBuiltinService(String serviceId)
+ private Logger loggerForBuiltinService(String serviceId)
{
- return _logSource.getLog(TapestryIOCModule.class + "." + serviceId);
+ return _logSource.getLogger(TapestryIOCModule.class + "." + serviceId);
}
private <T> void addBuiltin(String serviceId, Class<T> serviceInterface, T service)
@@ -294,9 +294,10 @@
{
_lock.check();
- Log log = null;
+ String serviceId = serviceDef.getServiceId();
+ Logger logger = getServiceLogger(serviceId);
- final Orderer<T> orderer = new Orderer<T>(log);
+ final Orderer<T> orderer = new Orderer<T>(logger);
OrderedConfiguration<T> configuration = new OrderedConfigurationToOrdererAdaptor<T>(orderer);
@@ -362,19 +363,19 @@
if (contributions.isEmpty()) return;
- Log log = logForService(serviceId);
+ Logger logger = getServiceLogger(serviceId);
- boolean debug = log.isDebugEnabled();
+ boolean debug = logger.isDebugEnabled();
ObjectLocator locator = new ServiceResourcesImpl(this, module, serviceDef, _classFactory,
- log);
+ logger);
for (ContributionDef def : contributions)
{
MappedConfiguration<K, V> validating = new ValidatingMappedConfigurationWrapper<K, V>(
- serviceId, def, log, keyClass, valueType, keyToContribution, configuration);
+ serviceId, def, logger, keyClass, valueType, keyToContribution, configuration);
- if (debug) log.debug(IOCMessages.invokingMethod(def));
+ if (debug) logger.debug(IOCMessages.invokingMethod(def));
def.contribute(module, locator, validating);
}
@@ -389,19 +390,19 @@
if (contributions.isEmpty()) return;
- Log log = logForService(serviceId);
+ Logger logger = getServiceLogger(serviceId);
- boolean debug = log.isDebugEnabled();
+ boolean debug = logger.isDebugEnabled();
ObjectLocator locator = new ServiceResourcesImpl(this, module, serviceDef, _classFactory,
- log);
+ logger);
for (ContributionDef def : contributions)
{
- Configuration<T> validating = new ValidatingConfigurationWrapper<T>(serviceId, log,
+ Configuration<T> validating = new ValidatingConfigurationWrapper<T>(serviceId, logger,
valueType, def, configuration);
- if (debug) log.debug(IOCMessages.invokingMethod(def));
+ if (debug) logger.debug(IOCMessages.invokingMethod(def));
def.contribute(module, locator, validating);
}
@@ -415,18 +416,18 @@
if (contributions.isEmpty()) return;
- Log log = logForService(serviceId);
- boolean debug = log.isDebugEnabled();
+ Logger logger = getServiceLogger(serviceId);
+ boolean debug = logger.isDebugEnabled();
ObjectLocator locator = new ServiceResourcesImpl(this, module, serviceDef, _classFactory,
- log);
+ logger);
for (ContributionDef def : contributions)
{
OrderedConfiguration<T> validating = new ValidatingOrderedConfigurationWrapper<T>(
- serviceId, def, log, valueType, configuration);
+ serviceId, def, logger, valueType, configuration);
- if (debug) log.debug(IOCMessages.invokingMethod(def));
+ if (debug) logger.debug(IOCMessages.invokingMethod(def));
def.contribute(module, locator, validating);
}
@@ -504,9 +505,9 @@
assert serviceDef != null;
- Log log = logForService(serviceDef.getServiceId());
+ Logger logger = getServiceLogger(serviceDef.getServiceId());
- Orderer<ServiceDecorator> orderer = new Orderer<ServiceDecorator>(log);
+ Orderer<ServiceDecorator> orderer = new Orderer<ServiceDecorator>(logger);
for (Module module : _modules)
{
@@ -515,7 +516,7 @@
if (decorators.isEmpty()) continue;
ServiceResources resources = new ServiceResourcesImpl(this, module, serviceDef,
- _classFactory, log);
+ _classFactory, logger);
for (DecoratorDef dd : decorators)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvoker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvoker.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvoker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceBuilderMethodInvoker.java Sun Aug 26 15:23:55 2007
@@ -70,7 +70,8 @@
_resources,
getParameterDefaultsWithConfigurations());
- if (_log.isDebugEnabled()) _log.debug(IOCMessages.invokingMethod(_creatorDescription));
+ if (_logger.isDebugEnabled())
+ _logger.debug(IOCMessages.invokingMethod(_creatorDescription));
result = _builderMethod.invoke(moduleBuilder, parameters);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDecoratorImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceDecoratorImpl.java Sun Aug 26 15:23:55 2007
@@ -20,12 +20,12 @@
import java.lang.reflect.Method;
import java.util.Map;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ModuleBuilderSource;
import org.apache.tapestry.ioc.ServiceDecorator;
import org.apache.tapestry.ioc.ServiceResources;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
+import org.slf4j.Logger;
/**
* A wrapper around a decorator method.
@@ -38,7 +38,7 @@
private final Map<Class, Object> _parameterDefaults = newMap();
- private final Log _log;
+ private final Logger _logger;
private final ServiceResources _resources;
@@ -56,12 +56,12 @@
_moduleBuilderSource = moduleBuilderSource;
_resources = resources;
_serviceInterface = resources.getServiceInterface();
- _log = resources.getServiceLog();
+ _logger = resources.getLogger();
_classFactory = classFactory;
_parameterDefaults.put(String.class, _serviceId);
_parameterDefaults.put(ServiceResources.class, resources);
- _parameterDefaults.put(Log.class, _log);
+ _parameterDefaults.put(Logger.class, _logger);
_parameterDefaults.put(Class.class, _serviceInterface);
}
@@ -78,7 +78,7 @@
Map<Class, Object> parameterDefaults = newMap(_parameterDefaults);
parameterDefaults.put(Object.class, delegate);
- if (_log.isDebugEnabled()) _log.debug(IOCMessages.invokingMethod(methodId()));
+ if (_logger.isDebugEnabled()) _logger.debug(IOCMessages.invokingMethod(methodId()));
Object result = null;
Throwable failure = null;
@@ -113,11 +113,11 @@
if (result != null && !_serviceInterface.isInstance(result))
{
- _log.warn(IOCMessages.decoratorReturnedWrongType(
+ _logger.warn(IOCMessages.decoratorReturnedWrongType(
_decoratorMethod,
_serviceId,
result,
- _serviceInterface), null);
+ _serviceInterface));
// Change the result to null so that we won't use the interceptor,
// and so that ClassCastExceptions don't occur later down the pipeline.
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ServiceResourcesImpl.java Sun Aug 26 15:23:55 2007
@@ -21,12 +21,12 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.ObjectCreator;
import org.apache.tapestry.ioc.ServiceBuilderResources;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
+import org.slf4j.Logger;
/**
* Implementation of {@link org.apache.tapestry.ioc.ServiceBuilderResources}. We just have one
@@ -40,18 +40,18 @@
{
private final ServiceDef _serviceDef;
- private final Log _log;
+ private final Logger _logger;
private final ClassFactory _classFactory;
public ServiceResourcesImpl(InternalRegistry registry, Module module, ServiceDef serviceDef,
- ClassFactory classFactory, Log log)
+ ClassFactory classFactory, Logger logger)
{
super(registry, module);
_serviceDef = serviceDef;
_classFactory = classFactory;
- _log = log;
+ _logger = logger;
}
public String getServiceId()
@@ -64,9 +64,9 @@
return _serviceDef.getServiceInterface();
}
- public Log getServiceLog()
+ public Logger getLogger()
{
- return _log;
+ return _logger;
}
public <T> Collection<T> getUnorderedConfiguration(Class<T> valueType)
@@ -80,7 +80,8 @@
private void logConfiguration(Collection configuration)
{
- if (_log.isDebugEnabled()) _log.debug(IOCMessages.constructedConfiguration(configuration));
+ if (_logger.isDebugEnabled())
+ _logger.debug(IOCMessages.constructedConfiguration(configuration));
}
public <T> List<T> getOrderedConfiguration(Class<T> valueType)
@@ -96,7 +97,7 @@
{
Map<K, V> result = getRegistry().getMappedConfiguration(_serviceDef, keyType, valueType);
- if (_log.isDebugEnabled()) _log.debug(IOCMessages.constructedConfiguration(result));
+ if (_logger.isDebugEnabled()) _logger.debug(IOCMessages.constructedConfiguration(result));
return result;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapper.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapper.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingConfigurationWrapper.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,57 +12,60 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import org.apache.commons.logging.Log;
-import org.apache.tapestry.ioc.Configuration;
-import org.apache.tapestry.ioc.def.ContributionDef;
-
-/**
- * Performs some validation before delegating to another Configuration.
- */
-public class ValidatingConfigurationWrapper<T> implements Configuration<T>
-{
- private final String _serviceId;
-
- private final ContributionDef _contributionDef;
-
- private final Log _log;
-
- private final Configuration<T> _delegate;
-
- private final Class _expectedType;
-
- // Need a strategy for determing the right order for this mass of parameters!
-
- public ValidatingConfigurationWrapper(String serviceId, Log log, Class expectedType,
- ContributionDef contributionDef, Configuration<T> delegate)
- {
- _serviceId = serviceId;
- _log = log;
- _expectedType = expectedType;
- _contributionDef = contributionDef;
- _delegate = delegate;
- }
-
- public void add(T object)
- {
- if (object == null)
- {
- _log.warn(IOCMessages.contributionWasNull(_serviceId, _contributionDef));
- return;
- }
-
- // Sure, we say it is type T ... but is it really?
-
- if (!_expectedType.isInstance(object))
- {
- _log.warn(IOCMessages.contributionWrongValueType(_serviceId, _contributionDef, object
- .getClass(), _expectedType));
- return;
- }
-
- _delegate.add(object);
- }
-
-}
+package org.apache.tapestry.ioc.internal;
+
+import org.apache.tapestry.ioc.Configuration;
+import org.apache.tapestry.ioc.def.ContributionDef;
+import org.slf4j.Logger;
+
+/**
+ * Performs some validation before delegating to another Configuration.
+ */
+public class ValidatingConfigurationWrapper<T> implements Configuration<T>
+{
+ private final String _serviceId;
+
+ private final ContributionDef _contributionDef;
+
+ private final Logger _logger;
+
+ private final Configuration<T> _delegate;
+
+ private final Class _expectedType;
+
+ // Need a strategy for determing the right order for this mass of parameters!
+
+ public ValidatingConfigurationWrapper(String serviceId, Logger logger, Class expectedType,
+ ContributionDef contributionDef, Configuration<T> delegate)
+ {
+ _serviceId = serviceId;
+ _logger = logger;
+ _expectedType = expectedType;
+ _contributionDef = contributionDef;
+ _delegate = delegate;
+ }
+
+ public void add(T object)
+ {
+ if (object == null)
+ {
+ _logger.warn(IOCMessages.contributionWasNull(_serviceId, _contributionDef));
+ return;
+ }
+
+ // Sure, we say it is type T ... but is it really?
+
+ if (!_expectedType.isInstance(object))
+ {
+ _logger.warn(IOCMessages.contributionWrongValueType(
+ _serviceId,
+ _contributionDef,
+ object.getClass(),
+ _expectedType));
+ return;
+ }
+
+ _delegate.add(object);
+ }
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapper.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapper.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingMappedConfigurationWrapper.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,98 +12,101 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal;
-
-import java.util.Map;
-
-import org.apache.commons.logging.Log;
-import org.apache.tapestry.ioc.MappedConfiguration;
-import org.apache.tapestry.ioc.def.ContributionDef;
-
-/**
- * Provides two forms of validation for mapped configurations:
- * <ul>
- * <li>If either key or value is null, then a warning is logged </li>
- * <li>If the key has previously been stored (by some other
- * {@link org.apache.tapestry.ioc.def.ContributionDef}, then a warning is logged</li>
- * </ul>
- * <p>
- * When a warning is logged, the key/value pair is not added to the delegate.
- *
- * @param <K>
- * @param <V>
- */
-public class ValidatingMappedConfigurationWrapper<K, V> implements MappedConfiguration<K, V>
-{
- private final String _serviceId;
-
- private final ContributionDef _contributionDef;
-
- private final Log _log;
-
- private final Class<K> _expectedKeyType;
-
- private final Class<V> _expectedValueType;
-
- private final Map<K, ContributionDef> _keyToContributor;
-
- private final MappedConfiguration<K, V> _delegate;
-
- public ValidatingMappedConfigurationWrapper(String serviceId, ContributionDef contributionDef,
- Log log, Class<K> expectedKeyType, Class<V> expectedValueType,
- Map<K, ContributionDef> keyToContributor, MappedConfiguration<K, V> delegate)
- {
- _serviceId = serviceId;
- _contributionDef = contributionDef;
- _log = log;
- _expectedKeyType = expectedKeyType;
- _expectedValueType = expectedValueType;
- _keyToContributor = keyToContributor;
- _delegate = delegate;
- }
-
- public void add(K key, V value)
- {
- if (key == null)
- {
- _log.warn(IOCMessages.contributionKeyWasNull(_serviceId, _contributionDef));
- return;
- }
-
- if (value == null)
- {
- _log.warn(IOCMessages.contributionWasNull(_serviceId, _contributionDef));
- return;
- }
-
- if (!_expectedKeyType.isInstance(key))
- {
- _log.warn(IOCMessages.contributionWrongKeyType(_serviceId, _contributionDef, key
- .getClass(), _expectedKeyType));
- return;
- }
-
- if (!_expectedValueType.isInstance(value))
- {
- _log.warn(IOCMessages.contributionWrongValueType(_serviceId, _contributionDef, value
- .getClass(), _expectedValueType));
- return;
- }
-
- ContributionDef existing = _keyToContributor.get(key);
-
- if (existing != null)
- {
- _log.warn(IOCMessages.contributionDuplicateKey(_serviceId, _contributionDef, existing));
- return;
- }
-
- _delegate.add(key, value);
-
- // Remember that this key is provided by this contribution, when looking
- // for future conflicts.
-
- _keyToContributor.put(key, _contributionDef);
- }
-
-}
+package org.apache.tapestry.ioc.internal;
+
+import java.util.Map;
+
+import org.apache.tapestry.ioc.MappedConfiguration;
+import org.apache.tapestry.ioc.def.ContributionDef;
+import org.slf4j.Logger;
+
+/**
+ * Provides two forms of validation for mapped configurations:
+ * <ul>
+ * <li>If either key or value is null, then a warning is logged </li>
+ * <li>If the key has previously been stored (by some other
+ * {@link org.apache.tapestry.ioc.def.ContributionDef}, then a warning is logged</li>
+ * </ul>
+ * <p>
+ * When a warning is logged, the key/value pair is not added to the delegate.
+ *
+ * @param <K>
+ * @param <V>
+ */
+public class ValidatingMappedConfigurationWrapper<K, V> implements MappedConfiguration<K, V>
+{
+ private final String _serviceId;
+
+ private final ContributionDef _contributionDef;
+
+ private final Logger _logger;
+
+ private final Class<K> _expectedKeyType;
+
+ private final Class<V> _expectedValueType;
+
+ private final Map<K, ContributionDef> _keyToContributor;
+
+ private final MappedConfiguration<K, V> _delegate;
+
+ public ValidatingMappedConfigurationWrapper(String serviceId, ContributionDef contributionDef,
+ Logger logger, Class<K> expectedKeyType, Class<V> expectedValueType,
+ Map<K, ContributionDef> keyToContributor, MappedConfiguration<K, V> delegate)
+ {
+ _serviceId = serviceId;
+ _contributionDef = contributionDef;
+ _logger = logger;
+ _expectedKeyType = expectedKeyType;
+ _expectedValueType = expectedValueType;
+ _keyToContributor = keyToContributor;
+ _delegate = delegate;
+ }
+
+ public void add(K key, V value)
+ {
+ if (key == null)
+ {
+ _logger.warn(IOCMessages.contributionKeyWasNull(_serviceId, _contributionDef));
+ return;
+ }
+
+ if (value == null)
+ {
+ _logger.warn(IOCMessages.contributionWasNull(_serviceId, _contributionDef));
+ return;
+ }
+
+ if (!_expectedKeyType.isInstance(key))
+ {
+ _logger.warn(IOCMessages.contributionWrongKeyType(_serviceId, _contributionDef, key
+ .getClass(), _expectedKeyType));
+ return;
+ }
+
+ if (!_expectedValueType.isInstance(value))
+ {
+ _logger.warn(IOCMessages.contributionWrongValueType(_serviceId, _contributionDef, value
+ .getClass(), _expectedValueType));
+ return;
+ }
+
+ ContributionDef existing = _keyToContributor.get(key);
+
+ if (existing != null)
+ {
+ _logger.warn(IOCMessages.contributionDuplicateKey(
+ _serviceId,
+ _contributionDef,
+ existing));
+ return;
+ }
+
+ _delegate.add(key, value);
+
+ // Remember that this key is provided by this contribution, when looking
+ // for future conflicts.
+
+ _keyToContributor.put(key, _contributionDef);
+ }
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapper.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapper.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapper.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/ValidatingOrderedConfigurationWrapper.java Sun Aug 26 15:23:55 2007
@@ -14,9 +14,9 @@
package org.apache.tapestry.ioc.internal;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.OrderedConfiguration;
import org.apache.tapestry.ioc.def.ContributionDef;
+import org.slf4j.Logger;
/**
* Implements validation of values provided to an
@@ -33,18 +33,18 @@
private final ContributionDef _contributionDef;
- private final Log _log;
+ private final Logger _logger;
private final Class _expectedType;
private final OrderedConfiguration<T> _delegate;
public ValidatingOrderedConfigurationWrapper(String serviceId, ContributionDef contributionDef,
- Log log, Class expectedType, OrderedConfiguration<T> delegate)
+ Logger logger, Class expectedType, OrderedConfiguration<T> delegate)
{
_serviceId = serviceId;
_contributionDef = contributionDef;
- _log = log;
+ _logger = logger;
_expectedType = expectedType;
_delegate = delegate;
}
@@ -58,7 +58,7 @@
{
if (object == null || _expectedType.isInstance(object)) return object;
- _log.warn(IOCMessages.contributionWrongValueType(_serviceId, _contributionDef, object
+ _logger.warn(IOCMessages.contributionWrongValueType(_serviceId, _contributionDef, object
.getClass(), _expectedType));
return null;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/AbstractFab.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2005, 2006 The Apache Software Foundation
+// Copyright 2005, 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -20,8 +20,8 @@
import javassist.CtClass;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.internal.util.OneShotLock;
+import org.slf4j.Logger;
/**
* Base class for {@link org.apache.tapestry.ioc.internal.services.ClassFabImpl}. This code is a
@@ -36,13 +36,13 @@
private final CtClassSource _source;
- private final Log _log;
+ private final Logger _logger;
- public AbstractFab(CtClassSource source, CtClass ctClass, Log log)
+ public AbstractFab(CtClassSource source, CtClass ctClass, Logger logger)
{
_ctClass = ctClass;
_source = source;
- _log = log;
+ _logger = logger;
}
/**
@@ -103,7 +103,7 @@
{
_lock.lock();
- if (_log.isDebugEnabled()) _log.debug(String.format("Creating class from %s", this));
+ if (_logger.isDebugEnabled()) _logger.debug(String.format("Creating class from %s", this));
return _source.createClass(_ctClass);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/BridgeBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/BridgeBuilder.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/BridgeBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/BridgeBuilder.java Sun Aug 26 15:23:55 2007
@@ -22,11 +22,11 @@
import java.util.Iterator;
import java.util.List;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.MethodIterator;
import org.apache.tapestry.ioc.services.MethodSignature;
+import org.slf4j.Logger;
/**
* Used by the {@link org.apache.tapestry.ioc.internal.services.PipelineBuilderImpl} to create
@@ -36,7 +36,7 @@
*/
class BridgeBuilder<S, F>
{
- private final Log _log;
+ private final Logger _logger;
private final Class<S> _serviceInterface;
@@ -48,10 +48,10 @@
private Constructor _constructor;
- BridgeBuilder(Log log, Class<S> serviceInterface, Class<F> filterInterface,
+ BridgeBuilder(Logger logger, Class<S> serviceInterface, Class<F> filterInterface,
ClassFactory classFactory)
{
- _log = log;
+ _logger = logger;
_serviceInterface = serviceInterface;
_filterInterface = filterInterface;
@@ -149,9 +149,8 @@
{
MethodSignature ms = (MethodSignature) i.next();
- _log.error(
- ServiceMessages.extraFilterMethod(ms, _filterInterface, _serviceInterface),
- null);
+ _logger.error(ServiceMessages
+ .extraFilterMethod(ms, _filterInterface, _serviceInterface));
}
}
@@ -183,7 +182,7 @@
String message = ServiceMessages.unmatchedServiceMethod(ms, _filterInterface);
- _log.error(message, null);
+ _logger.error(message);
String code = format("throw new %s(\"%s\");", RuntimeException.class.getName(), message);
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFabImpl.java Sun Aug 26 15:23:55 2007
@@ -30,13 +30,13 @@
import javassist.CtMethod;
import javassist.NotFoundException;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.internal.util.Defense;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFabUtils;
import org.apache.tapestry.ioc.services.MethodIterator;
import org.apache.tapestry.ioc.services.MethodSignature;
+import org.slf4j.Logger;
/**
* Implementation of {@link org.apache.tapestry.ioc.services.ClassFab}. Hides, as much as possible,
@@ -64,9 +64,9 @@
private final Set<MethodSignature> _addedSignatures = newSet();
- public ClassFabImpl(CtClassSource source, CtClass ctClass, Log log)
+ public ClassFabImpl(CtClassSource source, CtClass ctClass, Logger logger)
{
- super(source, ctClass, log);
+ super(source, ctClass, logger);
}
/**
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ClassFactoryImpl.java Sun Aug 26 15:23:55 2007
@@ -23,20 +23,20 @@
import javassist.CtConstructor;
import javassist.CtMethod;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.tapestry.ioc.Location;
import org.apache.tapestry.ioc.internal.util.InternalUtils;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFabUtils;
import org.apache.tapestry.ioc.services.ClassFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Implementation of {@link org.apache.tapestry.ioc.services.ClassFactory}.
*/
public class ClassFactoryImpl implements ClassFactory
{
- private final Log _log;
+ private final Logger _logger;
/**
* ClassPool shared by all modules (all CtClassSource instances).
@@ -49,7 +49,7 @@
public ClassFactoryImpl(ClassLoader classLoader)
{
- this(classLoader, LogFactory.getLog(ClassFactoryImpl.class));
+ this(classLoader, LoggerFactory.getLogger(ClassFactoryImpl.class));
}
public ClassFactoryImpl()
@@ -58,13 +58,13 @@
}
/** Main constructor where a specific class loader and log is provided. */
- public ClassFactoryImpl(ClassLoader classLoader, Log log)
+ public ClassFactoryImpl(ClassLoader classLoader, Logger log)
{
this(classLoader, new ClassFactoryClassPool(classLoader), log);
}
/** Special constructor used when the class pool is provided externally. */
- public ClassFactoryImpl(ClassLoader classLoader, ClassFactoryClassPool pool, Log log)
+ public ClassFactoryImpl(ClassLoader classLoader, ClassFactoryClassPool pool, Logger logger)
{
_loader = classLoader;
@@ -72,7 +72,7 @@
_classSource = new CtClassSource(_pool, classLoader);
- _log = log;
+ _logger = logger;
}
public ClassFab newClass(Class serviceInterface)
@@ -88,15 +88,15 @@
public ClassFab newClass(String name, Class superClass)
{
- if (_log.isDebugEnabled())
- _log.debug(String.format("Create ClassFab for %s (extends %s)", name, superClass
+ if (_logger.isDebugEnabled())
+ _logger.debug(String.format("Create ClassFab for %s (extends %s)", name, superClass
.getName()));
try
{
CtClass ctNewClass = _classSource.newClass(name, superClass);
- return new ClassFabImpl(_classSource, ctNewClass, _log);
+ return new ClassFabImpl(_classSource, ctNewClass, _logger);
}
catch (Exception ex)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/LoggingDecoratorImpl.java Sun Aug 26 15:23:55 2007
@@ -21,7 +21,6 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.ClassFactory;
@@ -30,6 +29,7 @@
import org.apache.tapestry.ioc.services.MethodIterator;
import org.apache.tapestry.ioc.services.MethodSignature;
import org.apache.tapestry.ioc.util.BodyBuilder;
+import org.slf4j.Logger;
public class LoggingDecoratorImpl implements LoggingDecorator
{
@@ -46,11 +46,11 @@
_exceptionTracker = exceptionTracker;
}
- public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, Log serviceLog)
+ public <T> T build(Class<T> serviceInterface, T delegate, String serviceId, Logger logger)
{
Class interceptorClass = createInterceptorClass(serviceInterface, serviceId);
- ServiceLogger logger = new ServiceLogger(serviceLog, _exceptionTracker);
+ ServiceLogger serviceLogger = new ServiceLogger(logger, _exceptionTracker);
Constructor cc = interceptorClass.getConstructors()[0];
@@ -59,7 +59,7 @@
try
{
- interceptor = cc.newInstance(delegate, logger);
+ interceptor = cc.newInstance(delegate, serviceLogger);
}
catch (InvocationTargetException ite)
{
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/PipelineBuilderImpl.java Sun Aug 26 15:23:55 2007
@@ -16,11 +16,11 @@
import java.util.List;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.annotations.InjectService;
import org.apache.tapestry.ioc.services.ClassFactory;
import org.apache.tapestry.ioc.services.DefaultImplementationBuilder;
import org.apache.tapestry.ioc.services.PipelineBuilder;
+import org.slf4j.Logger;
public class PipelineBuilderImpl implements PipelineBuilder
{
@@ -37,7 +37,7 @@
_defaultImplementationBuilder = defaultImplementationBuilder;
}
- public <S, F> S build(Log log, Class<S> serviceInterface, Class<F> filterInterface,
+ public <S, F> S build(Logger log, Class<S> serviceInterface, Class<F> filterInterface,
List<F> filters)
{
S terminator = _defaultImplementationBuilder.createDefaultImplementation(serviceInterface);
@@ -45,7 +45,7 @@
return build(log, serviceInterface, filterInterface, filters, terminator);
}
- public <S, F> S build(Log log, Class<S> serviceInterface, Class<F> filterInterface,
+ public <S, F> S build(Logger log, Class<S> serviceInterface, Class<F> filterInterface,
List<F> filters, S terminator)
{
if (filters.isEmpty()) return terminator;
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/RegistryShutdownHubImpl.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,61 +12,61 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal.services;
-
+package org.apache.tapestry.ioc.internal.services;
+
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newThreadSafeList;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
+
+import java.util.List;
+
import org.apache.tapestry.ioc.internal.util.OneShotLock;
-import org.apache.tapestry.ioc.services.RegistryShutdownHub;
-import org.apache.tapestry.ioc.services.RegistryShutdownListener;
-
-public class RegistryShutdownHubImpl implements RegistryShutdownHub
-{
- private final OneShotLock _lock = new OneShotLock();
-
- private final Log _log;
-
- private final List<RegistryShutdownListener> _listeners = newThreadSafeList();
-
- public RegistryShutdownHubImpl(Log log)
- {
- _log = log;
- }
-
- public void addRegistryShutdownListener(RegistryShutdownListener listener)
- {
- _lock.check();
-
- _listeners.add(listener);
- }
-
- /**
- * Fires the {@link RegistryShutdownListener#registryDidShutdown()} method on each listener. At
- * the end, all the listeners are discarded.
- *
- * @param log
- * used if any listener throws an exception
- */
- public void fireRegistryDidShutdown()
- {
- _lock.lock();
-
- for (RegistryShutdownListener l : _listeners)
- {
- try
- {
- l.registryDidShutdown();
- }
- catch (Exception ex)
- {
- _log.error(ServiceMessages.shutdownListenerError(l, ex), ex);
- }
- }
-
- _listeners.clear();
- }
-
-}
+import org.apache.tapestry.ioc.services.RegistryShutdownHub;
+import org.apache.tapestry.ioc.services.RegistryShutdownListener;
+import org.slf4j.Logger;
+
+public class RegistryShutdownHubImpl implements RegistryShutdownHub
+{
+ private final OneShotLock _lock = new OneShotLock();
+
+ private final Logger _logger;
+
+ private final List<RegistryShutdownListener> _listeners = newThreadSafeList();
+
+ public RegistryShutdownHubImpl(Logger logger)
+ {
+ _logger = logger;
+ }
+
+ public void addRegistryShutdownListener(RegistryShutdownListener listener)
+ {
+ _lock.check();
+
+ _listeners.add(listener);
+ }
+
+ /**
+ * Fires the {@link RegistryShutdownListener#registryDidShutdown()} method on each listener. At
+ * the end, all the listeners are discarded.
+ *
+ * @param log
+ * used if any listener throws an exception
+ */
+ public void fireRegistryDidShutdown()
+ {
+ _lock.lock();
+
+ for (RegistryShutdownListener l : _listeners)
+ {
+ try
+ {
+ l.registryDidShutdown();
+ }
+ catch (Exception ex)
+ {
+ _logger.error(ServiceMessages.shutdownListenerError(l, ex), ex);
+ }
+ }
+
+ _listeners.clear();
+ }
+
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ServiceLogger.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,168 +12,165 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package org.apache.tapestry.ioc.internal.services;
-
-import static java.lang.String.format;
-
-import java.util.Iterator;
-
-import org.apache.commons.logging.Log;
+package org.apache.tapestry.ioc.internal.services;
+
+import static java.lang.String.format;
+
+import java.util.Iterator;
+
import org.apache.tapestry.ioc.internal.util.Defense;
-import org.apache.tapestry.ioc.services.ExceptionTracker;
-
-/**
- * Used by {@link org.apache.tapestry.ioc.internal.services.LoggingDecoratorImpl} to delegate out
- * logging behavior to a seperate object (helps ensure no naming conflicts).
- */
-public final class ServiceLogger
-{
- private final Log _log;
-
- private final ExceptionTracker _exceptionTracker;
-
- private static final String ENTER = "ENTER";
-
- private static final String EXIT = " EXIT";
-
- private static final String FAIL = " FAIL";
-
- public ServiceLogger(Log log, ExceptionTracker exceptionTracker)
- {
- _log = log;
- _exceptionTracker = exceptionTracker;
- }
-
- /** Returns true if the debugging is enabled for the underlying Log. */
- public boolean isDebugEnabled()
- {
- return _log.isDebugEnabled();
- }
-
- /**
- * Invoked when a method is first entered
- *
- * @param name
- * of the method
- * @param arguments
- */
- public void entry(String name, Object[] arguments)
- {
- StringBuilder buffer = new StringBuilder();
-
- buffer.append(format("[%s] %s(", ENTER, name));
-
- for (int i = 0; i < arguments.length; i++)
- {
- if (i > 0)
- buffer.append(", ");
-
- convert(buffer, arguments[i]);
- }
-
- buffer.append(")");
-
- _log.debug(buffer.toString());
- }
-
- private void convert(StringBuilder buffer, Object object)
- {
- if (object == null)
- {
- buffer.append("null");
- return;
- }
-
- // Minimal, alas: Doesn't handle embedded quotes and other
- // characters. Really want to convert the string back to what it
- // would look like as source code.
-
- if (object instanceof String)
- {
- buffer.append("\"");
- buffer.append(object.toString());
- buffer.append("\"");
- return;
- }
-
- if (object instanceof Object[])
- {
- Object[] values = (Object[]) object;
- buffer.append('{');
-
- for (int i = 0; i < values.length; i++)
- {
- if (i > 0)
- buffer.append(", ");
-
- convert(buffer, values[i]);
- }
-
- buffer.append('}');
- return;
- }
-
- if (object instanceof Iterable)
- {
- Iterable itr = (Iterable) object;
- boolean first = true;
-
- buffer.append('[');
- Iterator i = itr.iterator();
- while (i.hasNext())
- {
- if (!first)
- buffer.append(", ");
-
- convert(buffer, i.next());
- first = false;
- }
- buffer.append(']');
- return;
- }
-
- // Might need to add a few more, for things like character values ...
-
- buffer.append(object.toString());
- }
-
- /**
- * Invoked when a method returns a value
- *
- * @param name
- * of the method
- * @param result
- * the return value for the method invocation
- */
- public void exit(String name, Object result)
- {
- Defense.notNull(name, "name");
-
- StringBuilder buffer = new StringBuilder();
-
- buffer.append(format("[%s] %s [", EXIT, name));
-
- convert(buffer, result);
-
- buffer.append(']');
-
- _log.debug(buffer.toString());
- }
-
- /** Invoked when void method finishes succesfully. */
- public void voidExit(String name)
- {
- _log.debug(format("[%s] %s", EXIT, name));
- }
-
- /** Invoked when method invocation instead throws an exception. */
- public void fail(String name, Throwable t)
- {
- if (_log.isDebugEnabled())
- {
- _log.debug(
- format("[%s] %s -- %s", FAIL, name, t.getClass().getName()),
- _exceptionTracker.exceptionLogged(t) ? null : t);
- }
- }
-}
+import org.apache.tapestry.ioc.services.ExceptionTracker;
+import org.slf4j.Logger;
+
+/**
+ * Used by {@link org.apache.tapestry.ioc.internal.services.LoggingDecoratorImpl} to delegate out
+ * logging behavior to a seperate object (helps ensure no naming conflicts).
+ */
+public final class ServiceLogger
+{
+ private final Logger _logger;
+
+ private final ExceptionTracker _exceptionTracker;
+
+ private static final String ENTER = "ENTER";
+
+ private static final String EXIT = " EXIT";
+
+ private static final String FAIL = " FAIL";
+
+ public ServiceLogger(Logger logger, ExceptionTracker exceptionTracker)
+ {
+ _logger = logger;
+ _exceptionTracker = exceptionTracker;
+ }
+
+ /** Returns true if the debugging is enabled for the underlying Log. */
+ public boolean isDebugEnabled()
+ {
+ return _logger.isDebugEnabled();
+ }
+
+ /**
+ * Invoked when a method is first entered
+ *
+ * @param name
+ * of the method
+ * @param arguments
+ */
+ public void entry(String name, Object[] arguments)
+ {
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append(format("[%s] %s(", ENTER, name));
+
+ for (int i = 0; i < arguments.length; i++)
+ {
+ if (i > 0) buffer.append(", ");
+
+ convert(buffer, arguments[i]);
+ }
+
+ buffer.append(")");
+
+ _logger.debug(buffer.toString());
+ }
+
+ private void convert(StringBuilder buffer, Object object)
+ {
+ if (object == null)
+ {
+ buffer.append("null");
+ return;
+ }
+
+ // Minimal, alas: Doesn't handle embedded quotes and other
+ // characters. Really want to convert the string back to what it
+ // would look like as source code.
+
+ if (object instanceof String)
+ {
+ buffer.append("\"");
+ buffer.append(object.toString());
+ buffer.append("\"");
+ return;
+ }
+
+ if (object instanceof Object[])
+ {
+ Object[] values = (Object[]) object;
+ buffer.append('{');
+
+ for (int i = 0; i < values.length; i++)
+ {
+ if (i > 0) buffer.append(", ");
+
+ convert(buffer, values[i]);
+ }
+
+ buffer.append('}');
+ return;
+ }
+
+ if (object instanceof Iterable)
+ {
+ Iterable itr = (Iterable) object;
+ boolean first = true;
+
+ buffer.append('[');
+ Iterator i = itr.iterator();
+ while (i.hasNext())
+ {
+ if (!first) buffer.append(", ");
+
+ convert(buffer, i.next());
+ first = false;
+ }
+ buffer.append(']');
+ return;
+ }
+
+ // Might need to add a few more, for things like character values ...
+
+ buffer.append(object.toString());
+ }
+
+ /**
+ * Invoked when a method returns a value
+ *
+ * @param name
+ * of the method
+ * @param result
+ * the return value for the method invocation
+ */
+ public void exit(String name, Object result)
+ {
+ Defense.notNull(name, "name");
+
+ StringBuilder buffer = new StringBuilder();
+
+ buffer.append(format("[%s] %s [", EXIT, name));
+
+ convert(buffer, result);
+
+ buffer.append(']');
+
+ _logger.debug(buffer.toString());
+ }
+
+ /** Invoked when void method finishes succesfully. */
+ public void voidExit(String name)
+ {
+ _logger.debug(format("[%s] %s", EXIT, name));
+ }
+
+ /** Invoked when method invocation instead throws an exception. */
+ public void fail(String name, Throwable t)
+ {
+ if (_logger.isDebugEnabled())
+ {
+ _logger.debug(
+ format("[%s] %s -- %s", FAIL, name, t.getClass().getName()),
+ _exceptionTracker.exceptionLogged(t) ? null : t);
+ }
+ }
+}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImpl.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/services/ThreadCleanupHubImpl.java Sun Aug 26 15:23:55 2007
@@ -18,9 +18,9 @@
import java.util.List;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.services.ThreadCleanupHub;
import org.apache.tapestry.ioc.services.ThreadCleanupListener;
+import org.slf4j.Logger;
public class ThreadCleanupHubImpl implements ThreadCleanupHub
{
@@ -33,13 +33,13 @@
}
}
- private final Log _log;
+ private final Logger _logger;
private final ListHolder _holder = new ListHolder();
- public ThreadCleanupHubImpl(Log log)
+ public ThreadCleanupHubImpl(Logger logger)
{
- _log = log;
+ _logger = logger;
}
public void addThreadCleanupListener(ThreadCleanupListener listener)
@@ -69,7 +69,7 @@
}
catch (Exception ex)
{
- _log.warn(ServiceMessages.threadCleanupError(listener, ex), ex);
+ _logger.warn(ServiceMessages.threadCleanupError(listener, ex), ex);
}
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/DependencyNode.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/DependencyNode.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/DependencyNode.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/DependencyNode.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -12,135 +12,127 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-/**
- *
- */
-package org.apache.tapestry.ioc.internal.util;
-
+package org.apache.tapestry.ioc.internal.util;
+
import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
-
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.tapestry.ioc.Orderable;
-
-/**
- * Used by {@link org.apache.tapestry.ioc.internal.util.Orderer} to establish backward dependencies for
- * {@link org.apache.tapestry.ioc.Orderable} objects.
- *
- * @param <T>
- */
-
-class DependencyNode<T>
-{
- private final Log _log;
-
- private final Orderable<T> _orderable;
-
- private final List<DependencyNode<T>> _dependencies = newList();
-
- DependencyNode(Log errorLog, Orderable<T> orderable)
- {
- _log = errorLog;
- _orderable = orderable;
- }
-
- @Override
- public String toString()
- {
- StringBuilder buffer = new StringBuilder(String.format("[%s", getId()));
-
- boolean first = true;
-
- for (DependencyNode<T> node : _dependencies)
- {
-
- buffer.append(first ? ": " : ", ");
-
- buffer.append(node.toString());
-
- first = false;
- }
-
- buffer.append("]");
-
- return buffer.toString();
- }
-
- /**
- * Returns the underlying {@link Orderable}'s id.
- */
- public String getId()
- {
- return _orderable.getId();
- }
-
- void addDependency(DependencyNode<T> node)
- {
- if (node.isReachable(this))
- {
- String message = UtilMessages.dependencyCycle(node, this);
- _log.warn(message, null);
- return;
- }
-
- // Make this node depend on the other node.
- // That forces the other node's orderable
- // to appear before this node's orderable.
-
- _dependencies.add(node);
- }
-
- boolean isReachable(DependencyNode<T> node)
- {
- if (this == node)
- return true;
-
- // Quick fast pass for immediate dependencies
-
- for (DependencyNode<T> d : _dependencies)
- {
- if (d == node)
- return true;
- }
-
- // Slower second pass looks for
- // indirect dependencies
-
- for (DependencyNode<T> d : _dependencies)
- {
- if (d.isReachable(node))
- return true;
- }
-
- return false;
- }
-
- /**
- * Returns the {@link Orderable} objects for this node ordered based on dependencies.
- */
- List<Orderable<T>> getOrdered()
- {
- List<Orderable<T>> result = newList();
-
- fillOrder(result);
-
- return result;
- }
-
- private void fillOrder(List<Orderable<T>> list)
- {
- if (list.contains(_orderable))
- return;
-
- // Recusively add dependencies
-
- for (DependencyNode<T> node : _dependencies)
- {
- node.fillOrder(list);
- }
-
- list.add(_orderable);
- }
-
+
+import java.util.List;
+
+import org.apache.tapestry.ioc.Orderable;
+import org.slf4j.Logger;
+
+/**
+ * Used by {@link org.apache.tapestry.ioc.internal.util.Orderer} to establish backward dependencies
+ * for {@link org.apache.tapestry.ioc.Orderable} objects.
+ *
+ * @param <T>
+ */
+
+class DependencyNode<T>
+{
+ private final Logger _logger;
+
+ private final Orderable<T> _orderable;
+
+ private final List<DependencyNode<T>> _dependencies = newList();
+
+ DependencyNode(Logger logger, Orderable<T> orderable)
+ {
+ _logger = logger;
+ _orderable = orderable;
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder buffer = new StringBuilder(String.format("[%s", getId()));
+
+ boolean first = true;
+
+ for (DependencyNode<T> node : _dependencies)
+ {
+
+ buffer.append(first ? ": " : ", ");
+
+ buffer.append(node.toString());
+
+ first = false;
+ }
+
+ buffer.append("]");
+
+ return buffer.toString();
+ }
+
+ /**
+ * Returns the underlying {@link Orderable}'s id.
+ */
+ public String getId()
+ {
+ return _orderable.getId();
+ }
+
+ void addDependency(DependencyNode<T> node)
+ {
+ if (node.isReachable(this))
+ {
+ _logger.warn(UtilMessages.dependencyCycle(node, this));
+ return;
+ }
+
+ // Make this node depend on the other node.
+ // That forces the other node's orderable
+ // to appear before this node's orderable.
+
+ _dependencies.add(node);
+ }
+
+ boolean isReachable(DependencyNode<T> node)
+ {
+ if (this == node) return true;
+
+ // Quick fast pass for immediate dependencies
+
+ for (DependencyNode<T> d : _dependencies)
+ {
+ if (d == node) return true;
+ }
+
+ // Slower second pass looks for
+ // indirect dependencies
+
+ for (DependencyNode<T> d : _dependencies)
+ {
+ if (d.isReachable(node)) return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns the {@link Orderable} objects for this node ordered based on dependencies.
+ */
+ List<Orderable<T>> getOrdered()
+ {
+ List<Orderable<T>> result = newList();
+
+ fillOrder(result);
+
+ return result;
+ }
+
+ private void fillOrder(List<Orderable<T>> list)
+ {
+ if (list.contains(_orderable)) return;
+
+ // Recusively add dependencies
+
+ for (DependencyNode<T> node : _dependencies)
+ {
+ node.fillOrder(list);
+ }
+
+ list.add(_orderable);
+ }
+
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/Orderer.java Sun Aug 26 15:23:55 2007
@@ -21,11 +21,11 @@
import java.util.List;
import java.util.Map;
-import org.apache.commons.logging.Log;
import org.apache.tapestry.ioc.IdMatcher;
import org.apache.tapestry.ioc.Orderable;
import org.apache.tapestry.ioc.internal.IdMatcherImpl;
import org.apache.tapestry.ioc.internal.OrIdMatcher;
+import org.slf4j.Logger;
/**
* Used to order objects into an "execution" order. Each object must have a unique id. It may
@@ -35,7 +35,7 @@
{
private final OneShotLock _lock = new OneShotLock();
- private final Log _log;
+ private final Logger _logger;
private final List<Orderable> _orderables = newList();
@@ -75,9 +75,9 @@
}
};
- public Orderer(Log log)
+ public Orderer(Logger logger)
{
- _log = log;
+ _logger = logger;
}
/**
@@ -93,7 +93,7 @@
if (_orderablesById.containsKey(id))
{
- _log.warn(UtilMessages.duplicateOrderer(id), null);
+ _logger.warn(UtilMessages.duplicateOrderer(id));
return;
}
@@ -143,7 +143,7 @@
private void initializeGraph()
{
- _trailer = new DependencyNode<T>(_log, new Orderable<T>("*-trailer-*", null));
+ _trailer = new DependencyNode<T>(_logger, new Orderable<T>("*-trailer-*", null));
addNodes();
@@ -154,7 +154,7 @@
{
for (Orderable<T> orderable : _orderables)
{
- DependencyNode<T> node = new DependencyNode<T>(_log, orderable);
+ DependencyNode<T> node = new DependencyNode<T>(_logger, orderable);
_dependencyNodesById.put(orderable.getId(), node);
@@ -194,7 +194,7 @@
if (linker == null)
{
- _log.warn(UtilMessages.constraintFormat(constraint, sourceId));
+ _logger.warn(UtilMessages.constraintFormat(constraint, sourceId));
return;
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/LoggingDecorator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/LoggingDecorator.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/LoggingDecorator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/LoggingDecorator.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -13,8 +13,8 @@
// limitations under the License.
package org.apache.tapestry.ioc.services;
-
-import org.apache.commons.logging.Log;
+
+import org.slf4j.Logger;
/**
* Service that can create a logging interceptor that wraps around a service implementation (or
@@ -35,10 +35,10 @@
* existing object to be wrapped
* @param serviceId
* id of service
- * @param serviceLog
+ * @param logger
* log used for debug level logging messages by the interceptor
* @return a new object implementing the interface that can be used in place of the delegate,
* providing logging behavior around each method call on the service interface
*/
- <T> T build(Class<T> serviceInterface, T delegate, String serviceId, Log serviceLog);
+ <T> T build(Class<T> serviceInterface, T delegate, String serviceId, Logger logger);
}
Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/PipelineBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/PipelineBuilder.java?rev=569893&r1=569892&r2=569893&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/PipelineBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/services/PipelineBuilder.java Sun Aug 26 15:23:55 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -14,9 +14,9 @@
package org.apache.tapestry.ioc.services;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
+import java.util.List;
+
+import org.slf4j.Logger;
/**
* Creates a pipeline from a service inteface and an ordered list of filters. Each filter is defined
@@ -58,7 +58,7 @@
* end of the pipeline
* @return an object that encapsulates the filters and the terminator
*/
- <S, F> S build(Log log, Class<S> serviceInterface, Class<F> filterInterface, List<F> filters,
+ <S, F> S build(Logger log, Class<S> serviceInterface, Class<F> filterInterface, List<F> filters,
S terminator);
/**
@@ -73,6 +73,6 @@
* @param filters
* @return
*/
- <S, F> S build(Log log, Class<S> serviceInterface, Class<F> filterInterface, List<F> filters);
+ <S, F> S build(Logger log, Class<S> serviceInterface, Class<F> filterInterface, List<F> filters);
}