Skip to Content.
Sympa Menu

notify-dpml - r1259 - in trunk/main: depot/core/src/main/net/dpml/depot metro/component/src/main/net/dpml/component metro/runtime/src/main/net/dpml/metro/runtime planet/http/impl/src/main/net/dpml/http station/exec/src/main/net/dpml/station/exec station/server/etc/prefs/xmls station/server/src/main/net/dpml/station/server transit/core/src/main/net/dpml/transit util/logging/src/main/net/dpml/logging

notify-dpml AT lists.ibiblio.org

Subject: DPML Notify

List archive

Chronological Thread  
  • From: mcconnell at BerliOS <mcconnell AT mail.berlios.de>
  • To: notify-dpml AT lists.ibiblio.org
  • Subject: r1259 - in trunk/main: depot/core/src/main/net/dpml/depot metro/component/src/main/net/dpml/component metro/runtime/src/main/net/dpml/metro/runtime planet/http/impl/src/main/net/dpml/http station/exec/src/main/net/dpml/station/exec station/server/etc/prefs/xmls station/server/src/main/net/dpml/station/server transit/core/src/main/net/dpml/transit util/logging/src/main/net/dpml/logging
  • Date: Fri, 24 Mar 2006 03:57:28 +0100

Author: mcconnell
Date: 2006-03-24 03:56:55 +0100 (Fri, 24 Mar 2006)
New Revision: 1259

Added:
trunk/main/planet/http/impl/src/main/net/dpml/http/LogAdapter.java
trunk/main/planet/http/impl/src/main/net/dpml/http/LoggerAdapter.java
Modified:
trunk/main/depot/core/src/main/net/dpml/depot/Main.java

trunk/main/metro/component/src/main/net/dpml/component/ControllerContext.java
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java

trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java

trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java

trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
trunk/main/station/server/etc/prefs/xmls/registry.xml

trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java

trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java

trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
trunk/main/util/logging/src/main/net/dpml/logging/Logger.java
Log:
cleanup logging channel assignments to ensure that new top-level components
are created under the station namespace when launched by the station

Modified: trunk/main/depot/core/src/main/net/dpml/depot/Main.java
===================================================================
--- trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-03-23
21:17:41 UTC (rev 1258)
+++ trunk/main/depot/core/src/main/net/dpml/depot/Main.java 2006-03-24
02:56:55 UTC (rev 1259)
@@ -143,7 +143,7 @@
private void handleMetro( String[] arguments )
{
String[] args = processSystemProperties( arguments );
- String name = "metro";
+ String name = "exec";
String spec = "@DEPOT-EXEC-URI@";
handlePlugin( name, spec, args, true );
}
@@ -161,7 +161,7 @@
new File( Transit.DPML_DATA, "logs/station" ).mkdirs();
if( CLIHelper.isOptionPresent( arguments, "-server" ) )
{
- String name = "station.server";
+ String name = "station";
String[] args = CLIHelper.consolidate( arguments, "-server" );
args = processSystemProperties( args );
String spec = "@DEPOT-STATION-SERVER-URI@";
@@ -169,7 +169,7 @@
}
else
{
- String name = "station.console";
+ String name = "station";
String spec = "@DEPOT-STATION-URI@";
handlePlugin( name, spec, arguments, false );
}
@@ -207,11 +207,12 @@
logger.debug( "uri: " + path );
logger.debug( "args: [" + toString( args ) + "]" );
}
+ Logger log = resolveLogger( logger, command );
try
{
URI uri = new URI( path );
Transit transit = Transit.getInstance( model );
- setupMonitors( transit, (Adapter) getLogger() );
+ setupMonitors( transit, (Adapter) logger );
Repository repository = transit.getRepository();
m_plugin =
repository.getPlugin(
@@ -219,7 +220,9 @@
uri,
new Object[]
{
- model, args, new LoggingAdapter( command )
+ model,
+ args,
+ log
}
);
}
@@ -267,6 +270,19 @@
}
}

+ private Logger resolveLogger( Logger logger, String command )
+ {
+ String partition = System.getProperty( "dpml.station.partition",
null );
+ if( null != partition )
+ {
+ return new LoggingAdapter( partition );
+ }
+ else
+ {
+ return logger.getChildLogger( command );
+ }
+ }
+
private TransitModel getTransitModel( String[] args )
{
final String key = "dpml.transit.model";
@@ -314,7 +330,7 @@

try
{
- Logger logger = getLogger();
+ Logger logger = getLogger().getChildLogger( "transit" );
return DefaultTransitModel.getDefaultModel( logger );
}
catch( Exception e )

Modified:
trunk/main/metro/component/src/main/net/dpml/component/ControllerContext.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/ControllerContext.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/metro/component/src/main/net/dpml/component/ControllerContext.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -33,11 +33,11 @@
public interface ControllerContext
{
/**
- * Return the assigned logging channel.
+ * Return the assigned root partition.
*
- * @return the logging channel
+ * @return the partition name
*/
- Logger getLogger();
+ String getPartition();

/**
* Return the root working directory.

Modified:
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
===================================================================
---
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/metro/component/src/main/net/dpml/component/InitialContext.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -175,9 +175,9 @@
private File m_temp;

/**
- * The assigned logging channel.
+ * The assigned partition name.
*/
- private Logger m_logger;
+ private String m_partition;


//----------------------------------------------------------------------------
// constructor
@@ -188,16 +188,16 @@
*/
public InitialContext()
{
- this( new LoggingAdapter( "metro" ), null, null );
+ this( "", null, null );
}

/**
* Creation of a new <tt>InitialContext</tt>.
- * @param logger the assigned logging channel
+ * @param partition the assigned partition name
*/
- public InitialContext( Logger logger )
+ public InitialContext( String partition )
{
- this( logger, null, null );
+ this( partition, null, null );
}

/**
@@ -206,11 +206,11 @@
* @param work the working directory
* @param temp the temporary directory
*/
- public InitialContext( Logger logger, File work, File temp )
+ public InitialContext( String partition, File work, File temp )
{
- super( new LoggingAdapter( "metro.context" ) );
+ super( new LoggingAdapter( partition ) );

- m_logger = logger;
+ m_partition = partition;

if( null == work )
{
@@ -254,12 +254,12 @@

//----------------------------------------------------------------------------

/**
- * Return the assigned logging channel
- * @return the logging channel
+ * Return the partition name
+ * @return the partion name
*/
- public Logger getLogger()
+ public String getPartition()
{
- return m_logger;
+ return m_partition;
}

/**

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/ComponentController.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -84,7 +84,7 @@
m_logger = logger;
m_controller = controller;
}
-
+

//--------------------------------------------------------------------------
// ComponentController

//--------------------------------------------------------------------------
@@ -114,7 +114,7 @@
Classpath classpath, ComponentDirective directive ) throws
ControlException
{
ClassLoader anchor = Logger.class.getClassLoader();
- String partition = Model.PARTITION_SEPARATOR;
+ String partition = m_controller.getPartition() +
Model.PARTITION_SEPARATOR;
return createComponentModel( anchor, classpath, partition, directive
);
}

@@ -563,7 +563,7 @@
String getPathForLogger( DefaultComponentHandler handler )
{
String path = handler.getPath();
- return path.substring( 1 ).replace( '/', '.' );
+ return path.replace( '/', '.' );
}

Object getContextValue( DefaultComponentHandler handler, String key )
throws ControlException

Modified:
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
===================================================================
---
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/metro/runtime/src/main/net/dpml/metro/runtime/CompositionController.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -89,6 +89,7 @@
private final HashMap m_handlers = new HashMap(); // foreign controllers
private final Repository m_loader;
private final InternalControllerContextListener m_listener;
+ private final String m_partition;

//--------------------------------------------------------------------
// mutable state
@@ -111,7 +112,8 @@
super();

m_context = context;
- Logger root = new StandardLogger( context.getLogger() );
+ m_partition = context.getPartition();
+ Logger root = new StandardLogger( m_partition );
m_logger = root.getChildLogger( "control" );
m_listener = new InternalControllerContextListener( this );
m_context.addControllerContextListener( m_listener );
@@ -445,6 +447,11 @@
}
*/

+ String getPartition()
+ {
+ return m_partition;
+ }
+
void dispose()
{
getLogger().debug( "initating controller disposal" );

Added: trunk/main/planet/http/impl/src/main/net/dpml/http/LogAdapter.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/LogAdapter.java
2006-03-23 21:17:41 UTC (rev 1258)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/LogAdapter.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -0,0 +1,153 @@
+/*
+ * Copyright 2006 Stephen McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.http;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Wrapper to redirect Jetty logging to standard JVM logging.
+ */
+public class LogAdapter implements org.mortbay.log.Logger
+{
+ private final Logger m_logger;
+
+ public LogAdapter()
+ {
+ this( Logger.getLogger( "org.mortbay" ) );
+ }
+
+ LogAdapter( Logger logger )
+ {
+ m_logger = logger;
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return m_logger.isLoggable( Level.FINE );
+ }
+
+ public void info( String msg, Object arg0, Object arg1 )
+ {
+ if( m_logger.isLoggable( Level.INFO ) )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.info( message );
+ }
+ }
+
+ public void debug( String message, Throwable cause )
+ {
+ if( isDebugEnabled() )
+ {
+ m_logger.log( Level.FINE, message, cause );
+ }
+ }
+
+ public void debug( String msg, Object arg0, Object arg1 )
+ {
+ if( isDebugEnabled() )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.log( Level.FINE, message );
+ }
+ }
+
+ public void warn( String msg,Object arg0, Object arg1 )
+ {
+ if( m_logger.isLoggable( Level.WARNING ) )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.log( Level.WARNING, message );
+ }
+ }
+
+ public void warn( String message, Throwable error )
+ {
+ if( m_logger.isLoggable( Level.WARNING ) )
+ {
+ m_logger.log( Level.WARNING, message, error );
+ }
+ }
+
+ private String format( String msg, Object arg0, Object arg1 )
+ {
+ int i0 = msg.indexOf( "{}" );
+
+ int i1 = 0;
+ if( i0 < 0 )
+ {
+ i1 = -1;
+ }
+ else
+ {
+ i1 = msg.indexOf( "{}" , i0 + 2 );
+ }
+
+ if( ( arg1 != null ) && ( i1 >= 0 ) )
+ {
+ msg =
+ msg.substring( 0, i1 )
+ + arg1
+ + msg.substring( i1 + 2 );
+ }
+ if( ( arg0 != null ) && ( i0 >= 0 ) )
+ {
+ msg =
+ msg.substring( 0,i0 )
+ + arg0
+ + msg.substring( i0 + 2 );
+ }
+ return msg;
+ }
+
+ public org.mortbay.log.Logger getLogger( String category )
+ {
+ if( ( null == category ) || "org.mortbay".equals( category ) )
+ {
+ return this;
+ }
+ else
+ {
+ String name = m_logger.getName();
+ String path = trim( name + "." + category );
+ return new LogAdapter( Logger.getLogger( path ) );
+ }
+ }
+
+ private String trim( String path )
+ {
+ if( path.startsWith( "." ) )
+ {
+ return trim( path.substring( 1 ) );
+ }
+ else if( ".".equals( path ) )
+ {
+ return "";
+ }
+ else
+ {
+ return path;
+ }
+ }
+
+ public String toString()
+ {
+ return "java.util.logging.Logger/" + m_logger.getName();
+ }
+
+}
+

Added: trunk/main/planet/http/impl/src/main/net/dpml/http/LoggerAdapter.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/LoggerAdapter.java
2006-03-23 21:17:41 UTC (rev 1258)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/LoggerAdapter.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -0,0 +1,176 @@
+/*
+ * Copyright 2006 Stephen McConnell.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package net.dpml.http;
+
+import net.dpml.logging.Logger;
+
+import net.dpml.transit.util.ExceptionHelper;
+
+/**
+ * Wrapper to redirect Jetty logging to DPML logging.
+ */
+public class LoggerAdapter implements org.mortbay.log.Logger
+{
+ private static Logger m_LOGGER;
+
+ static void setRootLogger( Logger logger )
+ {
+ if( null == m_LOGGER )
+ {
+ m_LOGGER = logger;
+ System.setProperty( "org.mortbay.log.class",
LoggerAdapter.class.getName() );
+ }
+ else
+ {
+ throw new IllegalStateException( "m_LOGGER already initialized."
);
+ }
+ }
+
+ private final Logger m_logger;
+
+ public LoggerAdapter()
+ {
+ if( null == m_LOGGER )
+ {
+ throw new IllegalStateException( "m_LOGGER not initialized." );
+ }
+ else
+ {
+ m_logger = m_LOGGER;
+ }
+ }
+
+ LoggerAdapter( Logger logger )
+ {
+ m_logger = logger;
+ }
+
+ public boolean isDebugEnabled()
+ {
+ return m_logger.isDebugEnabled();
+ }
+
+ public void info( String msg, Object arg0, Object arg1 )
+ {
+ if( m_logger.isInfoEnabled() )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.info( message );
+ }
+ }
+
+ public void debug( String message, Throwable cause )
+ {
+ if( isDebugEnabled() )
+ {
+ if( null == cause )
+ {
+ m_logger.debug( message );
+ }
+ else
+ {
+ String error = ExceptionHelper.packException( message,
cause, false );
+ m_logger.debug( error );
+ }
+ }
+ }
+
+ public void debug( String msg, Object arg0, Object arg1 )
+ {
+ if( isDebugEnabled() )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.debug( message );
+ }
+ }
+
+ public void warn( String msg,Object arg0, Object arg1 )
+ {
+ if( m_logger.isWarnEnabled() )
+ {
+ String message = format( msg, arg0, arg1 );
+ m_logger.warn( message );
+ }
+ }
+
+ public void warn( String message, Throwable error )
+ {
+ if( m_logger.isWarnEnabled() )
+ {
+ m_logger.warn( message, error );
+ }
+ }
+
+ private String format( String msg, Object arg0, Object arg1 )
+ {
+ int i0 = msg.indexOf( "{}" );
+
+ int i1 = 0;
+ if( i0 < 0 )
+ {
+ i1 = -1;
+ }
+ else
+ {
+ i1 = msg.indexOf( "{}" , i0 + 2 );
+ }
+
+ if( ( arg1 != null ) && ( i1 >= 0 ) )
+ {
+ msg =
+ msg.substring( 0, i1 )
+ + arg1
+ + msg.substring( i1 + 2 );
+ }
+ if( ( arg0 != null ) && ( i0 >= 0 ) )
+ {
+ msg =
+ msg.substring( 0,i0 )
+ + arg0
+ + msg.substring( i0 + 2 );
+ }
+ return msg;
+ }
+
+ public org.mortbay.log.Logger getLogger( String category )
+ {
+ Logger logger = m_LOGGER.getChildLogger( category );
+ return new LoggerAdapter( logger );
+ }
+
+ private String trim( String path )
+ {
+ if( path.startsWith( "." ) )
+ {
+ return trim( path.substring( 1 ) );
+ }
+ else if( ".".equals( path ) )
+ {
+ return "";
+ }
+ else
+ {
+ return path;
+ }
+ }
+
+ public String toString()
+ {
+ return "net.dpml.logging.Logger";
+ }
+
+}
+

Modified: trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
===================================================================
--- trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-03-23 21:17:41 UTC (rev 1258)
+++ trunk/main/planet/http/impl/src/main/net/dpml/http/Server.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -105,6 +105,8 @@
{
super();

+ LoggerAdapter.setRootLogger( logger );
+
m_logger = logger;
m_context = context;


Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ApplicationHandler.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -161,8 +161,10 @@
URI params = getParametersURI( line );
URI categories = getCategoriesURI( line );
Properties properties = getCommandLineProperties( line );
-
- Component component = resolveTargetComponent( logger, uri, config,
params, categories, properties );
+ String partition = System.getProperty( "dpml.station.partition", ""
);
+ Component component =
+ resolveTargetComponent(
+ logger, partition, uri, config, params, categories, properties );
m_callback.started( PROCESS_ID, component );
}

@@ -206,7 +208,8 @@
}

private Component resolveTargetComponent(
- Logger logger, URI uri, URI config, URI params, URI categories,
Properties properties ) throws Exception
+ Logger logger, String partition, URI uri, URI config, URI params,
+ URI categories, Properties properties ) throws Exception
{
if( Artifact.isRecognized( uri ) )
{
@@ -214,7 +217,7 @@
String type = artifact.getType();
if( type.equals( "part" ) )
{
- return new ComponentAdapter( logger, uri, config, params,
categories, properties );
+ return new ComponentAdapter( logger, partition, uri, config,
params, categories, properties );
}
}


Modified:
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
===================================================================
---
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/station/exec/src/main/net/dpml/station/exec/ComponentAdapter.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -87,6 +87,7 @@
/**
* Creation of a new component adapter.
* @param logger the assigned logging channel
+ * @param partition the partition name
* @param codebase the codebase uri
* @param config a configuration uri
* @param params a parameters uri
@@ -95,7 +96,8 @@
* @exception Exception if an error occurs
*/
public ComponentAdapter(
- Logger logger, URI codebase, URI config, URI params, URI categories,
Properties properties ) throws Exception
+ Logger logger, String partition, URI codebase, URI config, URI params,
+ URI categories, Properties properties ) throws Exception
{
super( logger );

@@ -107,7 +109,7 @@
URI uri = new URI( "@COMPOSITION-CONTROLLER-URI@" );
Repository repository = Transit.getInstance().getRepository();
Class c = repository.getPluginClass( classloader, uri );
- InitialContext context = new InitialContext( logger );
+ InitialContext context = new InitialContext( partition );
Constructor constructor = c.getConstructor( new
Class[]{ControllerContext.class} );
m_controller = (Controller) constructor.newInstance( new
Object[]{context} );
}

Modified: trunk/main/station/server/etc/prefs/xmls/registry.xml
===================================================================
--- trunk/main/station/server/etc/prefs/xmls/registry.xml 2006-03-23
21:17:41 UTC (rev 1258)
+++ trunk/main/station/server/etc/prefs/xmls/registry.xml 2006-03-24
02:56:55 UTC (rev 1259)
@@ -9,6 +9,7 @@
<shutdown>6</shutdown>
<properties>
<property name="java.util.logging.config.class"
value="net.dpml.depot.DepotLoggingConfiguration"/>
+ <property name="org.mortbay.log.class"
value="net.dpml.http.LogAdapter"/>
</properties>
</jvm>


Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteApplication.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -328,6 +328,7 @@

Properties properties = m_descriptor.getSystemProperties();
properties.setProperty( "dpml.subprocess", "true" );
+ properties.setProperty( "dpml.station.partition", "depot.station." +
m_id );
if( null == properties.getProperty( "java.util.logging.config.class"
) )
{
properties.setProperty(

Modified:
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
===================================================================
---
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/station/server/src/main/net/dpml/station/server/RemoteStation.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -324,7 +324,8 @@
}
else
{
- Logger logger = new LoggingAdapter( key );
+ //Logger logger = new LoggingAdapter( key );
+ Logger logger = getLogger().getChildLogger( key );
ApplicationDescriptor descriptor =
m_registry.getApplicationDescriptor( key );
RemoteApplication application =
new RemoteApplication( logger, descriptor, key, m_port );
@@ -493,7 +494,7 @@
{
if( m_DISPATCH == null )
{
- Logger logger = getLogger().getChildLogger( "event" );
+ Logger logger = getLogger();
m_DISPATCH = new EventDispatchThread( logger );
m_DISPATCH.setDaemon( true );
m_DISPATCH.start();

Modified: trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
===================================================================
--- trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-03-23 21:17:41 UTC (rev 1258)
+++ trunk/main/transit/core/src/main/net/dpml/transit/DefaultModel.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -153,6 +153,11 @@
return m_logger;
}

+ Logger getLoggingChannel()
+ {
+ return getLogger();
+ }
+
/**
* Dispose of the model.
*/

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/transit/core/src/main/net/dpml/transit/DefaultTransitModel.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -98,7 +98,21 @@
*/
public static DefaultTransitModel getDefaultModel() throws Exception
{
- LoggingAdapter adapter = new LoggingAdapter( "transit" );
+ return getDefaultModel( "transit" );
+ }
+
+ /**
+ * Resolve the transit configuration using the default resource path
+ * <tt>local:xml:dpml/transit/config</tt>. If the resource does not exist
a classic
+ * default scenario will be returned.
+ *
+ * @param category the logging channel category name
+ * @return the transit model
+ * @exception Exception if an error occurs during model construction
+ */
+ public static DefaultTransitModel getDefaultModel( String category )
throws Exception
+ {
+ LoggingAdapter adapter = new LoggingAdapter( category );
return getDefaultModel( adapter );
}

@@ -107,7 +121,7 @@
* <tt>local:xml:dpml/transit/config</tt>. If the resource does not exist
a classic
* default scenario will be returned.
*
- * @param logger the logging channel
+ * @param category the logging channel category name
* @return the transit model
* @exception Exception if an error occurs during model construction
*/

Modified:
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
===================================================================
---
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-03-23 21:17:41 UTC (rev 1258)
+++
trunk/main/transit/core/src/main/net/dpml/transit/SecuredTransitContext.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -74,18 +74,18 @@
{
return m_CONTEXT;
}
-
+
if( null == model )
{
throw new NullArgumentException( "model" );
}
-
- Logger logger = new LoggingAdapter();
+
+ Logger logger = resolveLogger( model );
if( logger.isDebugEnabled() )
{
logger.debug( "creating transit context" );
}
-
+
try
{
m_CONTEXT = new SecuredTransitContext( model, logger );
@@ -99,10 +99,23 @@
String error = "Unable to establish the transit context.";
throw new TransitException( error, e );
}
-
+
return m_CONTEXT;
}
}
+
+ private static Logger resolveLogger( TransitModel model )
+ {
+ if( model instanceof DefaultTransitModel )
+ {
+ DefaultTransitModel m = (DefaultTransitModel) model;
+ return m.getLoggingChannel();
+ }
+ else
+ {
+ return new LoggingAdapter();
+ }
+ }

/**
* Return the singleton context.

Modified: trunk/main/util/logging/src/main/net/dpml/logging/Logger.java
===================================================================
--- trunk/main/util/logging/src/main/net/dpml/logging/Logger.java
2006-03-23 21:17:41 UTC (rev 1258)
+++ trunk/main/util/logging/src/main/net/dpml/logging/Logger.java
2006-03-24 02:56:55 UTC (rev 1259)
@@ -47,6 +47,12 @@
boolean isErrorEnabled();

/**
+ * Return TRUE is error warning logging is enabled.
+ * @return the enabled state of warning logging
+ */
+ boolean isWarnEnabled();
+
+ /**
* Record a debug level message.
* @param message the debug message to record
*/




  • r1259 - in trunk/main: depot/core/src/main/net/dpml/depot metro/component/src/main/net/dpml/component metro/runtime/src/main/net/dpml/metro/runtime planet/http/impl/src/main/net/dpml/http station/exec/src/main/net/dpml/station/exec station/server/etc/prefs/xmls station/server/src/main/net/dpml/station/server transit/core/src/main/net/dpml/transit util/logging/src/main/net/dpml/logging, mcconnell at BerliOS, 03/23/2006

Archive powered by MHonArc 2.6.24.

Top of Page