hammant 2002/11/06 23:57:34
Modified: altrmi build.xml default.properties
altrmi/src/java/org/apache/excalibur/altrmi/client/impl
AbstractSameVmBindableHostContext.java
altrmi/src/java/org/apache/excalibur/altrmi/registry
Binder.java
altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket
CompleteSocketCustomStreamPipedBinder.java
CompleteSocketCustomStreamPipedConnection.java
CompleteSocketCustomStreamServer.java
CompleteSocketObjectStreamPipedBinder.java
CompleteSocketObjectStreamPipedConnection.java
PartialSocketCustomStreamServer.java
PartialSocketObjectStreamServer.java
Added: altrmi/src/conf MANIFEST-registry.MF
altrmi/src/java/org/apache/excalibur/altrmi/common
RegistryHelper.java
Log:
RegistryHelper completes ClassLoader hiding of Registry
Revision Changes Path
1.42 +7 -0 jakarta-avalon-excalibur/altrmi/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/build.xml,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- build.xml 13 Oct 2002 13:40:00 -0000 1.41
+++ build.xml 7 Nov 2002 07:57:34 -0000 1.42
@@ -193,6 +193,13 @@
<include name="org/apache/excalibur/altrmi/generator/**"/>
<include name="org/apache/excalibur/altrmi/javacompiler/**"/>
</jar>
+
+ <jar jarfile="${build.lib}/${registry.jar.name}"
+ basedir="${build.classes}"
+ manifest="src/conf/MANIFEST-registry.MF">
+ <include name="org/apache/excalibur/altrmi/registry/**"/>
+ </jar>
+
</target>
1.11 +1 -0 jakarta-avalon-excalibur/altrmi/default.properties
Index: default.properties
===================================================================
RCS file: /home/cvs/jakarta-avalon-excalibur/altrmi/default.properties,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- default.properties 5 Sep 2002 21:13:46 -0000 1.10
+++ default.properties 7 Nov 2002 07:57:34 -0000 1.11
@@ -17,6 +17,7 @@
server-interfaces.jar.name=${name}-server-interfaces-${version}.jar
server-impl.jar.name=${name}-server-impl-${version}.jar
generator.jar.name=${name}-generator-${version}.jar
+registry.jar.name=${name}-registry-${version}.jar
# --------------------------------------------------
# REQUIRED LIBRARIES
1.4 +2 -16
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractSameVmBindableHostContext.java
Index: AbstractSameVmBindableHostContext.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/AbstractSameVmBindableHostContext.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AbstractSameVmBindableHostContext.java 26 Oct 2002 14:10:48 -0000 1.3
+++ AbstractSameVmBindableHostContext.java 7 Nov 2002 07:57:34 -0000 1.4
@@ -10,9 +10,7 @@
import org.apache.excalibur.altrmi.client.impl.AbstractHostContext;
import org.apache.excalibur.altrmi.client.AltrmiClientInvocationHandler;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
+import org.apache.excalibur.altrmi.common.RegistryHelper;
public abstract class AbstractSameVmBindableHostContext extends AbstractHostContext{
@@ -29,21 +27,9 @@
*/
public abstract AbstractHostContext makeSameVmHostContext() throws
AltrmiConnectionException;
-
protected Object getOptmization(String uniqueID)
{
- try
- {
- Object registry = this.getClass().getClassLoader()
-
.loadClass("org.apache.excalibur.altrmi.registry.Registry").newInstance();
- //Binder binder = registry.get("/.altrmi/optimizations/" + uniqueID);
- Method method = registry.getClass().getMethod("get", new Class[]
{String.class});
- return method.invoke(registry, new Object[] {"/.altrmi/optimizations/"
+ uniqueID});
- }
- catch (Exception e)
- {
- return null;
- }
+ return new RegistryHelper().get("/.altrmi/optimizations/" + uniqueID);
}
}
1.2 +1 -1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/Binder.java
Index: Binder.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/registry/Binder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Binder.java 13 Oct 2002 12:03:39 -0000 1.1
+++ Binder.java 7 Nov 2002 07:57:34 -0000 1.2
@@ -19,6 +19,6 @@
* @return The bound object
* @throws BindException if a problem
*/
- Bound bind(Object[] bindParms) throws BindException;
+ Object bind(Object[] bindParms) throws BindException;
}
1.2 +2 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedBinder.java
Index: CompleteSocketCustomStreamPipedBinder.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedBinder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompleteSocketCustomStreamPipedBinder.java 13 Oct 2002 11:54:28 -0000
1.1
+++ CompleteSocketCustomStreamPipedBinder.java 7 Nov 2002 07:57:34 -0000
1.2
@@ -10,7 +10,6 @@
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.registry.Binder;
import org.apache.excalibur.altrmi.registry.BindException;
-import org.apache.excalibur.altrmi.registry.Bound;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import java.util.Vector;
@@ -43,13 +42,13 @@
* @return thebound object
* @throws BindException if a problem
*/
- public Bound bind(Object[] bindParms) throws BindException
+ public Object bind(Object[] bindParms) throws BindException
{
PipedInputStream inputStream = (PipedInputStream) bindParms[0];
PipedOutputStream outputStream = (PipedOutputStream) bindParms[1];
try
{
- Bound connection =
+ Object connection =
new
CompleteSocketCustomStreamPipedConnection(m_invocationHandlerAdapter,
this, inputStream, outputStream);
m_connections.add(connection);
1.2 +1 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedConnection.java
Index: CompleteSocketCustomStreamPipedConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamPipedConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompleteSocketCustomStreamPipedConnection.java 13 Oct 2002 11:54:28 -0000
1.1
+++ CompleteSocketCustomStreamPipedConnection.java 7 Nov 2002 07:57:34 -0000
1.2
@@ -10,7 +10,6 @@
import org.apache.excalibur.altrmi.server.impl.piped.PipedCustomStreamServer;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
-import org.apache.excalibur.altrmi.registry.Bound;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -20,7 +19,7 @@
* A Complete Sockect Custom Stream Piped Instance.
* @author Paul Hammant
*/
-public class CompleteSocketCustomStreamPipedConnection implements Bound
+public class CompleteSocketCustomStreamPipedConnection
{
private PipedCustomStreamServer m_pipedCustomStreamServer;
1.6 +4 -4
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamServer.java
Index: CompleteSocketCustomStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketCustomStreamServer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- CompleteSocketCustomStreamServer.java 13 Oct 2002 13:40:00 -0000 1.5
+++ CompleteSocketCustomStreamServer.java 7 Nov 2002 07:57:34 -0000 1.6
@@ -11,7 +11,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerCustomStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
-import org.apache.excalibur.altrmi.registry.Registry;
+import org.apache.excalibur.altrmi.common.RegistryHelper;
/**
* Class CompleteSocketObjectStreamServer
@@ -36,7 +36,7 @@
public CompleteSocketCustomStreamServer( int port ) throws AltrmiServerException
{
super( port );
- new Registry().put("/.altrmi/optimizations/port=" + port,
+ new RegistryHelper().put("/.altrmi/optimizations/port=" + port,
new
CompleteSocketCustomStreamPipedBinder(super.getInovcationHandlerAdapter()));
}
@@ -54,7 +54,7 @@
throws AltrmiServerException
{
super( invocationHandlerAdapter, port );
- new Registry().put("/.altrmi/optimizations/port=" + port,
+ new RegistryHelper().put("/.altrmi/optimizations/port=" + port,
new
CompleteSocketCustomStreamPipedBinder(invocationHandlerAdapter));
}
1.2 +2 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedBinder.java
Index: CompleteSocketObjectStreamPipedBinder.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedBinder.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompleteSocketObjectStreamPipedBinder.java 13 Oct 2002 11:54:28 -0000
1.1
+++ CompleteSocketObjectStreamPipedBinder.java 7 Nov 2002 07:57:34 -0000
1.2
@@ -10,7 +10,6 @@
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.registry.Binder;
import org.apache.excalibur.altrmi.registry.BindException;
-import org.apache.excalibur.altrmi.registry.Bound;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import java.util.Vector;
@@ -43,13 +42,13 @@
* @return thebound object
* @throws BindException if a problem
*/
- public Bound bind(Object[] bindParms) throws BindException
+ public Object bind(Object[] bindParms) throws BindException
{
PipedInputStream inputStream = (PipedInputStream) bindParms[0];
PipedOutputStream outputStream = (PipedOutputStream) bindParms[1];
try
{
- Bound connection =
+ Object connection =
new
CompleteSocketObjectStreamPipedConnection(m_invocationHandlerAdapter,
this, inputStream, outputStream);
m_connections.add(connection);
1.2 +1 -2
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedConnection.java
Index: CompleteSocketObjectStreamPipedConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/CompleteSocketObjectStreamPipedConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CompleteSocketObjectStreamPipedConnection.java 13 Oct 2002 11:54:28 -0000
1.1
+++ CompleteSocketObjectStreamPipedConnection.java 7 Nov 2002 07:57:34 -0000
1.2
@@ -10,7 +10,6 @@
import org.apache.excalibur.altrmi.server.impl.piped.PipedObjectStreamServer;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
-import org.apache.excalibur.altrmi.registry.Bound;
import java.io.PipedInputStream;
import java.io.PipedOutputStream;
@@ -20,7 +19,7 @@
* A Complete Sockect Object Stream Piped Connection.
* @author Paul Hammant
*/
-public class CompleteSocketObjectStreamPipedConnection implements Bound
+public class CompleteSocketObjectStreamPipedConnection
{
private PipedObjectStreamServer m_pipedObjectStreamServer;
1.7 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java
Index: PartialSocketCustomStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketCustomStreamServer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PartialSocketCustomStreamServer.java 13 Oct 2002 13:40:00 -0000 1.6
+++ PartialSocketCustomStreamServer.java 7 Nov 2002 07:57:34 -0000 1.7
@@ -11,7 +11,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.server.AltrmiServerException;
-import org.apache.excalibur.altrmi.registry.Registry;
+import org.apache.excalibur.altrmi.common.RegistryHelper;
/**
* Class PartialSocketCustomStreamServer
@@ -36,7 +36,7 @@
m_completeSocketCustomStreamPipedBinder =
new
CompleteSocketCustomStreamPipedBinder(super.getInovcationHandlerAdapter());
- new Registry().put("/.altrmi/optimizations/port="
+ new RegistryHelper().put("/.altrmi/optimizations/port="
+ port, m_completeSocketCustomStreamPipedBinder);
}
1.7 +3 -3
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java
Index: PartialSocketObjectStreamServer.java
===================================================================
RCS file:
/home/cvs/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/socket/PartialSocketObjectStreamServer.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- PartialSocketObjectStreamServer.java 13 Oct 2002 13:40:00 -0000 1.6
+++ PartialSocketObjectStreamServer.java 7 Nov 2002 07:57:34 -0000 1.7
@@ -11,7 +11,7 @@
import org.apache.excalibur.altrmi.server.impl.ServerStreamReadWriter;
import org.apache.excalibur.altrmi.server.impl.adapters.InvocationHandlerAdapter;
import org.apache.excalibur.altrmi.server.AltrmiServerException;
-import org.apache.excalibur.altrmi.registry.Registry;
+import org.apache.excalibur.altrmi.common.RegistryHelper;
/**
@@ -37,7 +37,7 @@
{
m_completeSocketObjectStreamPipedBinder =
new
CompleteSocketObjectStreamPipedBinder(super.getInovcationHandlerAdapter());
- new Registry().put("/.altrmi/optimizations/port="
+ new RegistryHelper().put("/.altrmi/optimizations/port="
+ port, m_completeSocketObjectStreamPipedBinder);
}
1.1 jakarta-avalon-excalibur/altrmi/src/conf/MANIFEST-registry.MF
Index: MANIFEST-registry.MF
===================================================================
Extension-Name: excalibur-altrmi-registry
Specification-Vendor: Apache Software Foundation
Specification-Version: 0.9
Implementation-Vendor: Apache Software Foundation
Implementation-Version: 0.9
1.1
jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/common/RegistryHelper.java
Index: RegistryHelper.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.txt file.
*/
package org.apache.excalibur.altrmi.common;
import java.lang.reflect.Method;
/**
* RegistryHelper
* @author Paul Hammant
*/
public class RegistryHelper{
/**
* Put an item into the registry
* @param key The key
* @param binder The object to Bind
*/
public void put(String key, Object binder)
{
try
{
Class registryClass = this.getClass().getClassLoader()
.loadClass("org.apache.excalibur.altrmi.registry.Registry");
Object registry = registryClass.newInstance();
Method put = registryClass.getMethod("put", new Class[] {String.class,
Object.class});
put.invoke(registry, new Object[] {key,binder});
}
catch (Exception e)
{
// If the registry is not found then c'est la vie.
}
}
/**
* Get an item from the registry
* @param key The key
* @return The bound object
*/
public Object get(String key)
{
try
{
Object registry = this.getClass().getClassLoader()
.loadClass("org.apache.excalibur.altrmi.registry.Registry").newInstance();
//Binder binder = registry.get("/.altrmi/optimizations/" + uniqueID);
Method method = registry.getClass().getMethod("get", new Class[]
{String.class});
return method.invoke(registry, new Object[] {key});
}
catch (Exception e)
{
return null;
}
}
}
--
To unsubscribe, e-mail: <mailto:avalon-cvs-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@;jakarta.apache.org>