You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemind.apache.org by hl...@apache.org on 2004/11/02 23:32:17 UTC
cvs commit: jakarta-hivemind/examples build.xml
hlship 2004/11/02 14:32:16
Modified: . .classpath status.xml
framework/src/java/org/apache/hivemind/service/impl
HiveMindClassPool.java CtClassSource.java
ClassFactoryClassLoader.java
framework/src/test/org/apache/hivemind/service/impl
TestClassFab.java
library build.xml
framework build.xml
src/documentation/content/xdocs dependencies.xml
examples build.xml
Added: . build.properties
Log:
Update Javassist version to 3.0-rc-1.
Revision Changes Path
1.40 +1 -1 jakarta-hivemind/.classpath
Index: .classpath
===================================================================
RCS file: /home/cvs/jakarta-hivemind/.classpath,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- .classpath 12 Oct 2004 13:36:13 -0000 1.39
+++ .classpath 2 Nov 2004 22:32:16 -0000 1.40
@@ -14,7 +14,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="ext-package/lib/commons-logging-1.0.3.jar"/>
<classpathentry kind="lib" path="ext-package/lib/easymock-1.1.jar"/>
- <classpathentry kind="lib" path="ext-package/lib/javassist-2.6.jar"/>
+ <classpathentry sourcepath="C:/Work/javassist-3.0RC1/src/main" kind="lib" path="ext-package/lib/javassist-3.0-rc-1.jar"/>
<classpathentry kind="lib" path="ext-package/lib/log4j-1.2.7.jar"/>
<classpathentry kind="lib" path="ext-package/lib/oro-2.0.6.jar"/>
<classpathentry kind="lib" path="ext-package/lib/servletapi-2.3.jar"/>
1.74 +3 -0 jakarta-hivemind/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/status.xml,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- status.xml 2 Nov 2004 17:46:12 -0000 1.73
+++ status.xml 2 Nov 2004 22:32:16 -0000 1.74
@@ -79,6 +79,9 @@
Add support for the ErrorLog (a simple wrapper around an ErrorHandler and a Log). Add support
for setting the service's ErrorLog to BuilderFactory.
</action>
+ <action type="update" dev="HLS">
+ Switch Javassist to version 3.0-rc-1.
+ </action>
</release>
<release version="1.0" date="Sep 22 2004">
1.1 jakarta-hivemind/build.properties
Index: build.properties
===================================================================
# Copyright 2004 The Apache Software Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http:#www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
javassist.version=3.0-rc-1
1.3 +16 -8 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/HiveMindClassPool.java
Index: HiveMindClassPool.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/HiveMindClassPool.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HiveMindClassPool.java 13 Sep 2004 14:48:15 -0000 1.2
+++ HiveMindClassPool.java 2 Nov 2004 22:32:16 -0000 1.3
@@ -17,15 +17,17 @@
import java.util.HashSet;
import java.util.Set;
+import javassist.CannotCompileException;
import javassist.ClassPath;
import javassist.ClassPool;
+import javassist.CtClass;
import javassist.LoaderClassPath;
/**
- * Used to ensure that {@link javassist.ClassPool#appendClassPath(javassist.ClassPath)} is
- * invoked with a synchronized lock. Additionally, wraps around a shared
+ * Used to ensure that {@link javassist.ClassPool#appendClassPath(javassist.ClassPath)}is invoked
+ * with a synchronized lock. Additionally, wraps around a shared
* {@link org.apache.hivemind.service.impl.ClassFactoryClassLoader}.
- *
+ *
* @author Howard Lewis Ship
*/
public class HiveMindClassPool extends ClassPool
@@ -43,8 +45,7 @@
}
/**
- * Convienience method for adding to the ClassPath for a particular
- * class loader.
+ * Convienience method for adding to the ClassPath for a particular class loader.
*/
public synchronized void appendClassLoader(ClassLoader loader)
{
@@ -60,8 +61,15 @@
_loaders.add(loader);
}
- public Class loadClass(String name, byte[] bytecodes)
+ /**
+ * Invoked to convert an fabricated class into a real class. The new classes' class loader will
+ * be the delegating {@link ClassFactoryClassLoader}which has visibility to all class loaders
+ * for all modules.
+ *
+ * @since 1.1
+ */
+ public Class toClass(CtClass ctClass) throws CannotCompileException
{
- return _loader.loadClass(name, bytecodes);
+ return ctClass.toClass(_loader);
}
-}
+}
\ No newline at end of file
1.4 +19 -21 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/CtClassSource.java
Index: CtClassSource.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/CtClassSource.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- CtClassSource.java 13 Sep 2004 14:48:15 -0000 1.3
+++ CtClassSource.java 2 Nov 2004 22:32:16 -0000 1.4
@@ -21,11 +21,10 @@
import org.apache.hivemind.service.ClassFabUtils;
/**
- * Wrapper around Javassist's {@link javassist.ClassPool} and
- * our own {@link org.apache.hivemind.service.impl.ClassFactoryClassLoader}
- * that manages the creation of new instance of {@link javassist.CtClass}
- * and converts finished CtClass's into instantiable Classes.
- *
+ * Wrapper around Javassist's {@link javassist.ClassPool}and our own
+ * {@link org.apache.hivemind.service.impl.ClassFactoryClassLoader}that manages the creation of new
+ * instance of {@link javassist.CtClass}and converts finished CtClass's into instantiable Classes.
+ *
* @author Howard Lewis Ship
*/
public class CtClassSource
@@ -47,9 +46,7 @@
}
catch (NotFoundException ex)
{
- throw new ApplicationRuntimeException(
- ServiceMessages.unableToLookupClass(name, ex),
- ex);
+ throw new ApplicationRuntimeException(ServiceMessages.unableToLookupClass(name, ex), ex);
}
}
@@ -64,25 +61,26 @@
public Class createClass(CtClass ctClass)
{
- String className = ctClass.getName();
+ // String className = ctClass.getName();
try
{
- _pool.write(className);
+ return _pool.toClass(ctClass);
- byte[] bytecode = _pool.write(className);
-
- Class result = _pool.loadClass(className, bytecode);
-
- // _cache.add(className, bytecode);
-
- return result;
+ // _pool.write(className);
+ //
+ // byte[] bytecode = _pool.write(className);
+ //
+ // Class result = _pool.loadClass(className, bytecode);
+ //
+ // // _cache.add(className, bytecode);
+ //
+ // return result;
}
catch (Throwable ex)
{
- throw new ApplicationRuntimeException(
- ServiceMessages.unableToWriteClass(ctClass, ex),
- ex);
+ throw new ApplicationRuntimeException(ServiceMessages.unableToWriteClass(ctClass, ex),
+ ex);
}
}
-}
+}
\ No newline at end of file
1.5 +1 -12 jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/ClassFactoryClassLoader.java
Index: ClassFactoryClassLoader.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/java/org/apache/hivemind/service/impl/ClassFactoryClassLoader.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClassFactoryClassLoader.java 13 Sep 2004 14:48:15 -0000 1.4
+++ ClassFactoryClassLoader.java 2 Nov 2004 22:32:16 -0000 1.5
@@ -28,18 +28,6 @@
private List _loaders = new ArrayList();
/**
- * Invoked to create a new class instance from fabricated bytecode.
- */
- public Class loadClass(String name, byte[] bytecodes)
- {
- Class result = defineClass(name, bytecodes, 0, bytecodes.length);
-
- resolveClass(result);
-
- return result;
- }
-
- /**
* Adds a delegate class loader to the list of delegate class loaders.
*/
public synchronized void addDelegateLoader(ClassLoader loader)
@@ -74,6 +62,7 @@
}
catch (ClassNotFoundException ex)
{
+ //
}
}
1.3 +44 -58 jakarta-hivemind/framework/src/test/org/apache/hivemind/service/impl/TestClassFab.java
Index: TestClassFab.java
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/src/test/org/apache/hivemind/service/impl/TestClassFab.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestClassFab.java 13 Sep 2004 14:48:16 -0000 1.2
+++ TestClassFab.java 2 Nov 2004 22:32:16 -0000 1.3
@@ -35,7 +35,7 @@
/**
* Tests related to {@link org.apache.hivemind.service.impl.ClassFabImpl},
* {@link org.apache.hivemind.service.impl.CtClassSource}, etc.
- *
+ *
* @author Howard Lewis Ship
*/
public class TestClassFab extends HiveMindTestCase
@@ -68,13 +68,14 @@
cf.addField("_stringValue", String.class);
- MethodSignature setStringValue =
- new MethodSignature(void.class, "setStringValue", new Class[] { String.class }, null);
+ MethodSignature setStringValue = new MethodSignature(void.class, "setStringValue",
+ new Class[]
+ { String.class }, null);
cf.addMethod(Modifier.PUBLIC, setStringValue, "_stringValue = $1;");
- MethodSignature getStringValue =
- new MethodSignature(String.class, "getStringValue", null, null);
+ MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
+ null);
cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");
@@ -94,10 +95,11 @@
ClassFab cf = newClassFab("ConstructableBean", Object.class);
cf.addField("_stringValue", String.class);
- cf.addConstructor(new Class[] { String.class }, null, "{ _stringValue = $1; }");
+ cf.addConstructor(new Class[]
+ { String.class }, null, "{ _stringValue = $1; }");
- MethodSignature getStringValue =
- new MethodSignature(String.class, "getStringValue", null, null);
+ MethodSignature getStringValue = new MethodSignature(String.class, "getStringValue", null,
+ null);
cf.addMethod(Modifier.PUBLIC, getStringValue, "return _stringValue;");
@@ -114,7 +116,8 @@
Constructor c = targetClass.getConstructors()[0];
- Object targetBean = c.newInstance(new Object[] { "Buffy" });
+ Object targetBean = c.newInstance(new Object[]
+ { "Buffy" });
String actual = (String) PropertyUtils.read(targetBean, "stringValue");
@@ -126,18 +129,19 @@
ClassFab cf = newClassFab("MyIntHolder", AbstractIntWrapper.class);
cf.addField("_intValue", int.class);
- cf.addConstructor(new Class[] { int.class }, null, "{ _intValue = $1; }");
+ cf.addConstructor(new Class[]
+ { int.class }, null, "{ _intValue = $1; }");
cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(int.class, "getIntValue", null, null),
- "return _intValue;");
+ Modifier.PUBLIC,
+ new MethodSignature(int.class, "getIntValue", null, null),
+ "return _intValue;");
Class targetClass = cf.createClass();
Constructor c = targetClass.getConstructors()[0];
- AbstractIntWrapper targetBean =
- (AbstractIntWrapper) c.newInstance(new Object[] { new Integer(137)});
+ AbstractIntWrapper targetBean = (AbstractIntWrapper) c.newInstance(new Object[]
+ { new Integer(137) });
assertEquals(137, targetBean.getIntValue());
}
@@ -163,10 +167,8 @@
cf.addInterface(SimpleService.class);
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(int.class, "add", new Class[] { int.class, int.class }, null),
- "return $1 + $2;");
+ cf.addMethod(Modifier.PUBLIC, new MethodSignature(int.class, "add", new Class[]
+ { int.class, int.class }, null), "return $1 + $2;");
Class targetClass = cf.createClass();
@@ -185,9 +187,9 @@
}
catch (ApplicationRuntimeException ex)
{
- assertEquals(
- "Unable to create class StringSubclass: Cannot inherit from final class",
- ex.getMessage());
+ assertExceptionRegexp(
+ ex,
+ "Unable to create class StringSubclass\\:.*Cannot inherit from final class");
}
}
@@ -211,9 +213,9 @@
try
{
cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(void.class, "run", null, null),
- "fail;");
+ Modifier.PUBLIC,
+ new MethodSignature(void.class, "run", null, null),
+ "fail;");
}
catch (ApplicationRuntimeException ex)
{
@@ -237,11 +239,8 @@
{
ClassFab cf = newClassFab("ExtendMethod", Object.class);
- MethodFab mf =
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(int.class, "getValue", null, null),
- "return 1;");
+ MethodFab mf = cf.addMethod(Modifier.PUBLIC, new MethodSignature(int.class, "getValue",
+ null, null), "return 1;");
mf.extend("return 2 * $_;", false);
@@ -254,11 +253,8 @@
{
ClassFab cf = newClassFab("ExtendMethodAlterReturn", Object.class);
- MethodFab mf =
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(int.class, "getValue", null, null),
- "return 2;");
+ MethodFab mf = cf.addMethod(Modifier.PUBLIC, new MethodSignature(int.class, "getValue",
+ null, null), "return 2;");
mf.extend("$_ = 3 * $_;", false);
@@ -271,11 +267,8 @@
{
ClassFab cf = newClassFab("ExtendMethodFailure", Object.class);
- MethodFab mf =
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(int.class, "getValue", null, null),
- "return 1;");
+ MethodFab mf = cf.addMethod(Modifier.PUBLIC, new MethodSignature(int.class, "getValue",
+ null, null), "return 1;");
try
{
@@ -285,8 +278,8 @@
catch (ApplicationRuntimeException ex)
{
assertExceptionSubstring(
- ex,
- "Unable to extend method int getValue() of class ExtendMethodFailure:");
+ ex,
+ "Unable to extend method int getValue() of class ExtendMethodFailure:");
}
}
@@ -303,9 +296,8 @@
}
catch (ApplicationRuntimeException ex)
{
- assertEquals(
- "Attempt to redefine method void foo() of class DupeMethodAdd.",
- ex.getMessage());
+ assertEquals("Attempt to redefine method void foo() of class DupeMethodAdd.", ex
+ .getMessage());
}
}
@@ -330,11 +322,8 @@
cf.addInterface(FailService.class);
- MethodFab mf =
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(void.class, "fail", null, null),
- "throw new java.lang.RuntimeException(\"Ouch!\");");
+ MethodFab mf = cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "fail", null,
+ null), "throw new java.lang.RuntimeException(\"Ouch!\");");
mf.addCatch(RuntimeException.class, "throw new java.io.IOException($e.getMessage());");
@@ -359,11 +348,8 @@
cf.addInterface(Runnable.class);
- MethodFab mf =
- cf.addMethod(
- Modifier.PUBLIC,
- new MethodSignature(void.class, "run", null, null),
- "return;");
+ MethodFab mf = cf.addMethod(Modifier.PUBLIC, new MethodSignature(void.class, "run", null,
+ null), "return;");
try
{
@@ -373,8 +359,8 @@
catch (ApplicationRuntimeException ex)
{
assertExceptionSubstring(
- ex,
- "Unable to add catch block for exception java.lang.RuntimeException to class BadCatch");
+ ex,
+ "Unable to add catch block for exception java.lang.RuntimeException to class BadCatch");
}
}
@@ -400,4 +386,4 @@
// fail.
}
-}
+}
\ No newline at end of file
1.12 +2 -1 jakarta-hivemind/library/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/library/build.xml,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- build.xml 10 Aug 2004 14:25:11 -0000 1.11
+++ build.xml 2 Nov 2004 22:32:16 -0000 1.12
@@ -20,6 +20,7 @@
<property name="javadoc.package" value="org.apache.hivemind.lib.*"/>
<property name="root.dir" value=".."/>
+ <property file="${root.dir}/build.properties"/>
<import file="${root.dir}/hivebuild/jar-module.xml"/>
<import file="${hivebuild.dir}/javadoc-report.xml"/>
<import file="${hivebuild.dir}/clover-report.xml"/>
@@ -39,7 +40,7 @@
<ibiblio-dependency artifact="commons-logging" version="1.0.3" group="commons-logging"/>
<ibiblio-dependency artifact="log4j" version="1.2.7" group="log4j" use="test"/>
- <ibiblio-dependency artifact="javassist" version="2.6" group="jboss" use="test"/>
+ <ibiblio-dependency artifact="javassist" version="${javassist.version}" group="jboss" use="test"/>
<ibiblio-dependency artifact="servletapi" version="2.3" group="servletapi" use="test"/>
<ibiblio-dependency artifact="oro" version="2.0.6" group="oro" use="test"/>
<ibiblio-dependency artifact="easymock" version="1.1" group="easymock" use="test"/>
1.14 +2 -1 jakarta-hivemind/framework/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/framework/build.xml,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- build.xml 18 Aug 2004 22:48:23 -0000 1.13
+++ build.xml 2 Nov 2004 22:32:16 -0000 1.14
@@ -21,13 +21,14 @@
<property name="module.junit.use" value="compile"/>
<property name="root.dir" value=".."/>
+ <property file="${root.dir}/build.properties"/>
<import file="${root.dir}/hivebuild/jar-module.xml"/>
<import file="${hivebuild.dir}/javadoc-report.xml"/>
<import file="${hivebuild.dir}/clover-report.xml"/>
<target name="compile">
<ibiblio-dependency artifact="commons-logging" version="1.0.3" group="commons-logging"/>
- <ibiblio-dependency artifact="javassist" version="2.6" group="jboss"/>
+ <ibiblio-dependency artifact="javassist" version="${javassist.version}" group="jboss"/>
<ibiblio-dependency artifact="servletapi" version="2.3" group="servletapi"/>
<ibiblio-dependency artifact="oro" version="2.0.6" group="oro"/>
<ibiblio-dependency artifact="log4j" version="1.2.7" group="log4j"/>
1.7 +5 -1 jakarta-hivemind/src/documentation/content/xdocs/dependencies.xml
Index: dependencies.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/src/documentation/content/xdocs/dependencies.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dependencies.xml 21 Oct 2004 12:35:56 -0000 1.6
+++ dependencies.xml 2 Nov 2004 22:32:16 -0000 1.7
@@ -30,6 +30,10 @@
the <link href="http://maven.apache.org/">Maven</link> repository on <link
href="http://www.ibiblio.org/maven/">ibiblio</link>.</p>
+<warning> Occasionally, HiveMind outstrips the availability of JAR versions on ibiblio.com. If a version of a JAR is
+ not available, you will need to locate and download the other package's distribution, extract the necessary JAR file
+ (and occasionally rename it), and copy it into ext-package/lib. The build scripts will pick up the file from there.
+ </warning>
<table>
<tr>
@@ -61,7 +65,7 @@
<code>javax.ejb</code> package.</td>
</tr>
<tr>
- <td>javassist-2.6.jar</td>
+ <td>javassist-3.0-rc-1.jar</td>
<td>
<link href="http://www.jboss.org/products/javassist">Javassist bytecode
library</link>
1.10 +2 -1 jakarta-hivemind/examples/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-hivemind/examples/build.xml,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- build.xml 21 Oct 2004 14:57:19 -0000 1.9
+++ build.xml 2 Nov 2004 22:32:16 -0000 1.10
@@ -19,6 +19,7 @@
<property name="javadoc.package" value="com.panorama.*"/>
<property name="module.install.dir" value="target"/>
<property name="root.dir" value=".."/>
+ <property file="${root.dir}/build.properties"/>
<import file="${root.dir}/hivebuild/jar-module.xml"/>
<import file="${hivebuild.dir}/javadoc-report.xml"/>
<import file="${hivebuild.dir}/clover-report.xml"/>
@@ -52,7 +53,7 @@
<ibiblio-dependency artifact="spring-full" version="1.0.1" group="springframework"/>
<ibiblio-dependency artifact="commons-logging" version="1.0.3" group="commons-logging"/>
<ibiblio-dependency artifact="log4j" version="1.2.7" group="log4j" use="run"/>
- <ibiblio-dependency artifact="javassist" version="2.6" group="jboss" use="run"/>
+ <ibiblio-dependency artifact="javassist" version="${javassist.version}" group="jboss" use="run"/>
<ibiblio-dependency artifact="oro" version="2.0.6" group="oro" use="run"/>
<ibiblio-dependency artifact="easymock" version="1.1" group="easymock" use="test"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-cvs-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-cvs-help@jakarta.apache.org