Return-Path: Delivered-To: apmail-avalon-cvs-archive@avalon.apache.org Received: (qmail 53277 invoked by uid 500); 6 Apr 2003 19:22:39 -0000 Mailing-List: contact cvs-help@avalon.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Avalon CVS List" Reply-To: "Avalon Developers List" Delivered-To: mailing list cvs@avalon.apache.org Received: (qmail 53266 invoked by uid 500); 6 Apr 2003 19:22:39 -0000 Received: (qmail 53263 invoked from network); 6 Apr 2003 19:22:39 -0000 Received: from icarus.apache.org (208.185.179.13) by daedalus.apache.org with SMTP; 6 Apr 2003 19:22:39 -0000 Received: (qmail 77157 invoked by uid 1438); 6 Apr 2003 19:22:38 -0000 Date: 6 Apr 2003 19:22:38 -0000 Message-ID: <20030406192238.77156.qmail@icarus.apache.org> From: mcconnell@apache.org To: avalon-sandbox-cvs@apache.org Subject: cvs commit: avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context navigation.xml X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N 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 =================================================================== 1.1 avalon-sandbox/merlin/merlin-smp/src/examples/afs/project.xml Index: project.xml =================================================================== 3 merlin merlin-afs Apache Financial Services 1.0 Apache Software Foundation http://avalon.apache.org/ http://avalon.apache.org/images/apache-avalon-logo.png 2003 http://avalon.apache.org/sandbox/merlin/index.html http://nagoya.apache.org/ Avalon Developer List avalon-dev-subscribe@avalon.apache.org avalon-dev-unsubscribe@avalon.apache.org http://nagoya.apache.org/eyebrowse/SummarizeList?listName=dev@avalon.apache.org Avalon User List avalon-users-subscribe@avalon.apache.org avalon-users-unsubscribe@avalon.apache.org http://nagoya.apache.org/eyebrowse/SummarizeList?listName=users@avalon.apache.org Stephen McConnell mcconnell mcconnell@apache.org OSM SARL dev@avalon.apache.org ${basedir}/src/java ${basedir}/src/test **/*TestCase* ${basedir}/src/test **/*.dtd **/*.properties **/*.xinfo **/*.xtype **/*.xprofile **/*.xconfig **/*.xml **/*.xservice ${basedir}/src/java **/*.dtd **/*.properties **/*.xinfo **/*.xtype **/*.xprofile **/*.xconfig **/*.xml **/*.xservice 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 =================================================================== 1.1 avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/project.xml Index: project.xml =================================================================== ${basedir}/../project.xml merlin apache-bank Simple Bank org.apache.bank 2003 Apache Financial Service - Simple Bank A demonstration of a very simple component based implementation of a bank. scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple http://cvs.apache.org/viewcvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple avalon avalon-framework 4.1.4 xml-apis 1.0.b2 http://xml.apache.org/xerces2-j/ xerces 2.2.1 http://xml.apache.org/xerces2-j/ avalon avalon-logkit 1.2 avalon avalon-lifecycle 1.0 avalon avalon-meta 1.0 avalon avalon-meta-spi 1.0 avalon avalon-assembly-spi 1.0 avalon avalon-assembly 1.0 excalibur excalibur-i18n 1.0 excalibur excalibur-event 2.0 excalibur excalibur-util-concurrent 1.3.1 excalibur excalibur-configuration 1.0 excalibur excalibur-extension 1.0 merlin merlin-spi 1.0 merlin merlin-core 2.1 commons-collections 2.1 commons-cli 1.0 1.1 avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml Index: block.xml =================================================================== 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 . 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 . */ 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 . */ 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 . */ package org.apache.bank; /** * Exception thrown when a request to withdraw funds is applied against an account * with insufficient funds. * * @author Avalon Development Team * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $ */ public class InsufficientFundsException extends Exception { /** * Construct a new InsufficientFundsException 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 . */ package org.apache.bank; /** * Exception thrown when requesting an unknown account. * * @author Avalon Development Team * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $ */ public class NoSuchAccountException extends Exception { /** * Construct a new NoSuchAccountException 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 . */ package org.apache.bank; /** * Exception thrown when an attempt is made to perform an action * that contradicts a banking policy. * * @author Avalon Development Team * @version $Revision: 1.1 $ $Date: 2003/04/06 19:22:37 $ */ public class PolicyException extends Exception { /** * Construct a new PolicyException 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 . */ 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 . */ 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 =================================================================== bank 1.0 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 . */ 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 @@ + 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 @@ + 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 @@ + 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 @@ + --------------------------------------------------------------------- To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org For additional commands, e-mail: cvs-help@avalon.apache.org