You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by le...@apache.org on 2002/07/03 22:21:04 UTC
cvs commit: jakarta-avalon-excalibur/tweety/src/conf build.xml
leosimons 2002/07/03 13:21:03
Modified: tweety build.xml default.properties README.txt
tweety.properties
tweety/src/xdocs faq.xml features.xml getting-started.xml
tweety/src/java/org/apache/avalon/excalibur/tweety
Tweety.java
tweety/src/java/org/apache/avalon/excalibur/tweety/demos
ChirpWorld.java
Added: tweety/src/conf build.xml
Log:
expand on docs, expand logging, create distribution
Revision Changes Path
1.5 +49 -12 jakarta-avalon-excalibur/tweety/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/build.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- build.xml 2 Jul 2002 16:30:16 -0000 1.4
+++ build.xml 3 Jul 2002 20:21:03 -0000 1.5
@@ -4,7 +4,7 @@
<!ENTITY cocoon-targets SYSTEM "../cocoon.xtarget">
]>
-<project name="Avalon Excalibur's Tweety" default="main" basedir=".">
+<project name="Avalon Excalibur's Tweety" default="run" basedir=".">
&cocoon-targets;
@@ -56,8 +56,7 @@
<!-- =================================================================== -->
<!-- Run Tweety -->
<!-- =================================================================== -->
- <target name="run"
- depends="compile"
+ <target name="run" depends="compile"
description="Runs the program">
<java classname="org.apache.avalon.excalibur.tweety.Tweety" fork="true" dir="." failonerror="true">
@@ -276,21 +275,58 @@
<!-- Creates the distribution -->
<target name="dist"
- depends="dist-jar, test-reports, checkstyle-report, javadocs"
+ depends="dist-jar, test-reports, checkstyle-report, docs"
description="Generates a distribution (jar + javadocs + unit tests + checkstyle reports)">
<copy file="${build.conf}/LICENSE.txt" todir="${dist.dir}"/>
+ <copy file="${conf.dir}/build.xml" todir="${dist.dir}"/>
+ <copy file="tweety.properties" todir="${dist.dir}"/>
<copy file="../KEYS" todir="${dist.dir}"/>
<copy file="README.txt" todir="${dist.dir}"/>
+ <copy file="${avalon-framework.jar}" tofile="${dist.dir}/avalon-framework.jar"/>
<mkdir dir="${dist.base}"/>
- <zip zipfile="${dist.base}/${dist.name}-bin.zip" compress="true">
+ <copy todir="${dist.dir}/docs">
+ <fileset dir="${build.docs}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+ <copy todir="${dist.dir}/src">
+ <fileset dir="${src.dir}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <mkdir dir="${dist.dir}/lib"/>
+ <mkdir dir="${dist.dir}/classes"/>
+
+ <!-- create temporary dir so we can get a proper .tar even with the current, released ant -->
+ <mkdir dir="${dist.base}/${dist.name}"/>
+ <copy todir="${dist.base}/${dist.name}">
+ <fileset dir="${dist.dir}">
+ <include name="**/*"/>
+ </fileset>
+ </copy>
+
+ <zip zipfile="${dist.base}/${dist.name}.zip" compress="true">
<zipfileset dir="${dist.dir}" prefix="${dist.name}"/>
</zip>
- <!--
+ <tar longfile="gnu" tarfile="${dist.base}/${dist.name}.tar">
+ <tarfileset dir="${dist.base}/" username="avalon" group="avalon">
+ <include name="${dist.name}/**"/>
+ </tarfileset>
+ </tar>
+
+ <gzip zipfile="${dist.base}/${dist.name}.tar.gz"
+ src="${dist.base}/${dist.name}.tar"/>
+
+ <delete file="${dist.base}/${dist.name}.tar"/>
+ <delete dir="${dist.base}/${dist.name}" />
+
+ <!--
Not supported by released ant but when it is we should enable this across
all of the products
<tar longfile="gnu" tarfile="${dist.base}/${dist.name}-bin.tar">
@@ -311,7 +347,8 @@
<fileset dir="${dist.base}" />
</checksum>
-->
- <delete dir="${dist.dir}" />
+ <!--<delete dir="${dist.dir}" />-->
+
</target>
@@ -323,7 +360,7 @@
<include name="*.jar"/>
</fileset>
</copy>
- </target>
+ </target>
<!-- Creates a minimal distribution -->
<target name="dist.lite"
@@ -345,7 +382,7 @@
<filter token="status" value="${status}"/>
<filter token="release" value="${release}"/>
<filter token="short-version" value="${short.version}"/>
-
+
<property name="avalon.base" value="http://jakarta.apache.org/avalon"/>
<property name="framework.base" value="http://jakarta.apache.org/avalon/framework"/>
<property name="phoenix.base" value="http://jakarta.apache.org/avalon/phoenix"/>
@@ -361,7 +398,7 @@
<filter token="LOGKIT_BASE" value="${logkit.base}"/>
<filter token="TESTLET_BASE" value="${testlet.base}"/>
</target>
-
+
<!-- Prepares the documentation directory -->
<target name="docs" depends="html-docs, javadocs" description="generates all the Avalon documentation"/>
@@ -370,9 +407,9 @@
<target name="site" depends="javadocs, docs" description=" Places Docs ready for hosting on website">
- <mkdir dir="../site/dist/docs/${dir-name}"/>
+ <mkdir dir="../site/dist/docs/${dir-name}"/>
<copy todir="../site/dist/docs/${dir-name}">
- <fileset dir="${docs.dir}">
+ <fileset dir="${build.docs}">
<include name="**"/>
</fileset>
</copy>
1.3 +1 -1 jakarta-avalon-excalibur/tweety/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/default.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- default.properties 2 Jul 2002 16:30:17 -0000 1.2
+++ default.properties 3 Jul 2002 20:21:03 -0000 1.3
@@ -8,7 +8,7 @@
name=excalibur-tweety
Name=Excalibur Tweety
dir-name=tweety
-version=1.0
+version=1.0.1-alpha
package-version=0.99
year=2000-2002
1.3 +51 -8 jakarta-avalon-excalibur/tweety/README.txt
Index: README.txt
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/README.txt,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- README.txt 27 Jun 2002 16:57:18 -0000 1.2
+++ README.txt 3 Jul 2002 20:21:03 -0000 1.3
@@ -1,6 +1,13 @@
Avalons Excalibur Tweety
-----------------------------
+License
+-------
+
+Please see the LICENSE.txt file that came with this distribution for
+licensing terms.
+
+
Background
----------
@@ -12,6 +19,7 @@
Tweety is a minimalist container explicitly designed for educational
purposes.
+
Goals
-----
- be well documented
@@ -27,18 +35,53 @@
- no classloader management
- separation of engine and (mainable) embeddor
+
Use Case
--------
An example of an avalon container for simple components, to use in
teaching avalon concepts.
+
Getting Started:
----------------
-If you downloaded a source release of the component then you
-will need to build the component. Directions for building the
-component are located in BUILDING.txt
-
-If you downloaded a binary release, or a release with both binary
-and source then it is recomended you look over the documentation
-in docs/index.html - and then look into the examples/ directory
-for examples of the component in action.
+Make sure you have ant installed, then type 'ant' in the directory where
+you extracted the distribution. This will start up tweety and run the
+included sample. You should see output on your screen similar to the
+following:
+
+Buildfile: build.xml
+
+run:
+ [java] [INFO] Tweety: Tweety is starting up...
+ [java] [INFO] Tweety: Tweety is setting up the component implementing role 'chirp-mondo'
+ [java] [INFO] Tweety: Tweety is setting up the component implementing role 'chirp-world'
+ [java] [INFO] Tweety: Tweety is starting the component implementing role chirp-mondo
+ [java] [INFO] ChirpWorld: I thawgt I saw a pussycat!
+ [java] [INFO] Tweety: Tweety is starting the component implementing role chirp-world
+ [java] [INFO] ChirpWorld: I thawgt I saw a pussycat!
+ [java] [INFO] Tweety: Tweety has started.
+ [java] [INFO] Tweety: Tweety is stopping the component implementing role chirp-mondo
+ [java] [INFO] Tweety: Tweety is stopping the component implementing role chirp-world
+ [java] [INFO] Tweety: Tweety has stopped.
+
+BUILD SUCCESSFUL
+
+Total time: 2 seconds
+
+
+Now, drop the classes containing your avalon components into the classes/
+directory, and any required library jars into the lib/ directory (if you
+have your components packaged into jar files, you can drop those into the
+lib/ directory as well).
+
+Then, modify the tweety.properties file so tweety knows about your components.
+The name you choose for the component is the name other components will be able
+to find it under in their ComponentManager and/or ServiceManager.
+
+Type 'ant' again and your components should run. It is that simple!
+
+
+More Documentation
+------------------
+Please see docs/index.html for more, or the tweety site at
+http://jakarta.apache.org/avalon/excalibur/tweety.
\ No newline at end of file
1.2 +0 -1 jakarta-avalon-excalibur/tweety/tweety.properties
Index: tweety.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/tweety.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tweety.properties 22 Jun 2002 15:18:12 -0000 1.1
+++ tweety.properties 3 Jul 2002 20:21:03 -0000 1.2
@@ -7,4 +7,3 @@
# FORMAT: <role> = <javaclassname>
chirp-world = org.apache.avalon.excalibur.tweety.demos.ChirpWorld
-chirp-mondo = org.apache.avalon.excalibur.tweety.demos.ChirpWorld
1.2 +9 -3 jakarta-avalon-excalibur/tweety/src/xdocs/faq.xml
Index: faq.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/src/xdocs/faq.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- faq.xml 2 Jul 2002 16:30:17 -0000 1.1
+++ faq.xml 3 Jul 2002 20:21:03 -0000 1.2
@@ -8,8 +8,14 @@
</authors>
</header>
<body>
- <s1 title="Not written yet!">
- <p>TBD</p>
+ <s1 title="Why tweety?">
+ <p>Some people found avalon very complex to get started with. We decided a good way to
+ fix this was to provide an implementation specifically geared at learning how avalon
+ works: tweety.</p>
+ </s1>
+ <s1 title="Will you add feature XXX to tweety?">
+ <p>Very unlikely. That would probably increase tweety in size and complexity, which we
+ don't want.</p>
</s1>
</body>
<footer>
1.2 +5 -3 jakarta-avalon-excalibur/tweety/src/xdocs/features.xml
Index: features.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/src/xdocs/features.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- features.xml 2 Jul 2002 16:30:17 -0000 1.1
+++ features.xml 3 Jul 2002 20:21:03 -0000 1.2
@@ -8,8 +8,10 @@
</authors>
</header>
<body>
- <s1 title="Not written yet!">
- <p>TBD</p>
+ <s1 title="Simple, simple, simple">
+ <p>The one feature that Tweety has as opposed to related avalon projects is that it is
+ simple, simple, simple. Following the getting started document should get you running
+ tweety in about 2 minutes, and developing components in 10.</p>
</s1>
</body>
<footer>
1.2 +26 -2 jakarta-avalon-excalibur/tweety/src/xdocs/getting-started.xml
Index: getting-started.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/src/xdocs/getting-started.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- getting-started.xml 2 Jul 2002 16:30:17 -0000 1.1
+++ getting-started.xml 3 Jul 2002 20:21:03 -0000 1.2
@@ -8,7 +8,31 @@
</authors>
</header>
<body>
- <s1 title="Not written yet!">
+ <s1 title="Introduction">
+ <p>Getting started with tweety is quite simple. In a nutshell:</p>
+
+ <ol>
+ <li>Download and install a Java Runtime Environment or Java Development Kit if you
+ haven't already. If you don't know how to this, Avalon is not for you. Get some java
+ experience first.</li>
+ <li>Download and install <link href="http://jakarta.apache.org/ant">ant</link> if you
+ don't have it installed already.</li>
+ <li>Download and unpack the
+ <link href="http://jakarta.apache.org/builds/jakarta-avalon-excalibur/release/tweety">distribution</link></li>
+ <li><strong>optional:</strong> Drop your Tweety-compatible Avalon components into the
+ <code>classes/</code> directory inside
+ the distribution</li>
+ <li><strong>optional:</strong> Drop any libraries your components depend on into the <code>lib/</code> directory</li>
+ <li><strong>optional:</strong> Modify <code>tweety.properties</code> to know about your components</li>
+ <li>at the root of the distribution, type 'ant'</li>
+ <li>Your components should run! We include one component with Tweety called
+ ChirpWorld which will run automatically.</li>
+ </ol>
+ </s1>
+ <s1 title="Detailed installation instructions">
+ <p>Please read the <link href="install.html">Install Document</link>.</p>
+ </s1>
+ <s1 title="Component writing tutorial">
<p>TBD</p>
</s1>
</body>
1.4 +48 -27 jakarta-avalon-excalibur/tweety/src/java/org/apache/avalon/excalibur/tweety/Tweety.java
Index: Tweety.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/src/java/org/apache/avalon/excalibur/tweety/Tweety.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Tweety.java 23 Jun 2002 22:09:12 -0000 1.3
+++ Tweety.java 3 Jul 2002 20:21:03 -0000 1.4
@@ -122,11 +122,11 @@
*/
public static void main( String[] args )
{
+ // create logger
+ ConsoleLogger logger = new ConsoleLogger( ConsoleLogger.LEVEL_INFO );
+
try
{
- // create logger
- Logger logger = new ConsoleLogger();
-
/** @todo: this is stupid. Figure out what to do about contexts */
// create dummy context
Context context = new DefaultContext();
@@ -140,16 +140,35 @@
properties.load(new FileInputStream("tweety.properties"));
// create parameters from properties
- Parameters params = new Parameters();
- params.fromProperties( properties );
+ Parameters params = Parameters.fromProperties( properties );
+
+ // debug: show the stuff we feed into tweety
// create tweety instance
Tweety tweety = new Tweety();
+
+ logger.debug("Tweety: Providing tweety with a console logger.");
tweety.enableLogging( logger );
+
+ logger.debug("Tweety: Providing tweety with an empty context.");
tweety.contextualize( context );
+
+ logger.debug("Tweety: Providing tweety with an empty configuration");
tweety.configure( config );
+
+ String[] paramNames = params.getNames();
+ logger.debug("Tweety: Configuring tweety with the following parameters:");
+ for( int i = 0; i < paramNames.length; i++ )
+ {
+ logger.debug(" parameter: " + paramNames[i] +
+ " = " + params.getParameter(paramNames[i]) );
+ }
tweety.parameterize( params );
+
+ logger.debug("Tweety: Initializing tweety.");
tweety.initialize();
+
+ logger.debug("Tweety: Starting tweety");
tweety.start();
//
@@ -160,14 +179,12 @@
}
catch( java.io.IOException ioe )
{
- ioe.printStackTrace();
- System.err.println("Error reading configuration file.\nProgram Terminated");
+ logger.error( "Tweety: Error reading configuration file.\nProgram Terminated", ioe );
System.exit(-4);
}
catch( Exception e )
{
- e.printStackTrace();
- System.err.println("Error.\nProgram Terminated");
+ logger.error( "Tweety: Error starting up.\nProgram Terminated", e );
System.exit(-2);
}
}
@@ -182,7 +199,7 @@
public void enableLogging( Logger logger )
{
m_logger = logger;
- logger.debug( "Tweety got a logger" );
+ logger.debug( "Tweety: Tweety got a logger" );
}
/**
@@ -194,7 +211,7 @@
public void contextualize( Context context )
{
m_context = context;
- m_logger.debug( "Tweety got a context" );
+ m_logger.debug( "Tweety: Tweety got a context" );
}
/**
@@ -206,7 +223,7 @@
public void configure( Configuration configuration )
{
m_configuration = configuration;
- m_logger.debug( "Tweety got a configuration" );
+ m_logger.debug( "Tweety: Tweety got a configuration" );
}
/**
@@ -256,7 +273,7 @@
// we'll simply store these for later use
m_parameters = parameters;
- m_logger.debug( "Tweety got its parameters" );
+ m_logger.debug( "Tweety: Tweety got its parameters" );
}
/**
@@ -298,15 +315,19 @@
// the component doesn't have a public no arguments constructor!
// log error
- m_logger.error( "The class " + clazz +
+ m_logger.error( "Tweety: The class " + clazz +
" specified properties file is not a valid avalon tweety component:" +
" it doesn't have a public no-arguments constructor!" );
-
- //
}
}
- m_logger.debug( "Tweety has been initialized" );
+ // create the global ComponentManager
+ m_componentManager = new DefaultComponentManager();
+
+ // create the global ServiceManager
+ m_serviceManager = new DefaultServiceManager();
+
+ m_logger.debug( "Tweety: Tweety has been initialized" );
}
/**
@@ -316,7 +337,7 @@
*/
public void start()
{
- m_logger.info( "Tweety is starting up..." );
+ m_logger.info( "Tweety: Tweety is starting up..." );
// get all the roles
Iterator it = m_components.keySet().iterator();
@@ -329,7 +350,7 @@
// component that implements the role
Object component = m_components.get( role );
- m_logger.info( "Tweety is setting up the componet implementing role " + role );
+ m_logger.info( "Tweety: Tweety is setting up the component implementing role '" + role + "'");
try
{
@@ -363,9 +384,9 @@
// log the error
m_logger.error(
- "We were unable to set up the component with the role: " + role +
+ "Tweety: We were unable to set up the component with the role: " + role +
".\n The exception thrown was: " + e.getClass() +
- ", with the message" + e.getMessage() );
+ ", with the message: " + e.getMessage() );
// remove the component from our interal list so we don't try
// and start() or stop() it later
@@ -387,7 +408,7 @@
// current component
Object component = m_components.get( role );
- m_logger.info( "Tweety is starting the component implementing role " + role );
+ m_logger.info( "Tweety: Tweety is starting the component implementing role " + role );
try
{
@@ -400,7 +421,7 @@
// log the error
m_logger.error(
- "We were unable to start the component with the role: " + role +
+ "Tweety: We were unable to start the component with the role: " + role +
".\n The exception thrown was: " + e.getClass().getName() +
",\n with the message" + e.getMessage() );
@@ -410,7 +431,7 @@
}
}
- m_logger.info( "Tweety has started." );
+ m_logger.info( "Tweety: Tweety has started." );
}
/**
@@ -430,7 +451,7 @@
// current component
Object component = m_components.get( role );
- m_logger.info( "Tweety is stopping the component implementing role " + role );
+ m_logger.info( "Tweety: Tweety is stopping the component implementing role " + role );
try
{
@@ -445,13 +466,13 @@
// we failed to stop this component properly!
// log the problem, but don't do anything else
m_logger.error(
- "We were unable to start the component with the role: " + role +
+ "Tweety: We were unable to start the component with the role: " + role +
".\n The exception thrown was: " + e.getClass().getName() +
",\n with the message" + e.getMessage() );
}
}
- m_logger.info( "Tweety has stopped." );
+ m_logger.info( "Tweety: Tweety has stopped." );
}
}
1.4 +9 -9 jakarta-avalon-excalibur/tweety/src/java/org/apache/avalon/excalibur/tweety/demos/ChirpWorld.java
Index: ChirpWorld.java
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/tweety/src/java/org/apache/avalon/excalibur/tweety/demos/ChirpWorld.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- ChirpWorld.java 23 Jun 2002 22:09:12 -0000 1.3
+++ ChirpWorld.java 3 Jul 2002 20:21:03 -0000 1.4
@@ -38,47 +38,47 @@
public void enableLogging( Logger logger )
{
this.logger = logger;
- logger.debug("enableLogging() called, Logger gotten");
+ logger.debug("ChirpWorld: enableLogging() called, Logger gotten");
}
public void contextualize( Context context )
{
this.context = context;
- logger.debug("contextualize() called, Context gotten");
+ logger.debug("ChirpWorld: contextualize() called, Context gotten");
}
public void compose( ComponentManager cm )
{
this.cm = cm;
- logger.debug("compose() called, ComponentManager gotten");
+ logger.debug("ChirpWorld: compose() called, ComponentManager gotten");
}
public void service( ServiceManager cm )
{
this.sm = sm;
- logger.debug("service() called, ServiceManager gotten");
+ logger.debug("ChirpWorld: service() called, ServiceManager gotten");
}
public void initialize()
{
- logger.debug("initialize() called");
+ logger.debug("ChirpWorld: initialize() called");
}
public void start()
{
- logger.debug("start() called");
+ logger.debug("ChirpWorld: start() called");
- logger.info( "I thawgt I saw a pussycat!" );
+ logger.info( "ChirpWorld: I thawgt I saw a pussycat!" );
}
public void stop()
{
- logger.debug("stop() called");
+ logger.debug("ChirpWorld: stop() called");
}
public void dispose()
{
- logger.debug("dispose called");
+ logger.debug("ChirpWorld: dispose called");
}
}
1.1 jakarta-avalon-excalibur/tweety/src/conf/build.xml
Index: build.xml
===================================================================
<?xml version="1.0"?>
<!-- Provided with distribution to run tweety -->
<project name="Tweety Runner" default="run" basedir=".">
<property file="${user.home}/build.properties"/>
<property file="${user.home}/.ant.properties"/>
<property name="avalon-framework.jar" value="avalon-framework.jar"/>
<property name="tweety.jar" value="excalibur-tweety-1.0.1-alpha.jar"/>
<property name="classes.dir" value="classes"/>
<property name="lib.dir" value="lib"/>
<!-- Classpath for product -->
<path id="project.class.path">
<pathelement location="${avalon-framework.jar}"/>
<pathelement location="${tweety.jar}"/>
<pathelement path="${java.class.path}"/>
<pathelement path="{classes.dir}"/>
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>
</path>
<target name="main" depends="run" description="Run tweety"/>
<!-- =================================================================== -->
<!-- Run Tweety -->
<!-- =================================================================== -->
<target name="run"
description="Runs the program">
<java classname="org.apache.avalon.excalibur.tweety.Tweety"
fork="true" dir="." failonerror="true">
<classpath refid="project.class.path" />
</java>
</target>
</project>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>