KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > kernel > registry > msg > request > RegistryRequest


1 /**
2  * PETALS - PETALS Services Platform.
3  * Copyright (c) 2005 EBM Websourcing, http://www.ebmwebsourcing.com/
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * -------------------------------------------------------------------------
19  * $Id: JNDICommand.java 7:04:52 PM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.kernel.registry.msg.request;
23
24 import java.io.Serializable JavaDoc;
25
26 /**
27  * This class is a registry request which is used to send request to the
28  * registry
29  *
30  * @author ddesjardins - eBMWebsourcing
31  */

32 public class RegistryRequest implements Serializable JavaDoc {
33
34     /**
35      * Request types
36      *
37      * @author ddesjardins - eBMWebsourcing
38      */

39     public static enum RequestType {
40         /**
41          *
42          */

43         addToEnvironment,
44         /**
45          * BIND : arg1 = context name, arg2 = key, arg3 = value
46          */

47         bind,
48         /**
49          * CREATE SUBCONTEXT : arg1 = context name, arg2 = name of the context
50          * to create
51          */

52         createSubcontext,
53         /**
54          * DESTROY SUBCONTEXT : arg1 = context name, arg2 = nam of the context
55          * to destroy
56          */

57         destroySubcontext,
58         /**
59          * FULL UPDATE : no args
60          */

61         fullUpdate,
62         /**
63          * LIST : arg1 = context name, arg2 = context name to list the content
64          */

65         list,
66         /**
67          * LIST BINDINGS : arg1 = context name, arg2 = context name to list the
68          * content
69          */

70         listBindings,
71         /**
72          * LOOKUP : arg1 = context name, arg2 = key
73          */

74         lookup,
75         /**
76          * LOOKUP LINK : arg1 = context name, arg2 = key
77          */

78         lookupLink,
79         /**
80          * NEW MASTER : no args
81          */

82         newMaster,
83         /**
84          * PING : no args
85          */

86         ping,
87         /**
88          * REBIND : arg1 = context name, arg2 = key, arg3 = value
89          */

90         rebind,
91         /**
92          * RENAME : arg1 = context name, arg2 = old key, arg3 = new key
93          */

94         rename,
95         /**
96          * UNBIND : arg1 = context name, arg2 = key
97          */

98         unbind
99     }
100
101     private static final long serialVersionUID = 1L;;
102
103     /**
104      * First argument
105      */

106     protected Object JavaDoc arg1;
107
108     /**
109      * Second argument
110      */

111     protected Object JavaDoc arg2;
112
113     /**
114      * Third argument
115      */

116     protected Object JavaDoc arg3;
117
118     /**
119      * Start time of the recipient or 0 to send it to everybody
120      */

121     protected long recipient;
122
123     /**
124      * Date of the request
125      */

126     protected long requestDate;
127
128     /**
129      * Start time of the sender
130      */

131     protected long sender;
132
133     /**
134      * Type of request
135      */

136     protected RequestType type;
137
138     protected RegistryRequest(RequestType type, long sender, long recipient) {
139         super();
140         this.type = type;
141         this.sender = sender;
142         this.recipient = recipient;
143         requestDate = System.nanoTime();
144     }
145
146     protected RegistryRequest(RequestType type, Object JavaDoc arg1, long sender,
147         long recipient) {
148         super();
149         this.type = type;
150         this.arg1 = arg1;
151         this.sender = sender;
152         this.recipient = recipient;
153         requestDate = System.nanoTime();
154     }
155
156     protected RegistryRequest(RequestType type, Object JavaDoc arg1, Object JavaDoc arg2,
157         long sender, long recipient) {
158         super();
159         this.type = type;
160         this.arg1 = arg1;
161         this.arg2 = arg2;
162         this.sender = sender;
163         this.recipient = recipient;
164         requestDate = System.nanoTime();
165     }
166
167     protected RegistryRequest(RequestType type, Object JavaDoc arg1, Object JavaDoc arg2,
168         Object JavaDoc arg3, long sender, long recipient) {
169         super();
170         this.type = type;
171         this.arg1 = arg1;
172         this.arg2 = arg2;
173         this.arg3 = arg3;
174         this.sender = sender;
175         this.recipient = recipient;
176         requestDate = System.nanoTime();
177     }
178
179     public Object JavaDoc getArg1() {
180         return arg1;
181     }
182
183     public Object JavaDoc getArg2() {
184         return arg2;
185     }
186
187     public Object JavaDoc getArg3() {
188         return arg3;
189     }
190
191     public long getRecipient() {
192         return recipient;
193     }
194
195     public long getRequestDate() {
196         return requestDate;
197     }
198
199     public long getSender() {
200         return sender;
201     }
202
203     public RequestType getType() {
204         return type;
205     }
206
207     public void setArg1(Object JavaDoc arg1) {
208         this.arg1 = arg1;
209     }
210
211     public void setArg2(Object JavaDoc arg2) {
212         this.arg2 = arg2;
213     }
214
215     public void setArg3(Object JavaDoc arg3) {
216         this.arg3 = arg3;
217     }
218
219     public void setRecipient(long recipient) {
220         this.recipient = recipient;
221     }
222
223     public void setSender(long sender) {
224         this.sender = sender;
225     }
226
227     public void setType(RequestType type) {
228         this.type = type;
229     }
230
231     public String JavaDoc toString() {
232         return "RegistryRequest " + type + " date " + requestDate;
233     }
234
235 }
236
Popular Tags