KickJava   Java API By Example, From Geeks To Geeks.

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


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: DummyServerServiceContext.java,v 1.5 2005/02/08 10:03:48 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.carol.jtests.conform.interceptor.jrmp;
29
30 import java.io.Externalizable JavaDoc;
31 import java.io.IOException JavaDoc;
32 import java.io.ObjectInput JavaDoc;
33 import java.io.ObjectOutput JavaDoc;
34
35 import org.objectweb.carol.rmi.jrmp.interceptor.JServiceContext;
36
37 /**
38  * Class <code>DummyClientServiceContext</code> is a JRMP Interface for
39  * Interceptor implementation for carol testing
40  * @author Guillaume Riviere (Guillaume.Riviere@inrialpes.fr)
41  */

42 public class DummyServerServiceContext implements JServiceContext, Externalizable JavaDoc {
43
44     /**
45      * Adress
46      */

47     String JavaDoc address = null;
48
49     /**
50      * context id
51      */

52     private int context_id;
53
54     /**
55      * the JServiceContext id
56      */

57     public int getContextId() {
58         return context_id;
59     }
60
61     /**
62      * empty constructor for Externalizable
63      */

64     public DummyServerServiceContext() {
65     }
66
67     /**
68      * constructor
69      * @param int the context_id
70      * @param byte[] the context data
71      */

72     public DummyServerServiceContext(int context_id, String JavaDoc address) {
73         this.context_id = context_id;
74         this.address = address;
75     }
76
77     public String JavaDoc toString() {
78         return "Server Dummy Context From " + address;
79     }
80
81     /**
82      * readExternal
83      * @param in the ObjectInput
84      */

85     public void readExternal(ObjectInput JavaDoc in) throws IOException JavaDoc, ClassNotFoundException JavaDoc {
86         context_id = in.readInt();
87         address = (String JavaDoc) in.readObject();
88     }
89
90     /**
91      * writeExternal
92      * @param out the object output stream
93      */

94     public void writeExternal(ObjectOutput JavaDoc out) throws IOException JavaDoc {
95         out.writeInt(context_id);
96         out.writeObject(address);
97     }
98 }
Popular Tags