KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > proactive > core > body > UniversalBody


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;
32
33 import java.io.IOException JavaDoc;
34 import java.security.PublicKey JavaDoc;
35 import java.security.cert.X509Certificate JavaDoc;
36 import java.util.ArrayList JavaDoc;
37
38 import org.objectweb.proactive.core.UniqueID;
39 import org.objectweb.proactive.core.body.reply.Reply;
40 import org.objectweb.proactive.core.body.request.Request;
41 import org.objectweb.proactive.ext.security.Communication;
42 import org.objectweb.proactive.ext.security.CommunicationForbiddenException;
43 import org.objectweb.proactive.ext.security.Policy;
44 import org.objectweb.proactive.ext.security.ProActiveSecurityManager;
45 import org.objectweb.proactive.ext.security.RenegotiateSessionException;
46 import org.objectweb.proactive.ext.security.SecurityContext;
47 import org.objectweb.proactive.ext.security.SecurityNotAvailableException;
48 import org.objectweb.proactive.ext.security.crypto.AuthenticationException;
49 import org.objectweb.proactive.ext.security.crypto.ConfidentialityTicket;
50 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException;
51
52
53 /**
54  * An object implementing this interface provides the minimum service a body offers
55  * remotely or locally. This interface is the generic version that is used remotely
56  * and locally. A body accessed from the same JVM offers all services of this interface,
57  * plus the services defined in the Body interface.
58  *
59  * @author ProActive Team
60  * @version 1.0, 2001/10/23
61  * @since ProActive 0.9
62  * @see org.objectweb.proactive.Body
63  * @see org.objectweb.proactive.core.body.rmi.RemoteBodyAdapter
64  */

65 public interface UniversalBody {
66
67     /**
68      * Receives a request for later processing. The call to this method is non blocking
69      * unless the body cannot temporary receive the request.
70      * @param request the request to process
71      * @exception java.io.IOException if the request cannot be accepted
72      */

73     public void receiveRequest(Request request) throws java.io.IOException JavaDoc, RenegotiateSessionException ;
74
75     /**
76      * Receives a reply in response to a former request.
77      * @param reply the reply received
78      * @exception java.io.IOException if the reply cannot be accepted
79      */

80     public void receiveReply(Reply r) throws java.io.IOException JavaDoc;
81
82     /**
83      * Returns the url of the node this body is associated to
84      * The url of the node can change if the active object migrates
85      * @return the url of the node this body is associated to
86      */

87     public String JavaDoc getNodeURL();
88
89     /**
90      * Returns the UniqueID of this body
91      * This identifier is unique accross all JVMs
92      * @return the UniqueID of this body
93      */

94     public UniqueID getID();
95
96     /**
97      * Signals to this body that the body identified by id is now to a new
98      * remote location. The body given in parameter is a new stub pointing
99      * to this new location. This call is a way for a body to signal to his
100      * peer that it has migrated to a new location
101      * @param id the id of the body
102      * @param body the stub to the new location
103      */

104     public void updateLocation(UniqueID id, UniversalBody body)
105         throws java.io.IOException JavaDoc;
106
107     /**
108      * Returns the remote friendly version of this body
109      * @return the remote friendly version of this body
110      */

111     public UniversalBody getRemoteAdapter();
112
113     /**
114      * Enables automatic continuation mechanism for this body
115      */

116     public void enableAC() throws java.io.IOException JavaDoc;
117
118     /**
119      * Disables automatic continuation mechanism for this body
120      */

121     public void disableAC() throws java.io.IOException JavaDoc;
122
123     /**
124      * For setting an immediate service for this body.
125      * An immediate service is a method that will bw excecuted by the calling thread.
126      */

127     public void setImmediateService(String JavaDoc methodName)
128         throws IOException JavaDoc;
129
130     // SECURITY
131
public void initiateSession(int type,UniversalBody body)
132          throws java.io.IOException JavaDoc, CommunicationForbiddenException,
133              AuthenticationException, RenegotiateSessionException,
134              SecurityNotAvailableException;
135
136      public void terminateSession(long sessionID)
137          throws java.io.IOException JavaDoc, SecurityNotAvailableException;
138
139      public X509Certificate JavaDoc getCertificate()
140          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
141
142      public ProActiveSecurityManager getProActiveSecurityManager()
143          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
144
145      public Policy getPolicyFrom(X509Certificate JavaDoc certificate)
146          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
147
148      public long startNewSession(Communication policy)
149          throws SecurityNotAvailableException, java.io.IOException JavaDoc,
150              RenegotiateSessionException;
151
152      public ConfidentialityTicket negociateKeyReceiverSide(
153          ConfidentialityTicket confidentialityTicket, long sessionID)
154          throws SecurityNotAvailableException, KeyExchangeException,
155              java.io.IOException JavaDoc;
156
157      public PublicKey JavaDoc getPublicKey()
158          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
159
160      public byte[] randomValue(long sessionID, byte[] cl_rand)
161          throws SecurityNotAvailableException, Exception JavaDoc;
162
163      public byte[][] publicKeyExchange(long sessionID,
164          UniversalBody distantBody, byte[] my_pub, byte[] my_cert,
165          byte[] sig_code)
166          throws SecurityNotAvailableException, Exception JavaDoc,
167              RenegotiateSessionException;
168
169      byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1,
170          byte[] tmp2, byte[] tmp3, byte[] tmp4)
171          throws SecurityNotAvailableException, Exception JavaDoc,
172              RenegotiateSessionException;
173
174      public Communication getPolicyTo(String JavaDoc type, String JavaDoc from, String JavaDoc to)
175          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
176     
177     
178      public SecurityContext getPolicy(SecurityContext securityContext)
179          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
180
181      /**
182       * @return name of the virtual node where the object has been created
183       */

184      public String JavaDoc getVNName()
185          throws SecurityNotAvailableException, java.io.IOException JavaDoc;
186
187      /**
188       * @return object's X509Certificate as byte array
189       */

190      public byte[] getCertificateEncoded()
191          throws SecurityNotAvailableException, IOException JavaDoc;
192         
193         public ArrayList JavaDoc getEntities() throws SecurityNotAvailableException, IOException JavaDoc;
194 }
195
Popular Tags