notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2850 - development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi
- From: niclas AT hedhman.org
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2850 - development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi
- Date: Tue, 14 Jun 2005 01:34:53 -0400
Author: niclas AT hedhman.org
Date: Tue Jun 14 01:34:53 2005
New Revision: 2850
Modified:
development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi/Metro.java
Log:
Managed to use the OSGi LogService.
Modified:
development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi/Metro.java
==============================================================================
---
development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi/Metro.java
(original)
+++
development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi/Metro.java
Tue Jun 14 01:34:53 2005
@@ -19,23 +19,26 @@
package net.dpml.osgi;
import net.dpml.composition.model.ContainmentModel;
-import net.dpml.system.SystemContext;
import net.dpml.system.Factory;
+import net.dpml.system.SystemContext;
import net.dpml.transit.artifact.Artifact;
-import net.dpml.transit.repository.StandardLoader;
import net.dpml.transit.repository.Repository;
+import net.dpml.transit.repository.StandardLoader;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
import java.net.URI;
-import java.util.Map;
import java.util.Hashtable;
+import java.util.Map;
public class Metro
implements BundleActivator
{
private ContainmentModel m_root;
+ private LogService m_LogService;
public Metro()
{
@@ -44,7 +47,12 @@
public void start( BundleContext bundleContext )
throws Exception
{
+ m_LogService = findLogService( bundleContext );
+
+ m_LogService.log( LogService.LOG_INFO, "Starting the Metro Bundle.");
+
String systemDir = bundleContext.getProperty( "dpml.system.dir" );
+ String debugMode = bundleContext.getProperty(
"urn:transit.debug.policy" );
Repository repo = new StandardLoader();
//
@@ -55,7 +63,7 @@
ClassLoader classloader = getClass().getClassLoader();
Map data = new Hashtable();
- data.put( "urn:transit.debug.policy", new Boolean( false ) ); //
TODO check in supplied map
+ data.put( "urn:transit.debug.policy", new Boolean( debugMode ) );
Factory systemfactory = (Factory) repo.getPlugin( classloader, uri,
new Object[]{ data } );
Map systemCriteria = systemfactory.createDefaultCriteria();
systemCriteria.put( "dpml.system.dir", systemDir );
@@ -69,12 +77,23 @@
Object[] params = new Object[]{ system };
Factory modelFactory = (Factory) system.getRepository().getPlugin(
classloader, uri, params );
m_root = (ContainmentModel) modelFactory.create();
+ m_LogService.log( LogService.LOG_INFO, String.valueOf( m_root ) );
+ m_LogService.log( LogService.LOG_INFO, "Metro Bundle started.");
}
public void stop( BundleContext bundleContext )
throws Exception
{
+ m_LogService.log( LogService.LOG_INFO, "Stopping the Metro Bundle.");
m_root.decommission();
m_root.disassemble();
+ m_LogService.log( LogService.LOG_INFO, "Metro Bundle stopped.");
+ }
+
+ private LogService findLogService( BundleContext context )
+ {
+ ServiceReference reference = context.getServiceReference(
"org.osgi.service.log.LogService" );
+ LogService logService = (LogService) context.getService( reference );
+ return logService;
}
}
- svn commit: r2850 - development/laboratory/users/niclas/osgi/osgi/src/main/net/dpml/osgi, niclas, 06/14/2005
Archive powered by MHonArc 2.6.24.