avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/merlin-smp/src/tutorial/002/src/java/tutorial HelloComponent.java HelloComponent.xconfig HelloComponent.xinfo
Date Fri, 04 Apr 2003 12:03:09 GMT
mcconnell    2003/04/04 04:03:09

  Added:       merlin/merlin-smp/src/tutorial/002 .cvsignore build.xml
               merlin/merlin-smp/src/tutorial/002/src/config block.xml
                        config.xml
               merlin/merlin-smp/src/tutorial/002/src/java/tutorial
                        HelloComponent.java HelloComponent.xconfig
                        HelloComponent.xinfo
  Log:
  Tutorial content for lesson 002.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  build
  logs
  tutorial.jar
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/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="config.dir"  value="${src.dir}/config" />
    <property name="build.dir"  value="${basedir}/build" />
    <property name="classes.dir"  value="${build.dir}/classes" />
  
    <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"/>
          <include name="**/*.xconfig"/>
        </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/002/src/config/block.xml
  
  Index: block.xml
  ===================================================================
  
  <block name="tutorial">
     <container>
       <component name="hello" class="tutorial.HelloComponent" activation="startup">
         <configuration>
           <source>explicit configuration within block</source>
         </configuration>
       </component>
    </container>
  </block>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/src/config/config.xml
  
  Index: config.xml
  ===================================================================
  
  <configuration>
  </configuration>
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/src/java/tutorial/HelloComponent.java
  
  Index: HelloComponent.java
  ===================================================================
  
  package tutorial;
  
  import org.apache.avalon.framework.logger.AbstractLogEnabled;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  
  public class HelloComponent extends AbstractLogEnabled 
    implements Configurable, Initializable
  {
      private String m_source = "undefined";
  
     /**
      * Configuration of the component by the container.  The 
      * implementation get a child element named 'source' and 
      * assigns the value of the element to a local variable.
      *
      * @param config the component configuration
      * @exception ConfigurationException if a configuration error occurs
      */
      public void configure( Configuration config ) throws ConfigurationException
      {
          getLogger().info( "configuration stage" );
          m_source = config.getChild( "source" ).getValue( "unknown" );
      }
  
     /**
      * Initialization of the component by the container.
      * @exception Exception if an initialization error occurs
      */
      public void initialize() throws Exception
      {
          getLogger().info( "initialization stage" );
          final String message = 
            "source: " + m_source;
          getLogger().info( message );
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/src/java/tutorial/HelloComponent.xconfig
  
  Index: HelloComponent.xconfig
  ===================================================================
  <?xml version="1.0"?>
  
  <!--
  This is an example of a configuration packaged with a component
  type.  Configuration declarations of this kind are normally used
  to establish default configuration values required by an 
  implementation.  The Merlin container will use this information
  to construct a cascading configuration where this configuration
  is placed as the configuration of last resort.
  -->
  
  <configuration>
    <source>packaged default</source>
  </configuration>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/tutorial/002/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


Mime
View raw message