00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 package org.objectweb.proactive.core.body.ibis;
00032
00033 import java.io.IOException;
00034 import java.security.PublicKey;
00035 import java.security.cert.X509Certificate;
00036 import java.util.ArrayList;
00037
00038 import org.objectweb.proactive.Body;
00039 import org.objectweb.proactive.core.UniqueID;
00040 import org.objectweb.proactive.core.body.UniversalBody;
00041 import org.objectweb.proactive.core.body.ft.internalmsg.FTMessage;
00042 import org.objectweb.proactive.core.body.reply.Reply;
00043 import org.objectweb.proactive.core.body.request.Request;
00044 import org.objectweb.proactive.core.exceptions.NonFunctionalException;
00045 import org.objectweb.proactive.core.exceptions.manager.NFEListener;
00046 import org.objectweb.proactive.core.rmi.RandomPortSocketFactory;
00047 import org.objectweb.proactive.ext.security.Communication;
00048 import org.objectweb.proactive.ext.security.SecurityContext;
00049 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException;
00050 import org.objectweb.proactive.ext.security.exceptions.RenegotiateSessionException;
00051 import org.objectweb.proactive.ext.security.exceptions.SecurityNotAvailableException;
00052
00053 import ibis.rmi.RemoteException;
00054
00055
00056 public class IbisRemoteBodyImpl extends ibis.rmi.server.UnicastRemoteObject
00057 implements IbisRemoteBody, java.rmi.server.Unreferenced {
00058
00062 protected static RandomPortSocketFactory factory = new RandomPortSocketFactory(37002,
00063 5000);
00064
00069 protected transient UniversalBody body;
00070
00071
00072
00073
00074 public IbisRemoteBodyImpl() throws RemoteException {
00075 }
00076
00077 public IbisRemoteBodyImpl(UniversalBody body) throws RemoteException {
00078
00079 if (bodyLogger.isDebugEnabled()) {
00080 bodyLogger.debug(" IbisRemoteBodyImpl<init> ");
00081 }
00082 this.body = body;
00083 }
00084
00085
00086
00087
00088
00089
00090
00091 public int receiveRequest(Request r)
00092 throws java.io.IOException, RenegotiateSessionException {
00093 if (bodyLogger.isDebugEnabled()) {
00094 bodyLogger.debug("body = " + body);
00095 bodyLogger.debug("request = " + r.getMethodName());
00096 }
00097 return body.receiveRequest(r);
00098 }
00099
00100 public int receiveReply(Reply r) throws java.io.IOException {
00101 return body.receiveReply(r);
00102 }
00103
00107 public void terminate() throws IOException {
00108 body.terminate();
00109 }
00110
00111 public String getNodeURL() {
00112 return body.getNodeURL();
00113 }
00114
00115 public UniqueID getID() {
00116 return body.getID();
00117 }
00118
00119 public String getJobID() {
00120 return body.getJobID();
00121 }
00122
00123 public void updateLocation(UniqueID id, UniversalBody remoteBody)
00124 throws java.io.IOException {
00125 body.updateLocation(id, remoteBody);
00126 }
00127
00128 public void unreferenced() {
00129 if (bodyLogger.isDebugEnabled()) {
00130
00131 }
00132
00133
00134 }
00135
00136 public void enableAC() throws java.io.IOException {
00137 body.enableAC();
00138 }
00139
00140 public void disableAC() throws java.io.IOException {
00141 body.disableAC();
00142 }
00143
00144 public void setImmediateService(String methodName)
00145 throws java.io.IOException {
00146 body.setImmediateService(methodName);
00147 }
00148
00149 public void removeImmediateService(String methodName,
00150 Class[] parametersTypes) throws IOException {
00151 body.removeImmediateService(methodName, parametersTypes);
00152 }
00153
00154 public void setImmediateService(String methodName, Class[] parametersTypes)
00155 throws IOException {
00156 body.setImmediateService(methodName, parametersTypes);
00157 }
00158
00159
00160 public void terminateSession(long sessionID)
00161 throws IOException, SecurityNotAvailableException {
00162 body.terminateSession(sessionID);
00163 }
00164
00165 public X509Certificate getCertificate()
00166 throws SecurityNotAvailableException, IOException {
00167 X509Certificate cert = body.getCertificate();
00168 return cert;
00169 }
00170
00171 public long startNewSession(Communication policy)
00172 throws SecurityNotAvailableException, IOException,
00173 RenegotiateSessionException {
00174 return body.startNewSession(policy);
00175 }
00176
00177 public PublicKey getPublicKey()
00178 throws SecurityNotAvailableException, IOException {
00179 return body.getPublicKey();
00180 }
00181
00182 public byte[] randomValue(long sessionID, byte[] cl_rand)
00183 throws IOException, SecurityNotAvailableException,
00184 RenegotiateSessionException {
00185 return body.randomValue(sessionID, cl_rand);
00186 }
00187
00188 public byte[][] publicKeyExchange(long sessionID, byte[] my_pub,
00189 byte[] my_cert, byte[] sig_code)
00190 throws IOException, SecurityNotAvailableException,
00191 RenegotiateSessionException, KeyExchangeException {
00192 return body.publicKeyExchange(sessionID, my_pub, my_cert, sig_code);
00193 }
00194
00195 public byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1,
00196 byte[] tmp2, byte[] tmp3, byte[] tmp4)
00197 throws IOException, SecurityNotAvailableException,
00198 RenegotiateSessionException {
00199 return body.secretKeyExchange(sessionID, tmp, tmp1, tmp2, tmp3, tmp4);
00200 }
00201
00202
00203
00204
00205 public byte[] getCertificateEncoded()
00206 throws IOException, SecurityNotAvailableException {
00207 return body.getCertificateEncoded();
00208 }
00209
00210
00211
00212
00213 public SecurityContext getPolicy(SecurityContext securityContext)
00214 throws IOException, SecurityNotAvailableException {
00215 return body.getPolicy(securityContext);
00216 }
00217
00218
00219
00220
00221 public ArrayList getEntities()
00222 throws SecurityNotAvailableException, IOException {
00223 return body.getEntities();
00224 }
00225
00226 public void changeProxiedBody(Body newBody) {
00227 this.body = newBody;
00228 }
00229
00230
00231
00232
00233 public void addNFEListener(NFEListener listener) {
00234 body.addNFEListener(listener);
00235 }
00236
00237 public void removeNFEListener(NFEListener listener) {
00238 body.removeNFEListener(listener);
00239 }
00240
00241 public int fireNFE(NonFunctionalException e) {
00242 return body.fireNFE(e);
00243 }
00244
00245
00246
00247
00248
00249
00250
00251 private void readObject(java.io.ObjectInputStream in)
00252 throws java.io.IOException, ClassNotFoundException {
00253
00254 in.defaultReadObject();
00255 }
00256
00260 public Object receiveFTMessage(FTMessage fte) throws IOException {
00261 return this.body.receiveFTMessage(fte);
00262 }
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 }