You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by mc...@apache.org on 2004/01/13 13:46:55 UTC
cvs commit: avalon/merlin/platform/xdocs/meta/block components.xml
mcconnell 2004/01/13 04:46:55
Modified: merlin maven.xml
Added: merlin/facilities/http .cvsignore maven.xml
project.properties project.xml
merlin/facilities/http/api .cvsignore maven.xml project.xml
merlin/facilities/http/api/src/java/org/apache/avalon/http
HttpService.java package.html
merlin/facilities/http/conf kernel.xml test.block
merlin/facilities/http/impl .cvsignore maven.xml
merlin.properties project.xml
merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl
AvalonLogSink.java DefaultServer.java package.html
merlin/facilities/http/listener .cvsignore maven.xml
merlin.properties project.xml
merlin/facilities/http/listener/src/java/org/apache/avalon/http/listener
DefaultHTTPModelListener.java package.html
merlin/facilities/http/root README.TXT
merlin/facilities/jmx README.TXT
merlin/facilities/logging README.TXT
Removed: merlin/platform/xdocs/meta/block components.xml
Log:
Move http content to a seperate facilities sub-package.
Revision Changes Path
1.33 +36 -41 avalon/merlin/maven.xml
Index: maven.xml
===================================================================
RCS file: /home/cvs/avalon/merlin/maven.xml,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- maven.xml 13 Jan 2004 11:41:22 -0000 1.32
+++ maven.xml 13 Jan 2004 12:46:54 -0000 1.33
@@ -83,7 +83,7 @@
<goal name="avalon:build-main" description="Build Merlin.">
<maven:reactor basedir="${basedir}"
- includes="extension/**/project.xml,activation/**/project.xml,composition/**/project.xml,kernel/api/project.xml,kernel/impl/project.xml"
+ includes="extension/**/project.xml,composition/**/project.xml,activation/**/project.xml,kernel/api/project.xml,kernel/impl/project.xml,facilities/**/project.xml"
banner="Installing:"
goals="jar:install"
ignoreFailures="false"
@@ -152,6 +152,37 @@
toDir="${maven.build.dir}/merlin/plugins"/>
</goal>
+ <goal name="avalon:build-facilities" description="Build Facilities.">
+ <maven:reactor basedir="${basedir}"
+ includes="facilities/**/project.xml"
+ excludes="facilities/*/project.xml"
+ banner="Installing:"
+ goals=""
+ ignoreFailures="false"
+ postProcessing="true" />
+
+ <j:forEach var="child" items="${reactorProjects}">
+ <ant:copy todir="${maven.build.dir}/merlin/system/${child.groupId}/${child.type}s"
+ preserveLastModified="true">
+ <ant:fileset dir="${child.file.parentFile}/target">
+ <ant:include
+ name="${child.artifactId}-${child.currentVersion}.${child.type}"/>
+ <ant:include
+ name="${child.artifactId}-${child.currentVersion}.${child.type}.meta"/>
+ </ant:fileset>
+ </ant:copy>
+ <j:set var="deps" value="${child.dependencies}"/>
+ <j:forEach var="dep" items="${deps}">
+ <ant:copy todir="${maven.build.dir}/merlin/system"
+ preserveLastModified="true">
+ <ant:fileset dir="${maven.repo.local}">
+ <ant:include name="${dep.getArtifactDirectory()}/${dep.getType()}s/${dep.getArtifact()}"/>
+ </ant:fileset>
+ </ant:copy>
+ </j:forEach>
+ </j:forEach>
+ </goal>
+
<!--
==============================================================================
@@ -164,32 +195,6 @@
<goal name="avalon:xinstall">
- <!-- prepare structure -->
-
- <!-- import bootstrap jar -->
- <!--
- <ant:mkdir dir="${merlin.build.inst.dir}"/>
- <ant:mkdir dir="${merlin.build.inst.dir}/bin/lib"/>
- <ant:copy
- file="${basedir}/kernel/cli/target/${merlin.cli.jar}"
- toDir="${merlin.build.inst.dir}/bin/lib"/>
- -->
- <!-- import subproject jar files -->
- <!--<maven:reactor
- basedir="${basedir}"
- includes="platform.xml"
- goals="ximport"
- banner="Resolving dependencies:"
- ignoreFailures="false"/>-->
-
- <!--
- <ant:copy toDir="${maven.build.dir}/merlin/plugins">
- <fileset dir="${basedir}/kernel/plugin/target">
- <include name="${merlin.plugin.jar}"/>
- </fileset>
- </ant:copy>
- -->
-
<!-- add supporting resources -->
<ant:copy toDir="${merlin.build.inst.dir}">
<fileset dir="${basedir}">
@@ -201,8 +206,6 @@
<filter token="VERSION" value="${pom.currentVersion}"/>
</filterset>
</ant:copy>
-
- <!-- add supporting resources -->
<ant:copy toDir="${merlin.build.inst.dir}">
<fileset dir="${basedir}/platform/src">
<include name="bin/**/*"/>
@@ -219,7 +222,6 @@
<filter token="MERLIN_CLI_VERSION" value="${merlin.cli.version}"/>
</filterset>
</ant:copy>
-
<ant:copy toDir="${merlin.build.inst.dir}">
<fileset dir="${basedir}/platform/src">
<include name="config/**/*"/>
@@ -232,7 +234,6 @@
<include name="LICENSE.txt"/>
</fileset>
</ant:copy>
-
<ant:chmod file="${merlin.build.inst.dir}/bin/merlin" perm="u=rwx,go=rx"/>
<ant:chmod file="${merlin.build.inst.dir}/bin/merlinx" perm="u=rwx,go=rx"/>
<ant:chmod file="${merlin.build.inst.dir}/bin/internal-cygwin.sh" perm="u=rwx,go=rx"/>
@@ -263,7 +264,6 @@
<include name="merlinx.sh"/>
<include name="merlin-server.sh"/>
</ant:fixcrlf>
-
</goal>
<!--
@@ -334,13 +334,8 @@
-->
<goal name="avalon:site"
- description="Build the Merlin site" prereqs="license,xjavadoc,site">
- <!--<maven:reactor basedir="${basedir}"
- includes="platform.xml"
- goals="site"
- banner="Building site:"
- ignoreFailures="false"/>-->
- </goal>
+ description="Build the Merlin site"
+ prereqs="license,xjavadoc,site"/>
<!--
==============================================================================
@@ -379,7 +374,7 @@
<goal name="xjavadoc">
<maven:reactor basedir="${basedir}"
- includes="activation/**/project.xml,composition/**/project.xml,extension/**/project.xml,kernel/**/project.xml"
+ includes="activation/**/project.xml,composition/**/project.xml,extension/**/project.xml,kernel/**/project.xml,facilities/**/project.xml"
excludes="**/target/**"
banner="Site Prep:"
ignoreFailures="false"
@@ -509,7 +504,7 @@
<maven:reactor
basedir="${basedir}"
includes="**/project.xml"
- excludes="project.xml,merlin-extensions/**,**/target/project.xml,platform/**"
+ excludes="project.xml,**/target/project.xml,platform/**"
goals="clean:clean"
banner="Cleaning subproject:"
ignoreFailures="true"/>
1.1 avalon/merlin/facilities/http/.cvsignore
Index: .cvsignore
===================================================================
*.log
build.properties
repository
.classpath
.project
target
1.1 avalon/merlin/facilities/http/maven.xml
Index: maven.xml
===================================================================
<project default="avalon:build" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:util="jelly:util" xmlns:ant="jelly:ant">
<goal name="avalon:clean" prereqs="clean">
<maven:reactor
basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml,target/**"
goals="clean"
banner="Cleaning:"
ignoreFailures="true"/>
</goal>
<goal name="avalon:build">
<maven:reactor basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml,target/**"
goals=""
banner="Building:"
ignoreFailures="false"
postProcessing="true" />
<ant:copy todir="${maven.build.dir}">
<j:forEach var="child" items="${reactorProjects}">
<ant:fileset dir="${child.file.parentFile}/target">
<ant:include name="${child.artifactId}-${child.currentVersion}.jar"/>
</ant:fileset>
</j:forEach>
</ant:copy>
</goal>
<goal name="avalon:site" prereqs="avalon:build,xjavadoc,site"/>
<goal name="xjavadoc">
<maven:reactor basedir="${basedir}"
includes="*/project.xml"
excludes="project.xml"
banner="Site Prep:"
ignoreFailures="false"
postProcessing="true" />
<ant:mkdir dir="${maven.build.dir}/docs/api" />
<ant:property name="copyright"
value="Copyright &copy; ${year} ${pom.organization.name}. All Rights Reserved." />
<ant:path id="template.classpath">
<j:forEach var="child" items="${reactorProjects}">
<j:set var="deps" value="${child.dependencies}"/>
<j:forEach var="dep" items="${deps}">
<ant:pathelement
path="${maven.repo.local}/${dep.getArtifactDirectory()}/jars/${dep.getArtifact()}"/>
</j:forEach>
</j:forEach>
</ant:path>
<util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize>
<ant:property name="title" value="${pom.name} ${pom.currentVersion}"/>
<ant:javadoc destdir="${maven.build.dir}/docs/api"
doctitle="<h1>${title}</h1>"
noindex="false" author="true" use="true"
windowtitle="${title}"
bottom="${copyright}"
additionalparam="-breakiterator -J-Xmx128m "
packagenames="*,org.*">
<j:forEach var="packageGroup" items="${pom.packageGroups}">
<group title="${packageGroup.title}" packages="${packageGroup.packages}"/>
</j:forEach>
<j:forEach var="child" items="${reactorProjects}">
<sourcepath path="${child.file.parentFile}/src/java"/>
</j:forEach>
<j:forEach var="link" items="${links}">
<ant:link href="${link.trim()}"/>
</j:forEach>
<classpath>
<path refid="template.classpath"/>
</classpath>
<link href="http://java.sun.com/j2se/1.4.2/docs/api/" />
<!-- allow custom tags -->
<util:tokenize var="listOfTags" delim=" ">${maven.javadoc.customtags}</util:tokenize>
<j:forEach var="someTag" items="${listOfTags}">
<j:set var="nameVar" value="${someTag}.name"/>
<j:set var="name" value="${context.findVariable(nameVar)}"/>
<j:set var="descriptionVar" value="${someTag}.description"/>
<j:set var="description" value="${context.findVariable(descriptionVar)}"/>
<j:set var="enabledVar" value="${someTag}.enabled"/>
<j:set var="enabled" value="${context.findVariable(enabledVar)}"/>
<j:set var="scopeVar" value="${someTag}.scope"/>
<j:set var="scope" value="${context.findVariable(scopeVar)}"/>
<ant:tag name="${name}" description="${description}"
enabled="${enabled}" scope="${scope}"/>
</j:forEach>
</ant:javadoc>
</goal>
<goal name="template">
<ant:delete dir="${maven.build.dir}/template" />
<ant:mkdir dir="${maven.build.dir}/template" />
<ant:copy todir="${maven.build.dir}/template">
<ant:fileset dir=".">
<ant:include name="LICENSE*"/>
<ant:include name="project.properties"/>
<ant:include name="maven.xml"/>
<ant:include name="project.xml"/>
<ant:include name="master.xml"/>
</ant:fileset>
</ant:copy>
<ant:copy todir="${maven.build.dir}/template">
<ant:fileset dir="${basedir}">
<include name="api/**"/>
<include name="impl/**"/>
<include name="xdocs/**"/>
<exclude name="**/target/**"/>
<exclude name="**/*.log"/>
</ant:fileset>
</ant:copy>
</goal>
</project>
1.1 avalon/merlin/facilities/http/project.properties
Index: project.properties
===================================================================
#
# custom tags spec
#
maven.javadoc.customtags = component service
component.name = avalon.component
component.description = Component:
component.enabled = true
component.scope = class
service.name = avalon.service
service.description = Service Export:
service.enabled = true
service.scope = class
1.1 avalon/merlin/facilities/http/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../../project.xml</extend>
<groupId>avalon-http</groupId>
<name>Avalon HTTP</name>
<currentVersion>1.0</currentVersion>
<shortDescription>Avalon HTTP Project Template.</shortDescription>
<packageGroups>
<packageGroup>
<title>Avalon HTTP API</title>
<packages>org.apache.avalon.http</packages>
</packageGroup>
<packageGroup>
<title>Avalon HTTP Implementation</title>
<packages>org.apache.avalon.http.*</packages>
</packageGroup>
</packageGroups>
<build>
<nagEmailAddress>dev@avalon.apache.org</nagEmailAddress>
<sourceDirectory>${basedir}/src/java</sourceDirectory>
<unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
<unitTest>
<includes>
<include>**/*TestCase.*</include>
</includes>
<excludes>
<exclude>**/Abstract*.*</exclude>
</excludes>
<resources>
<resource>
<directory>${basedir}/src/test</directory>
<includes>
<include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.x*</include>
</includes>
</resource>
</resources>
</unitTest>
<resources>
<resource>
<directory>${basedir}/src/java</directory>
<includes>
<include>**/*.dtd</include>
<include>**/*.properties</include>
<include>**/*.x*</include>
</includes>
</resource>
<resource>
<directory>${basedir}/conf</directory>
<targetPath>BLOCK-INF</targetPath>
<includes>
<include>block.xml</include>
</includes>
</resource>
</resources>
<jars></jars>
</build>
</project>
1.1 avalon/merlin/facilities/http/api/.cvsignore
Index: .cvsignore
===================================================================
*.log
build.properties
repository
.classpath
.project
target
1.1 avalon/merlin/facilities/http/api/maven.xml
Index: maven.xml
===================================================================
<project default="jar:install"/>
1.1 avalon/merlin/facilities/http/api/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>avalon-http-api</id>
<name>Avalon HTTP API</name>
<package>org.apache.avalon.http</package>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<shortDescription>Avalon HTTP Server API</shortDescription>
</project>
1.1 avalon/merlin/facilities/http/api/src/java/org/apache/avalon/http/HttpService.java
Index: HttpService.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.http;
/**
* Defintion of the HttpService service contract.
*/
public interface HttpService
{
}
1.1 avalon/merlin/facilities/http/api/src/java/org/apache/avalon/http/package.html
Index: package.html
===================================================================
<body>
<p>
The <code>template/api</code> package contains an
service defintion class that will normally be
replaced by a real service defintion.
</p>
</body>
1.1 avalon/merlin/facilities/http/conf/kernel.xml
Index: kernel.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<kernel>
<logging priority="INFO" name="kernel">
<category name="/logger" priority="WARN"/>
</logging>
<repository>
<hosts>
<host path="http://dpml.net/"/>
<host path="http://ibiblio.org/maven/"/>
</hosts>
</repository>
<facilities>
<classloader>
<classpath>
<repository>
<resource id="servletapi:servletapi" version="2.3"/>
<resource id="jetty:org.mortbay.jetty" version="4.2.15"/>
<resource id="avalon-http:avalon-http-api" version="1.0-SNAPSHOT"/>
<resource id="avalon-http:avalon-http-impl" version="1.0-SNAPSHOT"/>
<resource id="avalon-http:avalon-http-listener" version="1.0-SNAPSHOT"/>
<resource id="xerces:xerces" version="2.4.0"/>
</repository>
</classpath>
</classloader>
<component name="http"
class="org.apache.avalon.http.impl.DefaultServer"
activation="startup">
<categories priority="INFO"/>
</component>
<component name="http-listener"
class="org.apache.avalon.http.listener.DefaultHTTPModelListener"
activation="startup">
<categories priority="INFO"/>
</component>
</facilities>
</kernel>
1.1 avalon/merlin/facilities/http/conf/test.block
Index: test.block
===================================================================
<!-- definition of an embedded block -->
<container name="demo">
<classloader>
<classpath>
<repository>
<resource id="merlin/tutorial:hello" version="1.1"/>
</repository>
</classpath>
</classloader>
<component name="hello" class="tutorial.HelloComponent"/>
</container>
1.1 avalon/merlin/facilities/http/impl/.cvsignore
Index: .cvsignore
===================================================================
*.log
build.properties
repository
.classpath
.project
target
1.1 avalon/merlin/facilities/http/impl/maven.xml
Index: maven.xml
===================================================================
<project default="jar:install">
<preGoal name="java:compile">
<attainGoal name="avalon:meta"/>
</preGoal>
</project>
1.1 avalon/merlin/facilities/http/impl/merlin.properties
Index: merlin.properties
===================================================================
#
# General properties referenced by merlin plugin
# goals and the merlin unit test.
#
merlin.info = false
merlin.debug = false
1.1 avalon/merlin/facilities/http/impl/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>avalon-http-impl</id>
<name>Avalon HTTP Implementation</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<shortDescription>Avalon HTTP Implementation</shortDescription>
<package>org.apache.avalon.http.impl</package>
<dependencies>
<dependency>
<groupId>avalon-http</groupId>
<artifactId>avalon-http-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<id>excalibur-configuration</id>
<version>1.1</version>
</dependency>
<dependency>
<groupId>jetty</groupId>
<artifactId>org.mortbay.jetty</artifactId>
<version>4.2.15</version>
</dependency>
<dependency>
<groupId>servletapi</groupId>
<artifactId>servletapi</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-unit</artifactId>
<version>3.2.8</version>
</dependency>
</dependencies>
</project>
1.1 avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/AvalonLogSink.java
Index: AvalonLogSink.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.http.impl;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.mortbay.util.Frame;
import org.mortbay.util.Log;
import org.mortbay.util.LogSink;
/**
* Jetty Log redirection to the Avalon framework logging channel.
* @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
* @version 1.0
*/
public class AvalonLogSink extends AbstractLogEnabled implements LogSink
{
/**
* Stop the logging channel. This implementation does nothing
* as avalon channels cannot be started or stopped.
* @throws InterruptedException
*/
public void stop() throws InterruptedException
{
}
/**
* Returns the started state of the loging channel. The
* implementation always returns TRUE.
* @return the started state of the channel
*/
public boolean isStarted()
{
return true;
}
/**
* Set a loging option. Not implemented.
* @param s the options
*/
public void setOptions( String s )
{
}
/**
* Get a logging channel option. Not implemented.
* @return an zero length string
*/
public String getOptions()
{
return "";
}
/**
* Log a message to the channel.
* @param type the type of message
* @param message the message
* @param frame the frame
* @param time the time
*/
public void log( String type, Object message, Frame frame, long time )
{
if( type.equals( Log.DEBUG ) )
{
if( getLogger().isDebugEnabled() )
{
getLogger().debug(
message
+ "\n\ttime: " + time
+ "\n\tframe: " + frame );
}
}
else if( type.equals( Log.FAIL ) )
{
if( getLogger().isErrorEnabled() )
{
getLogger().error(
message
+ "\n\ttime: " + time
+ "\n\tframe: " + frame );
}
}
else if( type.equals( Log.WARN ) )
{
if( getLogger().isWarnEnabled() )
{
getLogger().warn(
message
+ "\n\ttime: " + time
+ "\n\tframe: " + frame );
}
}
else
{
if( getLogger().isInfoEnabled() )
{
getLogger().info( "" + message );
}
}
}
/**
* Log a message to the logging channel.
* @param message the message to log
*/
public void log( String message )
{
getLogger().info( message );
}
/**
* Start the logging channel.
* The default implementation does nothing.
* @throws Exception
*/
public void start() throws Exception
{
}
}
1.1 avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/DefaultServer.java
Index: DefaultServer.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.http.impl;
import java.io.File;
import java.net.UnknownHostException;
import org.apache.avalon.framework.CascadingRuntimeException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.framework.activity.Startable;
import org.apache.excalibur.configuration.ConfigurationUtil;
import org.apache.avalon.http.HttpService;
import org.mortbay.http.HttpServer;
import org.mortbay.http.SocketListener;
import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpListener;
import org.mortbay.http.handler.ResourceHandler;
import org.mortbay.http.SunJsseListener;
import org.mortbay.http.ajp.AJP13Listener;
import org.mortbay.util.Log;
/**
* This is a sample service implementation that will be included
* within the template-impl deliverable.
*
* @avalon.component name="server" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.http.HttpService"
* @author <a href="mailto:exterminatorx@comcast.net">Timothy Bennett</a>
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
*/
public class DefaultServer implements LogEnabled, Contextualizable, Configurable,
Initializable, Startable, HttpService
{
//---------------------------------------------------------
// static
//---------------------------------------------------------
private static final String LISTENER_TYPE_ATTRIBUTE_NAME = "type";
private static final String PORT_ATTRIBUTE_NAME = "port";
private static final String HOST_ATTRIBUTE_NAME = "host";
private static final String TIMEOUT_ATTRIBUTE_NAME = "timeout";
private static final String PATH_ATTRIBUTE_NAME = "path";
private static final String BASE_ATTRIBUTE_NAME = "dir";
private static final String KEYSTORE_ELEMENT_NAME = "keystore";
private static final String FILE_ELEMENT_NAME = "file";
private static final String PASSWORD_ELEMENT_NAME = "password";
private static final String KEYPASSWORD_ELEMENT_NAME = "key-password";
private static final String SOCKET_TYPE = "socket";
private static final String JSSE_TYPE = "jsse";
private static final String AJP_TYPE = "ajp";
//---------------------------------------------------------
// state
//---------------------------------------------------------
/**
* The logging channel assigned by the container.
*/
private Logger m_logger;
/**
* The supplied server configuration.
*/
private Configuration m_config;
/**
* The http server.
*/
private HttpServer m_server = new HttpServer();
/**
* The working base directory.
*/
private File m_basedir;
//---------------------------------------------------------
// LogEnabled
//---------------------------------------------------------
/**
* Handle the assignment of a logging channel by the
* container (this could be simplified if this class extended
* the AbstractLogEnabled class).
*
* @param logger the logging channel
*/
public void enableLogging( Logger logger )
{
m_logger = logger;
}
//---------------------------------------------------------
// Contextualizable
//---------------------------------------------------------
/**
* Contextualization of the server by the container.
* @param config the supplied server context
* @exception ContextException if a contextualization error occurs
* @avalon.entry key="urn:composition:dir" type="java.io.File"
*/
public void contextualize( Context context ) throws ContextException
{
m_basedir = getBaseDirectory( context );
}
//---------------------------------------------------------
// Configurable
//---------------------------------------------------------
/**
* Configuration of the server by the container.
* @param config the supplied server configuration
* @exception ConfigurationException if a configuration error occurs
*/
public void configure( Configuration config ) throws ConfigurationException
{
m_config = config;
}
//---------------------------------------------------------
// Initializable
//---------------------------------------------------------
/**
* Initialization of the component by the container.
*/
public void initialize() throws Exception
{
if( m_logger.isInfoEnabled() )
{
m_logger.debug( "initialization" );
}
//
// map the jetty logging channel to the avalon logger
//
AvalonLogSink sink = new AvalonLogSink();
sink.enableLogging( m_logger );
Log.instance().add( sink );
//
// if no listeners are declared create a default
// socket listener on port 8080
//
if( null == m_config.getChild( "listener", false ))
{
SocketListener listener = new SocketListener();
listener.setPort( 8080 );
m_server.addListener( listener );
}
//
// if no context entries are declared then create
// a default context for the path "/" using static
// content under the directory "root"
//
if( null == m_config.getChild( "context", false ))
{
HttpContext context = createContext( "/", "./root/" );
m_server.addContext( context );
}
//
// handle the children declared in the configuration
// (includes listeners, context, etc.)
//
Configuration[] children = m_config.getChildren();
for( int i=0; i<children.length; i++ )
{
Configuration child = children[i];
String name = child.getName();
if( name.equalsIgnoreCase( "listener" ) )
{
HttpListener listener = createListener( child );
m_server.addListener( listener );
}
else if( name.equalsIgnoreCase( "context" ) )
{
HttpContext context = createContext( child );
m_server.addContext( context );
}
else
{
final String error =
"Http server configuration contains an unrecognized element: ["
+ name + "]\n"
+ ConfigurationUtil.list( child );
throw new ConfigurationException( error );
}
}
}
//---------------------------------------------------------
// Startable
//---------------------------------------------------------
/**
* Start the server.
*/
public void start() throws Exception
{
m_server.start();
}
/**
* Stop the server.
*/
public void stop() throws Exception
{
m_server.stop();
}
//---------------------------------------------------------
// HttpServer
//---------------------------------------------------------
//---------------------------------------------------------
// implementation
//---------------------------------------------------------
/**
* Create a context defined in the component configuration.
* @param conf the context configuration
*/
private HttpContext createContext( Configuration child )
throws Exception
{
HttpContext context = new HttpContext();
String path = child.getAttribute( PATH_ATTRIBUTE_NAME, "/*" );
String base = child.getAttribute( BASE_ATTRIBUTE_NAME, null );
return createContext( path, base );
}
/**
* Create a context using the supplied parameters.
* @param conf the context configuration
*/
private HttpContext createContext( String path, String base )
throws Exception
{
HttpContext context = new HttpContext();
context.setContextPath( path );
String dir = getDerivedPath( base );
context.setResourceBase( dir );
context.addHandler( new ResourceHandler() );
return context;
}
/**
* Add a listener defined in the component configuration.
* @param conf the listener configuration
*/
private HttpListener createListener( Configuration conf )
throws Exception
{
HttpListener listener = null;
String listenerType =
conf.getAttribute(
LISTENER_TYPE_ATTRIBUTE_NAME,
SOCKET_TYPE );
if( listenerType.equals( AJP_TYPE ) )
{
listener = createAJP13Listener( conf, 2345 );
}
else if( listenerType.equals( JSSE_TYPE ) )
{
listener = createSunJsseListener( conf, 8443 );
}
else if( listenerType.equals( SOCKET_TYPE ) )
{
listener = createSocketListener( conf, 8080 );
}
else
{
final String error =
"Unrecognized listener type [" + listenerType + "].";
throw new IllegalArgumentException( error );
}
return listener;
}
/**
* Creates a new AJP13 Listener
* @param config an AJP13 listener configuration
* @param port the default port
*/
private HttpListener createAJP13Listener( Configuration config, int port )
throws UnknownHostException
{
AJP13Listener listener = new AJP13Listener();
listener.setMaxIdleTimeMs(
config.getAttributeAsInteger(
TIMEOUT_ATTRIBUTE_NAME,
60000 ));
return setUpListener( listener, config, port );
}
/**
* Creates a new socket listener
* @param config an socket listener configuration
*/
private HttpListener createSocketListener( Configuration config, int port )
throws UnknownHostException
{
SocketListener listener = new SocketListener();
listener.setMaxIdleTimeMs(
config.getAttributeAsInteger(
TIMEOUT_ATTRIBUTE_NAME,
60000 ));
return setUpListener( listener, config, port );
}
/**
* Creates a default sun jsse listener.
* @param configuration
* @return The newly created sun jsse listener
* @throws Exception
*/
private HttpListener createSunJsseListener( Configuration configuration, int port )
throws Exception
{
SunJsseListener listener = new SunJsseListener();
listener.setMaxIdleTimeMs(
configuration.getAttributeAsInteger(
TIMEOUT_ATTRIBUTE_NAME,
60000 ));
Configuration ksconfig =
configuration.getChild(
KEYSTORE_ELEMENT_NAME );
String fileName =
ksconfig.getChild(
FILE_ELEMENT_NAME ).getValue( "conf/.keystore" );
File configuredFile = new File( fileName );
if( !configuredFile.isAbsolute() )
{
listener.setKeystore(
new File( m_basedir, fileName ).getAbsolutePath() );
}
else
{
listener.setKeystore(
configuredFile.getAbsolutePath() );
}
listener.setPassword(
ksconfig.getChild(
PASSWORD_ELEMENT_NAME ).getValue( null ) );
listener.setKeyPassword(
ksconfig.getChild(
KEYPASSWORD_ELEMENT_NAME ).getValue( null ) );
return setUpListener( listener, configuration, port );
}
private HttpListener setUpListener(
HttpListener listener, Configuration config, int port )
throws UnknownHostException
{
listener.setPort(
config.getAttributeAsInteger(
PORT_ATTRIBUTE_NAME,
port ) );
listener.setHost(
config.getAttribute(
HOST_ATTRIBUTE_NAME,
"0.0.0.0" ) );
return listener;
}
private String getDerivedPath( final String path )
{
if( null == path )
{
return m_basedir.toString();
}
else
{
return new File( m_basedir, path ).toString();
}
}
private File getBaseDirectory( Context context ) throws ContextException
{
return (File) context.get( "urn:composition:dir" );
}
}
1.1 avalon/merlin/facilities/http/impl/src/java/org/apache/avalon/http/impl/package.html
Index: package.html
===================================================================
<body>
<p>
The <code>template/impl</code> package contains an
component implementation class that will normally be
replaced by a real component implementation.
</p>
</body>
1.1 avalon/merlin/facilities/http/listener/.cvsignore
Index: .cvsignore
===================================================================
*.log
build.properties
repository
.classpath
.project
target
1.1 avalon/merlin/facilities/http/listener/maven.xml
Index: maven.xml
===================================================================
<project default="jar:install">
<preGoal name="java:compile">
<attainGoal name="avalon:meta"/>
</preGoal>
</project>
1.1 avalon/merlin/facilities/http/listener/merlin.properties
Index: merlin.properties
===================================================================
#
# General properties referenced by merlin plugin
# goals and the merlin unit test.
#
merlin.info = false
merlin.debug = false
1.1 avalon/merlin/facilities/http/listener/project.xml
Index: project.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<project>
<extend>${basedir}/../project.xml</extend>
<id>avalon-http-listener</id>
<name>Avalon HTTP Model Listener</name>
<currentVersion>1.0-SNAPSHOT</currentVersion>
<shortDescription>Avalon HTTP Model Listener</shortDescription>
<package>org.apache.avalon.http.listener</package>
<dependencies>
<dependency>
<groupId>avalon-http</groupId>
<artifactId>avalon-http-api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-http</groupId>
<artifactId>avalon-http-impl</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>avalon-framework</groupId>
<artifactId>avalon-framework-api</artifactId>
<version>4.1.5</version>
</dependency>
<dependency>
<groupId>avalon-meta</groupId>
<artifactId>avalon-meta-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>avalon-extension</groupId>
<artifactId>avalon-extension-spi</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>avalon-composition</groupId>
<artifactId>avalon-composition-api</artifactId>
<version>2.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>merlin</groupId>
<artifactId>merlin-unit</artifactId>
<version>3.3-SNAPSHOT</version>
</dependency>
</dependencies>
</project>
1.1 avalon/merlin/facilities/http/listener/src/java/org/apache/avalon/http/listener/DefaultHTTPModelListener.java
Index: DefaultHTTPModelListener.java
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Jakarta", "Apache Avalon", "Avalon Framework" and
"Apache Software Foundation" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact apache@apache.org.
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This software consists of voluntary contributions made by many individuals
on behalf of the Apache Software Foundation. For more information on the
Apache Software Foundation, please see <http://www.apache.org/>.
*/
package org.apache.avalon.http.listener;
import org.apache.avalon.composition.event.CompositionEvent;
import org.apache.avalon.composition.event.CompositionEventListener;
import org.apache.avalon.composition.model.ContainmentModel;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.activity.Initializable;
import org.apache.avalon.http.HttpService;
/**
* DefaultHTTPModelListener listens to application model events
* and registeres itself as a factory relative to servlet
* components.
*
* @avalon.component name="listener" lifestyle="singleton"
* @avalon.service type="org.apache.avalon.composition.event.CompositionEventListener"
* @author <a href="mailto:mcconnell@apache.org">Stephen McConnell</a>
*/
public class DefaultHTTPModelListener extends AbstractLogEnabled
implements Contextualizable, Serviceable, Initializable,
CompositionEventListener
{
//---------------------------------------------------------
// state
//---------------------------------------------------------
/**
* The http server supplied during the serviceable
* lifecycle phase.
*/
private HttpService m_server;
/**
* The root application model supplied during the
* contextualization phase.
*/
private ContainmentModel m_model;
//---------------------------------------------------------
// Contextualizable
//---------------------------------------------------------
/**
* Contextulaization of the listener by the container during
* which we are supplied with the root composition model for
* the application.
*
* @param context the supplied listener context
* @avalon.entry key="urn:composition:application"
* type="org.apache.avalon.composition.model.ContainmentModel"
* @exception ContextException if a contextualization error occurs
*/
public void contextualize( Context context ) throws ContextException
{
m_model = (ContainmentModel) context.get( "urn:composition:application" );
}
//---------------------------------------------------------
// Serviceable
//---------------------------------------------------------
/**
* Assignment of dependent services by the container during which
* we resolve the HTTP service used to register servlets.
*
* @param manager the supplied service manager
* @avalon.dependency type="org.apache.avalon.http.HttpService" key="http"
* @exception ServiceException if an error is service assignment occurs
*/
public void service( ServiceManager manager ) throws ServiceException
{
m_server = (HttpService) manager.lookup( "http" );
}
//---------------------------------------------------------
// Initializable
//---------------------------------------------------------
/**
* Initialization of the component by the container.
*/
public void initialize() throws Exception
{
if( getLogger().isInfoEnabled() )
{
getLogger().debug(
"registering listener: " + m_model );
}
m_model.addCompositionListener( this );
}
//---------------------------------------------------------
// CompositionEventListener
//---------------------------------------------------------
/**
* Model addition.
*/
public void modelAdded( CompositionEvent event )
{
System.out.println( "# model added: " + event );
}
/**
* Model addition.
*/
public void modelRemoved( CompositionEvent event )
{
System.out.println( "# model removed: " + event );
}
}
1.1 avalon/merlin/facilities/http/listener/src/java/org/apache/avalon/http/listener/package.html
Index: package.html
===================================================================
<body>
<p>
The <code>template/impl</code> package contains an
component implementation class that will normally be
replaced by a real component implementation.
</p>
</body>
1.1 avalon/merlin/facilities/http/root/README.TXT
Index: README.TXT
===================================================================
The HTTP package contains a model listener and dependent
web server. The model listener is registered as a listener
to the root application model. The listeners has dependency
on a web server with is deployed as an internal container
facility.
$ cd http
$ merlin -kernel file:conf/kernel.xml
1.1 avalon/merlin/facilities/jmx/README.TXT
Index: README.TXT
===================================================================
Placeholder for an internal JMX listener and server adapter.
1.1 avalon/merlin/facilities/logging/README.TXT
Index: README.TXT
===================================================================
Placeholder for a pluggable logging manager.
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org