avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mcconn...@apache.org
Subject cvs commit: avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/impl DefaultBlock.java
Date Wed, 19 Feb 2003 11:19:33 GMT
mcconnell    2003/02/19 03:19:33

  Modified:    merlin/src/java/org/apache/avalon/merlin/block Block.java
               merlin/src/java/org/apache/avalon/merlin/block/impl
                        DefaultBlock.java
  Log:
  Added accessors to child blocks and appliances.
  
  Revision  Changes    Path
  1.11      +21 -1     avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/Block.java
  
  Index: Block.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/Block.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- Block.java	7 Feb 2003 15:39:33 -0000	1.10
  +++ Block.java	19 Feb 2003 11:19:32 -0000	1.11
  @@ -50,6 +50,7 @@
   
   package org.apache.avalon.merlin.block;
   
  +import java.net.URL;
   import org.apache.avalon.assembly.appliance.Appliance;
   import org.apache.avalon.merlin.container.Container;
   
  @@ -73,6 +74,25 @@
       * @exception Exception if a deployment error occurs
       */
       void deploy() throws Exception;
  +
  +   /**
  +    * Return the set of locally managed appliance instances.
  +    * @return the set of appliance instances local to this block.
  +    */
  +    public Appliance[] getAppliances();
  +
  +   /**
  +    * Return the set of blocks locally managed by this block.
  +    * @return the set of immediate sibling blocks.
  +    */
  +    Block[] getBlocks();
  +
  +   /**
  +    * Return the set of appliance URLs for the entire block hierachy inclding the
  +    * URL of this block.
  +    * @return the set of urls
  +    */
  +    URL[] getURLs();
   
      /**
       * Decommission the block.
  
  
  
  1.8       +39 -0     avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java
  
  Index: DefaultBlock.java
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/src/java/org/apache/avalon/merlin/block/impl/DefaultBlock.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DefaultBlock.java	17 Feb 2003 12:11:56 -0000	1.7
  +++ DefaultBlock.java	19 Feb 2003 11:19:33 -0000	1.8
  @@ -294,6 +294,45 @@
       //-------------------------------------------------------------------------------
   
      /**
  +    * Return the set of locally managed appliance instances.
  +    * @return the set of appliance instances local to this block.
  +    */
  +    public Appliance[] getAppliances()
  +    {
  +        return (Appliance[]) m_appliances.toArray( new Appliance[0] );
  +    }
  +
  +   /**
  +    * Return the set of blocks locally managed by this block.
  +    * @return the set of immediate sibling blocks.
  +    */
  +    public Block[] getBlocks()
  +    {
  +        return (Block[]) m_blocks.toArray( new Block[0] );
  +    }
  +
  +    public URL[] getURLs()
  +    {
  +        List list = new ArrayList();
  +        list.add( getURL() );
  +        Appliance[] appliances = getAppliances();
  +        for( int i=0; i<appliances.length; i++ )
  +        {
  +            list.add( appliances[i].getURL() );
  +        }
  +        Block[] blocks = getBlocks();
  +        for( int j=0; j<blocks.length; j++ )
  +        {
  +            URL[] expanded = blocks[j].getURLs();
  +            for( int k=0; k<expanded.length; k++ )
  +            {
  +                list.add( expanded[k] );
  +            }
  +        }
  +        return (URL[]) list.toArray( new URL[0] );
  +    }
  +
  +   /**
       * Get the appliance URL.
       * @return the appliance URL
       */
  
  
  

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


Mime
View raw message