notify-dpml AT lists.ibiblio.org
Subject: DPML Notify
List archive
svn commit: r2884 - development/main/test/components/http/impl/src/main/net/dpml/http/impl
- From: mcconnell AT dpml.net
- To: notify-dpml AT lists.ibiblio.org
- Subject: svn commit: r2884 - development/main/test/components/http/impl/src/main/net/dpml/http/impl
- Date: Fri, 17 Jun 2005 17:43:25 -0400
Author: mcconnell AT dpml.net
Date: Fri Jun 17 17:43:25 2005
New Revision: 2884
Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NotFoundHandler.java
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
Log:
Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NotFoundHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NotFoundHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NotFoundHandler.java
Fri Jun 17 17:43:25 2005
@@ -16,18 +16,8 @@
package net.dpml.http.impl;
import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;
/**
* @metro.component name="http-notfound-handler" lifestyle="singleton"
@@ -37,49 +27,56 @@
extends org.mortbay.http.handler.NotFoundHandler
implements Startable
{
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;
- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public NotFoundHandler(Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ContextException, ServiceException
+ public NotFoundHandler(Logger logger, Context context )
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
-
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
-
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );
}
- public void start()
- throws Exception
+ public void start() throws Exception
{
if( m_index >= 0 )
+ {
m_context.addHandler( m_index, this );
+ }
else
+ {
m_context.addHandler( this );
+ }
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Starting NotFoundHandler: " + this );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}
- public void doStop()
- throws InterruptedException
+ public void doStop() throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping NotFoundHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}
Modified:
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
==============================================================================
---
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
(original)
+++
development/main/test/components/http/impl/src/main/net/dpml/http/impl/NullHandler.java
Fri Jun 17 17:43:25 2005
@@ -16,68 +16,65 @@
package net.dpml.http.impl;
import net.dpml.activity.Startable;
-import net.dpml.context.Context;
-import net.dpml.context.ContextException;
-import net.dpml.context.Contextualizable;
-import net.dpml.logging.LogEnabled;
import net.dpml.logging.Logger;
-import net.dpml.parameters.ParameterException;
-import net.dpml.parameters.Parameterizable;
-import net.dpml.parameters.Parameters;
import net.dpml.http.HttpContextService;
-import net.dpml.service.ServiceException;
-import net.dpml.service.ServiceManager;
-import net.dpml.service.Serviceable;
-
-/**
- * @metro.component name="http-null-handler" lifestyle="singleton"
- * @metro.service type="org.mortbay.http.HttpHandler"
- */
+
public class NullHandler
extends org.mortbay.http.handler.NullHandler
implements Startable
{
+ public interface Context
+ {
+ String getName();
+ HttpContextService getHttpContext();
+ int getHandlerIndex( int value );
+ }
+
private Logger m_logger;
private HttpContextService m_context;
private int m_index;
- /**
- * @metro.logger name="http"
- * @metro.entry key="urn:metro:name"
- * type="java.lang.String"
- * @metro.dependency type="net.dpml.http.HttpContextService"
- * key="http-context"
- */
- public NullHandler(Logger logger, Context ctx, Parameters params,
ServiceManager man )
- throws ContextException, ServiceException
+ public NullHandler(Logger logger, Context context )
{
m_logger = logger;
- m_context = (HttpContextService) man.lookup( "http-context" );
- String name = (String) ctx.get( "urn:metro:name" );
+ m_context = context.getHttpContext();
+ String name = context.getName();
setName( name );
- m_index = params.getParameterAsInteger( "handler-index", -1 );
+ m_index = context.getHandlerIndex( -1 );
}
public void start()
throws Exception
{
if( m_index >= 0 )
+ {
m_context.addHandler( m_index, this );
+ }
else
+ {
m_context.addHandler( this );
+ }
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Starting NullHandler: " + this );
+ }
if( ! isStarted() )
+ {
super.start();
+ }
}
public void stop()
throws InterruptedException
{
if( m_logger.isDebugEnabled() )
+ {
m_logger.debug( "Stopping NullHandler: " + this );
+ }
if( isStarted() )
+ {
super.stop();
+ }
m_context.removeHandler( this );
}
}
- svn commit: r2884 - development/main/test/components/http/impl/src/main/net/dpml/http/impl, mcconnell, 06/17/2005
Archive powered by MHonArc 2.6.24.