mcconnell 2003/09/06 02:15:45 Modified: merlin/merlin-platform/tutorials/composition README.txt merlin/merlin-platform/xdocs/starting/advanced composite.xml Log: Doc updates (composition tutorial doc was a little out of sync with the actual tutorial implementation). Revision Changes Path 1.5 +1 -1 avalon-sandbox/merlin/merlin-platform/tutorials/composition/README.txt Index: README.txt =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/composition/README.txt,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- README.txt 20 Aug 2003 17:55:07 -0000 1.4 +++ README.txt 6 Sep 2003 09:15:45 -0000 1.5 @@ -5,7 +5,7 @@ Overview -------- -This tutorial presents the creation ofn virtual components +This tutorial presents the creation of virtual components using composition of package containers. In this demonstration we have three application groups, a top level application, a locator system, and a publisher system. The top level app 1.4 +59 -66 avalon-sandbox/merlin/merlin-platform/xdocs/starting/advanced/composite.xml Index: composite.xml =================================================================== RCS file: /home/cvs/avalon-sandbox/merlin/merlin-platform/xdocs/starting/advanced/composite.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- composite.xml 16 Aug 2003 11:16:34 -0000 1.3 +++ composite.xml 6 Sep 2003 09:15:45 -0000 1.4 @@ -11,24 +11,25 @@ <section name="Advanced Features"> <subsection name="Composite Blocks"> <p> - A block can declare services that it exports. In such a case - the block contains directives that map components declared - in the block implementation directive as service providers. - This mechanism enables blocks to behave like regular components. + A container can declare services that it exports. In such a case + the container declares one or more service directives that map + components declared within itself as service providers. + This mechanism enables a container to appear as a regular + component relative to other components. </p> <p> Content supporting this tutorial is available under the - tutorial/composition directory. + tutorials/composition directory. </p> </subsection> - <subsection name="Sample Blocks"> + <subsection name="Sample Container"> <p> - The following block definition contains: + The following container definition includes: </p> <ul> - <li><p>a publisher block</p></li> - <li><p>a location provider block</p></li> - <li><p>an application block</p></li> + <li><p>an application component</p></li> + <li><p>a location provider block inlcuded by reference</p></li> + <li><p>an application block included by reference</p></li> </ul> <p> The application block declares dependencies on a location @@ -37,72 +38,72 @@ the general component assembly process - Merlin will assemble blocks relative to the services and dependencies they declare. When a block is deployed, it appears to other components as a - component providing the services it declares. However in practice - these services are provided by components with the <implementation> - of the block. + component providing the services it exports. However in practice + these services are provided by components defined with the + container (i.e. the container represents the defintion of + a virtual component and the containers components and subcontainers + represent the virual compoent implementation). </p> - <p>The top level block declaration (block.xml):</p> + <p>The top level application block declaration (block.xml):</p> <source><![CDATA[ -<container name="tutotial"> +<container name="application"> <classloader> <classpath> <repository> - <resource id="tutorial:composition-api" version="1.0"/> + <resource id="avalon-framework:avalon-framework-api" version="SNAPSHOT"/> + <resource id="avalon-framework:avalon-framework-impl" version="SNAPSHOT"/> + <resource id="merlin-tutorial:locator-api" version="1.0"/> + <resource id="merlin-tutorial:publisher-api" version="1.0"/> + <resource id="merlin-tutorial:application-impl" version="1.0"/> </repository> </classpath> </classloader> - <include id="tutorial:composition-publisher" version="1.0"/> - <include id="tutorial:composition-application" version="1.0"/> - <include id="tutorial:composition-location" version="1.0"/> + <!-- + note: each of the following include directives is equivalent to + a nested container declaration - using include or declaraing a + sub-container is semantically equivalent + --> -</container> -]]></source> - <p> - The common shared API (containing interfaces) is declared in - in the classpath as a referencable library. The three include - statements (publisher, application and location) are established - by Merlin in a deployment order consistent with their respective - dependencies. In the above example, the block definitions are - resolved from the block.xml files containing in the respective - jar files. - </p> - <source><![CDATA[ -<container name="composition-block"> - - <classloader> - <classpath> - <repository> - <resource id="tutorial:composition-api" version="1.0"/> - </repository> - </classpath> - </classloader> + <include name="location" id="merlin-tutorial:locator-impl" version="1.0"/> + <include name="publisher" id="merlin-tutorial:publisher-impl" version="1.0"/> <component name="application" - class="tutorial.application.Application" activation="startup"> + class="tutorial.application.Application"> </component> </container> ]]></source> <p> - If we look at the locator block (as an example) we will see a corresponding + If we look at the location block (as an example) we will see a corresponding service declaration. This declaration includes a source reference that is a relative component path that tells Merlin to use the sub-component named "location" as the component that will fulfil the service published by this block. </p> <source><![CDATA[ -<container name="location-block"> +<container name="locator"> <services> - <service type="tutorial.LocationService"> - <source>location</source> + <service type="tutorial.location.LocationService"> + <source>info</source> </service> </services> - <component name="location" - class="tutorial.location.LocationComponent" activation="startup"> + <classloader> + <classpath> + <repository> + <resource id="avalon-framework:avalon-framework-api" version="SNAPSHOT"/> + <resource id="avalon-framework:avalon-framework-impl" version="SNAPSHOT"/> + <resource id="merlin-tutorial:locator-api" version="1.0"/> + <resource id="merlin-tutorial:locator-impl" version="1.0"/> + </repository> + </classpath> + </classloader> + + <component name="info" + class="tutorial.location.LocationComponent"> <configuration> <source>Paris</source> </configuration> @@ -114,15 +115,12 @@ </subsection> <subsection name="Execution"> <p> - The execute the tutorial you need to invoke "ant install". This will - result in the installation of the tutorial jar files into the Merlin - repository. NOTE: to run the demo use the "src\config\block.xml" - defintion. + To run build and run the example please use the following commands: </p> <source><![CDATA[ -$ cd tutorial\composition -$ ant install -$ merlin scr\config\block.xml +$ cd application/impl +$ maven build +$ merlin target\*.jar -system %MAVEN_HOME% -execute ]]></source> <p> The log output demonstrates the deployment by Merlin of the blocks @@ -130,21 +128,16 @@ execution of the test application. </p> <source><![CDATA[ -[INFO ] (location-block.location): location: Paris -[INFO ] (location-block): initialization -[INFO ] (publisher-block.publisher): created -[INFO ] (publisher-block): initialization -[INFO ] (application-block.application): servicing application -[INFO ] (publisher-block.publisher): +[INFO ] (application.publisher.publisher): created +[INFO ] (application.location.info): location: Paris +[INFO ] (application.application): servicing application +[INFO ] (application.location.info): location: Paris +[INFO ] (application.publisher.publisher): created +[INFO ] (application.publisher.publisher): ****************** * Paris ****************** -[INFO ] (application-block.application): done -[INFO ] (application-block): initialization -[INFO ] (sys): commencing decommissioning phase -[INFO ] (application-block.application): disposal -[INFO ] (location-block.location): disposal -[INFO ] (publisher-block.publisher): disposal +[INFO ] (application.application): done ]]></source> </subsection> <subsection name="Note">
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]