Paul,
I did kind of do that (exposeObject(..) on purpose ,
something I tried to model along the lines of our RMI
dame.
[UnicastRemoteObject.exportObject(..) ..]
But I guess the way you have illustrated through test
cases checked in test/callback/ files
is also feasible ; & definitely more kewler.
gr8 suggestion dude and it does make sense.
And attached here is the patch to get rid of
the exposeObject(..) kind of call .
[There was another method within
CallbackInvocationHandler which had to be public'zed
]
I guess now the test cases that you kindly checked
in for me , should work too .
(after the proper imports of callback
factories/servers)
The BaseServedObject marshallerer now checks the
typs of arguments and accordingly publishes
the obj with the internal altrmiServer.
BTW,
the callback.xml must create the stub for the
CallBackTestListener too or we should generate it
through code .( I shall start the brain-surgery
on stubs using BCEL after we are through with settling
the dust over callbacks)
Regards,
V i n a y
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
cvs diff BaseServedObject.java (in directory
C:\vinay\jc\jakarta-avalon-excalibur\altrmi\src\java\org\apache\excalibur\altrmi\client\impl)
Index: BaseServedObject.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/client/impl/BaseServedObject.java,v
retrieving revision 1.1
diff -r1.1 BaseServedObject.java
29a30,34
> //callback
> import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
> import
>org.apache.excalibur.altrmi.client.impl.socket.CallbackEnabledCustomSocketStreamInvocationHandler;
> import java.util.StringTokenizer;
> import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
47c52,55
<
---
> //<callback related>
> private boolean mbIsCallbackAware=false;
> private CallbackEnabledCustomSocketStreamInvocationHandler
>mCallbackEnabledCustomSocketStreamInvocationHandler=null;
> //</callback related>
70a79,87
> //<callback related>
> if(mInvocationHandler instanceof
>CallbackEnabledCustomSocketStreamInvocationHandler)
> {
>
> mCallbackEnabledCustomSocketStreamInvocationHandler =
>
>(CallbackEnabledCustomSocketStreamInvocationHandler)mInvocationHandler;
> mbIsCallbackAware=true;
> }
> //</callback related>
206c223
< marshallCorrection(args);
---
> marshallCorrection(methodSignature,args);
312c329,332
< private void marshallCorrection(Object[] args) {
---
> private void marshallCorrection(String methodSignature , Object[] args) {
>
> String _methodArgumentClasses =
>methodSignature.substring(methodSignature.indexOf("(")+1,methodSignature.lastIndexOf(")"));
> StringTokenizer _methodArgumentClassTokens = new
>StringTokenizer(_methodArgumentClasses,",");
314a335,346
>
> String _sArgClass=_methodArgumentClassTokens.nextToken();
> Class _cArgClass=null;
> try
> {
>
> _cArgClass=Class.forName(_sArgClass);
> }
> catch(ClassNotFoundException cnfe)
> {
> System.err.println("Class "+_sArgClass +" Not Found");
> }
326a359,388
> else if(mbIsCallbackAware)
> {
> String publishedName =
>mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
> if(publishedName!=null) //already published
> {
> ExposedObjectProxy exposedObjectProxy = new
>ExposedObjectProxy(publishedName);
> args[i]=exposedObjectProxy;
> }
> else //check whether its Publish'able
> {
> if(!_cArgClass.isInterface()) //Hey do we
>handle only interfaces?
> continue;
>
>if(_cArgClass.isAssignableFrom(args[i].getClass()))
> {
> try
> {
>
>mCallbackEnabledCustomSocketStreamInvocationHandler.exposeObject(args[i],_cArgClass);
> }
> catch(AltrmiCallbackException ace)
> {
> ace.printStackTrace();
> }
> publishedName =
>mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
> ExposedObjectProxy exposedObjectProxy
>= new ExposedObjectProxy(publishedName);
> args[i]=exposedObjectProxy;
>
> }
>
> }
> }
/*
* 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.client.impl.socket;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import org.apache.excalibur.altrmi.client.impl.stream.ClientStreamReadWriter;
import org.apache.excalibur.altrmi.common.*;
import org.apache.excalibur.altrmi.common.AltrmiConnectionException;
import org.apache.excalibur.altrmi.common.AltrmiCallbackException;
import org.apache.excalibur.altrmi.client.impl.stream.*;
import
org.apache.excalibur.altrmi.client.impl.stream.CallbackEnabledClientCustomStreamReadWriter;
/**
* Class CallbackEnabledCustomSocketStreamInvocationHandler
*
* @author <a href="mailto:[EMAIL PROTECTED]">Vinay Chandran</a>
* @version $Revision: 1.0 $
*/
public final class CallbackEnabledCustomSocketStreamInvocationHandler
extends AbstractSocketStreamInvocationHandler {
private CallbackEnabledClientCustomStreamReadWriter
mCallbackEnabledClientCustomStreamReadWriter;
/*
* @see
AbstractSocketStreamInvocationHandler#AbstractSocketStreamInvocationHandler(String,
int, ClassLoader)
*/
public CallbackEnabledCustomSocketStreamInvocationHandler(String host, int port,
ClassLoader classLoader)
throws AltrmiConnectionException {
super(host, port, classLoader);
}
/*
* @see
AbstractSocketStreamInvocationHandler#createClientStreamReadWriter(InputStream,
OutputStream)
*/
protected ClientStreamReadWriter createClientStreamReadWriter(
InputStream in, OutputStream out) throws IOException {
if(mCallbackEnabledClientCustomStreamReadWriter==null)
{
mCallbackEnabledClientCustomStreamReadWriter = new
CallbackEnabledClientCustomStreamReadWriter(in, out, mInterfacesClassLoader);
}
return mCallbackEnabledClientCustomStreamReadWriter;
}
public boolean exposeObject(Object tobeExposedObject,Class
tobeExposedInterface) throws AltrmiCallbackException
{
return
mCallbackEnabledClientCustomStreamReadWriter.exposeObject(tobeExposedObject,tobeExposedInterface);
}
public String getPublishedName(Object tobeExposedObject)
{
return
mCallbackEnabledClientCustomStreamReadWriter.getPublishedName(tobeExposedObject);
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>