KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > rmi > jrmp > server > JRemoteServerCall


1 /**
2  * Copyright (C) 2002,2004 - INRIA (www.inria.fr)
3  *
4  * CAROL: Common Architecture for RMI ObjectWeb Layer
5  *
6  * This library is developed inside the ObjectWeb Consortium,
7  * http://www.objectweb.org
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22  * USA
23  *
24  * --------------------------------------------------------------------------
25  * $Id: JRemoteServerCall.java,v 1.7 2004/09/01 11:02:41 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.carol.rmi.jrmp.server;
29
30 //java import
31
import java.io.IOException JavaDoc;
32 import java.io.ObjectInput JavaDoc;
33 import java.io.ObjectOutput JavaDoc;
34 import java.io.StreamCorruptedException JavaDoc;
35 import java.rmi.server.RemoteCall JavaDoc;
36
37 import org.objectweb.carol.rmi.jrmp.interceptor.JServerInterceptorHelper;
38 import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInterceptor;
39
40 /**
41  * Class <code>JRemoteServerCall</code> is the CAROL JRMP Remote Server call
42  * with context propagation
43  * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
44  * @version 1.0, 15/07/2002
45  */

46 public class JRemoteServerCall implements RemoteCall JavaDoc {
47
48     /**
49      * The Remote Call Impl
50      * @deprecated
51      */

52     RemoteCall JavaDoc impl;
53
54     /**
55      * Array of Interceptor for this Server Ref
56      */

57     protected JServerRequestInterceptor[] sis = null;
58
59     /**
60      * Constructor for server side call
61      * @param impl the Remote call
62      * @param sis the server interceptor
63      */

64     public JRemoteServerCall(RemoteCall JavaDoc impl, JServerRequestInterceptor[] sis) {
65         // we use delegation but need to extend StreamRemoteCall for 1.1 Stub
66
this.impl = impl;
67         this.sis = sis;
68     }
69
70     /**
71      * override getResultStream to dissociate and pass contexts back to the
72      * client. This method might be called several times.
73      * @param success if success
74      * @deprecated
75      */

76     public ObjectOutput JavaDoc getResultStream(boolean success) throws IOException JavaDoc, StreamCorruptedException JavaDoc {
77         ObjectOutput JavaDoc out = impl.getResultStream(success);
78         // we must send a dummy exception due to StreamRemoteCall.executeCall
79
// flow of control
80
if (!success) {
81             out.writeObject(new Exception JavaDoc("dummy"));
82             JServerInterceptorHelper.send_exception(out, sis);
83             return out;
84         } else { // succes !
85
JServerInterceptorHelper.send_reply(out, sis);
86             return out;
87         }
88     }
89
90     // standard server remote call methods
91
/**
92      * @deprecated
93      */

94     public ObjectOutput JavaDoc getOutputStream() throws IOException JavaDoc {
95         return impl.getOutputStream();
96     }
97
98     /**
99      * @see java.rmi.server.RemoteCall#releaseOutputStream()
100      * @deprecated
101      */

102     public void releaseOutputStream() throws IOException JavaDoc {
103         impl.releaseOutputStream();
104     }
105
106     /**
107      * @see java.rmi.server.RemoteCall#getInputStream()
108      * @deprecated
109      */

110     public ObjectInput JavaDoc getInputStream() throws IOException JavaDoc {
111         return impl.getInputStream();
112     }
113
114     /**
115      * @see java.rmi.server.RemoteCall#releaseInputStream()
116      * @deprecated
117      */

118     public void releaseInputStream() throws IOException JavaDoc {
119         impl.releaseInputStream();
120     }
121
122     /**
123      * @see java.rmi.server.RemoteCall#executeCall()
124      * @deprecated
125      */

126     public void executeCall() throws Exception JavaDoc {
127         throw new Error JavaDoc("should never be called by server");
128     }
129
130     /**
131      * @see java.rmi.server.RemoteCall#done()
132      * @deprecated
133      */

134     public void done() throws IOException JavaDoc {
135         impl.done();
136     }
137
138 }
Popular Tags