You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by jb...@apache.org on 2011/02/08 17:32:56 UTC
svn commit: r1068468 [2/2] - in /servicemix/smx4/nmr/trunk: ./ document/
examples/interceptors/endpoint/
examples/interceptors/endpoint/src/main/java/org/apache/servicemix/nmr/examples/interceptors/endpoint/
examples/interceptors/exchange/ examples/int...
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/AbstractComponentContext.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/AbstractComponentContext.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/AbstractComponentContext.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/AbstractComponentContext.java Tue Feb 8 16:32:54 2011
@@ -36,8 +36,6 @@ import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.xml.namespace.QName;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.runtime.ComponentWrapper;
import org.apache.servicemix.jbi.runtime.impl.utils.DOMUtil;
import org.apache.servicemix.jbi.runtime.impl.utils.URIResolver;
@@ -46,6 +44,7 @@ import org.apache.servicemix.nmr.api.End
import org.apache.servicemix.nmr.api.NMR;
import org.apache.servicemix.nmr.api.internal.InternalEndpoint;
import org.apache.servicemix.nmr.management.Nameable;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
@@ -57,7 +56,7 @@ public abstract class AbstractComponentC
public static final String INTERNAL_ENDPOINT = "jbi.internal";
public static final String EXTERNAL_ENDPOINT = "jbi.external";
- private static final Log LOG = LogFactory.getLog(AbstractComponentContext.class);
+ private final org.slf4j.Logger logger = LoggerFactory.getLogger(AbstractComponentContext.class);
protected DeliveryChannel dc;
protected ComponentRegistryImpl componentRegistry;
@@ -416,7 +415,7 @@ public abstract class AbstractComponentC
}
}
} catch (Exception e) {
- LOG.debug("Unable to resolve EPR: " + e);
+ logger.debug("Unable to resolve EPR: {}", e);
}
return null;
}
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentContextImpl.java Tue Feb 8 16:32:54 2011
@@ -35,10 +35,10 @@ import javax.wsdl.PortType;
import javax.wsdl.Service;
import javax.wsdl.Port;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.runtime.ComponentRegistry;
import org.apache.servicemix.jbi.runtime.ComponentWrapper;
import org.apache.servicemix.jbi.runtime.impl.utils.DOMUtil;
@@ -54,7 +54,7 @@ public class ComponentContextImpl extend
public static final int DEFAULT_QUEUE_CAPACITY = 1024;
- private static final Log LOG = LogFactory.getLog(ComponentContextImpl.class);
+ private final Logger logger = LoggerFactory.getLogger(ComponentContextImpl.class);
protected ComponentWrapper component;
protected Map<String,?> properties;
@@ -86,7 +86,7 @@ public class ComponentContextImpl extend
try {
dc.close();
} catch (MessagingException e) {
- LOG.warn("Error when closing the delivery channel", e);
+ logger.warn("Error when closing the delivery channel", e);
}
componentRegistry.getNmr().getEndpointRegistry().unregister(componentEndpoint, properties);
}
@@ -206,15 +206,11 @@ public class ComponentContextImpl extend
protected QName[] getInterfaces(Document document, ServiceEndpoint serviceEndpoint) {
try {
if (document == null || document.getDocumentElement() == null) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Endpoint " + serviceEndpoint + " has no service description");
- }
+ logger.debug("Endpoint {} has no service description", serviceEndpoint);
return null;
}
if (!WSDL1_NAMESPACE.equals(document.getDocumentElement().getNamespaceURI())) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Endpoint " + serviceEndpoint + " has a non WSDL1 service description");
- }
+ logger.debug("Endpoint {} has a non WSDL1 service description", serviceEndpoint);
return null;
}
WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
@@ -227,42 +223,36 @@ public class ComponentContextImpl extend
&& definition.getServices().keySet().size() == 0) {
PortType portType = (PortType) definition.getPortTypes().values().iterator().next();
QName interfaceName = portType.getQName();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
- }
+ logger.debug("Endpoint {} implements interface {}", serviceEndpoint, interfaceName);
return new QName[] { interfaceName };
} else {
Service service = definition.getService(serviceEndpoint.getServiceName());
if (service == null) {
- LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching service found in "
- + definition.getServices().keySet());
+ logger.info("Endpoint {} has a service description, but no matching service found in {}", serviceEndpoint, definition.getServices().keySet());
return null;
}
Port port = service.getPort(serviceEndpoint.getEndpointName());
if (port == null) {
- LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no matching endpoint found in "
- + service.getPorts().keySet());
+ logger.info("Endpoint {} has a service description, but no matching endpoint found in {}", serviceEndpoint, service.getPorts().keySet());
return null;
}
if (port.getBinding() == null) {
- LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no binding found");
+ logger.info("Endpoint {} has a service description, but no binding found", serviceEndpoint);
return null;
}
if (port.getBinding().getPortType() == null) {
- LOG.info("Endpoint " + serviceEndpoint + " has a service description, but no port type found");
+ logger.info("Endpoint {} has a service description, but no port type found", serviceEndpoint);
return null;
}
QName interfaceName = port.getBinding().getPortType().getQName();
- if (LOG.isDebugEnabled()) {
- LOG.debug("Endpoint " + serviceEndpoint + " implements interface " + interfaceName);
+ if (logger.isDebugEnabled()) {
+ logger.debug("Endpoint {} implements interface {}", serviceEndpoint, interfaceName);
}
return new QName[] { interfaceName };
}
} catch (Throwable e) {
- LOG.warn("Error retrieving interfaces from service description: " + e.getMessage());
- if (LOG.isDebugEnabled()) {
- LOG.debug("Error retrieving interfaces from service description", e);
- }
+ logger.warn("Error retrieving interfaces from service description: {}", e.getMessage());
+ logger.debug("Error retrieving interfaces from service description", e);
return null;
}
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ComponentRegistryImpl.java Tue Feb 8 16:32:54 2011
@@ -22,22 +22,21 @@ import java.util.concurrent.ConcurrentHa
import javax.jbi.JBIException;
import javax.jbi.component.ComponentContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.document.DocumentRepository;
import org.apache.servicemix.jbi.runtime.ComponentRegistry;
import org.apache.servicemix.jbi.runtime.Environment;
import org.apache.servicemix.jbi.runtime.ComponentWrapper;
import org.apache.servicemix.nmr.api.NMR;
import org.apache.servicemix.nmr.core.ServiceRegistryImpl;
-import org.fusesource.commons.management.ManagementStrategy;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Registry of JBI components objects
*/
public class ComponentRegistryImpl extends ServiceRegistryImpl<ComponentWrapper> implements ComponentRegistry {
- private static final Log LOGGER = LogFactory.getLog(ComponentRegistryImpl.class);
+ private final Logger logger = LoggerFactory.getLogger(ComponentRegistryImpl.class);
private NMR nmr;
private DocumentRepository documentRepository;
@@ -80,7 +79,7 @@ public class ComponentRegistryImpl exten
*/
@Override
protected void doRegister(ComponentWrapper component, Map<String, ?> properties) throws JBIException {
- LOGGER.info("JBI component registered with properties: " + properties);
+ logger.info("JBI component registered with properties: {}", properties);
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(component.getClass().getClassLoader());
try {
@@ -90,7 +89,7 @@ public class ComponentRegistryImpl exten
if (name != null) {
contexts.put(name, context);
} else {
- LOGGER.warn("Component has no name!");
+ logger.warn("Component has no name!");
}
} finally {
Thread.currentThread().setContextClassLoader(cl);
@@ -104,7 +103,7 @@ public class ComponentRegistryImpl exten
*/
@Override
protected void doUnregister(ComponentWrapper component, Map<String, ?> properties)throws JBIException {
- LOGGER.info("JBI component unregistered with properties: " + properties);
+ logger.info("JBI component unregistered with properties: {}", properties);
String name = properties != null ? (String) properties.get(NAME) : null;
if (name != null) {
ComponentContextImpl context = contexts.remove(name);
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ServiceEndpointImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ServiceEndpointImpl.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ServiceEndpointImpl.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/ServiceEndpointImpl.java Tue Feb 8 16:32:54 2011
@@ -21,14 +21,14 @@ import java.util.Map;
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.servicemix.nmr.api.Endpoint;
import org.apache.servicemix.jbi.runtime.impl.utils.DOMUtil;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
/**
* A basic implementation of ServiceEndpoint
@@ -42,7 +42,7 @@ public class ServiceEndpointImpl impleme
public static final String JBI_ENDPOINT_NAME = "end-point-name";
public static final String XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/";
- private static final Log LOG = LogFactory.getLog(ServiceEndpointImpl.class);
+ private final Logger logger = LoggerFactory.getLogger(ServiceEndpointImpl.class);
private final Map<String, ?> properties;
private final QName serviceName;
@@ -74,7 +74,7 @@ public class ServiceEndpointImpl impleme
fragment.appendChild(epr);
return fragment;
} catch (Exception e) {
- LOG.warn("Unable to create reference for ServiceEndpoint " + this, e);
+ logger.warn("Unable to create reference for ServiceEndpoint {}", this, e);
return null;
}
}
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/utils/DOMUtil.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/utils/DOMUtil.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/utils/DOMUtil.java (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/src/main/java/org/apache/servicemix/jbi/runtime/impl/utils/DOMUtil.java Tue Feb 8 16:32:54 2011
@@ -33,6 +33,8 @@ import javax.xml.transform.TransformerFa
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -40,8 +42,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.xml.sax.SAXException;
/**
@@ -51,7 +51,8 @@ import org.xml.sax.SAXException;
*/
public final class DOMUtil {
- private static final Log LOG = LogFactory.getLog(DOMUtil.class);
+ private final static Logger logger = LoggerFactory.getLogger(DOMUtil.class);
+
private static DocumentBuilderFactory dbf;
private static Queue<DocumentBuilder> builders = new ConcurrentLinkedQueue<DocumentBuilder>();
@@ -164,9 +165,7 @@ public final class DOMUtil {
try {
answer = element.getAttribute(attributeName);
} catch (Exception e) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element + ". Cause: " + e, e);
- }
+ logger.trace("Caught exception looking up attribute: " + attributeName + " on element: " + element, e);
}
if (answer == null || answer.length() == 0) {
Node parentNode = element.getParentNode();
Modified: servicemix/smx4/nmr/trunk/nmr/audit/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/audit/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/audit/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/audit/pom.xml Tue Feb 8 16:32:54 2011
@@ -56,6 +56,16 @@
<artifactId>org.apache.karaf.shell.console</artifactId>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<optional>true</optional>
Modified: servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/AbstractAuditor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/AbstractAuditor.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/AbstractAuditor.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/AbstractAuditor.java Tue Feb 8 16:32:54 2011
@@ -16,10 +16,10 @@
*/
package org.apache.servicemix.nmr.audit;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.Exchange;
import org.apache.servicemix.nmr.api.event.ExchangeListener;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Base class for ServiceMix auditors implementations.
@@ -30,7 +30,7 @@ import org.apache.servicemix.nmr.api.eve
*/
public abstract class AbstractAuditor implements AuditorMBean, ExchangeListener {
- protected final Log log = LogFactory.getLog(getClass());
+ protected final Logger logger = LoggerFactory.getLogger(getClass());
/* (non-Javadoc)
* @see org.apache.servicemix.nmr.audit.AuditorMBean#getExchangeCount()
Modified: servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/file/FileAuditor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/file/FileAuditor.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/file/FileAuditor.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/file/FileAuditor.java Tue Feb 8 16:32:54 2011
@@ -25,8 +25,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.Exchange;
import org.apache.servicemix.nmr.api.Status;
import org.apache.servicemix.nmr.audit.AbstractAuditor;
@@ -42,7 +40,6 @@ import org.apache.servicemix.util.FileUt
*/
public class FileAuditor extends AbstractAuditor {
- private static final Log LOG = LogFactory.getLog(FileAuditor.class);
private File directory;
private FileAuditorStrategy strategy = new FileAuditorStrategyImpl();
@@ -54,7 +51,7 @@ public class FileAuditor extends Abstrac
*/
public void setDirectory(File directory) {
if (!directory.exists()) {
- LOG.info("Creating directory " + directory);
+ logger.info("Creating directory {}", directory);
directory.mkdirs();
}
this.directory = directory;
@@ -71,7 +68,7 @@ public class FileAuditor extends Abstrac
os.close();
}
} catch (Exception e) {
- LOG.error(String.format("Error occurred while storing message %s", exchange.getId()), e);
+ logger.error("Error occurred while storing message {}", exchange.getId(), e);
}
}
Modified: servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/jdbc/JdbcAuditor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/jdbc/JdbcAuditor.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/jdbc/JdbcAuditor.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/jdbc/JdbcAuditor.java Tue Feb 8 16:32:54 2011
@@ -126,7 +126,7 @@ public class JdbcAuditor extends Abstrac
close(connection, restoreAutoCommit);
}
} catch (Exception e) {
- log.error("Could not persist exchange", e);
+ logger.error("Could not persist exchange", e);
}
}
@@ -192,7 +192,7 @@ public class JdbcAuditor extends Abstrac
added = nonSerializableClasses.add(o.getClass().getName());
}
if (added) {
- log.warn("Properties of types '" + o.getClass().getName() + "' will be removed from the audit log as they are not serializable");
+ logger.warn("Properties of types '" + o.getClass().getName() + "' will be removed from the audit logger as they are not serializable");
}
}
Modified: servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/lucene/LuceneAuditor.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/lucene/LuceneAuditor.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/lucene/LuceneAuditor.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/audit/src/main/java/org/apache/servicemix/nmr/audit/lucene/LuceneAuditor.java Tue Feb 8 16:32:54 2011
@@ -129,7 +129,7 @@ public class LuceneAuditor extends Abstr
((ExchangeListener) delegatedAuditor).exchangeSent(exchange);
}
} catch (Exception e) {
- log.error("Error while adding to lucene", e);
+ logger.error("Error while adding to lucene", e);
}
}
Modified: servicemix/smx4/nmr/trunk/nmr/core/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/pom.xml Tue Feb 8 16:32:54 2011
@@ -54,8 +54,13 @@
<artifactId>servicemix-utils</artifactId>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.servicemix.bundles</groupId>
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ChannelImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ChannelImpl.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ChannelImpl.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ChannelImpl.java Tue Feb 8 16:32:54 2011
@@ -23,8 +23,6 @@ import java.util.concurrent.TimeoutExcep
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.atomic.AtomicBoolean;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.AbortedException;
import org.apache.servicemix.nmr.api.Endpoint;
import org.apache.servicemix.nmr.api.Exchange;
@@ -38,6 +36,8 @@ import org.apache.servicemix.nmr.api.int
import org.apache.servicemix.nmr.api.internal.InternalExchange;
import org.apache.servicemix.executors.Executor;
import org.apache.servicemix.executors.ExecutorAwareRunnable;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* The {@link org.apache.servicemix.nmr.api.Channel} implementation.
@@ -49,7 +49,7 @@ import org.apache.servicemix.executors.E
*/
public class ChannelImpl implements InternalChannel {
- private static final Log LOG = LogFactory.getLog(NMR.class);
+ private final Logger logger = LoggerFactory.getLogger(NMR.class);
private final InternalEndpoint endpoint;
private final Executor executor;
@@ -192,11 +192,8 @@ public class ChannelImpl implements Inte
throw new ChannelClosedException();
}
// Log the exchange
- if (LOG.isTraceEnabled()) {
- LOG.trace("Channel " + name + " delivering exchange: " + exchange.display(true));
- } else if (LOG.isDebugEnabled()) {
- LOG.debug("Channel " + name + " delivering exchange: " + exchange.display(false));
- }
+ logger.trace("Channel {} delivering exchange: {}", name, exchange.display(true));
+ logger.debug("Channel {} delivering exchange: {}", name, exchange.display(false));
// Handle case where the exchange has been sent synchronously
Semaphore lock = exchange.getRole() == Role.Provider ? exchange.getConsumerLock(false)
: exchange.getProviderLock(false);
@@ -268,11 +265,8 @@ public class ChannelImpl implements Inte
throw new ChannelClosedException();
}
// Log the exchange
- if (LOG.isTraceEnabled()) {
- LOG.trace("Channel " + name + " dispatching exchange: " + exchange.display(true));
- } else if (LOG.isDebugEnabled()) {
- LOG.debug("Channel " + name + " dispatching exchange: " + exchange.display(false));
- }
+ logger.trace("Channel {} dispatching exchange: {}", name, exchange.display(true));
+ logger.debug("Channel {} dispatching exchange: {}", name, exchange.display(false));
// Set source endpoint
if (exchange.getSource() == null) {
exchange.setSource(endpoint);
@@ -290,7 +284,7 @@ public class ChannelImpl implements Inte
}
protected void handleFailure(InternalExchange exchange, RuntimeException e, boolean dispatch) {
- LOG.warn("Error processing exchange " + exchange, e);
+ logger.warn("Error processing exchange {}", exchange, e);
if (dispatch) {
exchange.setError(e);
for (ExchangeListener l : nmr.getListenerRegistry().getListeners(ExchangeListener.class)) {
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceRegistryImpl.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceRegistryImpl.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceRegistryImpl.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/ServiceRegistryImpl.java Tue Feb 8 16:32:54 2011
@@ -22,10 +22,10 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.ServiceMixException;
import org.apache.servicemix.nmr.api.service.ServiceRegistry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* A very basic implementation of a ServiceRegistry that can be
@@ -35,7 +35,7 @@ public class ServiceRegistryImpl<T> impl
private ConcurrentMap<T, Map<String, ?>> registry = new ConcurrentHashMap<T, Map<String, ?>>();
- private final Log logger = LogFactory.getLog(getClass());
+ private final Logger logger = LoggerFactory.getLogger(getClass());
public void register(T service, Map<String, ?> properties) {
assert service != null : "service should not be null";
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/JaasAuthenticationService.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/JaasAuthenticationService.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/JaasAuthenticationService.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/main/java/org/apache/servicemix/nmr/core/security/JaasAuthenticationService.java Tue Feb 8 16:32:54 2011
@@ -28,25 +28,23 @@ import javax.security.auth.callback.Pass
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.LoginContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.security.AuthenticationService;
import org.apache.servicemix.nmr.api.security.CertificateCallback;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* An implementation of the AuthenticationService based on JAAS.
*/
public class JaasAuthenticationService implements AuthenticationService {
- private static final Log LOG = LogFactory.getLog(JaasAuthenticationService.class);
+ private final Logger logger = LoggerFactory.getLogger(JaasAuthenticationService.class);
public void authenticate(Subject subject,
String domain,
final String user,
final Object credentials) throws GeneralSecurityException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Authenticating '" + user + "' with '" + credentials + "'");
- }
+ logger.debug("Authenticating '{}' with '{}'", user, credentials);
LoginContext loginContext = new LoginContext(domain, subject, new CallbackHandler() {
public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
for (int i = 0; i < callbacks.length; i++) {
Modified: servicemix/smx4/nmr/trunk/nmr/core/src/test/java/org/apache/servicemix/nmr/core/util/ExchangeUtilsTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/core/src/test/java/org/apache/servicemix/nmr/core/util/ExchangeUtilsTest.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/core/src/test/java/org/apache/servicemix/nmr/core/util/ExchangeUtilsTest.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/core/src/test/java/org/apache/servicemix/nmr/core/util/ExchangeUtilsTest.java Tue Feb 8 16:32:54 2011
@@ -17,13 +17,13 @@
package org.apache.servicemix.nmr.core.util;
import junit.framework.TestCase;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.Exchange;
import org.apache.servicemix.nmr.api.Message;
import org.apache.servicemix.nmr.api.Pattern;
import org.apache.servicemix.nmr.api.Status;
import org.apache.servicemix.nmr.core.ExchangeImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import javax.xml.namespace.QName;
@@ -34,7 +34,7 @@ import java.io.ByteArrayInputStream;
public class ExchangeUtilsTest extends TestCase {
- private static final Log LOG = LogFactory.getLog(ExchangeUtilsTest.class);
+ private final Logger logger = LoggerFactory.getLogger(ExchangeUtilsTest.class);
public void testReReadable() throws Exception {
Exchange e = new ExchangeImpl(Pattern.InOnly);
@@ -61,7 +61,7 @@ public class ExchangeUtilsTest extends T
msg.setBody(new StringSource("<hello/>"));
String str = e.display(false);
- LOG.info(str);
+ logger.info(str);
assertNotNull(msg.getBody());
assertTrue(msg.getBody() instanceof StringSource);
assertNotNull(msg.getAttachment("id"));
@@ -69,7 +69,7 @@ public class ExchangeUtilsTest extends T
assertTrue(str.indexOf("<hello/>") == -1);
str = e.display(true);
- LOG.info(str);
+ logger.info(str);
assertNotNull(msg.getBody());
assertTrue(msg.getBody() instanceof StringSource);
assertNotNull(msg.getAttachment("id"));
@@ -80,7 +80,7 @@ public class ExchangeUtilsTest extends T
System.setProperty(ExchangeUtils.SYSTEM_PROPERTY_SUPPRESS_CONTENT, "true");
str = e.display(true);
- LOG.info(str);
+ logger.info(str);
assertNotNull(msg.getBody());
assertTrue(msg.getBody() instanceof StringSource);
assertNotNull(msg.getAttachment("id"));
Modified: servicemix/smx4/nmr/trunk/nmr/management/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/pom.xml Tue Feb 8 16:32:54 2011
@@ -71,10 +71,15 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.fusesource.commonman</groupId>
<artifactId>commons-management</artifactId>
Modified: servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/DefaultNamingStrategy.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/DefaultNamingStrategy.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/DefaultNamingStrategy.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/DefaultNamingStrategy.java Tue Feb 8 16:32:54 2011
@@ -16,6 +16,9 @@
*/
package org.apache.servicemix.nmr.management;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -23,14 +26,11 @@ import java.util.Map;
import javax.management.ObjectName;
import javax.management.MalformedObjectNameException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
/**
*/
public class DefaultNamingStrategy implements NamingStrategy {
- private static final Log LOG = LogFactory.getLog(DefaultNamingStrategy.class);
+ private final static Logger logger = LoggerFactory.getLogger(DefaultNamingStrategy.class);
private String jmxDomainName;
@@ -94,7 +94,7 @@ public class DefaultNamingStrategy imple
} catch (MalformedObjectNameException e) {
// shouldn't happen
String error = "Could not create ObjectName for " + props;
- LOG.error(error, e);
+ logger.error(error, e);
throw new RuntimeException(error);
}
return result;
@@ -106,9 +106,9 @@ public class DefaultNamingStrategy imple
try {
result = new ObjectName(tmp);
} catch (MalformedObjectNameException e) {
- LOG.error("Failed to build ObjectName:", e);
+ logger.error("Failed to build ObjectName:", e);
} catch (NullPointerException e) {
- LOG.error("Failed to build ObjectName:", e);
+ logger.error("Failed to build ObjectName:", e);
}
return result;
}
Modified: servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementAgent.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementAgent.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementAgent.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementAgent.java Tue Feb 8 16:32:54 2011
@@ -29,8 +29,6 @@ import javax.management.ObjectInstance;
import javax.management.ObjectName;
import javax.management.StandardMBean;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.management.stats.CountStatistic;
import org.apache.servicemix.nmr.management.stats.TimeStatistic;
import org.fusesource.commons.management.ManagementStrategy;
@@ -40,12 +38,14 @@ import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.blueprint.container.ServiceUnavailableException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*/
public class ManagementAgent implements ManagementStrategy {
- private static final transient Log LOG = LogFactory.getLog(ManagementAgent.class);
+ private final Logger logger = LoggerFactory.getLogger(ManagementAgent.class);
private boolean enabled;
private MBeanServer mbeanServer;
@@ -141,9 +141,7 @@ public class ManagementAgent implements
* logging Log.
*/
public void notify(EventObject event) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace(event.toString());
- }
+ logger.trace(event.toString());
}
public void setBundleContext(BundleContext ctx) {
@@ -206,7 +204,7 @@ public class ManagementAgent implements
try {
register(mbeans.get(name), name);
} catch (JMException jmex) {
- LOG.info("Exception unregistering MBean", jmex);
+ logger.info("Exception unregistering MBean", jmex);
caught++;
} catch (ServiceUnavailableException sue) {
// due to timing / shutdown ordering issue that we may
@@ -215,7 +213,7 @@ public class ManagementAgent implements
}
}
if (caught > 0) {
- LOG.warn("A number of " + caught
+ logger.warn("A number of " + caught
+ " exceptions caught while unregistering MBeans during stop operation. "
+ "See INFO log for details.");
}
@@ -233,10 +231,10 @@ public class ManagementAgent implements
registerMBeanWithServer(obj, name, forceRegistration);
} catch (UndeclaredThrowableException ute) {
if (ute.getCause() instanceof RuntimeException) {
- LOG.warn("MBean registration failed: ", ute.getCause());
+ logger.warn("MBean registration failed: ", ute.getCause());
throw (RuntimeException) ute.getCause();
} else {
- LOG.warn("MBean registration failed: ", ute.getCause());
+ logger.warn("MBean registration failed: ", ute.getCause());
throw new JMException(ute.getCause().getMessage());
}
}
@@ -250,7 +248,7 @@ public class ManagementAgent implements
try {
unregister(name);
} catch (JMException jmex) {
- LOG.info("Exception unregistering MBean", jmex);
+ logger.info("Exception unregistering MBean", jmex);
caught++;
} catch (ServiceUnavailableException sue) {
// due to timing / shutdown ordering issue that we may
@@ -259,7 +257,7 @@ public class ManagementAgent implements
}
}
if (caught > 0) {
- LOG.warn("A number of " + caught
+ logger.warn("A number of " + caught
+ " exceptions caught while unregistering MBeans during stop operation. "
+ "See INFO log for details.");
}
Modified: servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementEndpointRegistry.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementEndpointRegistry.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementEndpointRegistry.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/src/main/java/org/apache/servicemix/nmr/management/ManagementEndpointRegistry.java Tue Feb 8 16:32:54 2011
@@ -19,8 +19,6 @@ package org.apache.servicemix.nmr.manage
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.nmr.api.Exchange;
import org.apache.servicemix.nmr.api.Role;
import org.apache.servicemix.nmr.api.Status;
@@ -31,12 +29,14 @@ import org.fusesource.commons.management
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
*/
public class ManagementEndpointRegistry implements ExchangeListener {
- private static final transient Log LOG = LogFactory.getLog(ManagementEndpointRegistry.class);
+ private final Logger logger = LoggerFactory.getLogger(ManagementEndpointRegistry.class);
private BundleContext bundleContext;
private ManagementStrategy managementStrategy;
@@ -101,7 +101,7 @@ public class ManagementEndpointRegistry
}
public void bindManagementStrategy(ManagementStrategy ms) {
- LOG.debug("Using new management strategy: " + ms);
+ logger.debug("Using new management strategy: {}", ms);
unregisterAll();
managementStrategy = ms;
registerAll();
@@ -126,12 +126,12 @@ public class ManagementEndpointRegistry
protected void registerEndpoint(InternalEndpoint iep) {
if (managementStrategy != null) {
try {
- LOG.info("Registering endpoint: " + iep + " with properties " + iep.getMetaData());
+ logger.info("Registering endpoint: {} with properties {}", iep, iep.getMetaData());
ManagedEndpoint ep = new ManagedEndpoint(iep, managementStrategy);
endpoints.put(iep.getId(), ep);
managementStrategy.manageObject(ep);
} catch (Exception e) {
- LOG.warn("Unable to register managed endpoint: " + e, e);
+ logger.warn("Unable to register managed endpoint.", e);
}
}
}
@@ -139,11 +139,11 @@ public class ManagementEndpointRegistry
private void unregisterEndpoint(InternalEndpoint iep) {
if (managementStrategy != null) {
try {
- LOG.info("Unregistering endpoint: " + iep + " with properties " + iep.getMetaData());
+ logger.info("Unregistering endpoint: {} with properties {}", iep, iep.getMetaData());
ManagedEndpoint ep = endpoints.remove(iep.getId());
managementStrategy.unmanageObject(ep);
} catch (Exception e) {
- LOG.warn("Unable to unregister managed endpoint: " + e, e);
+ logger.warn("Unable to unregister managed endpoint.", e);
}
}
}
@@ -160,56 +160,46 @@ public class ManagementEndpointRegistry
public void exchangeSent(Exchange exchange) {
try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Sending exchange: " + exchange);
- }
+ logger.trace("Sending exchange: {}", exchange);
if (exchange.getStatus() == Status.Active &&
exchange.getRole() == Role.Consumer &&
exchange.getOut(false) == null &&
exchange.getFault(false) == null &&
exchange instanceof InternalExchange) {
String id = ((InternalExchange) exchange).getSource().getId();
- if (LOG.isTraceEnabled()) {
- LOG.trace("Source endpoint: " + id + " (known endpoints: " + endpoints + ")");
- }
+ logger.trace("Source endpoint: {} (known endpoints: {})", id, endpoints);
ManagedEndpoint me = endpoints.get(id);
if (me == null) {
- if (LOG.isTraceEnabled()) {
- LOG.trace("No managed endpoint registered with id: " + id);
- }
+ logger.trace("No managed endpoint registered with id: {}", id);
} else {
me.incrementOutbound();
}
}
} catch (Throwable t) {
- LOG.warn("Caught exception while processing exchange: " + t, t);
+ logger.warn("Caught exception while processing exchange.", t);
}
}
public void exchangeDelivered(Exchange exchange) {
try {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Receiving exchange: " + exchange);
- }
+ logger.trace("Receiving exchange: {}", exchange);
if (exchange.getStatus() == Status.Active &&
exchange.getRole() == Role.Provider &&
exchange.getOut(false) == null &&
exchange.getFault(false) == null &&
exchange instanceof InternalExchange) {
String id = ((InternalExchange) exchange).getDestination().getId();
- if (LOG.isTraceEnabled()) {
- LOG.trace("Dest endpoint: " + id + " (known endpoints: " + endpoints + ")");
- }
+ logger.trace("Dest endpoint: {} (known endpoints: {})", id, endpoints);
ManagedEndpoint me = endpoints.get(id);
if (me == null) {
- LOG.warn("No managed endpoint registered with id: " + id);
+ logger.warn("No managed endpoint registered with id: {}", id);
} else {
me.incrementInbound();
}
}
} catch (Throwable t) {
- LOG.warn("Caught exception while processing exchange: " + t, t);
+ logger.warn("Caught exception while processing exchange.", t);
}
}
@@ -218,7 +208,7 @@ public class ManagementEndpointRegistry
try {
managementStrategy.notify(event);
} catch (Exception ex) {
- LOG.warn("ExchangeFailedEvent notification failed", ex);
+ logger.warn("ExchangeFailedEvent notification failed", ex);
}
}
Modified: servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/CountStatisticTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/CountStatisticTest.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/CountStatisticTest.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/CountStatisticTest.java Tue Feb 8 16:32:54 2011
@@ -16,13 +16,10 @@
*/
package org.apache.servicemix.nmr.management.stats;
-import org.apache.servicemix.nmr.management.stats.CountStatistic;
-
public class CountStatisticTest extends StatisticTestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
- .getLog(CountStatisticTest.class);
+ private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(CountStatisticTest.class);
/**
* Use case for CountStatisticImple class.
@@ -53,7 +50,7 @@ public class CountStatisticTest extends
assertLastTimeNotStartTime(stat);
- LOG.info("Counter is: " + stat);
+ logger.info("Counter is: {}", stat);
stat.reset();
Modified: servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/TimeStatisticTest.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/TimeStatisticTest.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/TimeStatisticTest.java (original)
+++ servicemix/smx4/nmr/trunk/nmr/management/src/test/java/org/apache/servicemix/nmr/management/stats/TimeStatisticTest.java Tue Feb 8 16:32:54 2011
@@ -18,8 +18,7 @@ package org.apache.servicemix.nmr.manage
public class TimeStatisticTest extends StatisticTestSupport {
- private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory
- .getLog(TimeStatisticTest.class);
+ private final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TimeStatisticTest.class);
/**
* Use case for TimeStatisticImpl class.
@@ -55,7 +54,7 @@ public class TimeStatisticTest extends S
assertLastTimeNotStartTime(stat);
- LOG.info("Stat is: " + stat);
+ logger.info("Stat is: {}", stat);
stat.reset();
Modified: servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/osgi/pom.xml Tue Feb 8 16:32:54 2011
@@ -67,8 +67,13 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Modified: servicemix/smx4/nmr/trunk/nmr/spring/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/nmr/spring/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/nmr/spring/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/nmr/spring/pom.xml Tue Feb 8 16:32:54 2011
@@ -73,8 +73,13 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Modified: servicemix/smx4/nmr/trunk/pom.xml
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/pom.xml?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/pom.xml Tue Feb 8 16:32:54 2011
@@ -117,7 +117,6 @@
<spring.osgi.version>1.2.0</spring.osgi.version>
<!-- Other Dependencies -->
- <commons-logging.version>1.1.1</commons-logging.version>
<commons-management.version>1.0</commons-management.version>
<derby.version>10.5.3.0_1</derby.version>
<easymock.version>2.4</easymock.version>
@@ -128,6 +127,7 @@
<log4j.version>1.2.16</log4j.version>
<lucene.version>2.4.1</lucene.version>
<mina.version>2.0.0-M6</mina.version>
+ <slf4j.version>1.5.8</slf4j.version>
<sshd.version>0.3.0</sshd.version>
<woodstox.version>4.0.8</woodstox.version>
<woodstox.stax2-api.version>3.0.2</woodstox.stax2-api.version>
@@ -613,11 +613,6 @@
<!-- Dependencies -->
<dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
- </dependency>
- <dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>${hsqldb.version}</version>
@@ -702,6 +697,16 @@
<artifactId>org.eclipse.osgi</artifactId>
<version>${equinox.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java (original)
+++ servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/Counter.java Tue Feb 8 16:32:54 2011
@@ -15,8 +15,8 @@
*/
package org.apache.servicemix.platform.testing.support;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
/**
* Simple counting class which can be incremented or decremented in a
@@ -62,7 +62,7 @@ public class Counter {
private int counter = 0;
- private static final Log log = LogFactory.getLog(Counter.class);
+ private final Logger logger = LoggerFactory.getLogger(Counter.class);
private final String name;
@@ -79,8 +79,7 @@ public class Counter {
*/
public synchronized void increment() {
counter++;
- if (log.isTraceEnabled())
- log.trace("counter [" + name + "] incremented to " + counter);
+ logger.trace("counter [{}] incremented to {}", name, counter);
}
/**
@@ -88,8 +87,7 @@ public class Counter {
*/
public synchronized void decrement() {
counter--;
- if (log.isTraceEnabled())
- log.trace("counter [" + name + "] decremented to " + counter);
+ logger.trace("counter [{}] decremented to {}", name, counter);
notifyAll();
}
Modified: servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java
URL: http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java?rev=1068468&r1=1068467&r2=1068468&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java (original)
+++ servicemix/smx4/nmr/trunk/testing/support/src/main/java/org/apache/servicemix/platform/testing/support/SmxPlatform.java Tue Feb 8 16:32:54 2011
@@ -36,8 +36,6 @@ import java.util.Map;
import java.util.Properties;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.felix.framework.Felix;
import org.apache.felix.framework.util.CompoundEnumeration;
import org.apache.felix.framework.util.FelixConstants;
@@ -46,13 +44,15 @@ import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.osgi.test.platform.FelixPlatform;
import org.springframework.osgi.test.platform.OsgiPlatform;
import org.springframework.util.ClassUtils;
public class SmxPlatform implements OsgiPlatform {
- private static final Log log = LogFactory.getLog(FelixPlatform.class);
+ private final Logger logger = LoggerFactory.getLogger(FelixPlatform.class);
private static final String FELIX_CONF_FILE = "config.properties";
@@ -181,9 +181,7 @@ public class SmxPlatform implements Osgi
tempFileName = File.createTempFile("org.sfw.osgi", suffix);
}
catch (IOException ex) {
- if (log.isWarnEnabled()) {
- log.warn("Could not create temporary directory, returning a temp folder inside the current folder", ex);
- }
+ logger.warn("Could not create temporary directory, returning a temp folder inside the current folder", ex);
return new File("./tmp-test");
}
@@ -202,8 +200,7 @@ public class SmxPlatform implements Osgi
Properties props = new Properties();
felixStorageDir = createTempDir("felix");
props.setProperty(FRAMEWORK_STORAGE, this.felixStorageDir.getAbsolutePath());
- if (log.isTraceEnabled())
- log.trace("felix storage dir is " + felixStorageDir.getAbsolutePath());
+ logger.trace("felix storage dir is {}", felixStorageDir.getAbsolutePath());
return props;
}