You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/04/20 03:49:44 UTC

cvs commit: jakarta-avalon-phoenix/src/xdocs config-xml-specification.xml assemblers-guide.xml assembly-xml-specification.xml book.xml creating-a-server-application.xml

donaldp     01/04/19 18:49:44

  Modified:    src/java/org/apache/phoenix/engine DefaultSarDeployer.java
               src/xdocs assemblers-guide.xml
                        assembly-xml-specification.xml book.xml
                        creating-a-server-application.xml
  Added:       src/xdocs config-xml-specification.xml
  Log:
  Update docs and code to reflect that config.xml is now a separate file from assembly.xml contents.
  
  Revision  Changes    Path
  1.12      +53 -20    jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/DefaultSarDeployer.java
  
  Index: DefaultSarDeployer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/phoenix/engine/DefaultSarDeployer.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- DefaultSarDeployer.java	2001/04/19 02:16:00	1.11
  +++ DefaultSarDeployer.java	2001/04/20 01:49:43	1.12
  @@ -59,8 +59,8 @@
       extends AbstractDeployer
       implements Composable
   {
  -    protected File            m_deployDirectory;
  -    protected Container       m_container;
  +    private File            m_deployDirectory;
  +    private Container       m_container;
   
       /**
        * Default constructor.
  @@ -99,7 +99,7 @@
           }
       }
   
  -    protected void expandTo( final File file, final File directory )
  +    private void expandTo( final File file, final File directory )
           throws DeploymentException
       {
           final ZipFile zipFile = DeployerUtil.getZipFileFor( file );
  @@ -144,18 +144,18 @@
           }
       }
   
  -    protected boolean shouldExpandEntry( final String name )
  +    private boolean shouldExpandEntry( final String name )
       {
           if( name.startsWith( "META-INF" ) ) return false;
           else return true;
       }
   
  -    protected boolean needsExpanding( final ZipFile zipFile, final File directory )
  +    private boolean needsExpanding( final ZipFile zipFile, final File directory )
       {
           return !directory.exists();
       }
   
  -    protected File getDestinationFor( final String location, final File file )
  +    private File getDestinationFor( final String location, final File file )
       {
           final String name =
               FileUtil.removeExtention( FileUtil.removePath( file.getName() ) );
  @@ -170,7 +170,7 @@
           }
       }
   
  -    protected Kernel getKernel()
  +    private Kernel getKernel()
           throws DeploymentException
       {
           if( !(m_container instanceof Kernel) )
  @@ -183,7 +183,7 @@
           }
       }
   
  -    protected void buildEntry( final String name,
  +    private void buildEntry( final String name,
                                  final ServerApplicationEntry entry,
                                  final File archive,
                                  final File directory )
  @@ -204,7 +204,7 @@
           entry.setConfiguration( configuration );
       }
   
  -    protected void deployFromDirectory( final File archive,
  +    private void deployFromDirectory( final File archive,
                                           final String name,
                                           final File directory )
           throws DeploymentException
  @@ -237,26 +237,32 @@
           final File blocksDirectory = new File( directory, "blocks" );
           CamelotUtil.deployFromDirectory( deployer, blocksDirectory, ".bar" );
   
  -        final File file =
  -            new File( directory, "conf" + File.separator + "assembly.xml" );
  -
  -        try
  +       try
           {
  +            final File file =
  +                new File( directory, "conf" + File.separator + "assembly.xml" );
  +
               final Configuration configuration = getConfigurationFor( file );
               final Configuration[] blocks = configuration.getChildren( "block" );
  -            handleBlocks( application, entry, blocks, registry );
  +            assembleBlocks( application, entry, blocks, registry );
           }
           catch( final ComponentException cme )
           {
  -            throw new DeploymentException( "Error setting up registries", cme );
  +            throw new DeploymentException( "Error Assembling Blocks", cme );
           }
           catch( final ConfigurationException ce )
           {
               throw new DeploymentException( "Error in assembly.xml", ce );
           }
  +
  +       final File file =
  +           new File( directory, "conf" + File.separator + "config.xml" );
  +       
  +       final Configuration configuration = getConfigurationFor( file );
  +       configureBlocks( application, entry, configuration.getChildren() );
       }
   
  -    protected void addEntry( final String name, final ServerApplicationEntry entry )
  +    private void addEntry( final String name, final ServerApplicationEntry entry )
           throws DeploymentException
       {
           try
  @@ -271,7 +277,7 @@
           getLogger().debug( "Adding " + m_type + "Entry " + name + " as " + entry );
       }
   
  -    protected Configuration getConfigurationFor( final File file )
  +    private Configuration getConfigurationFor( final File file )
           throws DeploymentException
       {
           try
  @@ -285,7 +291,7 @@
           }
       }
   
  -    protected Deployer getBlockDeployer( final ServerApplicationEntry entry, final Registry registry )
  +    private Deployer getBlockDeployer( final ServerApplicationEntry entry, final Registry registry )
           throws DeploymentException
       {
           final Deployer deployer = new DefaultBlockDeployer();
  @@ -309,7 +315,7 @@
           return deployer;
       }
   
  -    protected void handleBlocks( final Application application,
  +    private void assembleBlocks( final Application application,
                                    final ServerApplicationEntry saEntry,
                                    final Configuration[] blocks,
                                    final Registry registry )
  @@ -360,8 +366,35 @@
               {
                   throw new DeploymentException( "Error adding component to container", ce );
               }
  +
  +            getLogger().debug( "Adding BlockEntry " + name + " as " + entry );
  +        }
  +    }
  +
  +    private void configureBlocks( final Application application,
  +                                  final ServerApplicationEntry saEntry,
  +                                  final Configuration[] configurations )
  +        throws DeploymentException
  +    {
  +        for( int i = 0; i < configurations.length; i++ )
  +        {
  +            final Configuration configuration = configurations[ i ];
  +            final String name = configuration.getName();
  +
  +            BlockEntry entry = null;
  +            try 
  +            { 
  +                entry = (BlockEntry)application.getEntry( name ); 
  +            }
  +            catch( final ContainerException ce )
  +            {
  +                throw new DeploymentException( "Configuration element " + name + 
  +                                               " refers to unknown block", ce );
  +            }
  +
  +            entry.setConfiguration( configuration );
   
  -            getLogger().debug( "Adding " + m_type + "Entry " + name + " as " + entry );
  +            getLogger().debug( "Loaded configuration for block " + name );
           }
       }
   }
  
  
  
  1.3       +4 -1      jakarta-avalon-phoenix/src/xdocs/assemblers-guide.xml
  
  Index: assemblers-guide.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/xdocs/assemblers-guide.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- assemblers-guide.xml	2001/03/13 20:41:04	1.2
  +++ assemblers-guide.xml	2001/04/20 01:49:44	1.3
  @@ -42,6 +42,9 @@
             </link>
           </li>
           <li>
  +          <link href="config-xml-specification.html">config.xml specification</link>
  +        </li>
  +        <li>
             <link href="assembly-xml-specification.html">assembly.xml specification</link>
           </li>
           <li>
  @@ -53,7 +56,7 @@
     <footer>
       <legal>
         Copyright (c) @year@ The Jakarta Apache Project All rights reserved.
  -      $Revision: 1.2 $ $Date: 2001/03/13 20:41:04 $
  +      $Revision: 1.3 $ $Date: 2001/04/20 01:49:44 $
       </legal>
     </footer>
   </document>
  
  
  
  1.3       +5 -10     jakarta-avalon-phoenix/src/xdocs/assembly-xml-specification.xml
  
  Index: assembly-xml-specification.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/xdocs/assembly-xml-specification.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- assembly-xml-specification.xml	2001/03/01 14:07:05	1.2
  +++ assembly-xml-specification.xml	2001/04/20 01:49:44	1.3
  @@ -21,23 +21,18 @@
           below for a sample assembly.xml file.
         </p>
         <p>
  -        At the current time configuration data is also specified in the assembly.xml 
  -        file. The format of the configuration data is block specifc and you should 
  -        refer to the Blocks documentation to discover the format. In the future this 
  -        configuration data will be removed.
  +        In previous versions of Avalon configuration data was stored in assembly file. 
  +        This is no longer the case (It is now stored in config.xml).
         </p>
       </s1>
       <s1 title="Sample assembly.xml file">
         <source><![CDATA[
   <?xml version="1.0"?>
   
  -<avalon>
  +<assembly>
   
       <block name="myAuthorizer" 
              class="com.biz.cornerstone.blocks.MyAuthorizer">
  -      <configuration>
  -        ...configuration data here...
  -      </configuration>
       </block>
   
       <block name="myBlock" 
  @@ -46,7 +41,7 @@
                  role="com.biz.cornerstone.services.Authorizer"/>
       </block>
   
  -</avalon>]]>
  +</assembly>]]>
   
         </source>
       </s1>
  @@ -54,7 +49,7 @@
     <footer>
       <legal>
         Copyright (c) @year@ The Jakarta Apache Project All rights reserved.
  -      $Revision: 1.2 $ $Date: 2001/03/01 14:07:05 $
  +      $Revision: 1.3 $ $Date: 2001/04/20 01:49:44 $
       </legal>
     </footer>
   </document>
  
  
  
  1.4       +1 -0      jakarta-avalon-phoenix/src/xdocs/book.xml
  
  Index: book.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/xdocs/book.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- book.xml	2001/03/02 03:26:43	1.3
  +++ book.xml	2001/04/20 01:49:44	1.4
  @@ -28,6 +28,7 @@
       <menu-item label="Overview" source="assemblers-guide.xml"/>
       <menu-item label="What is a Server Application?" source="what-is-a-server-application.xml"/>
       <menu-item label="Creating a Server Application" source="creating-a-server-application.xml"/>
  +    <menu-item label="config.xml Specification" source="config-xml-specification.xml"/>
       <menu-item label="assembly.xml Specification" source="assembly-xml-specification.xml"/>
       <menu-item label="server.xml Specification" source="server-xml-specification.xml"/>
     </menu>
  
  
  
  1.2       +15 -9     jakarta-avalon-phoenix/src/xdocs/creating-a-server-application.xml
  
  Index: creating-a-server-application.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/xdocs/creating-a-server-application.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- creating-a-server-application.xml	2001/03/01 13:44:44	1.1
  +++ creating-a-server-application.xml	2001/04/20 01:49:44	1.2
  @@ -19,6 +19,7 @@
         </p>
         <ol>
           <li>Select the blocks you wish to assemble.</li>
  +        <li>Write the config.xml file.</li>
           <li>Write the assembly.xml file.</li>
           <li>Write the server.xml file.</li>
           <li>Package the component and related resources into a sar file.</li>
  @@ -33,6 +34,13 @@
           from an online repository.          
         </p>
       </s1>
  +    <s1 title="Write the config.xml file">
  +      <p>
  +        Configuration data for blocks is stored in the config.xml file.
  +        For more detail on the format of config.xml see the 
  +        <link href="config-xml-specification.html">specification</link>.
  +      </p>
  +    </s1>
       <s1 title="Write the assembly.xml file">
         <p>
           The next stage is to write the assembly.xml file. The assembly.xml specifies 
  @@ -40,10 +48,8 @@
           Block has a name. Each block may also have dependencies that need to be 
           satisfied and this can be done via the 'provide' sub-elements. The
           provide element maps block instances from the Server Application namespace 
  -        to the Block role namespace specified in BlockInfo files. At the present 
  -        time the configuration data for blocks is also stored in the assembly.xml file 
  -        but this will change in the future. For more detail on the format of 
  -        assembly.xml see the <link href="assembly-xml-specification.html">
  +        to the Block role namespace specified in BlockInfo files. For more detail 
  +        on the format of assembly.xml see the <link href="assembly-xml-specification.html">
           specification</link>.
         </p>
       </s1>
  @@ -59,17 +65,17 @@
         <p>
           The sar file format is the standard distribution format of Phoenix Server
           Applications. It is a standard Jar file with a specific directory layout. 
  -        The server.xml and assembly.xml file must be stored in <code>conf/</code>
  -        of the archive. All bar (Block ARchive) files must be stored in the 
  -        <code>blocks/</code> subdirectory while all supporting jar and zip files
  -        must be stored in the <code>lib/</code> subdirectory.
  +        The config.xml, server.xml and assembly.xml file must be stored in 
  +        <code>conf/</code> of the archive. All bar (Block ARchive) files must be 
  +        stored in the <code>blocks/</code> subdirectory while all supporting jar 
  +        and zip files must be stored in the <code>lib/</code> subdirectory.
         </p>
       </s1>
     </body>
     <footer>
       <legal>
         Copyright (c) @year@ The Jakarta Apache Project All rights reserved.
  -      $Revision: 1.1 $ $Date: 2001/03/01 13:44:44 $
  +      $Revision: 1.2 $ $Date: 2001/04/20 01:49:44 $
       </legal>
     </footer>
   </document>
  
  
  
  1.1                  jakarta-avalon-phoenix/src/xdocs/config-xml-specification.xml
  
  Index: config-xml-specification.xml
  ===================================================================
  <?xml version="1.0"?>
  
  <!DOCTYPE document SYSTEM "dtd/document-v10.dtd">
  
  <document>
    <header>
      <title>Server Assemblers Guide</title>
      <subtitle>Specification of config.xml </subtitle>
      <authors>
        <person id="PD" name="Peter Donald" email="donaldp@apache.org"/>
      </authors>
    </header>
    <body>
      <s1 title="Introduction">
        <p>
          The purpose of the <code>config.xml</code> file is to provide configuration data
          to each of the blocks that require configuration data. The format of the 
          configuration data is block-specific, thus refer to documentation of Block
          for relevent details. Each element below the root element has a name coresponding
          to the name of a block specified in assembly.xml file. The contents of this
          element is the configuration data for the block.
        </p>
      </s1>
      <s1 title="Sample config.xml file">
        <source><![CDATA[
  <?xml version="1.0"?>
  
  <config>
  
      <myAuthorizer>
        &lt;!-- ...configuration data here... --&gt;
      </myAuthorizer>
  
      <myBlock>
        <param1>param1-value</param1>
        <an-integer>2</an-integer>
        ...
      </myBlock>
  
  </config>]]>
  
        </source>
      </s1>
    </body>
    <footer>
      <legal>
        Copyright (c) @year@ The Jakarta Apache Project All rights reserved.
        $Revision: 1.1 $ $Date: 2001/04/20 01:49:44 $
      </legal>
    </footer>
  </document>
  
  
  
  

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