KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > carol > jtests > conform > interceptor > jrmp > DummyClientInterceptor


1 /**
2  * Copyright (C) 2002,2005 - 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: DummyClientInterceptor.java,v 1.4 2005/02/08 10:03:48 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.carol.jtests.conform.interceptor.jrmp;
29
30 import java.io.IOException JavaDoc;
31
32 import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInfo;
33 import org.objectweb.carol.rmi.jrmp.interceptor.JClientRequestInterceptor;
34
35 /**
36  * Class <code>DummyClientServiceContext</code> is a JRMP Dummy client
37  * interceptor for carol testing
38  * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
39  * @version 1.0, 15/07/2002
40  */

41 public class DummyClientInterceptor implements JClientRequestInterceptor {
42
43     /**
44      * Server dummy context id
45      */

46     private static int SERVER_CTX_ID = 50;
47
48     /**
49      * Client dummy context id
50      */

51     private static int CLIENT_CTX_ID = 51;
52
53     /**
54      * interceptor name
55      */

56     private String JavaDoc interceptorName = null;
57
58     /**
59      * constructor
60      * @param String name
61      */

62     public DummyClientInterceptor(String JavaDoc name) {
63         interceptorName = name;
64     }
65
66     /**
67      * get the name of this interceptor
68      * @return name
69      */

70     public String JavaDoc name() {
71         return interceptorName;
72     }
73
74     /**
75      * send client context with the request. The sendingRequest method of the
76      * JPortableInterceptors is called prior to marshalling arguments and
77      * contexts
78      * @param JClientRequestInfo jri the jrmp client info
79      * @exception IOException if an exception occur with the ObjectOutput
80      */

81     public void send_request(JClientRequestInfo jri) throws IOException JavaDoc {
82         // System.out.println("JRMP ClientInterceptor Add/Send Dummy Client
83
// Service Context");
84
jri.add_request_service_context(new DummyClientServiceContext(CLIENT_CTX_ID, java.net.InetAddress
85                 .getLocalHost().getHostName()));
86     }
87
88     /**
89      * Receive reply interception
90      * @param JClientRequestInfo jri the jrmp client info
91      * @exception IOException if an exception occur with the ObjectOutput
92      */

93     public void receive_reply(JClientRequestInfo jri) throws IOException JavaDoc {
94         //System.out.print("JRMP ClientInterceptor Get/Receive Dummy Server
95
// Service Context: ");
96
//System.out.println((DummyServerServiceContext)jri.get_reply_service_context(SERVER_CTX_ID));
97

98     }
99
100     // empty method
101
public void send_poll(JClientRequestInfo jri) throws IOException JavaDoc {
102     }
103
104     public void receive_exception(JClientRequestInfo jri) throws IOException JavaDoc {
105     }
106
107     public void receive_other(JClientRequestInfo jri) throws IOException JavaDoc {
108     }
109 }
Popular Tags