Author: gertv
Date: Tue Dec 6 10:17:34 2011
New Revision: 1210845
URL: http://svn.apache.org/viewvc?rev=1210845&view=rev
Log:
SMX4NMR-214: Error in Bootstrap init when accessing ComponentContext logger
through the InstallationContext
Modified:
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/InstallationContextImpl.java
servicemix/smx4/nmr/trunk/jbi/runtime/pom.xml
Modified:
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/InstallationContextImpl.java
URL:
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/InstallationContextImpl.java?rev=1210845&r1=1210844&r2=1210845&view=diff
==============================================================================
---
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/InstallationContextImpl.java
(original)
+++
servicemix/smx4/nmr/trunk/jbi/deployer/src/main/java/org/apache/servicemix/jbi/deployer/impl/InstallationContextImpl.java
Tue Dec 6 10:17:34 2011
@@ -37,6 +37,7 @@ import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.xml.namespace.QName;
+import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
@@ -54,6 +55,8 @@ import org.apache.servicemix.nmr.managem
*/
public class InstallationContextImpl implements InstallationContext,
ComponentContext, MBeanNames {
+ private static final org.slf4j.Logger LOGGER =
LoggerFactory.getLogger(InstallationContextImpl.class);
+
private ComponentDesc descriptor;
private Environment environment;
private File installRoot;
@@ -277,7 +280,13 @@ public class InstallationContextImpl imp
}
public Logger getLogger(String suffix, String resourceBundleName) throws
MissingResourceException, JBIException {
- throw new IllegalStateException("This operation is not available at
installation time");
+ LOGGER.warn("Method getLogger() should not be invoked on JBI
InstallationContext according to the JBI specification");
+ try {
+ String name = suffix != null ? getComponentName() + suffix :
getComponentName();
+ return Logger.getLogger(name, resourceBundleName);
+ } catch (IllegalArgumentException e) {
+ throw new JBIException("A logger can not be created using resource
bundle " + resourceBundleName);
+ }
}
public MBeanNames getMBeanNames() {
Modified: servicemix/smx4/nmr/trunk/jbi/runtime/pom.xml
URL:
http://svn.apache.org/viewvc/servicemix/smx4/nmr/trunk/jbi/runtime/pom.xml?rev=1210845&r1=1210844&r2=1210845&view=diff
==============================================================================
--- servicemix/smx4/nmr/trunk/jbi/runtime/pom.xml (original)
+++ servicemix/smx4/nmr/trunk/jbi/runtime/pom.xml Tue Dec 6 10:17:34 2011
@@ -98,6 +98,11 @@
<groupId>org.fusesource.commonman</groupId>
<artifactId>commons-management</artifactId>
</dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>