notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
r1063 - in trunk/main/transit: core/src/main/net/dpml/transit tools/src/main/net/dpml/transit/tools
- From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
- To: notify-dpml AT lists.ibiblio.org
- Subject: r1063 - in trunk/main/transit: core/src/main/net/dpml/transit tools/src/main/net/dpml/transit/tools
- Date: Thu, 9 Feb 2006 02:58:27 +0100
Author: mcconnell
Date: 2006-02-09 02:58:11 +0100 (Thu, 09 Feb 2006)
New Revision: 1063
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitTask.java
Log:
improve logging output
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-02-08 23:23:08 UTC (rev 1062)
+++
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-02-09 01:58:11 UTC (rev 1063)
@@ -295,7 +295,8 @@
protected void initialize() throws IOException
{
m_linkManager = new ArtifactLinkManager();
- m_repository = new StandardLoader();
+ Logger logger = getLogger().getChildLogger( "cache" );
+ m_repository = new StandardLoader( logger );
initializeCache();
}
Modified:
trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
2006-02-08 23:23:08 UTC (rev 1062)
+++ trunk/main/transit/core/src/main/net/dpml/transit/StandardLoader.java
2006-02-09 01:58:11 UTC (rev 1063)
@@ -36,6 +36,7 @@
import net.dpml.transit.artifact.ArtifactNotFoundException;
import net.dpml.transit.artifact.Handler;
import net.dpml.transit.monitor.RepositoryMonitorRouter;
+import net.dpml.transit.Logger;
/**
* Utility class supporting downloading of resources based on
@@ -46,6 +47,17 @@
*/
class StandardLoader implements Repository
{
+ private final Logger m_logger;
+
+ /**
+ * Creation of a new repository handler.
+ * @param logger the assigned logging channel
+ */
+ StandardLoader( Logger logger )
+ {
+ m_logger = logger;
+ }
+
//
------------------------------------------------------------------------
// Repository
//
------------------------------------------------------------------------
@@ -155,8 +167,9 @@
}
try
{
+ getLogger().debug( "loading plugin: " + uri );
+ //getMonitor().getPluginRequested( parent, uri, args );
Plugin descriptor = getPluginDescriptor( uri );
- getMonitor().sequenceInfo( "building classload stack" );
ClassLoader classloader = createClassLoader( parent, descriptor
);
String classname = descriptor.getClassname();
if( null == classname )
@@ -171,7 +184,8 @@
try
{
Class clazz = loadPluginClass( classloader, classname );
- getMonitor().establishedPluginClass( clazz );
+ getLogger().debug( "established plugin class: " +
clazz.getName() );
+ //getMonitor().establishedPluginClass( clazz );
return createPlugin( classloader, descriptor, clazz, args );
}
catch( ClassNotFoundException e )
@@ -193,7 +207,8 @@
catch( Exception ce )
{
String error = "Unable to create a plugin using [" + uri + "].";
- getMonitor().exceptionOccurred( "getPlugin", ce );
+ getLogger().error( error, ce );
+ //getMonitor().exceptionOccurred( "getPlugin", ce );
throw new InvocationTargetException( ce );
}
}
@@ -611,11 +626,11 @@
{
URI library = libraries[i];
File source = (File) library.toURL().getContent( new
Class[]{File.class} );
- String path = source.getAbsolutePath();
- getMonitor().sequenceInfo( "loading: " + path );
+ String path = source.getCanonicalPath();
System.load( path );
+ getLogger().debug( "loaded library: " + path );
}
-
+
URI plugin = descriptor.getURI();
URI[] systemArtifacts = descriptor.getDependencies( Category.SYSTEM
);
@@ -652,8 +667,7 @@
{
final String message =
"Cannot load system artifacts into a foreign classloader.";
- getMonitor().sequenceInfo( message );
- //throw new TransitException( error );
+ getLogger().warn( message );
}
}
}
@@ -771,7 +785,6 @@
}
catch( ClassNotFoundException e )
{
- System.out.println( "# CL: " + classloader );
throw e;
}
catch( Throwable e )
@@ -860,5 +873,10 @@
return Transit.getInstance().getRepositoryMonitorRouter();
}
+ private Logger getLogger()
+ {
+ return m_logger;
+ }
+
private static final int THREE = 3;
}
Modified:
trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitTask.java
===================================================================
--- trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitTask.java
2006-02-08 23:23:08 UTC (rev 1062)
+++ trunk/main/transit/tools/src/main/net/dpml/transit/tools/TransitTask.java
2006-02-09 01:58:11 UTC (rev 1063)
@@ -87,7 +87,9 @@
}
catch( TransitAlreadyInitializedException e )
{
- // move on
+ Adapter logger = new AntAdapter( task );
+ Transit transit = Transit.getInstance();
+ setupMonitors( transit, logger );
}
catch( Throwable e )
{
@@ -192,14 +194,21 @@
/**
* Setup the monitors.
*/
- private static void setupMonitors( Transit instance, Adapter adapter )
throws Exception
+ private static void setupMonitors( Transit instance, Adapter adapter )
{
- instance.getRepositoryMonitorRouter().addMonitor(
- new RepositoryMonitorAdapter( adapter ) );
- instance.getCacheMonitorRouter().addMonitor(
- new CacheMonitorAdapter( adapter ) );
- instance.getNetworkMonitorRouter().addMonitor(
- new NetworkMonitorAdapter( adapter ) );
+ try
+ {
+ instance.getRepositoryMonitorRouter().addMonitor(
+ new RepositoryMonitorAdapter( adapter ) );
+ instance.getCacheMonitorRouter().addMonitor(
+ new CacheMonitorAdapter( adapter ) );
+ instance.getNetworkMonitorRouter().addMonitor(
+ new NetworkMonitorAdapter( adapter ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
}
}
- r1063 - in trunk/main/transit: core/src/main/net/dpml/transit tools/src/main/net/dpml/transit/tools, mcconnell at BerliOS, 02/08/2006
Archive powered by MHonArc 2.6.24.