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 2003/04/04 14:07:02 UTC
cvs commit: avalon-sandbox/merlin/merlin-smp/src/tutorial/003/src/java/tutorial HelloComponent.java HelloComponent.xinfo
mcconnell 2003/04/04 04:07:02
Added: merlin/merlin-smp/src/tutorial/003 .cvsignore build.xml
merlin/merlin-smp/src/tutorial/003/src/config block.xml
merlin/merlin-smp/src/tutorial/003/src/java/tutorial
HelloComponent.java HelloComponent.xinfo
Log:
Tutorial content for lesson 003.
Revision Changes Path
1.1 avalon-sandbox/merlin/merlin-smp/src/tutorial/003/.cvsignore
Index: .cvsignore
===================================================================
build
logs
tutorial.jar
1.1 avalon-sandbox/merlin/merlin-smp/src/tutorial/003/build.xml
Index: build.xml
===================================================================
<!--
Test application
-->
<project name="tutorial" default="jar" basedir=".">
<property name="src.dir" value="${basedir}/src" />
<property name="java.dir" value="${src.dir}/java" />
<property name="build.dir" value="${basedir}/build" />
<property name="classes.dir" value="${build.dir}/classes" />
<property name="config.dir" value="${src.dir}/config" />
<property environment="env"/>
<property name="merlin.home" value="${env.MERLIN_HOME}"/>
<property name="framework.jar"
value="${merlin.home}/lib/shared/avalon-framework-4.1.4.jar" />
<path id="project.class.path">
<pathelement path="${java.class.path}" />
<pathelement location="${framework.jar}"/>
<fileset dir="${classes.dir}"/>
</path>
<target name="compile" >
<mkdir dir="${classes.dir}" />
<copy toDir="${classes.dir}">
<fileset dir="${java.dir}">
<include name="**/*.xinfo"/>
</fileset>
</copy>
<mkdir dir="${classes.dir}/BLOCK-INF" />
<copy toDir="${classes.dir}/BLOCK-INF">
<fileset dir="${config.dir}">
<include name="*.xml"/>
</fileset>
</copy>
<mkdir dir="${classes.dir}" />
<javac debug="on" destdir="${classes.dir}" >
<classpath>
<path refid="project.class.path"/>
</classpath>
<src path="${src.dir}" />
</javac>
</target>
<target name="jar" depends="compile">
<jar jarfile="tutorial.jar" basedir="${classes.dir}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
<delete file="tutorial.jar"/>
</target>
</project>
1.1 avalon-sandbox/merlin/merlin-smp/src/tutorial/003/src/config/block.xml
Index: block.xml
===================================================================
<block name="tutorial">
<container>
<component name="hello" class="tutorial.HelloComponent" activation="startup"/>
</container>
</block>
1.1 avalon-sandbox/merlin/merlin-smp/src/tutorial/003/src/java/tutorial/HelloComponent.java
Index: HelloComponent.java
===================================================================
package tutorial;
import java.io.File;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.context.Context;
import org.apache.avalon.framework.context.ContextException;
public class HelloComponent extends AbstractLogEnabled
implements Contextualizable
{
private File m_home = null;
private File m_temp = null;
private String m_name = "unknown";
private String m_partition = "unknown";
/**
* Contextualization of the component by the container.
* The context supplied by the container holds the
* Merlin standard context entries for the home and
* working directories, component name and partition.
*/
public void contextualize( Context context )
throws ContextException
{
m_home = (File) context.get( "urn:avalon:home" );
m_temp = (File) context.get( "urn:avalon:work" );
m_name = (String) context.get( "urn:avalon:name" );
m_partition = (String) context.get( "urn:avalon:partition" );
StringBuffer buffer = new StringBuffer( "standard context entries" );
buffer.append( "\n name: " + m_name );
buffer.append( "\n home: " + m_home );
buffer.append( "\n temp: " + m_temp );
buffer.append( "\n partition: " + m_partition );
getLogger().info( buffer.toString() );
}
}
1.1 avalon-sandbox/merlin/merlin-smp/src/tutorial/003/src/java/tutorial/HelloComponent.xinfo
Index: HelloComponent.xinfo
===================================================================
<?xml version="1.0"?>
<!DOCTYPE type
PUBLIC "-//AVALON/Type DTD Version 1.0//EN"
"http://avalon.apache.org/dtds/meta/type_1_1.dtd" >
<type>
<info>
<name>hello</name>
<version>1.0</version>
</info>
</type>
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org