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/06 21:22:38 UTC

cvs commit: avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context navigation.xml

mcconnell    2003/04/06 12:22:38

  Modified:    merlin/merlin-smp/xdocs/starting navigation.xml
               merlin/merlin-smp/xdocs/starting/advanced navigation.xml
               merlin/merlin-smp/xdocs/starting/hello navigation.xml
               merlin/merlin-smp/xdocs/starting/hello/context
                        navigation.xml
  Added:       merlin/merlin-smp/src/examples/afs maven.xml project.xml
               merlin/merlin-smp/src/examples/afs/simple .cvsignore
                        build.xml project.xml
               merlin/merlin-smp/src/examples/afs/simple/conf block.xml
               merlin/merlin-smp/src/examples/afs/simple/src/etc
                        LICENSE.txt project.mf stylesheet.css
               merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank
                        Account.java Bank.java
                        InsufficientFundsException.java
                        NoSuchAccountException.java PolicyException.java
               merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl
                        Accounts.java BankProvider.java BankProvider.xinfo
                        DefaultAccount.java
               merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/bank
                        BankTestCase.java
  Log:
  Initial commit of the finacial service example.
  
  Revision  Changes    Path
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/maven.xml
  
  Index: maven.xml
  ===================================================================
  <project default="java:jar" xmlns:maven="jelly:maven" xmlns:j="jelly:core" xmlns:util="jelly:util">
  
    <property name="maven.checkstyle.format" value="avalon"/>
    <property name="pom.organization.identifier" value="ASF"/>
    <property name="pom.specificationVersion" value="1.0"/>
  
    <property name="maven.license.licenseFile" 
      value="${basedir}/src/etc/LICENSE.txt"/>
    <property name="maven.javadoc.stylesheet" 
      value="${basedir}/src/etc/stylesheet.css"/>
  
    <preGoal name="java:compile">
      <mkdir dir="${maven.build.dest}/BLOCK-INF" />
      <copy toDir="${maven.build.dest}/BLOCK-INF">
        <fileset dir="${maven.conf.dir}">
          <include name="block.xml"/>
        </fileset>
      </copy>
    </preGoal>
  
    <postGoal name="clean:clean">
      <delete dir="${basedir}/working"/>
      <delete dir="${basedir}/logs"/>
    </postGoal>
  
  </project>
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <pomVersion>3</pomVersion>
    <groupId>merlin</groupId>
    <id>merlin-afs</id>
    <name>Apache Financial Services</name>
    <currentVersion>1.0</currentVersion>
  
    <organization>
      <name>Apache Software Foundation</name>
      <url>http://avalon.apache.org/</url>
      <logo>http://avalon.apache.org/images/apache-avalon-logo.png</logo>
    </organization>
    <inceptionYear>2003</inceptionYear>
  
    <package></package>
    <gumpRepositoryId></gumpRepositoryId>
    
    <url>http://avalon.apache.org/sandbox/merlin/index.html</url>
    <issueTrackingUrl>http://nagoya.apache.org/</issueTrackingUrl>
    
    <siteAddress></siteAddress>
    <siteDirectory></siteDirectory>
    <distributionDirectory></distributionDirectory>
  
    
    <mailingLists>
      <mailingList>
        <name>Avalon Developer List</name>
        <subscribe>avalon-dev-subscribe@avalon.apache.org</subscribe>
        <unsubscribe>avalon-dev-unsubscribe@avalon.apache.org</unsubscribe>
        <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=dev@avalon.apache.org</archive>
      </mailingList>
      <mailingList>
        <name>Avalon User List</name>
        <subscribe>avalon-users-subscribe@avalon.apache.org</subscribe>
        <unsubscribe>avalon-users-unsubscribe@avalon.apache.org</unsubscribe>
        <archive>http://nagoya.apache.org/eyebrowse/SummarizeList?listName=users@avalon.apache.org</archive>
      </mailingList>
    </mailingLists>
  
    <developers>
      <developer>
        <name>Stephen McConnell</name>
        <id>mcconnell</id>
        <email>mcconnell@apache.org</email>
        <organization>OSM SARL</organization>
      </developer>
    </developers>
  
    <build>
  
      <nagEmailAddress>dev@avalon.apache.org</nagEmailAddress>
      <sourceDirectory>${basedir}/src/java</sourceDirectory>
      <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory>
      <integrationUnitTestSourceDirectory/>
      <aspectSourceDirectory/>
  
      <unitTest>
        <includes>
          <include>**/*TestCase*</include>
        </includes>
        <excludes>
        </excludes>
        <resources>
          <resource>
            <directory>${basedir}/src/test</directory>
            <includes> 
              <include>**/*.dtd</include>
              <include>**/*.properties</include>
              <include>**/*.xinfo</include>
              <include>**/*.xtype</include>
              <include>**/*.xprofile</include>
              <include>**/*.xconfig</include>
              <include>**/*.xml</include>
              <include>**/*.xservice</include>
            </includes>
          </resource>
        </resources>
      </unitTest>
  
      <integrationUnitTestPatterns></integrationUnitTestPatterns>
      
      <resources>
        <resource>
          <directory>${basedir}/src/java</directory>
          <includes>
            <include>**/*.dtd</include>
            <include>**/*.properties</include>
            <include>**/*.xinfo</include>
            <include>**/*.xtype</include>
            <include>**/*.xprofile</include>
            <include>**/*.xconfig</include>
            <include>**/*.xml</include>
            <include>**/*.xservice</include>
          </includes>
        </resource>
      </resources>
      
      <jars></jars>
    </build>
  
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/.cvsignore
  
  Index: .cvsignore
  ===================================================================
  build
  logs
  tutorial.jar
  working
  target
  maven.log
  bank.jar
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/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="${basedir}/conf" />
  
    <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="**/*.xprofile"/>
        </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="bank.jar" basedir="${classes.dir}"/>
    </target>
  
    <target name="clean">
      <delete dir="${build.dir}"/>
      <delete file="tutorial.jar"/>
      <delete dir="working"/>
      <delete dir="logs"/>
    </target>
  
   </project>
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/project.xml
  
  Index: project.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <project>
  
    <extend>${basedir}/../project.xml</extend>
    <groupId>merlin</groupId>
    <id>apache-bank</id>
    <name>Simple Bank</name>
    <package>org.apache.bank</package>
  
    <inceptionYear>2003</inceptionYear>
    <shortDescription>Apache Financial Service - Simple Bank</shortDescription>
  
    <description>
  A demonstration of a very simple component based implementation of a bank.
    </description>
    
    <repository>
      <connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple</connection>
      <url>http://cvs.apache.org/viewcvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple</url>
    </repository>
  
    <dependencies>
  
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-framework</artifactId>
        <version>4.1.4</version>
      </dependency>
  
      <!-- pre JDK 1.4 dependencies -->
  
      <dependency>
        <id>xml-apis</id>
        <version>1.0.b2</version>
        <url>http://xml.apache.org/xerces2-j/</url>
      </dependency>
  
      <dependency>
        <id>xerces</id>
        <version>2.2.1</version>
        <url>http://xml.apache.org/xerces2-j/</url>
      </dependency>
  
      <!-- unit test -->
  
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-logkit</artifactId>
        <version>1.2</version>
      </dependency>
  
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-lifecycle</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-meta</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-meta-spi</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-assembly-spi</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>avalon</groupId>
        <artifactId>avalon-assembly</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>excalibur</groupId>
        <artifactId>excalibur-i18n</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>excalibur</groupId>
        <artifactId>excalibur-event</artifactId>
        <version>2.0</version>
      </dependency>
      
      <dependency>
        <groupId>excalibur</groupId>
        <artifactId>excalibur-util-concurrent</artifactId>
        <version>1.3.1</version>
      </dependency>
  
      <dependency>
        <groupId>excalibur</groupId>
        <artifactId>excalibur-configuration</artifactId>
        <version>1.0</version>
      </dependency>
      
      <dependency>
        <groupId>excalibur</groupId>
        <artifactId>excalibur-extension</artifactId>
        <version>1.0</version>
      </dependency>
  
      <dependency>
        <groupId>merlin</groupId>
        <artifactId>merlin-spi</artifactId>
        <version>1.0</version>
      </dependency>
  
      <dependency>
        <groupId>merlin</groupId>
        <artifactId>merlin-core</artifactId>
        <version>2.1</version>
      </dependency>
  
      <dependency>
        <id>commons-collections</id>
        <version>2.1</version>
      </dependency>
  
      <dependency>
        <id>commons-cli</id>
        <version>1.0</version>
      </dependency>
  
    </dependencies>
    
  </project>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml
  
  Index: block.xml
  ===================================================================
  
  <block name="banking">
     <container>
       <component name="bank" class="org.apache.bank.impl.BankProvider" activation="startup"/>
    </container>
  </block>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/etc/LICENSE.txt
  
  Index: LICENSE.txt
  ===================================================================
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2003 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/>.
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/etc/project.mf
  
  Index: project.mf
  ===================================================================
  Manifest-Version: 1.0
  Created-By: Apache Avalon
  Extension-Name: apache-bank
  Specification-Vendor: Apache Software Foundation
  Specification-Version: 1.0
  Implementation-Vendor: Apache Software Foundation
  Implementation-Vendor-Id: ASF
  Implementation-Version: 1.0
  Extension-List: merlin 
  merlin-Extension-Name: avalon-merlin
  merlin-Specification-Version: 2.0
  merlin-Implementation-Version: 2.1
  merlin-Implementation-Vendor-Id: ASF
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/etc/stylesheet.css
  
  Index: stylesheet.css
  ===================================================================
  /* Javadoc style sheet */
  
  /* Define colors, fonts and other style attributes here to override the defaults */
  
  /* Page background color */
  body { background-color: #FFFFFF }
  
  /* Table colors */
  .TableHeadingColor     { background: #CCCCFF } /* Dark mauve */
  .TableSubHeadingColor  { background: #EEEEFF } /* Light mauve */
  .TableRowColor         { background: #FFFFFF } /* White */
  
  /* Font used in left-hand frame lists */
  .FrameTitleFont   { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
  .FrameHeadingFont { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
  .FrameItemFont    { font-size: 10pts; font-family: Helvetica, Arial, san-serif }
  
  /* Example of smaller, sans-serif font in frames */
  /* .FrameItemFont  { font-size: 10pt; font-family: Helvetica, Arial, sans-serif } */
  
  /* Navigation bar fonts and colors */
  .NavBarCell1    { background-color:#EEEEFF;}/* Light mauve */
  .NavBarCell1Rev { background-color:#00008B;}/* Dark Blue */
  .NavBarFont1    { font-family: Arial, Helvetica, sans-serif; color:#000000;}
  .NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;}
  
  .NavBarCell2    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
  .NavBarCell3    { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF;}
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/Account.java
  
  Index: Account.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.bank;
  
  public interface Account
  {
     /**
      * Get the account name.
      * @return the account name
      */
      String getName();
  
     /**
      * Get the account number.
      * @return the account number
      */
      int getID();
  
     /**
      * Get the account balance.
      * @return the account balance
      */
      float getBalance();
  
     /**
      * Deposit funds into the account.
      * @param amount the amount of funds to deposit
      */
      void deposit( float amount );
  
     /**
      * Withdraw funds from the account.
      * @param amount the amount of funds to withdraw
      */
      void withdraw( float amount ) throws InsufficientFundsException;
  
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/Bank.java
  
  Index: Bank.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.bank;
  
  public interface Bank
  {
     /**
      * Create, register and return a new account.
      * @param name the name of the account holder
      * @return Account the account
      */
      Account createAccount( String name );
  
     /**
      * Returns an account based on a supplied account number.
      * @param id the account number
      * @return Account the bank account
      */
      Account getAccount( int id ) throws NoSuchAccountException;
  
     /**
      * Close an account.
      * @param id the account number
      */
      void closeAccount( int id ) throws PolicyException, NoSuchAccountException;
  
     /**
      * Get the number of accounts managed by the bank.
      * @return the number of accounts
      */
      int accounts();
  
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/InsufficientFundsException.java
  
  Index: InsufficientFundsException.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.bank;
  
  /**
   * Exception thrown when a request to withdraw funds is applied against an account 
   * with insufficient funds.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $
   */
  public class InsufficientFundsException
      extends Exception
  {
  
      /**
       * Construct a new <code>InsufficientFundsException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public InsufficientFundsException( final String message )
      {
          super( message );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/NoSuchAccountException.java
  
  Index: NoSuchAccountException.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.bank;
  
  /**
   * Exception thrown when requesting an unknown account.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $
   */
  public class NoSuchAccountException
      extends Exception
  {
  
      /**
       * Construct a new <code>NoSuchAccountException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public NoSuchAccountException( final String message )
      {
          super( message );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/PolicyException.java
  
  Index: PolicyException.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.bank;
  
  /**
   * Exception thrown when an attempt is made to perform an action 
   * that contradicts a banking policy.
   *
   * @author <a href="mailto:dev@avalon.apache.org">Avalon Development Team</a>
   * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $
   */
  public class PolicyException
      extends Exception
  {
  
      /**
       * Construct a new <code>PolicyException</code> instance.
       *
       * @param message The detail message for this exception.
       */
      public PolicyException( final String message )
      {
          super( message );
      }
  }
  
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/Accounts.java
  
  Index: Accounts.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.bank.impl;
  
  import java.io.Serializable;
  import java.util.Hashtable;
  
  import org.apache.bank.Account;
  import org.apache.bank.Bank;
  import org.apache.bank.PolicyException;
  import org.apache.bank.NoSuchAccountException;
  
  /**
   * The back office persisterble bank registry.
   */
  class Accounts implements Serializable, Bank
  {
      private int m_index = 0;
  
     /**
      * Internal list of accounts.
      */
      private Hashtable m_accounts = new Hashtable();
  
     /**
      * Internal list of removed accounts.
      */
      private Hashtable m_archive = new Hashtable();
  
     /**
      * Create, register and return a new account.
      * @param name the name of the account holder
      * @return Account the account
      */
      public synchronized Account createAccount( String name )
      {
          m_index++;
          DefaultAccount account = new DefaultAccount( name, m_index );
          m_accounts.put( String.valueOf( m_index ), account );
          return account;
      }
  
     /**
      * Remove an account based on a supplied account identifier.
      * @param id the account number
      * @return Account the bank account
      */
      public synchronized void closeAccount( int id ) throws PolicyException, NoSuchAccountException
      {
          Account account = getAccount( id );
          if( account.getBalance() > 0 )
          {
              final String error = 
                "Cannot close an account with a non-zero balance.";
              throw new PolicyException( error );
          }
          final String key = String.valueOf( id );
          m_accounts.remove( key );
          m_archive.put( key, account );
      }
  
     /**
      * Returns an account based on a supplied account number.
      * @param id the account number
      * @return Account the bank account
      */
      public Account getAccount( int id ) throws NoSuchAccountException
      {
          return findAccount( m_accounts, String.valueOf( id ) );
      }
  
      private Account findAccount( Hashtable table, String key ) throws NoSuchAccountException
      {
          Account account = (Account) table.get( key );
          if( account == null )
          {
              throw new NoSuchAccountException( key );
          }
          return account;
      }
  
     /**
      * Get the number of accounts managed by the bank.
      * @return the number of accounts
      */
      public int accounts()
      {
          return m_accounts.size();
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/BankProvider.java
  
  Index: BankProvider.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.bank.impl;
  
  import java.io.File;
  import java.io.InputStream;
  import java.io.FileInputStream;
  import java.io.FileOutputStream;
  import java.io.ObjectInputStream;
  import java.io.ObjectOutputStream;
  import java.io.OutputStream;
  
  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;
  import org.apache.avalon.framework.activity.Initializable;
  import org.apache.avalon.framework.activity.Disposable;
  
  import org.apache.bank.Bank;
  import org.apache.bank.Account;
  import org.apache.bank.PolicyException;
  import org.apache.bank.NoSuchAccountException;
  
  
  public class BankProvider extends AbstractLogEnabled 
    implements Contextualizable, Initializable, Disposable, Bank
  {
      private File m_home = null;
  
     /**
      * The persistant account registry.
      */
      private Accounts m_accounts;
  
     /**
      * Supply of the runtime context to the component by the container.  The 
      * component uses the supplied home directory to store accounts.
      * @param context the runtime context
      * @exception ContextException if the container does not supply the 
      *    home directory under the "urn:avalon:home" key.
      */
      public void contextualize( Context context ) throws ContextException
      {
          m_home = (File) context.get( "urn:avalon:home" );
          getLogger().info( "setting home directory: " + m_home );
      }
  
     /**
      * Initialization of the component by the container.
      * @exception if an initialization error occurs
      */
      public void initialize() throws Exception
      {
          File file = new File( m_home, "accounts.ser" );
          getLogger().info( "initialization" );
          if( file.exists() )
          {
              getLogger().info( "loading store: " + file );
              InputStream stream = new FileInputStream( file );
              final ObjectInputStream ois = new ObjectInputStream( stream );
              m_accounts = (Accounts) ois.readObject();
              getLogger().info( "accounts established: " + m_accounts.accounts() );
          }
          else
          {
              getLogger().info( "creating new account registry" );
              m_accounts = new Accounts();
          }
      }
  
     /**
      * Disposal of the bank by the container.
      */
      public void dispose()
      {
          getLogger().info( "initiating bank disposal" );
          try
          {
              File file = new File( m_home, "accounts.ser" );
              File parent = file.getParentFile();
              parent.mkdirs();
              file.createNewFile();
              FileOutputStream stream = new FileOutputStream( file );
              final ObjectOutputStream output = new ObjectOutputStream( stream );
              output.writeObject( m_accounts );
              output.flush();
              getLogger().info( "accounts saved to " + file );
          }
          catch( Throwable e )
          {
              final String error = 
               "Unable to write accounts to file.";
              getLogger().error( error, e );
          }
      }
  
     /**
      * Get the number of accounts managed by the bank.
      * @return the number of accounts
      */
      public int accounts()
      {
          return m_accounts.accounts();
      }
  
     /**
      * Create, register and return a new account.
      * @param name the name of the account holder
      * @return Account the account
      */
      public Account createAccount( String name )
      {
          Account account = m_accounts.createAccount( name );
          getLogger().info( 
            "created new account for: " + name 
            + " with id: " + account.getID() );
          return account;
      }
  
     /**
      * Close an account.
      * @param id the account number
      */
      public void closeAccount( int id ) throws PolicyException, NoSuchAccountException
      {
          getLogger().info( "closing account: " + id );
          m_accounts.closeAccount( id );
      }
  
     /**
      * Returns an account based on a supplied account number.
      * @param id the account number
      * @return Account the bank account
      */
      public Account getAccount( int id ) throws NoSuchAccountException
      {
          Account account = m_accounts.getAccount( id );
          getLogger().info( 
            "retrieving account: " + id  
            + " for " + account.getName() );
          return account;
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/BankProvider.xinfo
  
  Index: BankProvider.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>bank</name>
      <version>1.0</version>
    </info>
  </type>
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/DefaultAccount.java
  
  Index: DefaultAccount.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.bank.impl;
  
  import java.io.Serializable;
  
  import org.apache.bank.Account;
  import org.apache.bank.InsufficientFundsException;
  
  public class DefaultAccount implements Account, Serializable
  {
      private int m_id;
      private String m_name;
      private float m_balance;
  
      public DefaultAccount( String name, int id )
      {
          m_id = id;
          m_name = name;
      }
  
     /**
      * Deposit funds into the account.
      * @param amount the amount of funds to deposit
      */
      public synchronized void deposit( float amount )
      {
          m_balance = m_balance + amount;
      }
  
     /**
      * Withdraw funds from the account.
      * @param amount the amount of funds to withdraw
      */
      public synchronized void withdraw( float amount ) throws InsufficientFundsException
      {
          if( amount > m_balance )
          {
              final String message = 
                "Request withdrawl of " + amount 
                + " exceeds balance of " + m_balance + ".";
              throw new InsufficientFundsException( message );
          }
          m_balance = m_balance - amount;
      }
  
     /**
      * Get the account balance.
      * @return the account balance
      */
      public float getBalance()
      {
          return m_balance;
      }
  
     /**
      * Get the account name.
      * @return the account name
      */
      public String getName()
      {
          return m_name;
      }
  
     /**
      * Get the account number.
      * @return the account number
      */
      public int getID()
      {
          return m_id;
      }
  
      public int hashcode()
      {
          return getID();
      }
  }
  
  
  
  1.1                  avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/test/org/apache/bank/BankTestCase.java
  
  Index: BankTestCase.java
  ===================================================================
  
  
  package org.apache.bank;
  
  import java.io.File;
  import java.io.IOException;
  import java.io.FileInputStream;
  import java.io.InputStream;
  import java.io.IOException;
  import java.io.FileNotFoundException;
  import java.util.StringTokenizer;
  import java.util.Enumeration;
  import java.util.List;
  import java.util.Iterator;
  import java.util.jar.JarFile;
  import java.util.ArrayList;
  import java.util.Map;
  import java.util.jar.Attributes;
  import java.util.jar.Manifest;
  import java.net.URLClassLoader;
  import java.net.URL;
  import java.util.zip.ZipEntry;
  import java.net.MalformedURLException;
  import java.net.JarURLConnection;
  
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.configuration.DefaultConfigurationBuilder;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.DefaultContext;
  import org.apache.avalon.framework.context.Contextualizable;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.merlin.block.Block;
  import org.apache.avalon.merlin.kernel.impl.DefaultKernel;
  import org.apache.avalon.merlin.kernel.KernelException;
  import org.apache.avalon.assembly.util.ExceptionHelper;
  import org.apache.avalon.assembly.locator.DefaultLocator;
  import org.apache.avalon.assembly.appliance.Appliance;
  import junit.framework.TestCase;
  
  public class BankTestCase extends TestCase
  {
  
      private DefaultKernel m_kernel;
  
      public BankTestCase( )
      {
          this( "bank" );
      }
  
      public BankTestCase( String name )
      {
          super( name );
      }
  
      public void setUp() throws Exception
      {
          ClassLoader loader = Thread.currentThread().getContextClassLoader();
          File base = new File( System.getProperty( "user.dir" ) );
          File classes = new File( base, "target/classes" );
  
          DefaultLocator context = new DefaultLocator();
          context.put( "urn:merlin:home", base );
          context.put( "urn:merlin:system", base );
          context.put( "urn:merlin:classloader.common", loader );
          context.put( "urn:merlin:classloader.system", loader );
          context.put( "urn:merlin:debug", "WARN" );
          context.put( "urn:merlin:logging.priority", "INFO" );
          context.put( "urn:merlin:block.url", classes.toURL() );
          context.makeReadOnly();
  
          m_kernel = new DefaultKernel();
          m_kernel.contextualize( context );
          m_kernel.initialize();
      }
  
      public void testBank() throws Exception
      {
          if( m_kernel != null )
          {
              //
              // get the bank
              //
  
              Block block = m_kernel.getRootBlock();
              URL banking = block.getURL();
              URL url = new URL( banking, banking.getPath() + "bank" );
              Appliance manager = (Appliance) url.getContent();
              Bank bank = (Bank) manager.resolve( this );
  
              //
              // create an account and deposit some funds
              //
              
              Account account = bank.createAccount( "test" );
              float deposit = new Float( 100.20 ).floatValue();
              account.deposit( deposit );
              assertTrue( account.getBalance() == deposit );
  
              //
              // make a withdrawl
              //
  
              float withdrawl = new Float( 60 ).floatValue();
              account.withdraw( withdrawl );
  
              //
              // withdrawl the balance and close the account
              //
  
              account.withdraw( account.getBalance() );
              assertTrue( account.getBalance() == 0 );
              bank.closeAccount( account.getID() );
              assertTrue( true );
          }
          else
          {
              assertTrue( false );
          }
      }
  
  
      public void tearDown() throws Exception
      {
          if( m_kernel != null )
          { 
              m_kernel.shutdown();
          }
      }
  }
  
  
  
  1.3       +1 -0      avalon-sandbox/merlin/merlin-smp/xdocs/starting/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/navigation.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- navigation.xml	2 Apr 2003 21:58:00 -0000	1.2
  +++ navigation.xml	6 Apr 2003 19:22:37 -0000	1.3
  @@ -15,6 +15,7 @@
           <item name="Installation" href="/starting/installation.html"/>
           <item name="Using Merlin" href="/starting/hello/index.html"/>
           <item name="Advanced Features" href="/starting/advanced/index.html"/>
  +        <item name="Examples" href="/starting/examples/index.html"/>
         </item>
         <item name="Merlin System" href="/merlin/index.html"/>
         <item name="Meta Model" href="/meta/index.html"/>
  
  
  
  1.4       +1 -0      avalon-sandbox/merlin/merlin-smp/xdocs/starting/advanced/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/advanced/navigation.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- navigation.xml	3 Apr 2003 14:42:43 -0000	1.3
  +++ navigation.xml	6 Apr 2003 19:22:37 -0000	1.4
  @@ -23,6 +23,7 @@
             <item name="Using a Custom Appliance" href="/starting/advanced/appliance.html"/>
             <item name="Custom Blocks" href="/starting/advanced/block.html"/>
           </item>
  +        <item name="Examples" href="/starting/examples/index.html"/>
         </item>
         <item name="Merlin System" href="/merlin/index.html"/>
         <item name="Meta Model" href="/meta/index.html"/>
  
  
  
  1.6       +1 -0      avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/navigation.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- navigation.xml	4 Apr 2003 15:49:44 -0000	1.5
  +++ navigation.xml	6 Apr 2003 19:22:38 -0000	1.6
  @@ -23,6 +23,7 @@
             <item name="Dependencies" href="/starting/hello/dependencies.html"/>
           </item>
           <item name="Advanced Features" href="/starting/advanced/index.html"/>
  +        <item name="Examples" href="/starting/examples/index.html"/>
         </item>
         <item name="Merlin System" href="/merlin/index.html"/>
         <item name="Meta Model" href="/meta/index.html"/>
  
  
  
  1.4       +1 -0      avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context/navigation.xml
  
  Index: navigation.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context/navigation.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- navigation.xml	4 Apr 2003 15:49:48 -0000	1.3
  +++ navigation.xml	6 Apr 2003 19:22:38 -0000	1.4
  @@ -27,6 +27,7 @@
             <item name="Dependencies" href="/starting/hello/dependencies.html"/>
           </item>
           <item name="Advanced Features" href="/starting/advanced/index.html"/>
  +        <item name="Examples" href="/starting/examples/index.html"/>
         </item>
         <item name="Merlin System" href="/merlin/index.html"/>
         <item name="Meta Model" href="/meta/index.html"/>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org