KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > body > request > Request


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.core.body.request;
32
33 import org.objectweb.proactive.Body;
34 import org.objectweb.proactive.core.body.UniversalBody;
35 import org.objectweb.proactive.core.body.message.Message;
36 import org.objectweb.proactive.core.body.reply.Reply;
37 import org.objectweb.proactive.core.mop.MethodCall;
38 import org.objectweb.proactive.ext.security.ProActiveSecurityManager;
39 import org.objectweb.proactive.ext.security.RenegotiateSessionException;
40
41 /**
42  * <p>
43  * A class implementing this interface is an object encapsulating a reified method call.
44  * Any method call on an active object ends up as a Request sent to its associated body.
45  * The request must implements this Request interface.
46  * </p><p>
47  * In addition to the standard messaging facilities (sender, receiver) it adds the concepts
48  * of method call and forwarding, which is, the ability for a request to pass on from
49  * one body to another in case of migration.
50  * </p>
51  *
52  * @author ProActive Team
53  * @version 1.0, 2001/10/23
54  * @since ProActive 0.9
55  *
56  */

57 public interface Request extends Message {
58
59   /**
60    * Returns true if the request has been forwarded
61    * @return true if the request has been forwarded
62    */

63   public boolean hasBeenForwarded();
64
65
66   /**
67    * Returns the parameter number <code>index</code> from the method call
68    * embedded in the request
69    * @param index the position of the parameter to return.
70    * @return the object passed in parameter of the method call that matches
71    * the given position or null if no match.
72    */

73   public Object JavaDoc getParameter(int index);
74
75
76   /**
77    * Returns the MethodCall embedded in the request
78    * @return the MethodCall embedded in the request
79    */

80   public MethodCall getMethodCall();
81
82   
83   /**
84    * Returns the sender of this request
85    * @return the sender of this request
86    */

87   public UniversalBody getSender();
88   
89       
90   /**
91    * Sends this request to the body destination
92    * @param destinationBody the body destination of this request
93    * @exception java.io.IOException if the request fails to be sent
94    */

95   public void send(UniversalBody destinationBody) throws java.io.IOException JavaDoc, RenegotiateSessionException;
96
97
98   /**
99    * Serves this request by executing the embedded method call using the given
100    * <code>targetBody</code>. Once the eventual result obtained from the method call
101    * a the reply is returned (based on that result).
102    * @param targetBody the body destination of the call
103    * @return the reply built using the result or null if the request is one way
104    * @exception ServeException if the method call fails to be served
105    */

106   public Reply serve(Body targetBody) throws ServeException;
107
108
109   /**
110    * Notifies the request that it has been received by the destination.
111    * When this request gets fowarded, this method must not be called as a
112    * fowarder is not the genuine destination of the request.
113    * @param bodyReceiver the body destination that received the request
114    * @exception java.io.IOException if the request failed to perform a possible
115    * operation upon that notification
116    */

117   public void notifyReception(UniversalBody bodyReceiver) throws java.io.IOException JavaDoc;
118  
119   // SECURITY
120

121    public boolean isCiphered();
122   
123    public long getSessionId() ;
124   
125    public boolean decrypt(ProActiveSecurityManager psm) throws RenegotiateSessionException;
126 }
127
Popular Tags