You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Vinay Chandran <vi...@yahoo.com> on 2002/04/05 23:07:26 UTC

[altrmi] Callback Iteration(1)

Hi,
Attached herewith is the first Iteration of the 
*Callback* feature for *Altrmi* :->
1. callback.patch (cvs diff for existing code)
2. callback-new-files.zip (archive of new files to be
add'd)

Among the archives is a sample illustrating
this new feature too.
(callback.xml script has the essential targets 
{server^client} to run this example too)

Regards,
V i n a y


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

Excellent work dude & welcome to the Avalon list.
I'll poke thru these in the morning :-)

- Paul

>Hi,
>Attached herewith is the first Iteration of the 
>*Callback* feature for *Altrmi* :->
>1. callback.patch (cvs diff for existing code)
>2. callback-new-files.zip (archive of new files to be
>add'd)
>
>Among the archives is a sample illustrating
>this new feature too.
>(callback.xml script has the essential targets 
>{server^client} to run this example too)
>
>Regards,
>V i n a y
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tax Center - online filing with TurboTax
>http://taxes.yahoo.com/
>
>
>------------------------------------------------------------------------
>
>cvs -q diff (in directory C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\java\org\apache\excalibur\altrmi)
>? client/impl/socket/CallbackEnabledCustomSocketStreamInvocationHandler.java
>? client/impl/socket/CallbackEnabledCustomSocketStreamHostContext.java
>? client/impl/stream/CallbackEnabledClientCustomStreamReadWriter.java
>? common/AltrmiCallbackException.java
>? common/ExposedObjectProxy.java
>? server/impl/CallbackEnabledCustomSocketStreamReadWriter.java
>? server/impl/socket/CallbackEnabledCustomSocketStreamServer.java
>Index: client/impl/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,33
>
>>//callback
>>import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
>>import org.apache.excalibur.altrmi.client.impl.socket.CallbackEnabledCustomSocketStreamInvocationHandler;
>>
>47c51,54
>< 
>---
>
>>	//<callback related>
>>	private boolean mbIsCallbackAware=false;
>>	private CallbackEnabledCustomSocketStreamInvocationHandler mCallbackEnabledCustomSocketStreamInvocationHandler=null;
>>	//</callback related>
>>
>70a78,86
>
>>        //<callback related>
>>        if(mInvocationHandler instanceof CallbackEnabledCustomSocketStreamInvocationHandler)
>>		{
>>			
>>			mCallbackEnabledCustomSocketStreamInvocationHandler	=
>>				(CallbackEnabledCustomSocketStreamInvocationHandler)mInvocationHandler;
>>			mbIsCallbackAware=true;
>>		}
>>        //</callback related>		
>>
>326a343,351
>
>>            else if(mbIsCallbackAware)
>>			{
>>				String publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
>>				if(publishedName!=null)
>>				{
>>					ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
>>					args[i]=exposedObjectProxy;
>>				}
>>			}
>>
>Index: generator/ProxyGeneratorImpl.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java,v
>retrieving revision 1.1
>diff -r1.1 ProxyGeneratorImpl.java
>14d13
>< import org.apache.excalibur.altrmi.test.TestInterface;
>Index: server/impl/classretrievers/PlainClassRetriever.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/PlainClassRetriever.java,v
>retrieving revision 1.1
>diff -r1.1 PlainClassRetriever.java
>60c60
><         is = mClassLoader.getResourceAsStream(thingName);
>---
>
>>        is = mClassLoader.getResourceAsStream(thingName+".class");
>>
>>
>>------------------------------------------------------------------------
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

>I guess it must be the changes we missed to do to the 
>callback/test classes.
>The CallBackTestServer and  CallBackTestClient
>must use CallbackEnabled Server and HostContext 
>respectively for callback's  to work properly.
>The errors are thus due to the fact that 
>the arg's are been serialized and passed-by-value to 
>the server when we use SocketCustomStreamHostContext.
>
>Moreover there is another modification that needs to
>be
>done to the build script (callback.xml), 
>one that generates the proxies for the callback stub 
>for the clients.
>(stubs for CallBackListener inf.)
>
>Attached patches must do the trick :-
>
The callback works, but I am holding back from a commit as 'socketa' and 
'piped' are not working now.  It seems to hand during the first of the 
'ten seconds' tests.

I'll try to find out if it is something I have done later on....



>Do let me know how this patch works at your end ?
>
No, when attached in email like this, one of a couple of servers to SMTP 
clients applies a word wrap to the patch that makes them unappliable.

For me, I am always happiest recieving whole files

Regards,

- Paul



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

Ah yes.... Doh!  
It is too late now to reapply again so I will get to this in the 
morning... :-)

- Paul

>Paul,
>I guess it must be the changes we missed to do to the 
>callback/test classes.
>The CallBackTestServer and  CallBackTestClient
>must use CallbackEnabled Server and HostContext 
>respectively for callback's  to work properly.
>The errors are thus due to the fact that 
>the arg's are been serialized and passed-by-value to 
>the server when we use SocketCustomStreamHostContext.
>
>Moreover there is another modification that needs to
>be
>done to the build script (callback.xml), 
>one that generates the proxies for the callback stub 
>for the clients.
>(stubs for CallBackListener inf.)
>
>Attached patches must do the trick :-
>
>Do let me know how this patch works at your end ?
>
>Regards,
>V i n a y
>===============================
>cvs -q diff callback.xml (in directory
>C:\avalon\cvs\jakarta-avalon-excalibur\altrmi)
>Index: callback.xml
>===================================================================
>RCS file:
>/home/cvspublic/jakarta-avalon-excalibur/altrmi/callback.xml,v
>retrieving revision 1.2
>diff -r1.2 callback.xml
>9c9
><  
>---
>
>>  <property file="default.properties"/>   <!-- User
>>
>local        -->
>60c60,67
><   
>---
>
>>   <altrmiproxies genname="CallBackTestListenerImpl"
>>
>srcgendir="${build.home}/genjava" 
>
>>        classgendir="${build.home}/genclasses"
>>
>verbose="true"
>
>>       
>>
>interfaces="org.apache.excalibur.altrmi.test.callback.CallBackTestListener">
>
>>      <classpath>
>>        <pathelement
>>
>location="${build.home}/classes"/>
>
>>      </classpath>
>>    </altrmiproxies>        
>>
>63c70
><   <target name="server" description="Callback test
>server">
>---
>
>>  <target name="server" description="Callback test
>>
>server" depends="generate">
>72c79
><   <target name="client" description="Callback test
>client" depends="generate">
>---
>
>>  <target name="client" description="Callback test
>>
>client" >
>
>*****CVS exited normally with code 1*****
>
>cvs -q diff CallBackTestClient.java (in directory
>C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\test\org\apache\excalibur\altrmi\test\callback)
>Index: CallBackTestClient.java
>===================================================================
>RCS file:
>/home/cvspublic/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestClient.java,v
>retrieving revision 1.2
>diff -r1.2 CallBackTestClient.java
>46c46
><         arhc = new
>SocketCustomStreamHostContext("127.0.0.1", 1235);
>---
>
>>        arhc = new
>>
>CallbackEnabledCustomSocketStreamHostContext("127.0.0.1",
>1235);
>
>*****CVS exited normally with code 1*****
>
>cvs -q diff CallBackTestServer.java (in directory
>C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\test\org\apache\excalibur\altrmi\test\callback)
>Index: CallBackTestServer.java
>===================================================================
>RCS file:
>/home/cvspublic/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestServer.java,v
>retrieving revision 1.2
>diff -r1.2 CallBackTestServer.java
>18a19
>
>42c43
><         AbstractServer as = new
>CompleteSocketCustomStreamServer(1235);
>---
>
>>        AbstractServer as = new
>>
>CallbackEnabledCustomSocketStreamServer(1235);
>
>
>===============================
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tax Center - online filing with TurboTax
>http://taxes.yahoo.com/
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Vinay Chandran <vi...@yahoo.com>.
Paul,
I guess it must be the changes we missed to do to the 
callback/test classes.
The CallBackTestServer and  CallBackTestClient
must use CallbackEnabled Server and HostContext 
respectively for callback's  to work properly.
The errors are thus due to the fact that 
the arg's are been serialized and passed-by-value to 
the server when we use SocketCustomStreamHostContext.

Moreover there is another modification that needs to
be
done to the build script (callback.xml), 
one that generates the proxies for the callback stub 
for the clients.
(stubs for CallBackListener inf.)

Attached patches must do the trick :-

Do let me know how this patch works at your end ?

Regards,
V i n a y
===============================
cvs -q diff callback.xml (in directory
C:\avalon\cvs\jakarta-avalon-excalibur\altrmi)
Index: callback.xml
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/altrmi/callback.xml,v
retrieving revision 1.2
diff -r1.2 callback.xml
9c9
<  
---
>   <property file="default.properties"/>   <!-- User
local        -->
60c60,67
<   
---
>    <altrmiproxies genname="CallBackTestListenerImpl"
srcgendir="${build.home}/genjava" 
>         classgendir="${build.home}/genclasses"
verbose="true"
>        
interfaces="org.apache.excalibur.altrmi.test.callback.CallBackTestListener">
>       <classpath>
>         <pathelement
location="${build.home}/classes"/>
>       </classpath>
>     </altrmiproxies>        
> 
63c70
<   <target name="server" description="Callback test
server">
---
>   <target name="server" description="Callback test
server" depends="generate">
72c79
<   <target name="client" description="Callback test
client" depends="generate">
---
>   <target name="client" description="Callback test
client" >

*****CVS exited normally with code 1*****

cvs -q diff CallBackTestClient.java (in directory
C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\test\org\apache\excalibur\altrmi\test\callback)
Index: CallBackTestClient.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestClient.java,v
retrieving revision 1.2
diff -r1.2 CallBackTestClient.java
46c46
<         arhc = new
SocketCustomStreamHostContext("127.0.0.1", 1235);
---
>         arhc = new
CallbackEnabledCustomSocketStreamHostContext("127.0.0.1",
1235);

*****CVS exited normally with code 1*****

cvs -q diff CallBackTestServer.java (in directory
C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\test\org\apache\excalibur\altrmi\test\callback)
Index: CallBackTestServer.java
===================================================================
RCS file:
/home/cvspublic/jakarta-avalon-excalibur/altrmi/src/test/org/apache/excalibur/altrmi/test/callback/CallBackTestServer.java,v
retrieving revision 1.2
diff -r1.2 CallBackTestServer.java
18a19
> 
42c43
<         AbstractServer as = new
CompleteSocketCustomStreamServer(1235);
---
>         AbstractServer as = new
CallbackEnabledCustomSocketStreamServer(1235);


===============================


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

I am not quite sure what you are saying dude.

Yes, I have committed some changes :
1) To the Callback test, which could not have run as was.
2) To the xdocs for AltRMI to allow the xdocs to refer to the api docs.

But I have not committed the changes I reapplied from your three emails 
to src/java as it did not pass the test

    ant -buildfile callback.xml server
    ant -buildfile callback.xml client

If you are saying there are problems, then it is possible that I have 
not applied your changes correctly.  Perhaps sending a fresh set of Java 
sources from you src/java tree (no patch files) will help me.....

Regards,

- Paul

>Paul,
>
>I dont get this ;-?
>Am I looking at the right place,Paul?
>(http://cvs.apache.org/viewcvs.cgi/jakarta-avalon-excalibur/altrmi/
>)
>
>The cvs @excalibur doesNOT reflect my recent callback
>patches and thus the barfs.
>
>Regards,
>V i n a y
>
>
>
>--- Paul Hammant <Pa...@yahoo.com> wrote:
>
>>Vinay,
>>
>>I have reapplied all the patches and the test barfs
>>as follows :
>>
>>     [java] Registering CallBackTestListenerImpls
>>with the CallBackTest
>>     [java] java.io.NotSerializableException: 
>>
>org.apache.excalibur.altrmi.test.callback.CallBackTestListenerImpl
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1224)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1050)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.common.MethodRequest.writeExternal(MethodRequest.java:147)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1265)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1243)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
>
>>     [java]     at 
>>
>java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.common.SerializationHelper.getBytesFromInstance(SerializationHelper.java:49)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.writeRequest(ClientCustomStreamReadWriter.java:74)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.postRequest(ClientCustomStreamReadWriter.java:64)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.client.impl.stream.StreamInvocationHandler.handleInvocation(StreamInvocationHandler.java:140)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.client.impl.BaseServedObject.processObjectRequest(BaseServedObject.java:227)
>
>>     [java]     at 
>>
>AltrmiGeneratedCallbackTest_Main.addCallBackListener(AltrmiGeneratedCallbackTest_Main.java:29)
>
>>     [java]     at 
>>
>org.apache.excalibur.altrmi.test.callback.CallBackTestClient.main(CallBackTestClient.java:75)
>
>>Have a check of it your end dude...
>>
>>Regards,
>>
>>- Paul
>>
>>>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
>>>>						{
>>>>
>=== message truncated ===
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tax Center - online filing with TurboTax
>http://taxes.yahoo.com/
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Vinay Chandran <vi...@yahoo.com>.
Paul,

I dont get this ;-?
Am I looking at the right place,Paul?
(http://cvs.apache.org/viewcvs.cgi/jakarta-avalon-excalibur/altrmi/
)

The cvs @excalibur doesNOT reflect my recent callback
patches and thus the barfs.

Regards,
V i n a y



--- Paul Hammant <Pa...@yahoo.com> wrote:
> Vinay,
> 
> I have reapplied all the patches and the test barfs
> as follows :
> 
>      [java] Registering CallBackTestListenerImpls
> with the CallBackTest
>      [java] java.io.NotSerializableException: 
>
org.apache.excalibur.altrmi.test.callback.CallBackTestListenerImpl
>      [java]     at 
>
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
>      [java]     at 
>
java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1224)
>      [java]     at 
>
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1050)
>      [java]     at 
>
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
>      [java]     at 
>
org.apache.excalibur.altrmi.common.MethodRequest.writeExternal(MethodRequest.java:147)
>      [java]     at 
>
java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1265)
>      [java]     at 
>
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1243)
>      [java]     at 
>
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
>      [java]     at 
>
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
>      [java]     at 
>
org.apache.excalibur.altrmi.common.SerializationHelper.getBytesFromInstance(SerializationHelper.java:49)
>      [java]     at 
>
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.writeRequest(ClientCustomStreamReadWriter.java:74)
>      [java]     at 
>
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.postRequest(ClientCustomStreamReadWriter.java:64)
>      [java]     at 
>
org.apache.excalibur.altrmi.client.impl.stream.StreamInvocationHandler.handleInvocation(StreamInvocationHandler.java:140)
>      [java]     at 
>
org.apache.excalibur.altrmi.client.impl.BaseServedObject.processObjectRequest(BaseServedObject.java:227)
>      [java]     at 
>
AltrmiGeneratedCallbackTest_Main.addCallBackListener(AltrmiGeneratedCallbackTest_Main.java:29)
>      [java]     at 
>
org.apache.excalibur.altrmi.test.callback.CallBackTestClient.main(CallBackTestClient.java:75)
> 
> Have a check of it your end dude...
> 
> Regards,
> 
> - Paul
> 
> >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
> >>						{
> 
=== message truncated ===


__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

I have reapplied all the patches and the test barfs as follows :

     [java] Registering CallBackTestListenerImpls with the CallBackTest
     [java] java.io.NotSerializableException: 
org.apache.excalibur.altrmi.test.callback.CallBackTestListenerImpl
     [java]     at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
     [java]     at 
java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1224)
     [java]     at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1050)
     [java]     at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
     [java]     at 
org.apache.excalibur.altrmi.common.MethodRequest.writeExternal(MethodRequest.java:147)
     [java]     at 
java.io.ObjectOutputStream.writeExternalData(ObjectOutputStream.java:1265)
     [java]     at 
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1243)
     [java]     at 
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
     [java]     at 
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
     [java]     at 
org.apache.excalibur.altrmi.common.SerializationHelper.getBytesFromInstance(SerializationHelper.java:49)
     [java]     at 
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.writeRequest(ClientCustomStreamReadWriter.java:74)
     [java]     at 
org.apache.excalibur.altrmi.client.impl.stream.ClientCustomStreamReadWriter.postRequest(ClientCustomStreamReadWriter.java:64)
     [java]     at 
org.apache.excalibur.altrmi.client.impl.stream.StreamInvocationHandler.handleInvocation(StreamInvocationHandler.java:140)
     [java]     at 
org.apache.excalibur.altrmi.client.impl.BaseServedObject.processObjectRequest(BaseServedObject.java:227)
     [java]     at 
AltrmiGeneratedCallbackTest_Main.addCallBackListener(AltrmiGeneratedCallbackTest_Main.java:29)
     [java]     at 
org.apache.excalibur.altrmi.test.callback.CallBackTestClient.main(CallBackTestClient.java:75)

Have a check of it your end dude...

Regards,

- Paul

>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:vinayc77@yahoo.com">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:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: [altrmi] Callback Iteration(1)

Posted by Vinay Chandran <vi...@yahoo.com>.
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/

Re: [altrmi] Callback Iteration(1)

Posted by Paul Hammant <Pa...@yahoo.com>.
Vinay,

OK dude I have looked at the code and think you are 85% of the way 
there.  Overall though an excellent effort.

The problem is that the Client the way you have coded it is very 
conscious of the fact that AltRMI is in the middle.  It should be 
transparent.  Also it looks like there can only be one callback for a 
published name,  I think the Callback object passed back should also 
hold a reference to the sessionID and referenceID, thus the client could 
register many callbacks to the same event (as would likely be the case 
in normal Java).

What I have done is committed your tests (after a rename and some mods, 
but still in your name).  If you look at the CallBackTestClient you will 
see the mods that make it transparent (the goal).  Given that this test 
cannot complete until the thing is working, this is a true XP style test 
before impl...  Also the CallBackTestClient and Server use the normal 
custom stream transports (so that it compiles), these you are obviously 
allowed to change :-)

Go for it dude, this will be brilliant when you have finished it (but do 
remember to take your time - there is no rush)...

Regards,

- Paul

>Hi,
>Attached herewith is the first Iteration of the 
>*Callback* feature for *Altrmi* :->
>1. callback.patch (cvs diff for existing code)
>2. callback-new-files.zip (archive of new files to be
>add'd)
>
>Among the archives is a sample illustrating
>this new feature too.
>(callback.xml script has the essential targets 
>{server^client} to run this example too)
>
>Regards,
>V i n a y
>
>
>__________________________________________________
>Do You Yahoo!?
>Yahoo! Tax Center - online filing with TurboTax
>http://taxes.yahoo.com/
>
>
>------------------------------------------------------------------------
>
>cvs -q diff (in directory C:\avalon\cvs\jakarta-avalon-excalibur\altrmi\src\java\org\apache\excalibur\altrmi)
>? client/impl/socket/CallbackEnabledCustomSocketStreamInvocationHandler.java
>? client/impl/socket/CallbackEnabledCustomSocketStreamHostContext.java
>? client/impl/stream/CallbackEnabledClientCustomStreamReadWriter.java
>? common/AltrmiCallbackException.java
>? common/ExposedObjectProxy.java
>? server/impl/CallbackEnabledCustomSocketStreamReadWriter.java
>? server/impl/socket/CallbackEnabledCustomSocketStreamServer.java
>Index: client/impl/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,33
>
>>//callback
>>import org.apache.excalibur.altrmi.common.ExposedObjectProxy;
>>import org.apache.excalibur.altrmi.client.impl.socket.CallbackEnabledCustomSocketStreamInvocationHandler;
>>
>47c51,54
>< 
>---
>
>>	//<callback related>
>>	private boolean mbIsCallbackAware=false;
>>	private CallbackEnabledCustomSocketStreamInvocationHandler mCallbackEnabledCustomSocketStreamInvocationHandler=null;
>>	//</callback related>
>>
>70a78,86
>
>>        //<callback related>
>>        if(mInvocationHandler instanceof CallbackEnabledCustomSocketStreamInvocationHandler)
>>		{
>>			
>>			mCallbackEnabledCustomSocketStreamInvocationHandler	=
>>				(CallbackEnabledCustomSocketStreamInvocationHandler)mInvocationHandler;
>>			mbIsCallbackAware=true;
>>		}
>>        //</callback related>		
>>
>326a343,351
>
>>            else if(mbIsCallbackAware)
>>			{
>>				String publishedName = mCallbackEnabledCustomSocketStreamInvocationHandler.getPublishedName(args[i]);
>>				if(publishedName!=null)
>>				{
>>					ExposedObjectProxy exposedObjectProxy =  new ExposedObjectProxy(publishedName);
>>					args[i]=exposedObjectProxy;
>>				}
>>			}
>>
>Index: generator/ProxyGeneratorImpl.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/generator/ProxyGeneratorImpl.java,v
>retrieving revision 1.1
>diff -r1.1 ProxyGeneratorImpl.java
>14d13
>< import org.apache.excalibur.altrmi.test.TestInterface;
>Index: server/impl/classretrievers/PlainClassRetriever.java
>===================================================================
>RCS file: /home/cvspublic/jakarta-avalon-excalibur/altrmi/src/java/org/apache/excalibur/altrmi/server/impl/classretrievers/PlainClassRetriever.java,v
>retrieving revision 1.1
>diff -r1.1 PlainClassRetriever.java
>60c60
><         is = mClassLoader.getResourceAsStream(thingName);
>---
>
>>        is = mClassLoader.getResourceAsStream(thingName+".class");
>>
>>
>>------------------------------------------------------------------------
>>
>>--
>>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>>For additional commands, e-mail: <ma...@jakarta.apache.org>
>>




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>