Author: mcconnell
Date: Fri Jul 2 07:31:12 2004
New Revision: 22477
Added:
avalon/trunk/planet/tutorials/simple-web/build.xml
avalon/trunk/planet/tutorials/simple-web/src/main/
- copied from rev 22276, avalon/trunk/planet/tutorials/simple-web/src/java/
Removed:
avalon/trunk/planet/tutorials/parameterization/copy-all.xsl
avalon/trunk/planet/tutorials/parameterization/index.ent
avalon/trunk/planet/tutorials/parameterization/merlin.properties
avalon/trunk/planet/tutorials/parameterization/project.xml
avalon/trunk/planet/tutorials/profiles/project.xml
avalon/trunk/planet/tutorials/simple-web/conf/
avalon/trunk/planet/tutorials/simple-web/maven.xml
avalon/trunk/planet/tutorials/simple-web/project.properties
avalon/trunk/planet/tutorials/simple-web/project.xml
avalon/trunk/planet/tutorials/simple-web/src/java/
Modified:
avalon/trunk/planet/cornerstone/index.xml
avalon/trunk/planet/tutorials/index.xml
avalon/trunk/planet/tutorials/parameterization/README.txt
avalon/trunk/planet/tutorials/simple-web/src/main/tutorial/SimpleWebServerComponent.java
Log:
Add the simple-web tutorial and the parameterization tutorial. Also made some updates to the web-server to make it parameterizable instead of configurable (we only need a port number). Converted the block to be automatically generated and got rid of related fluff.
Modified: avalon/trunk/planet/cornerstone/index.xml
==============================================================================
--- avalon/trunk/planet/cornerstone/index.xml (original)
+++ avalon/trunk/planet/cornerstone/index.xml Fri Jul 2 07:31:12 2004
@@ -172,6 +172,7 @@
</info>
<dependencies>
<include key="cornerstone-connection-api"/>
+ <include key="cornerstone-threads-impl"/>
<include key="avalon-framework-impl"/>
</dependencies>
<plugins>
@@ -227,7 +228,7 @@
</info>
<dependencies>
<include key="cornerstone-scheduler-api"/>
- <include key="cornerstone-threads-api"/>
+ <include key="cornerstone-threads-impl"/>
<include key="avalon-framework-impl"/>
</dependencies>
<plugins>
Modified: avalon/trunk/planet/tutorials/index.xml
==============================================================================
--- avalon/trunk/planet/tutorials/index.xml (original)
+++ avalon/trunk/planet/tutorials/index.xml Fri Jul 2 07:31:12 2004
@@ -5,6 +5,9 @@
<import index="../../runtime/index.xml"
href="http://svn.apache.org/repos/asf/avalon/trunk/runtime/index.xml"/>
+ <import index="../cornerstone/index.xml"
+ href="http://svn.apache.org/repos/asf/avalon/trunk/planet/cornerstone/index.xml"/>
+
<!--
Hello Tutorial.
-->
@@ -340,6 +343,46 @@
</info>
<dependencies>
<include key="avalon-framework-api"/>
+ </dependencies>
+ <plugins>
+ <include key="avalon-meta-tools"/>
+ </plugins>
+ </project>
+
+ <project basedir="profiles">
+ <info>
+ <group>avalon/tutorial</group>
+ <name>avalon-tutorial-profiles</name>
+ </info>
+ <dependencies>
+ <include key="avalon-framework-api"/>
+ </dependencies>
+ <plugins>
+ <include key="avalon-meta-tools"/>
+ </plugins>
+ </project>
+
+ <project basedir="selection">
+ <info>
+ <group>avalon/tutorial</group>
+ <name>avalon-tutorial-selection</name>
+ </info>
+ <dependencies>
+ <include key="avalon-framework-api"/>
+ </dependencies>
+ <plugins>
+ <include key="avalon-meta-tools"/>
+ </plugins>
+ </project>
+
+ <project basedir="simple-web">
+ <info>
+ <group>avalon/tutorial</group>
+ <name>avalon-tutorial-webserver</name>
+ </info>
+ <dependencies>
+ <include key="cornerstone-sockets-impl"/>
+ <include key="cornerstone-connection-impl"/>
</dependencies>
<plugins>
<include key="avalon-meta-tools"/>
Modified: avalon/trunk/planet/tutorials/parameterization/README.txt
==============================================================================
--- avalon/trunk/planet/tutorials/parameterization/README.txt (original)
+++ avalon/trunk/planet/tutorials/parameterization/README.txt Fri Jul 2 07:31:12 2004
@@ -10,25 +10,11 @@
Build the project using the following command:
-$ maven
-
-The above command triggers the default goal jar:jar which will
-create a jar file under the target directory named
-parameters-1.0.jar. The jar file contains a single
-component, generated .xinfo descriptor, and a bundled block.xml
-deployment descriptor.
+$ ant
Runtime
-------
-To see Merlin in action, execute Merlin and give it either the
-jar file of the target/classes directory as the deployment
-argument.
-
$ merlin target\classes -execute
-
-Or:
-
-$ merlin target\parameters-1.0.jar -execute
Added: avalon/trunk/planet/tutorials/simple-web/build.xml
==============================================================================
--- (empty file)
+++ avalon/trunk/planet/tutorials/simple-web/build.xml Fri Jul 2 07:31:12 2004
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<project name="avalon-tutorial-webserver" default="install" basedir="."
+ xmlns:x="antlib:org.apache.avalon.tools">
+
+ <property name="project.home" value=".."/>
+ <import file="${project.home}/standard.xml"/>
+
+ <target name="build" depends="standard.build">
+ <x:block name="my-web-server" embed="MAIN">
+ <x:component name="thread-manager"
+ class="org.apache.avalon.cornerstone.blocks.threads.DefaultThreadManager"
+ profile="default"/>
+ <x:component name="connection-manager"
+ class="org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager" />
+ <x:component name="connection-handler-factory"
+ class="tutorial.SimpleConnectionHandlerFactory" />
+ <x:component name="socket-manager"
+ class="org.apache.avalon.cornerstone.blocks.sockets.DefaultSocketManager"
+ profile="default"/>
+ <x:component name="simple-web-server"
+ class="tutorial.SimpleWebServerComponent">
+ <x:parameters>
+ <x:parameter name="port" value="9080"/>
+ </x:parameters>
+ </x:component>
+ </x:block>
+ </target>
+
+</project>
+
Modified: avalon/trunk/planet/tutorials/simple-web/src/main/tutorial/SimpleWebServerComponent.java
==============================================================================
--- avalon/trunk/planet/tutorials/simple-web/src/java/tutorial/SimpleWebServerComponent.java (original)
+++ avalon/trunk/planet/tutorials/simple-web/src/main/tutorial/SimpleWebServerComponent.java Fri Jul 2 07:31:12 2004
@@ -19,16 +19,15 @@
import java.net.ServerSocket;
-import org.apache.avalon.cornerstone.services.connection.
- ConnectionHandlerFactory;
+import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
import org.apache.avalon.cornerstone.services.sockets.ServerSocketFactory;
import org.apache.avalon.cornerstone.services.sockets.SocketManager;
import org.apache.avalon.framework.activity.Disposable;
import org.apache.avalon.framework.activity.Executable;
-import org.apache.avalon.framework.configuration.Configurable;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.parameters.Parameterizable;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.parameters.ParameterException;
import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceException;
@@ -42,10 +41,10 @@
*
* @author <a href="mailto:[email protected]">Avalon Development Team</a>
*
- * @avalon.component version="1.0" name="simple-web-server"
+ * @avalon.component version="1.0" name="simple-web-server" lifestyle="singleton"
*/
public class SimpleWebServerComponent
- implements LogEnabled, Serviceable, Configurable, Executable, Disposable {
+ implements LogEnabled, Serviceable, Parameterizable, Executable, Disposable {
/**
* Internal reference to the logging channel supplied by the container.
*/
@@ -76,8 +75,6 @@
* Supply of a logging channel by the container.
*
* @param logger the logging channel for this component
- *
- * @see org.apache.avalon.framework.logger.LogEnabled#enableLogging(org.apache.avalon.framework.logger.Logger)
*/
public void enableLogging(Logger logger) {
m_logger = logger;
@@ -106,26 +103,14 @@
}
/**
- * Configuration of the component by the container.
- *
- * TODO: Describe the configuration of the component.
- *
- * @param config the component configuration
+ * Parameterization of the component by the container.
+ * @param parameters the component parameters
* @throws ConfigurationException if a configuration error occurs
- *
- * @see org.apache.avalon.framework.configuration.Configurable#configure(org.apache.avalon.framework.configuration.Configuration)
*/
- public void configure(Configuration config) throws ConfigurationException {
- getLogger().info("Configuring...");
-
- // Add an HTTP socket listener?
- Configuration httpConfig = config.getChild("http-listener", true);
- if (httpConfig == null) {
- throw new ConfigurationException("port attribute not found!");
- }
- else {
- m_port = httpConfig.getAttributeAsInteger("port", 80);
- }
+ public void parameterize( Parameters params ) throws ParameterException
+ {
+ getLogger().info("Parameterizing...");
+ m_port = params.getParameterAsInteger( "port", 80 );
}
/**
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.