donaldp 01/11/17 04:03:58
Modified: apps/demo build.xml
apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver
SimpleServer.java
apps/demo/src/manifest simpleserver-demo.mf
Added:
apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/extension1
ExtensionTestClass1.java
apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/extension2
ExtensionTestClass2.java
apps/demo/src/manifest test-extension1.mf test-extension2.mf
Log:
Added code to test the operation of Extensions in Phoenix. SimpleServers jar
now depends upon two extensions.
One of those extensions (extension1) is provided by a jar that is internal to
the .sar file. This case tests that we don't go looking for an extension when
it is already inside the .sar.
The other extension (extension2) is placed in the central extensions
repository. This tests that Phoenix will actually go looking for the extension
in central repository when necessary.
The Block references classes in each "Optional Package" so that it will fail
to initialize if the extensions are not placed in classloader properly.
Revision Changes Path
1.22 +23 -5 jakarta-avalon-cornerstone/apps/demo/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/demo/build.xml,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- build.xml 2001/11/11 09:08:04 1.21
+++ build.xml 2001/11/17 12:03:58 1.22
@@ -94,35 +94,49 @@
<mkdir dir="${build.lib}"/>
- <jar file="${build.lib}/demo-httpproxy.jar"
+ <jar jarfile="${build.lib}/demo-httpproxy.jar"
basedir="${build.classes}"
manifest="${manifest.dir}/http-proxy-demo.mf">
<include name="org/apache/avalon/cornerstone/demos/httpproxy/*"/>
</jar>
- <jar file="${build.lib}/demo-xcommander.jar"
+ <jar jarfile="${build.lib}/demo-xcommander.jar"
basedir="${build.classes}"
manifest="${manifest.dir}/demo-xcommander.mf">
<include name="org/apache/avalon/cornerstone/demos/xcommander/**"/>
</jar>
- <jar file="${build.lib}/demo-helloworld.jar"
+ <jar jarfile="${build.lib}/demo-helloworld.jar"
basedir="${build.classes}"
manifest="${manifest.dir}/helloworld-demo.mf">
<include
name="org/apache/avalon/cornerstone/demos/helloworldserver/*"/>
</jar>
- <jar file="${build.lib}/demo-soaphelloworld.jar"
+ <jar jarfile="${build.lib}/demo-soaphelloworld.jar"
basedir="${build.classes}"
manifest="${manifest.dir}/soaphelloworld-demo.mf">
<include
name="org/apache/avalon/cornerstone/demos/soaphelloworldserver/*"/>
</jar>
- <jar file="${build.lib}/demo-simpleserver.jar"
+ <jar jarfile="${build.lib}/demo-simpleserver.jar"
basedir="${build.classes}"
manifest="${manifest.dir}/simpleserver-demo.mf">
<include name="org/apache/avalon/cornerstone/demos/simpleserver/*"/>
+ <exclude
name="org/apache/avalon/cornerstone/demos/simpleserver/extension1/*"/>
+ <exclude
name="org/apache/avalon/cornerstone/demos/simpleserver/extension2/*"/>
</jar>
+
+ <jar jarfile="${build.lib}/demo-test-extension1.jar"
+ basedir="${build.classes}"
+ manifest="${manifest.dir}/test-extension1.mf">
+ <include
name="org/apache/avalon/cornerstone/demos/simpleserver/extension1/*"/>
+ </jar>
+
+ <jar jarfile="${build.lib}/demo-test-extension2.jar"
+ basedir="${build.classes}"
+ manifest="${manifest.dir}/test-extension2.mf">
+ <include
name="org/apache/avalon/cornerstone/demos/simpleserver/extension2/*"/>
+ </jar>
</target>
<target name="main" depends="sars" description="Default target to generate
build products minus docs"/>
@@ -137,6 +151,7 @@
<lib dir="${build.lib}/">
<include name="*.jar"/>
+ <exclude name="demo-test-extension2.jar"/>
<exclude name="demo-soaphelloworld.jar"/>
</lib>
@@ -317,6 +332,9 @@
<echo message="Installing to ${install.dir}" />
<delete dir="${install.dir}/avalon-demo" />
<copy file="${build.lib}/avalon-demo.sar" todir="${install.dir}" />
+ <copy file="${build.lib}/demo-test-extension2.jar"
+ tofile="${phoenix.home}/ext/demo-test-extension2.jar"
+ overwrite="true" />
</target>
<target name="uninstall" description="Uninstalls from Phoenix">
1.4 +10 -0
jakarta-avalon-cornerstone/apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/SimpleServer.java
Index: SimpleServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-cornerstone/apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/SimpleServer.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SimpleServer.java 2001/11/09 21:41:47 1.3
+++ SimpleServer.java 2001/11/17 12:03:58 1.4
@@ -39,6 +39,8 @@
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.phoenix.Block;
import org.apache.avalon.phoenix.BlockContext;
+import
org.apache.avalon.cornerstone.demos.simpleserver.extension1.ExtensionTestClass1;
+import
org.apache.avalon.cornerstone.demos.simpleserver.extension2.ExtensionTestClass2;
/**
* This is a demo block used to demonstrate a simple server using Avalon. The
@@ -125,6 +127,14 @@
m_connectionManager.connect( "DemoListener", serverSocket, this );
getLogger().info( "Got socket" );
+
+ getLogger().info( "Testing access to Extension in same .sar ..." );
+ ExtensionTestClass1.doSomeThing();
+ getLogger().info( "...successful test" );
+
+ getLogger().info( "Testing access to Extension from central
extension repository..." );
+ ExtensionTestClass2.doSomeThing();
+ getLogger().info( "...successful test" );
getLogger().info( "...Demo init" );
}
1.1
jakarta-avalon-cornerstone/apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/extension1/ExtensionTestClass1.java
Index: ExtensionTestClass1.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.cornerstone.demos.simpleserver.extension1;
import java.io.Serializable;
/**
* A simple class to test loading an extension that
* is contained within the .sar.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class ExtensionTestClass1
implements Serializable
{
public static void doSomeThing()
{
System.out.println( "ExtensionTestClass1.doSomeThing()" );
}
}
1.1
jakarta-avalon-cornerstone/apps/demo/src/java/org/apache/avalon/cornerstone/demos/simpleserver/extension2/ExtensionTestClass2.java
Index: ExtensionTestClass2.java
===================================================================
/*
* Copyright (C) The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*/
package org.apache.avalon.cornerstone.demos.simpleserver.extension2;
import java.io.Serializable;
/**
* A simple class to test loading an extension that
* is contained within the central extension repository.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Donald</a>
*/
public class ExtensionTestClass2
implements Serializable
{
public static void doSomeThing()
{
System.out.println( "ExtensionTestClass2.doSomeThing()" );
}
}
1.2 +13 -0
jakarta-avalon-cornerstone/apps/demo/src/manifest/simpleserver-demo.mf
Index: simpleserver-demo.mf
===================================================================
RCS file:
/home/cvs/jakarta-avalon-cornerstone/apps/demo/src/manifest/simpleserver-demo.mf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- simpleserver-demo.mf 2001/09/10 20:12:20 1.1
+++ simpleserver-demo.mf 2001/11/17 12:03:58 1.2
@@ -1,5 +1,18 @@
Manifest-Version: 1.0
Created-By: Apache Avalon Project
+Extension-Name: cornerstone.demo.simple
+Specification-Title: Avalon Cornerstone SimpleServer Demo Extension
+Implementation-Vendor-Id: org.apache.avalon
+Implementation-Vendor: Apache Avalon Project
+Extension-List: required1 required2
+required1-Extension-Name: cornerstone.test.extension
+required1-Specification-Version: 1.0
+required1-Implementation-Version: 1.0.2
+required1-Implementation-Vendor-Id: org.apache.avalon
+required2-Extension-Name: cornerstone.test.extension2
+required2-Specification-Version: 1.0
+required2-Implementation-Version: 1.0.2
+required2-Implementation-Vendor-Id: org.apache.avalon
Name: org/apache/avalon/cornerstone/demos/simpleserver/SimpleServer.class
Avalon-Block: true
1.1
jakarta-avalon-cornerstone/apps/demo/src/manifest/test-extension1.mf
Index: test-extension1.mf
===================================================================
Manifest-Version: 1.0
Extension-Name: cornerstone.test.extension
Specification-Title: Avalon Cornerstone Test Extension
Specification-Version: 1.1
Specification-Vendor: Jakarta Apache
Implementation-Vendor-Id: org.apache.avalon
Implementation-Vendor: Apache Avalon Project
Implementation-Version: 1.0.2
1.1
jakarta-avalon-cornerstone/apps/demo/src/manifest/test-extension2.mf
Index: test-extension2.mf
===================================================================
Manifest-Version: 1.0
Extension-Name: cornerstone.test.extension2
Specification-Title: Avalon Cornerstone Test Extension
Specification-Version: 1.1
Specification-Vendor: Jakarta Apache
Implementation-Vendor-Id: org.apache.avalon
Implementation-Vendor: Apache Avalon Project
Implementation-Version: 1.0.2
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>