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/07 19:02:06 UTC

cvs commit: avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl BankProvider.java

mcconnell    2003/04/07 10:02:06

  Modified:    merlin/merlin-smp/src/examples/afs/simple project.xml
               merlin/merlin-smp/src/examples/afs/simple/conf block.xml
               merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank
                        Bank.java
               merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl
                        BankProvider.java
  Log:
  Update to associate a bank name with the bank.
  
  Revision  Changes    Path
  1.2       +2 -2      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/project.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- project.xml	6 Apr 2003 19:22:36 -0000	1.1
  +++ project.xml	7 Apr 2003 17:02:06 -0000	1.2
  @@ -4,8 +4,8 @@
   
     <extend>${basedir}/../project.xml</extend>
     <groupId>merlin</groupId>
  -  <id>apache-bank</id>
  -  <name>Simple Bank</name>
  +  <id>merlin-example-simple-bank</id>
  +  <name>Simple Bank Example</name>
     <package>org.apache.bank</package>
   
     <inceptionYear>2003</inceptionYear>
  
  
  
  1.2       +5 -1      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml
  
  Index: block.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/conf/block.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- block.xml	6 Apr 2003 19:22:37 -0000	1.1
  +++ block.xml	7 Apr 2003 17:02:06 -0000	1.2
  @@ -1,6 +1,10 @@
   
   <block name="banking">
      <container>
  -     <component name="bank" class="org.apache.bank.impl.BankProvider" activation="startup"/>
  +     <component name="bank" class="org.apache.bank.impl.BankProvider" activation="startup">
  +       <configuration>
  +         <name>Apache Financial Services</name>
  +       </configuration>
  +     </component>
     </container>
   </block>
  
  
  
  1.2       +6 -0      avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/Bank.java
  
  Index: Bank.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/Bank.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Bank.java	6 Apr 2003 19:22:37 -0000	1.1
  +++ Bank.java	7 Apr 2003 17:02:06 -0000	1.2
  @@ -53,6 +53,12 @@
   public interface Bank
   {
      /**
  +    * Get the name of the bank.
  +    * @return the bank name
  +    */
  +    String getName();
  +
  +   /**
       * Create, register and return a new account.
       * @param name the name of the account holder
       * @return Account the account
  
  
  
  1.2       +23 -2     avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/BankProvider.java
  
  Index: BankProvider.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/src/examples/afs/simple/src/java/org/apache/bank/impl/BankProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BankProvider.java	6 Apr 2003 19:22:37 -0000	1.1
  +++ BankProvider.java	7 Apr 2003 17:02:06 -0000	1.2
  @@ -62,6 +62,9 @@
   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.configuration.Configurable;
  +import org.apache.avalon.framework.configuration.Configuration;
  +import org.apache.avalon.framework.configuration.ConfigurationException;
   import org.apache.avalon.framework.activity.Initializable;
   import org.apache.avalon.framework.activity.Disposable;
   
  @@ -72,15 +75,23 @@
   
   
   public class BankProvider extends AbstractLogEnabled 
  -  implements Contextualizable, Initializable, Disposable, Bank
  +  implements Contextualizable, Configurable, Initializable, Disposable, Bank
   {
       private File m_home = null;
   
  +    private String m_name;
  +
      /**
  -    * The persistant account registry.
  +    * The persistent account registry.
       */
       private Accounts m_accounts;
   
  +    public void configure( Configuration config ) throws ConfigurationException
  +    {
  +        m_name = config.getChild( "name" ).getValue();
  +        getLogger().info( "setting bank name: " + m_name );
  +    }
  +
      /**
       * Supply of the runtime context to the component by the container.  The 
       * component uses the supplied home directory to store accounts.
  @@ -142,6 +153,16 @@
               getLogger().error( error, e );
           }
       }
  +
  +   /**
  +    * Get the name of the bank.
  +    * @return the bank name
  +    */
  +    public String getName()
  +    {
  +        return m_name;
  +    }
  +
   
      /**
       * Get the number of accounts managed by the bank.
  
  
  

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