KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > petals > kernel > registry > msg > response > RegistryResponse


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: JNDIResponse.java 10:55:58 AM ddesjardins $
20  * -------------------------------------------------------------------------
21  */

22 package org.objectweb.petals.kernel.registry.msg.response;
23
24 import java.io.Serializable JavaDoc;
25
26 /**
27  * Registry response
28  *
29  * @author ddesjardins - eBMWebsourcing
30  */

31 public class RegistryResponse implements Serializable JavaDoc {
32
33     /**
34      * Types of response
35      *
36      * @author ddesjardins - eBMWebsourcing
37      */

38     public static enum ResponseType {
39         /**
40          * ACK :
41          */

42         ack,
43         /**
44          * CREATE SUBCONTEXT : arg1 = name of the newly created context
45          */

46         createSubcontext,
47         /**
48          * EXCEPTION : arg1 = naming exception
49          */

50         exception,
51         /**
52          * FULL UPDATE : arg1 = full data
53          */

54         fullUpdate,
55         /**
56          * LIST : arg1 = array of NameClassPair
57          */

58         list,
59         /**
60          * LIST BINDINGS : arg1 = array of Binding
61          */

62         listBindings,
63         /**
64          * LOOKUP : arg1 = value of the lookup object
65          */

66         lookup,
67         /**
68          * LOOKUP LINK: arg1 = value of the lookup object
69          */

70         lookupLink,
71         /**
72          * MY START TIME : arg1 : start time
73          */

74         myStartTime
75     }
76
77     private static final long serialVersionUID = 1L;;
78
79     /**
80      * First argument of the response
81      */

82     protected Object JavaDoc arg1;
83
84     /**
85      * Start time of the recipient for a specific recipient, 0 for everybody
86      */

87     protected long recipient;
88
89     /**
90      * Response date
91      */

92     protected long responseDate;
93
94     /**
95      * Start time of the sender
96      */

97     protected long sender;
98
99     /**
100      * Response type
101      */

102     protected ResponseType type;
103
104     protected RegistryResponse(ResponseType type, long sender, long recipient) {
105         super();
106         this.type = type;
107         this.sender = sender;
108         this.recipient = recipient;
109         responseDate = System.nanoTime();
110     }
111
112     protected RegistryResponse(ResponseType type, Object JavaDoc arg1, long sender,
113         long recipient) {
114         super();
115         this.type = type;
116         this.arg1 = arg1;
117         this.sender = sender;
118         this.recipient = recipient;
119         responseDate = System.nanoTime();
120     }
121
122     public Object JavaDoc getArg1() {
123         return arg1;
124     }
125
126     public long getRecipient() {
127         return recipient;
128     }
129
130     public long getResponseDate() {
131         return responseDate;
132     }
133
134     public long getSender() {
135         return sender;
136     }
137
138     public ResponseType getType() {
139         return type;
140     }
141
142     public void setArg1(Object JavaDoc arg1) {
143         this.arg1 = arg1;
144     }
145
146     public void setRecipient(int recipient) {
147         this.recipient = recipient;
148     }
149
150     public void setSender(int sender) {
151         this.sender = sender;
152     }
153
154     public void setType(ResponseType type) {
155         this.type = type;
156     }
157
158     public String JavaDoc toString() {
159         return "RegistryResponse " + type + " date " + responseDate;
160     }
161
162 }
163
Popular Tags