You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by bl...@apache.org on 2002/05/29 15:20:32 UTC
cvs commit: jakarta-avalon-excalibur/datasource/examples/conf components.xml logkit.xml roles.xml
bloritsch 02/05/29 06:20:32
Added: datasource/examples build.bat build.sh build.xml
datasource/examples/bin cpappend.bat hsqldbmgr.bat run.bat
run.sh
datasource/examples/conf components.xml logkit.xml roles.xml
Log:
add examples from all/ to here
Revision Changes Path
1.1 jakarta-avalon-excalibur/datasource/examples/build.bat
Index: build.bat
===================================================================
@echo off
set BASE=..\..\..
call %BASE%\build.bat %1 %2 %3 %4 %5 %6 %7 %8
1.1 jakarta-avalon-excalibur/datasource/examples/build.sh
Index: build.sh
===================================================================
#!/bin/sh
BASE=`dirname $0` # Directory containing this script. Not the same as $PWD.
$BASE/../../../build.sh -f $BASE/build.xml $@
1.1 jakarta-avalon-excalibur/datasource/examples/build.xml
Index: build.xml
===================================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- ======================================================================= -->
<!-- Container Example build file! -->
<!-- ======================================================================= -->
<project name="jdbcdatasource" default="main" basedir=".">
<!-- ================================================================ -->
<!-- Local user-defined build properties. -->
<!-- ================================================================ -->
<!-- The file below should exist on your system. On Windows machines, -->
<!-- user.home is probably the root of the C drive, but you should -->
<!-- verify this. This file should be a normal Java properties file. -->
<property file="${user.home}/.ant.properties" />
<property name="name" value="jdbcdatasource"/>
<property name="Name" value="jdbcDataSource"/>
<!-- Directories build by ant -->
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.javadocs.dir" value="${build.dir}/javadocs"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="sqldata.dir" value="${basedir}/sqldata"/>
<!-- Existing directories -->
<property name="src.dir" value="${basedir}/src"/>
<property name="src.java.dir" value="${src.dir}/java"/>
<property name="commonlib.dir" value="${basedir}/../commonlib"/>
<!-- Define paths used by this project -->
<path id="project.class.path">
<fileset dir="${commonlib.dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${build.classes.dir}" />
</path>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="usage">
<echo message="Use the -projecthelp option instead"/>
</target>
<target name="help" depends="usage"/>
<!-- =================================================================== -->
<!-- Help on usage -->
<!-- =================================================================== -->
<target name="collect-jars">
<ant antfile="build.xml" dir="${basedir}/.." target="collect-jars" inheritall="false"/>
</target>
<!-- =================================================================== -->
<!-- Initialize custom tasks -->
<!-- =================================================================== -->
<target name="init" depends="collect-jars">
</target>
<!-- =================================================================== -->
<!-- Compiles the source code -->
<!-- =================================================================== -->
<target name="compile" depends="init">
<mkdir dir="${build.dir}"/>
<mkdir dir="${build.classes.dir}"/>
<!-- compile everything under src/java -->
<javac srcdir="${src.java.dir}" destdir="${build.classes.dir}"
deprecation="on"
debug="on"
optimize="off">
<classpath refid="project.class.path" />
</javac>
<!-- copy image files to build directory -->
<copy todir="${build.classes.dir}" >
<fileset dir="${src.java.dir}" >
<include name="**/*.jpg" />
<include name="**/*.gif" />
</fileset>
</copy>
</target>
<!-- =================================================================== -->
<!-- Creates the jar archive -->
<!-- =================================================================== -->
<target name="jar" depends="compile" description="Builds the jar archive.">
<mkdir dir="${lib.dir}"/>
<jar jarfile="${lib.dir}/${name}.jar"
basedir="${build.classes.dir}"
includes="**/*.class,**/*.properties,**/*.xml,**/*.jpg,**/*.gif,**/*.roles"
/>
</target>
<!-- =================================================================== -->
<!-- Main target -->
<!-- =================================================================== -->
<target name="main" depends="jar" description="build the runnable application">
<mkdir dir="${sqldata.dir}"/>
</target>
<!-- =================================================================== -->
<!-- Creates the javadocs archive. -->
<!-- =================================================================== -->
<target name="javadocs" description="Generates javadoc documentation">
<mkdir dir="${build.javadocs.dir}"/>
<javadoc packagenames="org.apache.*"
sourcepath="${src.java.dir}"
destdir="${build.javadocs.dir}">
<classpath refid="project.class.path" />
<doclet name="com.sun.tools.doclets.standard.Standard">
<param name="-author"/>
<param name="-version"/>
<param name="-doctitle" value="${Name}"/>
<param name="-windowtitle" value="${Name} API"/>
<param name="-bottom"
value=""Copyright © 2001 Apache Jakarta Project. All Rights Reserved.""/>
</doclet>
</javadoc>
</target>
<!-- =================================================================== -->
<!-- Builds everything. -->
<!-- =================================================================== -->
<target name="all" depends="main, javadocs" description="Build everything"/>
<!-- =================================================================== -->
<!-- Cleans up compiled classes and generated XMLC source. -->
<!-- =================================================================== -->
<target name="clean" description="cleans up the directory">
<delete dir="${build.dir}"/>
</target>
</project>
1.1 jakarta-avalon-excalibur/datasource/examples/bin/cpappend.bat
Index: cpappend.bat
===================================================================
set _LIBJARS=%_LIBJARS%;%1
1.1 jakarta-avalon-excalibur/datasource/examples/bin/hsqldbmgr.bat
Index: hsqldbmgr.bat
===================================================================
@echo off
rem
rem Run HSQLDB Manager
rem
rem Author: Leif Mortenson [leif@tanukisoftware.com]
rem
rem Determine if JAVA_HOME is set and if so then use it
rem
if not "%JAVA_HOME%"=="" goto found_java
set EXAMPLE_JAVACMD=java
goto file_locate
:found_java
set EXAMPLE_JAVACMD=%JAVA_HOME%\bin\java
:file_locate
rem
rem Locate where the example is in filesystem
rem
if not "%OS%"=="Windows_NT" goto start
rem %~dp0 is name of current script under NT
set EXAMPLE_HOME=%~dp0
rem : operator works similar to make : operator
set EXAMPLE_HOME=%EXAMPLE_HOME:\bin\=%
:start
if not "%EXAMPLE_HOME%" == "" goto example_home
echo.
echo Warning: EXAMPLE_HOME environment variable is not set.
echo This needs to be set for Win9x as it's command prompt
echo scripting bites
echo.
goto end
:example_home
rem
rem build the runtime classpath
rem
set CP=%EXAMPLE_HOME%\lib\jdbcdatasource.jar
set _LIBJARS=;%EXAMPLE_HOME%\..\commonlib\hsqldb.jar
if not "%_LIBJARS%" == "" goto run
echo Unable to set CLASSPATH.
goto end
:run
set CP=%CP%%_LIBJARS%
rem Run the example application
%EXAMPLE_JAVACMD% -classpath "%CP%" org.hsqldb.util.DatabaseManager
:end
1.1 jakarta-avalon-excalibur/datasource/examples/bin/run.bat
Index: run.bat
===================================================================
@echo off
rem
rem Example start script.
rem
rem Author: Leif Mortenson [leif@tanukisoftware.com]
rem
rem Determine if JAVA_HOME is set and if so then use it
rem
if not "%JAVA_HOME%"=="" goto found_java
set EXAMPLE_JAVACMD=java
goto file_locate
:found_java
set EXAMPLE_JAVACMD=%JAVA_HOME%\bin\java
:file_locate
rem
rem Locate where the example is in filesystem
rem
if not "%OS%"=="Windows_NT" goto start
rem %~dp0 is name of current script under NT
set EXAMPLE_HOME=%~dp0
rem : operator works similar to make : operator
set EXAMPLE_HOME=%EXAMPLE_HOME:\bin\=%
:start
if not "%EXAMPLE_HOME%" == "" goto example_home
echo.
echo Warning: EXAMPLE_HOME environment variable is not set.
echo This needs to be set for Win9x as it's command prompt
echo scripting bites
echo.
goto end
:example_home
rem
rem build the runtime classpath
rem
set CP=%EXAMPLE_HOME%\lib\jdbcdatasource.jar
set _LIBJARS=
for %%i in (%EXAMPLE_HOME%\..\commonlib\*.jar) do call %EXAMPLE_HOME%\bin\cpappend.bat %%i
if not "%_LIBJARS%" == "" goto run
echo Unable to set CLASSPATH dynamically.
goto end
:run
set CP=%CP%%_LIBJARS%
rem Run the example application
%EXAMPLE_JAVACMD% -classpath "%CP%" org.apache.avalon.examples.jdbcdatasource.Main %1 %2 %3 %4 %5 %6 %7 %8 %9
:end
1.1 jakarta-avalon-excalibur/datasource/examples/bin/run.sh
Index: run.sh
===================================================================
#!/bin/bash
#
# Startup script.
#
#
# Determine if JAVA_HOME is set and if so then use it
#
if [ -z "$JAVA_HOME" ] ; then
JAVA=`which java`
if [ -z "$JAVA" ] ; then
echo "Cannot find JAVA. Please set your PATH."
exit 1
fi
JAVA_BINDIR=`dirname $JAVA`
JAVA_HOME=$JAVA_BINDIR/..
fi
if [ "$JAVACMD" = "" ] ; then
# it may be defined in env - including flags!!
JAVACMD=$JAVA_HOME/bin/java
fi
# Main.java has hard coded config values so this script must be run from
# altprofile/bin (any better ideas ?)
EXAMPLE_HOME=../..
#
# Build the runtime classpath
#
for i in ${EXAMPLE_HOME}/commonlib/*.jar ; do
CP=${CP}:$i
done
CP=${CP}:../lib/jdbcdatasource.jar
#echo $CP
# Run the example application
$JAVACMD -classpath $CP org.apache.avalon.examples.jdbcdatasource.Main $@
1.1 jakarta-avalon-excalibur/datasource/examples/conf/components.xml
Index: components.xml
===================================================================
<components logger="cm">
<!-- =============================================================== -->
<!-- Data sources. -->
<!-- =============================================================== -->
<datasources>
<jdbc name="test-db" logger="app.jdbc">
<pool-controller min="1" max="1">
<keep-alive disable="true"/>
</pool-controller>
<auto-commit>true</auto-commit>
<driver>org.hsqldb.jdbcDriver</driver>
<dburl>jdbc:hsqldb:..\sqldata\example</dburl>
<user>sa</user>
<password></password>
</jdbc>
</datasources>
<!-- =============================================================== -->
<!-- Application components. -->
<!-- =============================================================== -->
<hello-db logger="app">
<dbpool>test-db</dbpool>
</hello-db>
</components>
1.1 jakarta-avalon-excalibur/datasource/examples/conf/logkit.xml
Index: logkit.xml
===================================================================
<logkit logger="lm" log-level="INFO">
<factories>
<factory type="stream"
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
<factory type="file"
class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
<factory type="priority-filter"
class="org.apache.avalon.excalibur.logger.factory.PriorityFilterTargetFactory"/>
</factories>
<targets>
<stream id="console">
<stream>System.out</stream>
<format type="avalon">
%19.19{time:yyyy-MM-dd'T'HH:mm:ss.SSS} %5.5{priority} [%15.15{category}]: %{message}\n%{throwable}
</format>
</stream>
</targets>
<categories>
<!-- Role Manager Logger -->
<category name="rm" log-level="INFO">
<log-target id-ref="console"/>
</category>
<!-- Component Manager Logger -->
<category name="cm" log-level="INFO">
<log-target id-ref="console"/>
</category>
<!-- Application Loggers -->
<category name="app" log-level="INFO">
<log-target id-ref="console"/>
<category name="jdbc" log-level="INFO">
<log-target id-ref="console"/>
</category>
</category>
</categories>
</logkit>
1.1 jakarta-avalon-excalibur/datasource/examples/conf/roles.xml
Index: roles.xml
===================================================================
<role-list logger="rm">
<!-- =================================================================== -->
<!-- DataSource roles. -->
<!-- =================================================================== -->
<role name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector"
shorthand="datasources"
default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector">
<hint shorthand="jdbc" class="org.apache.avalon.excalibur.datasource.JdbcDataSource"/>
<hint shorthand="j2ee" class="org.apache.avalon.excalibur.datasource.J2eeDataSource"/>
</role>
<!-- =================================================================== -->
<!-- Application roles. -->
<!-- =================================================================== -->
<role name="org.apache.avalon.examples.jdbcdatasource.HelloDBService"
shorthand="hello-db"
default-class="org.apache.avalon.examples.jdbcdatasource.DefaultHelloDBService"/>
</role-list>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>