KickJava   Java API By Example, From Geeks To Geeks.

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


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: DummyServerInterceptor.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.JServerRequestInfo;
33 import org.objectweb.carol.rmi.jrmp.interceptor.JServerRequestInterceptor;
34
35 /**
36  * Class <code>DummyClientServiceContext</code> is a JRMP Interface for
37  * Interceptor implementation for carol testing
38  * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
39  */

40 public class DummyServerInterceptor implements JServerRequestInterceptor {
41
42     /**
43      * Server dummy context id
44      */

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

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

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

61     public DummyServerInterceptor(String JavaDoc name) {
62         interceptorName = name;
63     }
64
65     /**
66      * Receive request
67      * @param JServerRequestInfo the jrmp server request information
68      * @exception IOException if an exception occur with the ObjectOutput
69      */

70     public void receive_request(JServerRequestInfo jri) throws IOException JavaDoc {
71         //System.out.print("JRMP ServerInterceptor Get/Receive Dummy Client
72
// Service Context:");
73
//System.out.println((DummyClientServiceContext)jri.get_request_service_context(CLIENT_CTX_ID));
74
}
75
76     /**
77      * send reply with context
78      * @param JServerRequestInfo the jrmp server request information
79      * @exception IOException if an exception occur with the ObjectOutput
80      */

81     public void send_reply(JServerRequestInfo jri) throws IOException JavaDoc {
82         //System.out.println("JRMP ServerInterceptor Add/Send Dummy Server
83
// Service Context");
84
jri.add_reply_service_context(new DummyServerServiceContext(SERVER_CTX_ID, java.net.InetAddress.getLocalHost()
85                 .getHostName()));
86     }
87
88     /**
89      * get the name of this interceptor
90      * @return name
91      */

92     public String JavaDoc name() {
93         return interceptorName;
94     }
95
96     public void send_exception(JServerRequestInfo jri) throws IOException JavaDoc {
97     }
98
99     public void send_other(JServerRequestInfo jri) throws IOException JavaDoc {
100     }
101 }
Popular Tags