mcconnell 2003/06/18 04:19:28
Modified: merlin/merlin-platform/tutorials/dependencies/src/java/tutorial
HelloComponent.java RandomGeneratorProvider.java
merlin/merlin-platform/tutorials/hello/src/java/tutorial
HelloComponent.java
merlin/merlin-platform/xdocs/starting/tutorial
dependencies.xml
Log:
Moved some of the tutorials from ant to maven based builds and updated docs.
Started improvements to the inital hello demo so we can move it towards a more
interesting inital presentation in the tutorial structure.
Revision Changes Path
1.2 +11 -0
avalon-sandbox/merlin/merlin-platform/tutorials/dependencies/src/java/tutorial/HelloComponent.java
Index: HelloComponent.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/dependencies/src/java/tutorial/HelloComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HelloComponent.java 10 Jun 2003 02:12:24 -0000 1.1
+++ HelloComponent.java 18 Jun 2003 11:19:28 -0000 1.2
@@ -5,6 +5,12 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
+/**
+ * The HelloComponent is dependent on a RandomGenerator service.
+ * @avalon.meta.version 1.0
+ * @avalon.meta.name hello
+ * @avalon.meta.lifestyle singleton
+ */
public class HelloComponent extends AbstractLogEnabled
implements Serviceable
{
@@ -13,6 +19,11 @@
* Servicing of the component by the container during
* which service dependencies declared under the component
* can be resolved using the supplied service manager.
+ *
+ * @param manager the service manager
+ * @avalon.meta.dependency
+ * type="tutorial.RandomGenerator:1.0"
+ * key="random"
*/
public void service( ServiceManager manager )
throws ServiceException
1.2 +5 -0
avalon-sandbox/merlin/merlin-platform/tutorials/dependencies/src/java/tutorial/RandomGeneratorProvider.java
Index: RandomGeneratorProvider.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/dependencies/src/java/tutorial/RandomGeneratorProvider.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- RandomGeneratorProvider.java 10 Jun 2003 02:12:24 -0000 1.1
+++ RandomGeneratorProvider.java 18 Jun 2003 11:19:28 -0000 1.2
@@ -5,6 +5,11 @@
/**
* An implementation of a random number generator.
+ *
+ * @avalon.meta.version 1.0
+ * @avalon.meta.name random
+ * @avalon.meta.service type="tutorial.RandomGenerator:1.0"
+ * @avalon.meta.lifestyle singleton
*/
public class RandomGeneratorProvider implements RandomGenerator
{
1.2 +23 -2
avalon-sandbox/merlin/merlin-platform/tutorials/hello/src/java/tutorial/HelloComponent.java
Index: HelloComponent.java
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/tutorials/hello/src/java/tutorial/HelloComponent.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HelloComponent.java 10 Jun 2003 02:12:24 -0000 1.1
+++ HelloComponent.java 18 Jun 2003 11:19:28 -0000 1.2
@@ -2,9 +2,12 @@
package tutorial;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.activity.Disposable;
+import org.apache.avalon.framework.activity.Executable;
import org.apache.avalon.framework.activity.Initializable;
-public class HelloComponent extends AbstractLogEnabled implements Initializable
+public class HelloComponent extends AbstractLogEnabled
+ implements Initializable, Executable, Disposable
{
/**
* Initialization of the component by the container.
@@ -12,6 +15,24 @@
*/
public void initialize() throws Exception
{
- getLogger().info( "I've been initialized!" );
+ getLogger().info( "initialization stage executed." );
}
+
+ /**
+ * Component execution trigger by the container following
+ * completion of the initialization stage.
+ */
+ public void execute()
+ {
+ getLogger().info( "execution stage." );
+ }
+
+ /**
+ * Component disposal trigger by the container during which
+ * the component will release consumed resources.
+ */
+ public void dispose()
+ {
+ getLogger().info( "disposal stage." );
+ }
}
1.2 +21 -7
avalon-sandbox/merlin/merlin-platform/xdocs/starting/tutorial/dependencies.xml
Index: dependencies.xml
===================================================================
RCS file:
/home/cvs/avalon-sandbox/merlin/merlin-platform/xdocs/starting/tutorial/dependencies.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- dependencies.xml 10 Jun 2003 02:14:33 -0000 1.1
+++ dependencies.xml 18 Jun 2003 11:19:28 -0000 1.2
@@ -36,6 +36,12 @@
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.ServiceException;
+/**
+ * The HelloComponent is dependent on a RandomGenerator service.
+ * @avalon.meta.version 1.0
+ * @avalon.meta.name hello
+ * @avalon.meta.lifestyle singleton
+ */
public class HelloComponent extends AbstractLogEnabled
implements Serviceable
{
@@ -44,6 +50,11 @@
* Servicing of the component by the container during
* which service dependencies declared under the component
* can be resolved using the supplied service manager.
+ *
+ * @param manager the service manager
+ * @avalon.meta.dependency
+ * type="tutorial.RandomGenerator:1.0"
+ * key="random"
*/
public void service( ServiceManager manager )
throws ServiceException
@@ -56,19 +67,22 @@
</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.
+ In this example we are automatically generating the xinfo descriptors
+ using the builtin meta-info generation goal. The generated xinfo
+ for the hello component is shown below.
</p>
<p><i>HelloComponent.xinfo</i></p>
<source><![CDATA[
<type>
<info>
<name>hello</name>
- <version>1.0</version>
+ <version>1.0.0</version>
+ <attributes>
+ <attribute key="urn:avalon:lifestyle" value="singleton"/>
+ </attributes>
</info>
<dependencies>
- <dependency key="random" type="tutorial.RandomGenerator"/>
+ <dependency key="random" type="tutorial.RandomGenerator:1.0.0"/>
</dependencies>
</type>
]]></source>
@@ -78,8 +92,8 @@
Build and run the tutorial.
</p>
<source>
-$ ant
-$ merlin build\classes
+$ maven
+$ merlin target\merlin-tutorial-dependencies-1.0.jar -execute
</source>
<p>
In the logging output we see that Merlin has automatically
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]