KickJava   Java API By Example, From Geeks To Geeks.

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


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: DummyClientServiceContext.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  * @version 1.0, 15/07/2002
42  */

43 public class DummyClientServiceContext implements JServiceContext, Externalizable JavaDoc {
44
45     /**
46      * Adress
47      */

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

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

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

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

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

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

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