mcconnell    2003/04/04 07:49:48

  Modified:    merlin/merlin-smp project.xml
               merlin/merlin-smp/xdocs/starting/advanced index.xml
               merlin/merlin-smp/xdocs/starting/hello creation.xml
                        dependencies.xml index.xml navigation.xml
                        services.xml
               merlin/merlin-smp/xdocs/starting/hello/context casting.xml
                        navigation.xml
  Log:
  Updates to the dependency tutorial.
  
  Revision  Changes    Path
  1.5       +1 -0      avalon-sandbox/merlin/merlin-smp/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/project.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- project.xml       3 Apr 2003 22:14:07 -0000       1.4
  +++ project.xml       4 Apr 2003 15:49:44 -0000       1.5
  @@ -105,6 +105,7 @@
     </packageGroups>
   
     <reports>
  +    <report>maven-javadoc-plugin</report>
       <report>maven-jdepend-plugin</report>
       <report>maven-changelog-plugin</report>
       <report>maven-file-activity-plugin</report>
  
  
  
  1.3       +0 -4      
avalon-sandbox/merlin/merlin-smp/xdocs/starting/advanced/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/advanced/index.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- index.xml 2 Apr 2003 17:13:27 -0000       1.2
  +++ index.xml 4 Apr 2003 15:49:44 -0000       1.3
  @@ -12,10 +12,6 @@
           <table>
             <tr><th>Topic</th><th>Summary</th></tr>
             <tr>
  -            <td><a href="defaults.html">Default Configurations</a></td>
  -            <td>Association of a default configuration with a component.</td>
  -          </tr>
  -          <tr>
               <td><a href="profiles.html">Deployment Templates</a></td>
               <td>Creating and associating a deployment template with a 
component.</td>
             </tr>
  
  
  
  1.2       +1 -1      
avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/creation.xml
  
  Index: creation.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/creation.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- creation.xml      2 Apr 2003 15:52:17 -0000       1.1
  +++ creation.xml      4 Apr 2003 15:49:44 -0000       1.2
  @@ -18,7 +18,7 @@
           </p>
           <p>
           Resources (sample code and build files) supporting this tutorial 
  -        are included in the Merlin distribution under the docs/tutorial/001
  +        are included in the Merlin distribution under the tutorial/001
           directory.
           </p>
         </subsection>
  
  
  
  1.2       +82 -1     
avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/dependencies.xml
  
  Index: dependencies.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/dependencies.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- dependencies.xml  2 Apr 2003 15:52:17 -0000       1.1
  +++ dependencies.xml  4 Apr 2003 15:49:44 -0000       1.2
  @@ -10,7 +10,88 @@
     <body>
       <section name="Using Merlin">
         <subsection name="Managing Dependencies">
  -        <p>In preparation.</p>
  +        <p>
  +        A component type can declare dependencies on services provided by 
  +        other components.  Merlin will ensure that dependencies are resolved
  +        prior to creation of the dependent component.  Dependencies are 
  +        declared in the component xinfo resource and supplied by Merlin to
  +        the component using the Avalon Serviceable interface.
  +        </p>
  +        <p>
  +        Resource supporting this tutorial are contained in the 
  +        turorial/006 package.
  +        </p>
  +      </subsection>
  +      <subsection name="Adding a Serviceable method implementation">
  +        <p>
  +        The following code fragment is the implementation of the 
  +        Serviceable interface under the HelloComponent.java source. 
  +        </p>
  +        <p><i>HelloComponent.java</i></p>
  +<source>
  +package tutorial;
  +
  +import org.apache.avalon.framework.logger.AbstractLogEnabled;
  +import org.apache.avalon.framework.service.Serviceable;
  +import org.apache.avalon.framework.service.ServiceManager;
  +import org.apache.avalon.framework.service.ServiceException;
  +
  +public class HelloComponent extends AbstractLogEnabled 
  +  implements Serviceable
  +{
  +
  +   /**
  +    * Servicing of the component by the container during 
  +    * which service dependencies declared under the component
  +    * can be resolved using the supplied service manager.
  +    */
  +    public void service( ServiceManager manager )
  +      throws ServiceException
  +    {
  +        RandomGenerator random = (RandomGenerator) manager.lookup( "random" );
  +        getLogger().info( "random: " + random.getRandom() );
  +    }
  +}
  +</source>
  +      </subsection>
  +      <subsection name="Declaring the service dependency">
  +        <p>
  +        The xinfo descriptor needs to be updated to include the 
  +        service dependency criteria.  In this example we are declaring a 
  +        dependency on a RandomGenerator service. 
  +        </p>
  +        <p><i>HelloComponent.xinfo</i></p>
  +<source><![CDATA[
  +<type>
  +  <info>
  +    <name>hello</name>
  +    <version>1.0</version>
  +  </info>
  +  <dependencies>
  +    <dependency key="random" type="tutorial.RandomGenerator"/>
  +  </dependencies>
  +</type>
  +]]></source>
  +      </subsection>
  +      <subsection name="Executing the demo">
  +        <p>
  +        Build and run the tutorial.
  +        </p>
  +        <source>
  +$ ant
  +$ merlin build\classes
  +        </source>
  +        <p>
  +        In the logging output we see that Merlin has automatically
  +        locating the RandomGeneratorProvider and associated it as
  +        the source for the RandomGenerator service.  The HelloComponent
  +        implementation has logged the result of accessing and using 
  +        the service.
  +        </p>
  +<source>
  +[INFO   ] (tutorial.hello): random: -1509204111
  +</source>
  +
         </subsection>
       </section>
     </body>
  
  
  
  1.3       +6 -6      avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/index.xml
  
  Index: index.xml
  ===================================================================
  RCS file: /home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/index.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- index.xml 2 Apr 2003 17:13:27 -0000       1.2
  +++ index.xml 4 Apr 2003 15:49:44 -0000       1.3
  @@ -28,16 +28,16 @@
               <td>Extending HelloComponent to support configuration together with a 
guide to declararing configurations in a block.</td>
             </tr>
             <tr>
  -            <td><a href="context.html">Managing Contextulization</a></td>
  -            <td>Extending HelloComponent to receive a runtime context and using 
context directives to supply custom context entries to a component.</td>
  -          </tr>
  -          <tr>
  -            <td><a href="dependencies.html">Managing Dependencies</a></td>
  -            <td>Addition of a dependency to HelloComponent and the corresponding 
declarations in the component type descriptor.</td>
  +            <td><a href="context/index.html">Managing Contextulization</a></td>
  +            <td>A series of tutorials that go though usage of standard context 
entries, declaration of custom context entries, and mechanisms used to suppport 
type-safe context casting.</td>
             </tr>
             <tr>
               <td><a href="services.html">Publishing Services</a></td>
               <td>Extending HelloComponent to expose a service and the respective 
type declarations.</td>
  +          </tr>
  +          <tr>
  +            <td><a href="dependencies.html">Managing Dependencies</a></td>
  +            <td>Addition of a dependency to HelloComponent and the corresponding 
declarations in the component type descriptor.</td>
             </tr>
           </table>
       </section>
  
  
  
  1.5       +1 -1      
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.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- navigation.xml    4 Apr 2003 12:17:19 -0000       1.4
  +++ navigation.xml    4 Apr 2003 15:49:44 -0000       1.5
  @@ -19,8 +19,8 @@
             <item name="Behind the Scenes" href="/starting/hello/internal.html"/>
             <item name="Configurations" href="/starting/hello/config.html"/>
             <item name="Contextualization" href="/starting/hello/context/index.html"/>
  -          <item name="Dependencies" href="/starting/hello/dependencies.html"/>
             <item name="Services" href="/starting/hello/services.html"/>
  +          <item name="Dependencies" href="/starting/hello/dependencies.html"/>
           </item>
           <item name="Advanced Features" href="/starting/advanced/index.html"/>
         </item>
  
  
  
  1.2       +92 -1     
avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/services.xml
  
  Index: services.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/services.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- services.xml      2 Apr 2003 15:52:17 -0000       1.1
  +++ services.xml      4 Apr 2003 15:49:44 -0000       1.2
  @@ -10,7 +10,98 @@
     <body>
       <section name="Using Merlin">
         <subsection name="Publishing Services">
  -        <p>In preparation.</p>
  +        <p>
  +        One of the most important aspects of a component management 
  +        platform is the ability to provide component assembly.  Assembly
  +        is achieved by wiring together the services provides by one component
  +        with the service depndencies declared by a consumer component. 
  +        </p>
  +        <p>
  +        This tutorial presents the creation of a simple component that 
  +        publishes a service.  This component will be used in the subsequent 
  +        tutorial dealing with dependencies. 
  +        </p>
  +        <p>
  +        Resource supporting this tutorial are contained in the 
  +        turorial/006 package.
  +        </p>
  +      </subsection>
  +      <subsection name="Service Interface">
  +        <p>
  +        Services are normally exposed under a service interface. The following
  +        java source is the declaration of a RandomGenerator service interface. 
  +        </p>
  +        <p><i>RandomGenerator.java</i></p>
  +<source>
  +package tutorial;
  +
  +/**
  + * A service that provides access to a random number.
  + */
  +public interface RandomGenerator
  +{
  +
  +   /**
  +    * Return a random integer
  +    * @return the random number
  +    */
  +    int getRandom();
  +
  +}
  +</source>
  +      </subsection>
  +      <subsection name="Component Implementation">
  +        <p>
  +        The following source contain the component implementation for the 
  +        above service. 
  +        </p>
  +        <p><i>RandomGeneratorProvider.java</i></p>
  +<source>
  +package tutorial;
  +
  +import java.util.Random;
  +
  +/**
  + * An implementation of a random number generator.
  + */
  +public class RandomGeneratorProvider implements RandomGenerator
  +{
  +
  +    private Random m_random = new Random();
  +
  +   /**
  +    * Return a random integer
  +    * @return the random number
  +    */
  +    public int getRandom()
  +    {
  +        return m_random.nextInt();
  +    }
  +}
  +</source>
  +        <p>
  +          In addition to the implementation, we need to create an xinfo
  +          resource in which we declare the publication of the service by 
  +          the component.  In this example the component type is declaring 
  +          one service although multiple service declaration are supported.
  +        </p>
  +        <p><i>RandomGeneratorProvider.xinfo</i></p>
  +<source><![CDATA[
  +<type>
  +  <info>
  +    <name>random</name>
  +    <version>1.0</version>
  +  </info>
  +  <services>
  +    <service type="tutorial.RandomGenerator:1.0"/>
  +  </services>
  +</type>
  +]]></source>
  +        <p>
  +          The <a href="dependencies.html">following tutorial</a> presents the 
  +          use of this service by HelloComponent.
  +        </p>
  +
         </subsection>
       </section>
     </body>
  
  
  
  1.3       +1 -1      
avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context/casting.xml
  
  Index: casting.xml
  ===================================================================
  RCS file: 
/home/cvs/avalon-sandbox/merlin/merlin-smp/xdocs/starting/hello/context/casting.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- casting.xml       4 Apr 2003 12:17:19 -0000       1.2
  +++ casting.xml       4 Apr 2003 15:49:48 -0000       1.3
  @@ -30,7 +30,7 @@
           with casting and context entry key references.
           </p>
           <p>
  -        For example, the followign code fragment demonstrates a type
  +        For example, the following code fragment demonstrates a type
           safe casting of a supplied context value by the component to 
           domain specific context interface.
           </p>
  
  
  
  1.3       +1 -1      
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.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- navigation.xml    4 Apr 2003 12:17:19 -0000       1.2
  +++ navigation.xml    4 Apr 2003 15:49:48 -0000       1.3
  @@ -23,8 +23,8 @@
               <item name="Custom Entries" 
href="/starting/hello/context/entries.html"/>
               <item name="Context Casting" 
href="/starting/hello/context/casting.html"/>
             </item>
  -          <item name="Dependencies" href="/starting/hello/dependencies.html"/>
             <item name="Services" href="/starting/hello/services.html"/>
  +          <item name="Dependencies" href="/starting/hello/dependencies.html"/>
           </item>
           <item name="Advanced Features" href="/starting/advanced/index.html"/>
         </item>
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to