You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by ha...@apache.org on 2003/03/02 13:33:22 UTC
cvs commit: avalon-phoenix/src/bsh printApps.bsh printBlocks.bsh removeApp.bsh
hammant 2003/03/02 04:33:22
Modified: . ant.properties.sample build.xml
Added: lib .cvsignore
src/beanshell getBlock.bsh printApps.bsh printBlocks.bsh
removeApp.bsh resumeApp.bsh startApp.bsh
stopApp.bsh suspendApp.bsh
Removed: lib README.txt
src/bsh printApps.bsh printBlocks.bsh removeApp.bsh
Log:
reworked bsh commands. get-beanshell target.
Revision Changes Path
1.16 +3 -2 avalon-phoenix/ant.properties.sample
Index: ant.properties.sample
===================================================================
RCS file: /home/cvs/avalon-phoenix/ant.properties.sample,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- ant.properties.sample 8 Feb 2003 15:36:19 -0000 1.15
+++ ant.properties.sample 2 Mar 2003 12:33:21 -0000 1.16
@@ -61,7 +61,8 @@
# ----- Kernel Type -----
# Uncomment these two use BeanShell enhanced Kernel.
# It overrides that from project.properties.
-# You'll also need bsh-1.2b6.jar for compilation dependancies.
+# You'll also need bsh-1.2b7.jar for compilation dependancies.
+# Run 'ant get-beanshell' to get it.
#beanshell.jars
#kernel.impl.class=org.apache.avalon.phoenix.components.kernel.beanshell.BeanShellKernel
1.217 +34 -15 avalon-phoenix/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/avalon-phoenix/build.xml,v
retrieving revision 1.216
retrieving revision 1.217
diff -u -r1.216 -r1.217
--- build.xml 2 Mar 2003 02:50:21 -0000 1.216
+++ build.xml 2 Mar 2003 12:33:21 -0000 1.217
@@ -86,8 +86,11 @@
<property name="status2changes" value="${phoenix.tools.dir}/status2changes.xsl"/>
<!-- Invoke 'ant get-mx4j' to get these -->
- <property name="mx4j.jar" value="${repo.dir}/mx4j-1.1.1/lib/mx4j-jmx.jar"/>
- <property name="mx4j-tools.jar" value="${repo.dir}/mx4j-1.1.1/lib/mx4j-tools.jar"/>
+ <property name="mx4j.jar" value="${repo.dir}/mx4j/mx4j-1.1.1/lib/mx4j-jmx.jar"/>
+ <property name="mx4j-tools.jar" value="${repo.dir}/mx4j/mx4j-1.1.1/lib/mx4j-tools.jar"/>
+
+ <!-- Invoke 'ant get-beanshell' to get this -->
+ <property name="beanshell.jar" value="${repo.dir}/beanshell/bsh-1.2b7.jar"/>
<path id="project.class.path">
<pathelement location="${xerces.jar}"/>
@@ -97,11 +100,19 @@
<pathelement location="${wrapper.jar}"/>
<pathelement path="${mx4j.jar}"/>
<pathelement path="${mx4j-tools.jar}"/>
+ <pathelement path="${beanshell.jar}"/>
<pathelement path="${java.class.path}"/>
<fileset dir="${lib.dir}">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}/container">
+ <include name="*.jar"/>
+ </fileset>
+ <fileset dir="${lib.dir}/deploy">
<include name="**/*.jar"/>
</fileset>
+
<pathelement path="${target.classes}"/>
</path>
@@ -136,6 +147,7 @@
</available>
<antcall target="check-mx4j2"/>
</target>
+
<target name="check-mx4j2" unless="mx4j.present">
<echo>**************************</echo>
<echo>* Please execute target *</echo>
@@ -163,16 +175,27 @@
<!-- Get the jars from the MX4J project. -->
<!-- For licensing reasons, we are unable to put these Jars in our CVS or source distributions. -->
- <target name="get-mx4j">
- <mkdir dir="${repo.dir}"/>
+ <target name="get-mx4j" description="Get the MX4J distribution from SourceForge.">
+ <mkdir dir="${repo.dir}/mx4j"/>
<get src="http://telia.dl.sourceforge.net/sourceforge/mx4j/mx4j-1.1.1.tar.gz"
- dest="${repo.dir}/mx4j.tar.gz"
+ dest="${repo.dir}/mx4j/mx4j.tar.gz"
verbose="true"
usetimestamp="true"/>
- <gunzip src="${repo.dir}/mx4j.tar.gz" dest="${repo.dir}"/>
- <untar src="${repo.dir}/mx4j.tar" dest="${repo.dir}"/>
+ <gunzip src="${repo.dir}/mx4j/mx4j.tar.gz" dest="${repo.dir}/mx4j"/>
+ <untar src="${repo.dir}/mx4j/mx4j.tar" dest="${repo.dir}/mx4j"/>
</target>
+ <!-- Get the jars from the Beanshell project. -->
+ <!-- For licensing reasons, we are unable to put these Jars in our CVS or source distributions. -->
+ <!-- And given it is optional, it would be a bit of a byte-size waste anyway -->
+ <target name="get-beanshell" description="Get the BeanShell jar from beansehll.org.">
+ <mkdir dir="${repo.dir}/beanshell"/>
+ <get src="http://www.beanshell.org/bsh-1.2b7.jar"
+ dest="${repo.dir}/beanshell/bsh-1.2b7.jar"
+ verbose="true"
+ usetimestamp="true"/>
+ </target>
+
<!-- Prepares the build directory -->
<target name="prepare" depends="check-environment">
@@ -365,8 +388,8 @@
</fileset>
</jar>
- <jar jarfile="${target.lib}/phoenix-bsh-commands.jar">
- <zipfileset dir="src/bsh" prefix="bsh/commands/">
+ <jar jarfile="${target.lib}/phoenix-beanshell-commands.jar">
+ <zipfileset dir="src/beanshell" prefix="bsh/commands/">
<include name="**"/>
</zipfileset>
</jar>
@@ -427,12 +450,8 @@
<!-- Copy BeanShell jars -->
<target name="dist-beanshell" description="Copies Beanshell jars" if="beanshell.jars">
- <copy file="${target.lib}/phoenix-bsh-commands.jar" todir="${bin.dist.container.lib}"/>
- <copy todir="${bin.dist.container.lib}/">
- <fileset dir="${lib.dir}">
- <include name="bsh-*"/>
- </fileset>
- </copy>
+ <copy file="${target.lib}/phoenix-beanshell-commands.jar" todir="${bin.dist.container.lib}"/>
+ <copy file="${beanshell.jar}" todir="${bin.dist.container.lib}"/>
</target>
<!-- Create the lite build -->
1.1 avalon-phoenix/lib/.cvsignore
Index: .cvsignore
===================================================================
repo
1.1 avalon-phoenix/src/beanshell/getBlock.bsh
Index: getBlock.bsh
===================================================================
bsh.help.getBlock = "usage: getBlock( appName, blockName ), gets a named block for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
Object getBlock( String appName, String blockName ) {
kernel = this.interpreter.get("phoenix-kernel");
return kernel.getApplication(appName).getBlock(blockName);
}
Object getBlock( int appNo, String blockName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
return getBlock(apps[appNo], blockName);
}
Object getBlock( int appNo, int blockNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
return getBlock(apps[appNo], blockNo);
}
Object getBlock( String appName, int blockNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
return getBlock(appName, blocks[blockNo]);
}
1.1 avalon-phoenix/src/beanshell/printApps.bsh
Index: printApps.bsh
===================================================================
bsh.help.printApps = "usage: printApps(), prints a list of apps";
/*
By Paul Hammant : Specifically for Phoenix
*/
printApps() {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
print("Phoenix is running " + apps.length + " applications..");
for (int i = 0; i < apps.length; i++) {
print(i + " " + apps[i]);
}
}
1.1 avalon-phoenix/src/beanshell/printBlocks.bsh
Index: printBlocks.bsh
===================================================================
bsh.help.printBlocks = "usage: printBlocks( appName ), prints a blocks for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
printBlocks( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
print(appName + " has " + blocks.length + " blocks..");
for (int i = 0; i < blocks.length; i++) {
print(i + " " + blocks[i]);
}
}
printBlocks( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
printBlocks(apps[appNo]);
}
1.1 avalon-phoenix/src/beanshell/removeApp.bsh
Index: removeApp.bsh
===================================================================
bsh.help.removeApp = "usage: removeApp( appName ), remove an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
removeApp( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
kernel.removeApplication(appName);
print(appName + " removed");
}
removeApp( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
kernel.removeApplication(apps[appNo]);
print(appName + " removed");
}
1.1 avalon-phoenix/src/beanshell/resumeApp.bsh
Index: resumeApp.bsh
===================================================================
bsh.help.resumeApp = "usage: resumeApp( appName ), resumes the blocks for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
resumeApp( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
int ct =0;
for (int i = 0; i < blocks.length; i++) {
if (blocks[i] instanceof org.apache.avalon.framework.activity.Suspendable) {
blocks[i].resumeapp();
ct++;
}
}
print(ct + " blocks stopped for '" + appName + "'");
}
resumeApp( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
resumeApp(apps[appNo]);
}
1.1 avalon-phoenix/src/beanshell/startApp.bsh
Index: startApp.bsh
===================================================================
bsh.help.startApp = "usage: startApp( appName ), starts the blocks for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
startApp( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
int ct =0;
for (int i = 0; i < blocks.length; i++) {
block = kernel.getApplication(appName).getBlock(blocks[i]);
if (block instanceof org.apache.avalon.framework.activity.Startable) {
block.start();
ct++;
}
}
print(ct + " blocks stopped for '" + appName + "'");
}
startApp( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
startApp(apps[appNo]);
}
1.1 avalon-phoenix/src/beanshell/stopApp.bsh
Index: stopApp.bsh
===================================================================
bsh.help.stopApp = "usage: stopApp( appName ), stops the blocks for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
stopApp( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
int ct =0;
for (int i = 0; i < blocks.length; i++) {
block = kernel.getApplication(appName).getBlock(blocks[i]);
if (block instanceof org.apache.avalon.framework.activity.Startable) {
block.stop();
ct++;
}
}
print(ct + " blocks stopped for '" + appName + "'");
}
stopApp( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
stopApp(apps[appNo]);
}
1.1 avalon-phoenix/src/beanshell/suspendApp.bsh
Index: suspendApp.bsh
===================================================================
bsh.help.suspendApp = "usage: suspendApp( appName ), suspends the blocks for an app";
/*
By Paul Hammant : Specifically for Phoenix
*/
suspendApp( String appName ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] blocks = kernel.getApplication(appName).getBlockNames();
int ct =0;
for (int i = 0; i < blocks.length; i++) {
if (blocks[i] instanceof org.apache.avalon.framework.activity.Suspendable) {
blocks[i].suspend();
ct++;
}
}
print(ct + " blocks stopped for '" + appName + "'");
}
suspendApp( int appNo ) {
kernel = this.interpreter.get("phoenix-kernel");
String[] apps = kernel.getApplicationNames();
suspendApp(apps[appNo]);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org