[jboss-cvs] JBossAS SVN: r85279 - in projects/jboss-osgi/trunk: runtime/felix/src/main/java/org/jboss/osgi/felix/framework and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Mar 5 02:21:59 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-03-05 02:21:59 -0500 (Thu, 05 Mar 2009)
New Revision: 85279
Added:
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java
Modified:
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/spi/.classpath
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java
Log:
Add Felix framework logging
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-03-05 07:03:34 UTC (rev 85278)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleStartStopDeployer.java 2009-03-05 07:21:59 UTC (rev 85279)
@@ -90,7 +90,7 @@
unresolvedBundles.remove(bundle);
String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Stoped: " + bundle.getSymbolicName() + ",state=" + state);
+ log.info("Stoped: " + bundle + state);
}
catch (BundleException e)
{
@@ -104,7 +104,7 @@
{
bundle.start();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Started: " + bundle.getSymbolicName() + ",state=" + state);
+ log.info("Started: " + bundle + state);
}
catch (BundleException e)
{
@@ -144,7 +144,7 @@
{
auxBundle.start();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Started: " + bundle.getSymbolicName() + ",state=" + state);
+ log.info("Started: " + bundle + state);
}
catch (BundleException e)
{
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-05 07:03:34 UTC (rev 85278)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-05 07:21:59 UTC (rev 85279)
@@ -78,7 +78,7 @@
unit.addAttachment(Bundle.class, bundle);
String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Installed: " + bundle.getSymbolicName() + ",state=" + state);
+ log.info("Installed: " + bundle + state);
}
}
catch (BundleException ex)
@@ -97,7 +97,7 @@
{
bundle.uninstall();
String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Uninstalled: " + bundle.getSymbolicName() + ",state=" + state);
+ log.info("Uninstalled: " + bundle + state);
}
catch (BundleException ex)
{
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-03-05 07:03:34 UTC (rev 85278)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-03-05 07:21:59 UTC (rev 85279)
@@ -48,18 +48,18 @@
// Provide logging
final Logger log = Logger.getLogger(FelixIntegration.class);
- private Map<String, String> felixProperties = new HashMap<String, String>();
+ private Map<String, Object> felixProperties = new HashMap<String, Object>();
private List<URI> autoInstall = new ArrayList<URI>();
private List<URI> autoStart = new ArrayList<URI>();
private Felix felix;
- public Map<String, String> getFelixProperties()
+ public Map<String, Object> getFelixProperties()
{
return felixProperties;
}
- public void setFelixProperties(Map<String, String> props)
+ public void setFelixProperties(Map<String, Object> props)
{
this.felixProperties = props;
}
@@ -102,6 +102,9 @@
// When a Felix instance is embedded in a host application,
// the host application must inform the Felix instance that it is embedded
felixProperties.put("felix.embedded.execution", "true");
+
+ // An instance of Logger that the framework uses as its default logger
+ felixProperties.put("felix.log.logger", new FelixLogger());
// Init & Start the System Bundle
try
Added: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixLogger.java 2009-03-05 07:21:59 UTC (rev 85279)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.felix.framework;
+
+//$Id: FelixIntegration.java 84730 2009-02-25 12:57:23Z thomas.diesler at jboss.com $
+
+import org.jboss.logging.Logger;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * An integration with the Felix Logger.
+ *
+ * This Logger gets registered with the Felix framework and
+ * delegates framework log messages to the JBoss logger.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public class FelixLogger extends org.apache.felix.framework.Logger
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(FelixLogger.class);
+
+ public FelixLogger()
+ {
+ setLogLevel(LOG_DEBUG);
+ }
+
+ @Override
+ protected void doLog(ServiceReference sref, int level, String msg, Throwable throwable)
+ {
+ if (sref != null)
+ msg = sref + ": " + msg;
+
+ // An unresolved bundle causes a WARNING that comes with an exception
+ // Currently we only allow exceptions for ERRORs
+
+ if (level == LOG_DEBUG)
+ log.debug(msg);
+
+ else if (level == LOG_INFO)
+ log.info(msg);
+
+ else if (level == LOG_WARNING)
+ log.warn(msg);
+
+ else if (level == LOG_ERROR)
+ log.error(msg, throwable);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/runtime/spi/.classpath
===================================================================
--- projects/jboss-osgi/trunk/runtime/spi/.classpath 2009-03-05 07:03:34 UTC (rev 85278)
+++ projects/jboss-osgi/trunk/runtime/spi/.classpath 2009-03-05 07:21:59 UTC (rev 85279)
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java 2009-03-05 07:03:34 UTC (rev 85278)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi38/bundleA/ServiceA.java 2009-03-05 07:21:59 UTC (rev 85279)
@@ -55,6 +55,6 @@
super.removedService(reference, service);
}
};
- //tracker.open();
+ tracker.open();
}
}
More information about the jboss-cvs-commits
mailing list