KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > ic2d > spy > SpyEvent


1 /*
2 * ################################################################
3 *
4 * ProActive: The Java(TM) library for Parallel, Distributed,
5 * Concurrent computing with Security and Mobility
6 *
7 * Copyright (C) 1997-2002 INRIA/University of Nice-Sophia Antipolis
8 * Contact: proactive-support@inria.fr
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 * USA
24 *
25 * Initial developer(s): The ProActive Team
26 * http://www.inria.fr/oasis/ProActive/contacts.html
27 * Contributor(s):
28 *
29 * ################################################################
30 */

31 package org.objectweb.proactive.ic2d.spy;
32
33 import org.objectweb.proactive.core.UniqueID;
34 import org.objectweb.proactive.core.event.ProActiveEvent;
35
36 public class SpyEvent extends ProActiveEvent implements java.io.Serializable JavaDoc {
37   
38   public static final int GENERIC_TYPE = 0;
39   public static final int OBJECT_WAIT_BY_NECESSITY_TYPE = 20;
40   public static final int OBJECT_RECEIVED_FUTURE_RESULT_TYPE = 21;
41   public static final int OBJECT_WAIT_FOR_REQUEST_TYPE = 30;
42   public static final int REQUEST_SENT_MESSAGE_TYPE = 50;
43   public static final int REPLY_SENT_MESSAGE_TYPE = 60;
44   public static final int REQUEST_RECEIVED_MESSAGE_TYPE = 51;
45   public static final int REPLY_RECEIVED_MESSAGE_TYPE = 61;
46   public static final int VOID_REQUEST_SERVED_TYPE = 70;
47   public static final int SERVING_STARTED_TYPE = 80;
48   public static final int BODY_EVENT_TYPE = 100;
49   public static final int BODY_CREATION_EVENT_TYPE = 200;
50
51   /** The id of the object */
52   protected UniqueID bodyID;
53   
54   /** Position. useful for the receiver only */
55   protected int pos = -1;
56   
57   public SpyEvent(int type, UniqueID bodyID) {
58     super(bodyID, type);
59     this.bodyID = bodyID;
60   }
61   
62   public UniqueID getBodyID() { return bodyID; }
63   
64   public int getPos() { return pos; }
65   public void setPos(int v) { pos = v; }
66   
67   public String JavaDoc toString() {
68     return "SpyEvent "+eventTypeAsString(type)+" body="+bodyID;
69   }
70   
71   public static String JavaDoc eventTypeAsString(int type) {
72     switch (type) {
73       case GENERIC_TYPE: return "GENERIC_TYPE";
74       case OBJECT_WAIT_BY_NECESSITY_TYPE: return "OBJECT_WAIT_BY_NECESSITY_TYPE";
75       case OBJECT_WAIT_FOR_REQUEST_TYPE: return "OBJECT_WAIT_FOR_REQUEST_TYPE";
76       case OBJECT_RECEIVED_FUTURE_RESULT_TYPE: return "OBJECT_RECEIVED_FUTURE_RESULT_TYPE";
77       case REQUEST_SENT_MESSAGE_TYPE: return "REQUEST_SENT_MESSAGE_TYPE";
78       case REPLY_SENT_MESSAGE_TYPE: return "REPLY_SENT_MESSAGE_TYPE";
79       case REQUEST_RECEIVED_MESSAGE_TYPE: return "REQUEST_RECEIVED_MESSAGE_TYPE";
80       case REPLY_RECEIVED_MESSAGE_TYPE: return "REPLY_RECEIVED_MESSAGE_TYPE";
81       case VOID_REQUEST_SERVED_TYPE: return "VOID_REQUEST_SERVED_TYPE";
82       case SERVING_STARTED_TYPE: return "SERVING_STARTED_TYPE";
83       case BODY_EVENT_TYPE: return "BODY_EVENT_TYPE";
84       case BODY_CREATION_EVENT_TYPE: return "BODY_CREATION_EVENT_TYPE";
85     }
86     return "UNKNOWN";
87   }
88 }
89  
Popular Tags