Skip to Content.
Sympa Menu

notify-dpml - r993 - in trunk/main/planet: . http http/demo http/demo/src/main/net/dpml/http/demo http/demo/src/test/net/dpml/http http/parts http/parts/context http/parts/resource

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: r993 - in trunk/main/planet: . http http/demo http/demo/src/main/net/dpml/http/demo http/demo/src/test/net/dpml/http http/parts http/parts/context http/parts/resource
  • Date: Mon, 30 Jan 2006 16:58:50 +0100

Author: mcconnell
Date: 2006-01-30 16:58:48 +0100 (Mon, 30 Jan 2006)
New Revision: 993

Added:
trunk/main/planet/http/parts/resource/
trunk/main/planet/http/parts/resource/build.xml
Modified:
trunk/main/planet/http/demo/build.xml
trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java

trunk/main/planet/http/demo/src/main/net/dpml/http/demo/ManagementOperations.java
trunk/main/planet/http/demo/src/test/net/dpml/http/HttpTestCase.java
trunk/main/planet/http/module.xml
trunk/main/planet/http/parts/context/build.xml
trunk/main/planet/module.xml
Log:
playing around

Modified: trunk/main/planet/http/demo/build.xml
===================================================================
--- trunk/main/planet/http/demo/build.xml 2006-01-30 13:46:45 UTC (rev
992)
+++ trunk/main/planet/http/demo/build.xml 2006-01-30 15:58:48 UTC (rev
993)
@@ -31,6 +31,9 @@
<operation name="memory" method="getMemoryStats"/>
<operation name="stats" method="getStats"/>
<interface name="control"
class="net.dpml.http.demo.ManagementOperations"/>
+ <trigger event="termination">
+ <operation name="dispose" method="dispose"/>
+ </trigger>
</state>
<parts>
<component type="net.dpml.http.impl.HttpServerImpl" key="server"
collection="hard">
@@ -60,13 +63,15 @@
<entry key="server" lookup="net.dpml.http.spi.HttpService"/>
<entry key="requestLog" lookup="org.mortbay.http.RequestLog"/>
<entry key="tempDirectory"
value="$${java.io.tmpdir}/http/context"/>
- <entry key="contextPath" value="/"/>
+ <entry key="contextPath" value="/dpml"/>
<entry key="gracefulStop" value="true"/>
+ <entry key="resourceBase" value="$${dpml.data}/docs"/>
</context>
</component>
<component key="httpHandler"
type="net.dpml.http.impl.ResourceHandler" collection="hard">
<context>
<entry key="name" value="resource-handler"/>
+ <entry key="handlerIndex" value="0"/>
<entry key="dirAllowed" value="true"/>
<entry key="allowedMethods" value="GET"/>
<entry key="httpContext"
lookup="net.dpml.http.spi.HttpContextService"/>
@@ -74,6 +79,7 @@
</component>
<component key="notFoundHandler"
type="net.dpml.http.impl.NotFoundHandler" collection="hard">
<context>
+ <entry key="handlerIndex" value="1"/>
<entry key="name" value="not-found-handler"/>
<entry key="httpContext"
lookup="net.dpml.http.spi.HttpContextService"/>
</context>

Modified: trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
===================================================================
--- trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
2006-01-30 13:46:45 UTC (rev 992)
+++ trunk/main/planet/http/demo/src/main/net/dpml/http/demo/Demo.java
2006-01-30 15:58:48 UTC (rev 993)
@@ -25,19 +25,20 @@

import net.dpml.metro.ComponentContext;
import net.dpml.metro.ComponentHandler;
+import net.dpml.metro.PartsManager;

import net.dpml.part.Controller;
import net.dpml.part.Directive;
+import net.dpml.part.Disposable;

import net.dpml.http.spi.SocketListenerService;
-import net.dpml.http.impl.HttpContextImpl;

/**
* Working demo/test component. This component is aimed primarily
* and testing and validating interfaces and implementations related
* to remote management and control of interal parts.
*/
-public class Demo implements ManagementOperations
+public class Demo implements ManagementOperations, Disposable
{
//---------------------------------------------------------
// criteria
@@ -59,7 +60,7 @@
/**
* Internal part managmeent interface.
*/
- public interface Parts
+ public interface Parts extends PartsManager
{
/**
* Return the context map associated with the socket listener.
@@ -72,6 +73,7 @@
* @return the socket listener
*/
SocketListenerService getSocketListener();
+
}

//---------------------------------------------------------
@@ -93,7 +95,7 @@
* @param context the public component context
* @param parts the internal parts manager
*/
- public Demo( Logger logger, Context context, Parts parts )
+ public Demo( Logger logger, Context context, Parts parts ) throws
Exception
{
m_logger = logger;
m_parts = parts;
@@ -101,8 +103,15 @@
int port = context.getPort( 8080 );
parts.getSocketListenerMap().put( "port", new Integer( port ) );
m_parts.getSocketListener(); // trigger activation
+ ComponentHandler handler = parts.getComponentHandler( "context" );
+ m_httpContextTable.put( "/", handler );
}

+ public void dispose()
+ {
+ getLogger().info( "# DISPOSAL IN DEMO" );
+ }
+
//---------------------------------------------------------
// ManagementOperations
//---------------------------------------------------------
@@ -111,9 +120,10 @@
* Add a new http context to the application. This implementation
* is experimental and can be very significantly optimized however
* the primary object here is to test dynamic component loading.
+ * @param base the http resource base
* @param path the http context path
*/
- public void addContext( String path ) throws Exception
+ public void addContext( String base, String path ) throws Exception
{
if( m_httpContextTable.containsKey( path ) )
{
@@ -124,18 +134,40 @@
throw new IllegalArgumentException( error );
}

- getLogger().info( "# ADD: " + path );
+ getLogger().info( "# BASE: " + base );
+ getLogger().info( "# PATH: " + path );
URI uri = new URI( "link:part:dpml/planet/http/dpml-http-context" );
ClassLoader anchor = ManagementOperations.class.getClassLoader();
ComponentHandler handler = m_context.createComponentHandler( anchor,
uri );
+ handler.getContextMap().put( "resourceBase", base );
handler.getContextMap().put( "contextPath", path );
- getLogger().info( "# HANDLER: " + handler );
m_httpContextTable.put( path, handler );
Object value = handler.getProvider().getValue( false );
getLogger().info( "# VALUE: " + value );
-
- // .. now we can move ahead with dynamic addition of handlers to a
context
}
+
+ /**
+ * Add a new http content handler to a http context.
+ * @param context the http context path
+ */
+ public void addResourceHandler( String path ) throws Exception
+ {
+ getLogger().info( "# adding resource handler to path: " + path );
+ ComponentHandler httpContextHandler = (ComponentHandler)
m_httpContextTable.get( path );
+ if( null == httpContextHandler )
+ {
+ final String error =
+ "Http context path [" + path + "] is undefined.";
+ throw new IllegalArgumentException( error );
+ }
+ URI uri = new URI( "link:part:dpml/planet/http/dpml-http-resource" );
+ ClassLoader anchor = ManagementOperations.class.getClassLoader();
+ ComponentHandler handler = m_context.createComponentHandler( anchor,
uri );
+ Object httpContext = httpContextHandler.getProvider().getValue(
false );
+ handler.getContextMap().put( "httpContext", httpContext );
+ Object value = handler.getProvider().getValue( false );
+ getLogger().info( "# VALUE: " + value );
+ }

/**
* Remove an http context from the application.

Modified:
trunk/main/planet/http/demo/src/main/net/dpml/http/demo/ManagementOperations.java
===================================================================
---
trunk/main/planet/http/demo/src/main/net/dpml/http/demo/ManagementOperations.java
2006-01-30 13:46:45 UTC (rev 992)
+++
trunk/main/planet/http/demo/src/main/net/dpml/http/demo/ManagementOperations.java
2006-01-30 15:58:48 UTC (rev 993)
@@ -22,11 +22,18 @@
{
/**
* Add a new http context to the application.
+ * @param base the resource base path
* @param path the context path
*/
- void addContext( String path ) throws Exception;
+ void addContext( String base, String path ) throws Exception;

/**
+ * Add a new http content handler to a http context.
+ * @param path the http context path
+ */
+ void addResourceHandler( String path ) throws Exception;
+
+ /**
* Remove an http context from the application.
* @param path the context path
*/

Modified: trunk/main/planet/http/demo/src/test/net/dpml/http/HttpTestCase.java
===================================================================
--- trunk/main/planet/http/demo/src/test/net/dpml/http/HttpTestCase.java
2006-01-30 13:46:45 UTC (rev 992)
+++ trunk/main/planet/http/demo/src/test/net/dpml/http/HttpTestCase.java
2006-01-30 15:58:48 UTC (rev 993)
@@ -54,7 +54,7 @@
try
{
Demo demo = (Demo) component.getProvider().getValue( false );
- demo.addContext( "/test" );
+ demo.addContext( "${dpml.data}/docs", "/test" );
}
catch( ControlException e )
{
@@ -79,11 +79,11 @@

static
{
+ System.setProperty( "dpml.logging.config",
"local:properties:dpml/transit/debug" );
System.setProperty(
"java.util.logging.config.class",
System.getProperty(
"java.util.logging.config.class",
"net.dpml.transit.util.ConfigurationHandler" ) );
}
-
}

Modified: trunk/main/planet/http/module.xml
===================================================================
--- trunk/main/planet/http/module.xml 2006-01-30 13:46:45 UTC (rev 992)
+++ trunk/main/planet/http/module.xml 2006-01-30 15:58:48 UTC (rev 993)
@@ -56,18 +56,23 @@
<property name="project.test.halt-on-error" value="true"/>
<property name="project.test.halt-on-failure" value="true"/>
</properties>
- <dependencies>
- <include ref="dpml/metro/dpml-metro-model"/>
+ <dependencies scope="build">
+ <include key="dpml-http-context"/>
+ <include key="dpml-http-resource"/>
+ <include key="dpml-http-impl"/>
+ </dependencies>
+ <dependencies scope="runtime">
+ <include ref="dpml/metro/dpml-metro-model" tag="protected"/>
+ <include ref="dpml/util/dpml-logging-api" tag="protected"/>
<include urn="artifact:jar:servletapi/servletapi#2.3" tag="public"/>
+ <include key="dpml-http-spi" tag="protected"/>
+ <include urn="artifact:jar:commons-logging/commons-logging#1.0.4"
tag="protected"/>
<include key="dpml-http-impl"/>
</dependencies>
<dependencies scope="test">
<include ref="dpml/metro/dpml-part-api"/>
<include ref="ant/ant-junit"/>
</dependencies>
- <dependencies scope="build">
- <include key="dpml-http-context"/>
- </dependencies>
</project>

<project name="dpml-http-context" basedir="parts/context">
@@ -76,9 +81,18 @@
</types>
<dependencies>
<include ref="dpml/metro/dpml-metro-model"/>
- <include urn="artifact:jar:servletapi/servletapi#2.3" tag="public"/>
<include key="dpml-http-impl"/>
</dependencies>
</project>

+ <project name="dpml-http-resource" basedir="parts/resource">
+ <types>
+ <type id="part" alias="true"/>
+ </types>
+ <dependencies>
+ <include ref="dpml/metro/dpml-metro-model"/>
+ <include key="dpml-http-impl"/>
+ </dependencies>
+ </project>
+
</module>

Modified: trunk/main/planet/http/parts/context/build.xml
===================================================================
--- trunk/main/planet/http/parts/context/build.xml 2006-01-30 13:46:45
UTC (rev 992)
+++ trunk/main/planet/http/parts/context/build.xml 2006-01-30 15:58:48
UTC (rev 993)
@@ -27,8 +27,9 @@
<context>
<entry key="server" lookup="net.dpml.http.spi.HttpService"/>
<entry key="requestLog" lookup="org.mortbay.http.RequestLog"/>
- <entry key="tempDirectory" value="$${java.io.tmpdir}/http/context"/>
+ <entry key="tempDirectory" value="$${dpml.data}/temp/http/context"/>
<entry key="contextPath" value="/"/>
+ <entry key="resourceBase" value="."/>
<entry key="gracefulStop" value="true"/>
</context>
</component>

Added: trunk/main/planet/http/parts/resource/build.xml
===================================================================
--- trunk/main/planet/http/parts/resource/build.xml 2006-01-30 13:46:45
UTC (rev 992)
+++ trunk/main/planet/http/parts/resource/build.xml 2006-01-30 15:58:48
UTC (rev 993)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ * Copyright 2004-2005 Stephen J. 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.dpml.net/central/about/legal/
+ *
+ * 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.
+-->
+
+<project name="dpml-http-resource" default="install" basedir="."
+ xmlns:transit="antlib:net.dpml.transit"
+ xmlns:depot="dpml:depot" >
+
+ <transit:import uri="local:template:dpml/tools/standard"/>
+
+ <target name="build" depends="standard.build">
+ <depot:plugin uri="link:plugin:dpml/metro/dpml-metro-tools" urn="metro"/>
+ <component xmlns="metro" type="net.dpml.http.impl.ResourceHandler"
collection="hard">
+ <context>
+ <entry key="httpContext"
lookup="net.dpml.http.spi.HttpContextService"/>
+ <entry key="name" value="$${name}"/>
+ <entry key="dirAllowed" value="true"/>
+ <entry key="allowedMethods" value="GET"/>
+ </context>
+ </component>
+ </target>
+
+</project>
+

Modified: trunk/main/planet/module.xml
===================================================================
--- trunk/main/planet/module.xml 2006-01-30 13:46:45 UTC (rev 992)
+++ trunk/main/planet/module.xml 2006-01-30 15:58:48 UTC (rev 993)
@@ -7,5 +7,6 @@
</types>

<module base="http"/>
+ <module base="web"/>

</module>




  • r993 - in trunk/main/planet: . http http/demo http/demo/src/main/net/dpml/http/demo http/demo/src/test/net/dpml/http http/parts http/parts/context http/parts/resource, mcconnell at BerliOS, 01/30/2006

Archive powered by MHonArc 2.6.24.

Top of Page