[jboss-cvs] JBossAS SVN: r85385 - in projects/jboss-osgi/trunk: build/distribution and 15 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Mar 6 06:20:12 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-03-06 06:20:11 -0500 (Fri, 06 Mar 2009)
New Revision: 85385
Added:
projects/jboss-osgi/trunk/service/logging/
projects/jboss-osgi/trunk/service/logging/.classpath
projects/jboss-osgi/trunk/service/logging/.project
projects/jboss-osgi/trunk/service/logging/.settings/
projects/jboss-osgi/trunk/service/logging/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/trunk/service/logging/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/trunk/service/logging/pom.xml
projects/jboss-osgi/trunk/service/logging/src/
projects/jboss-osgi/trunk/service/logging/src/main/
projects/jboss-osgi/trunk/service/logging/src/main/java/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/JBossLoggingLogListener.java
projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/LoggingServiceActivator.java
Removed:
projects/jboss-osgi/trunk/service/http/
Modified:
projects/jboss-osgi/trunk/build/distribution/pom.xml
projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java
projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/service/pom.xml
Log:
Add jboss-logging service. Resurect WebConsole
Modified: projects/jboss-osgi/trunk/build/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -64,7 +64,7 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-service-http</artifactId>
+ <artifactId>jboss-osgi-service-logging</artifactId>
<version>${version}</version>
</dependency>
@@ -81,6 +81,10 @@
<artifactId>org.apache.felix.http.jetty</artifactId>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.codehaus.izpack</groupId>
<artifactId>izpack-standalone-compiler</artifactId>
<version>${izpack.version}</version>
Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -88,7 +88,9 @@
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deploy/osgi" override="true">
<include name="org.apache.felix.configadmin.jar" />
<include name="org.apache.felix.http.jetty.jar" />
- <!-- include name="jboss-osgi-service-webconsole.jar" /-->
+ <include name="org.apache.felix.log.jar" />
+ <include name="jboss-osgi-service-logging.jar" />
+ <include name="jboss-osgi-service-webconsole.jar" />
</fileset>
</pack>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/pom.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -37,6 +37,7 @@
<version.felix.configadmin>1.0.10</version.felix.configadmin>
<version.felix.framework>1.4.1</version.felix.framework>
<version.felix.http.jetty>0.9.0-20090218-R745505</version.felix.http.jetty>
+ <version.felix.log>0.9.0-SNAPSHOT</version.felix.log>
<version.felix.javax.servlet>1.0.0</version.felix.javax.servlet>
<version.felix.osgi.core>1.2.0</version.felix.osgi.core>
<version.jbossas>5.0.1.GA</version.jbossas>
@@ -197,6 +198,11 @@
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.felix.log}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>${version.felix.framework}</version>
</dependency>
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-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/OSGiDeployer.java 2009-03-06 11:20:11 UTC (rev 85385)
@@ -70,15 +70,32 @@
if (bundleUri == null)
throw new IllegalStateException("Cannot obtain bundle location for: " + metadata);
+ String bundlePath = bundleUri.getPath();
+ if (bundlePath.endsWith("/"))
+ bundlePath = bundlePath.substring(0, bundlePath.length() - 1);
+
try
{
- if (skipBundles != null && skipBundles.contains(bundleUri) == false)
+ if (skipBundles != null)
{
- Bundle bundle = systemContext.installBundle(bundleUri.toString());
- unit.addAttachment(Bundle.class, bundle);
-
- String state = StateFormat.formatBundleState(bundle.getState());
- log.info("Installed: " + bundle + state);
+ boolean skipBundle = false;
+ for (URI skip : skipBundles)
+ {
+ String skipPath = skip.getPath();
+ if (skipPath.equals(bundlePath))
+ {
+ skipBundle = true;
+ break;
+ }
+ }
+ if (skipBundle == false)
+ {
+ Bundle bundle = systemContext.installBundle(bundleUri.toString());
+ unit.addAttachment(Bundle.class, bundle);
+
+ String state = StateFormat.formatBundleState(bundle.getState());
+ log.info("Installed: " + bundle + state);
+ }
}
}
catch (BundleException ex)
Modified: projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/resources/osgi-deployers-jboss-beans.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -14,10 +14,13 @@
<key>org.osgi.framework.system.packages</key>
<value>
javax.management,
+ javax.xml.parsers,
+ org.jboss.logging,
org.jboss.osgi.service,
org.jboss.osgi.spi.management,
org.osgi.framework; version=1.4,
- org.osgi.service.startlevel
+ org.osgi.service.startlevel,
+ org.xml.sax
</value>
</entry>
<!--
@@ -30,6 +33,7 @@
<property name="autoStart">
<list elementClass="java.net.URI">
<value>${jboss.server.home.url}/deployers/osgi.deployer/org.osgi.compendium.jar</value>
+ <value>${jboss.server.home.url}/deploy/osgi/jboss-osgi-service-logging.jar</value>
</list>
</property>
</bean>
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-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-03-06 11:20:11 UTC (rev 85385)
@@ -45,86 +45,86 @@
*/
public class FelixIntegration implements OSGiFramework
{
- // Provide logging
- final Logger log = Logger.getLogger(FelixIntegration.class);
+ // Provide logging
+ final Logger log = Logger.getLogger(FelixIntegration.class);
- private Map<String, Object> felixProperties = new HashMap<String, Object>();
- private List<URI> autoInstall = new ArrayList<URI>();
- private List<URI> autoStart = new ArrayList<URI>();
+ 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;
+ private Felix felix;
- public Map<String, Object> getFelixProperties()
- {
- return felixProperties;
- }
+ public Map<String, Object> getFelixProperties()
+ {
+ return felixProperties;
+ }
- public void setFelixProperties(Map<String, Object> props)
- {
- this.felixProperties = props;
- }
+ public void setFelixProperties(Map<String, Object> props)
+ {
+ this.felixProperties = props;
+ }
- public List<URI> getAutoInstall()
- {
- return autoInstall;
- }
+ public List<URI> getAutoInstall()
+ {
+ return autoInstall;
+ }
- public void setAutoInstall(List<URI> autoInstall)
- {
- this.autoInstall = autoInstall;
- }
+ public void setAutoInstall(List<URI> autoInstall)
+ {
+ this.autoInstall = autoInstall;
+ }
- public List<URI> getAutoStart()
- {
- return autoStart;
- }
+ public List<URI> getAutoStart()
+ {
+ return autoStart;
+ }
- public void setAutoStart(List<URI> autoStart)
- {
- this.autoStart = autoStart;
- }
+ public void setAutoStart(List<URI> autoStart)
+ {
+ this.autoStart = autoStart;
+ }
- public Bundle getSystemBundle()
- {
- return felix;
- }
+ public Bundle getSystemBundle()
+ {
+ return felix;
+ }
- public BundleContext getSystemBundleContext()
- {
- return getSystemBundle().getBundleContext();
- }
+ public BundleContext getSystemBundleContext()
+ {
+ return getSystemBundle().getBundleContext();
+ }
- public void create()
- {
- String implVersion = getClass().getPackage().getImplementationVersion();
- log.info("OSGi Integration Felix - " + implVersion);
+ public void create()
+ {
+ String implVersion = getClass().getPackage().getImplementationVersion();
+ log.info("OSGi Integration Felix - " + implVersion);
- // 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());
+ // 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");
- // Init & Start the System Bundle
- try
- {
- felix = new Felix(felixProperties);
- felix.start();
- }
- catch (BundleException ex)
- {
- throw new FrameworkException("Cannot initialze system bundle", ex);
- }
- }
+ // An instance of Logger that the framework uses as its default logger
+ felixProperties.put("felix.log.logger", new FelixLogger());
- public void start()
+ // Init & Start the System Bundle
+ try
+ {
+ felix = new Felix(felixProperties);
+ felix.start();
+ }
+ catch (BundleException ex)
+ {
+ throw new FrameworkException("Cannot initialze system bundle", ex);
+ }
+ }
+
+ public void start()
{
// Get system bundle context
BundleContext context = felix.getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
-
+
Map<URI, Bundle> autoBundles = new HashMap<URI, Bundle>();
// Add the autoStart bundles to autoInstall
@@ -164,18 +164,18 @@
}
}
- public void stop()
- {
- if (felix != null)
- {
- try
+ public void stop()
+ {
+ if (felix != null)
{
- felix.stop();
+ try
+ {
+ felix.stop();
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot stop Felix", ex);
+ }
}
- catch (BundleException ex)
- {
- log.error("Cannot stop Felix", ex);
- }
- }
- }
+ }
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/service/logging/.classpath
===================================================================
--- projects/jboss-osgi/trunk/service/logging/.classpath (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/.classpath 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/trunk/service/logging/.project
===================================================================
--- projects/jboss-osgi/trunk/service/logging/.project (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/.project 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-service-logging</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/trunk/service/logging/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/trunk/service/logging/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/.settings/org.eclipse.jdt.core.prefs 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,5 @@
+#Fri Mar 06 10:50:43 CET 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/trunk/service/logging/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/trunk/service/logging/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/.settings/org.maven.ide.eclipse.prefs 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,9 @@
+#Fri Mar 06 10:50:37 CET 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/trunk/service/logging/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/service/logging/pom.xml (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/pom.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBoss OSGi - Service Logging</name>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-service-logging</artifactId>
+ <packaging>bundle</packaging>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-service</artifactId>
+ <version>1.0.0.Alpha3</version>
+ </parent>
+
+ <!-- Properties -->
+ <properties>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.jboss.osgi.service.logging</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.service.logging.LoggingServiceActivator</Bundle-Activator>
+ <Private-Package>org.jboss.osgi.service.logging</Private-Package>
+ <Import-Package>
+ org.jboss.logging,
+ org.osgi.framework,
+ org.osgi.service.log,
+ org.osgi.util.tracker
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: projects/jboss-osgi/trunk/service/logging/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/JBossLoggingLogListener.java
===================================================================
--- projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/JBossLoggingLogListener.java (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/JBossLoggingLogListener.java 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,61 @@
+/*
+ * 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.service.logging;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.osgi.framework.Bundle;
+import org.osgi.service.log.LogEntry;
+import org.osgi.service.log.LogListener;
+import org.osgi.service.log.LogService;
+
+/**
+ * A LogListener the logs LogEntrys to JBossLogging.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public class JBossLoggingLogListener implements LogListener
+{
+ public void logged(LogEntry entry)
+ {
+ Bundle bundle = entry.getBundle();
+ int level = entry.getLevel();
+ Throwable throwable = entry.getException();
+
+ String loggerName = bundle.getSymbolicName();
+ Logger log = Logger.getLogger(loggerName);
+
+ if (level == LogService.LOG_DEBUG)
+ log.debug(entry.getMessage(), throwable);
+
+ else if (level == LogService.LOG_INFO)
+ log.info(entry.getMessage(), throwable);
+
+ else if (level == LogService.LOG_WARNING)
+ log.warn(entry.getMessage(), throwable);
+
+ else if (level == LogService.LOG_ERROR)
+ log.error(entry.getMessage(), throwable);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/JBossLoggingLogListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/LoggingServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/LoggingServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/LoggingServiceActivator.java 2009-03-06 11:20:11 UTC (rev 85385)
@@ -0,0 +1,81 @@
+/*
+ * 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.service.logging;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogListener;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * The LoggingServiceActivator Activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class LoggingServiceActivator implements BundleActivator
+{
+ private ServiceTracker logTracker;
+
+ /**
+ * Implements BundleActivator.start().
+ *
+ * Track LogReaderService and add/remove LogListener
+ */
+ public void start(BundleContext context)
+ {
+ final LogListener listener = new JBossLoggingLogListener();
+
+ // Track LogReaderService and add/remove LogListener
+ logTracker = new ServiceTracker(context, LogReaderService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference reference)
+ {
+ LogReaderService logReader = (LogReaderService)super.addingService(reference);
+ logReader.addLogListener(listener);
+ return logReader;
+ }
+
+ @Override
+ public void removedService(ServiceReference reference, Object service)
+ {
+ super.removedService(reference, service);
+ LogReaderService logReader = (LogReaderService)service;
+ logReader.removeLogListener(listener);
+ }
+ };
+ logTracker.open();
+ }
+
+ /*
+ * Implements BundleActivator.stop().
+ */
+ public void stop(BundleContext context)
+ {
+ // NOTE: The service is automatically unregistered.
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/service/logging/src/main/java/org/jboss/osgi/service/logging/LoggingServiceActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/service/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/service/pom.xml 2009-03-06 10:40:42 UTC (rev 85384)
+++ projects/jboss-osgi/trunk/service/pom.xml 2009-03-06 11:20:11 UTC (rev 85385)
@@ -12,7 +12,7 @@
</parent>
<modules>
- <module>http</module>
+ <module>logging</module>
<module>webconsole</module>
</modules>
More information about the jboss-cvs-commits
mailing list