org/objectweb/proactive/core/event/MessageEvent.java

00001 /* 
00002  * ################################################################
00003  * 
00004  * ProActive: The Java(TM) library for Parallel, Distributed, 
00005  *            Concurrent computing with Security and Mobility
00006  * 
00007  * Copyright (C) 1997-2007 INRIA/University of Nice-Sophia Antipolis
00008  * Contact: proactive@objectweb.org
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free Software Foundation; either
00013  * version 2.1 of the License, or any later version.
00014  *  
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
00023  * USA
00024  *  
00025  *  Initial developer(s):               The ProActive Team
00026  *                        http://www.inria.fr/oasis/ProActive/contacts.html
00027  *  Contributor(s): 
00028  * 
00029  * ################################################################
00030  */ 
00031 package org.objectweb.proactive.core.event;
00032 
00033 import org.objectweb.proactive.core.UniqueID;
00034 import org.objectweb.proactive.core.body.ft.message.MessageInfo;
00035 import org.objectweb.proactive.core.body.ft.protocols.FTManager;
00036 import org.objectweb.proactive.core.body.message.Message;
00037 
00038 
00051 public class MessageEvent extends ProActiveEvent implements Message,
00052     java.io.Serializable {
00053 
00055     public static final int REQUEST_SENT = 10;
00056 
00058     public static final int REQUEST_RECEIVED = 20;
00059 
00061     public static final int REPLY_SENT = 30;
00062 
00064     public static final int REPLY_RECEIVED = 40;
00065 
00067     public static final int VOID_REQUEST_SERVED = 50;
00068 
00070     public static final int SERVING_STARTED = 60;
00071     protected UniqueID destinationID;
00072 
00075     protected int requestQueueLength;
00076 
00087     public MessageEvent(Message message, int messageActionType,
00088         UniqueID destinationID, int requestQueueLength) {
00089         super(message, messageActionType);
00090         this.destinationID = destinationID;
00091         this.requestQueueLength = requestQueueLength;
00092     }
00093 
00094     //
00095     // -- PUBLIC METHODS -----------------------------------------------
00096     //
00097 
00104     public UniqueID getDestinationBodyID() {
00105         return destinationID;
00106     }
00107 
00112     public int getRequestQueueLength() {
00113         return requestQueueLength;
00114     }
00115 
00120     public String toString() {
00121         return "methodName=" + getMethodName() + " sourceID=" +
00122         getSourceBodyID() + " destinationID=" + getDestinationBodyID() +
00123         " sequenceNumber=" + getSequenceNumber();
00124     }
00125 
00126     public boolean wasSent() {
00127         return (type == REQUEST_SENT) || (type == REPLY_SENT);
00128     }
00129 
00130     //
00131     // -- implements Message -----------------------------------------------
00132     //
00133     public UniqueID getSourceBodyID() {
00134         return getMessage().getSourceBodyID();
00135     }
00136 
00137     public String getMethodName() {
00138         return getMessage().getMethodName();
00139     }
00140 
00141     public long getSequenceNumber() {
00142         return getMessage().getSequenceNumber();
00143     }
00144 
00145     public boolean isOneWay() {
00146         return getMessage().isOneWay();
00147     }
00148 
00149     public MessageInfo getMessageInfo() {
00150         return getMessage().getMessageInfo();
00151     }
00152 
00153     public void setMessageInfo(MessageInfo mi) {
00154         getMessage().setMessageInfo(mi);
00155     }
00156 
00157     public void setIgnoreIt(boolean ignore) {
00158         getMessage().setIgnoreIt(ignore);
00159     }
00160 
00161     public boolean ignoreIt() {
00162         return getMessage().ignoreIt();
00163     }
00164 
00165     public void setFTManager(FTManager ft) {
00166         getMessage().setFTManager(ft);
00167     }
00168 
00169     public FTManager getFTManager() {
00170         return getMessage().getFTManager();
00171     }
00172 
00173     //
00174     // -- PRIVATE METHODS -----------------------------------------------
00175     //
00176     private final Message getMessage() {
00177         return (Message) getSource();
00178     }
00179 }

Generated on Mon Jan 22 15:16:07 2007 for ProActive by  doxygen 1.5.1