1 31 package org.objectweb.proactive.core.body.ibis; 32 33 import ibis.rmi.RemoteException; 34 35 import java.io.IOException ; 36 import java.security.PublicKey ; 37 import java.security.cert.X509Certificate ; 38 import java.util.ArrayList ; 39 40 import org.apache.log4j.Logger; 41 import org.objectweb.proactive.core.UniqueID; 42 import org.objectweb.proactive.core.body.UniversalBody; 43 import org.objectweb.proactive.core.body.reply.Reply; 44 import org.objectweb.proactive.core.body.request.Request; 45 import org.objectweb.proactive.core.rmi.RandomPortSocketFactory; 46 import org.objectweb.proactive.ext.security.Communication; 47 import org.objectweb.proactive.ext.security.CommunicationForbiddenException; 48 import org.objectweb.proactive.ext.security.Policy; 49 import org.objectweb.proactive.ext.security.ProActiveSecurityManager; 50 import org.objectweb.proactive.ext.security.RenegotiateSessionException; 51 import org.objectweb.proactive.ext.security.SecurityContext; 52 import org.objectweb.proactive.ext.security.SecurityNotAvailableException; 53 import org.objectweb.proactive.ext.security.crypto.AuthenticationException; 54 import org.objectweb.proactive.ext.security.crypto.ConfidentialityTicket; 55 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException; 56 57 58 public class IbisRemoteBodyImpl extends ibis.rmi.server.UnicastRemoteObject 59 implements IbisRemoteBody, java.rmi.server.Unreferenced { 60 protected static Logger logger = Logger.getLogger(IbisRemoteBodyImpl.class.getName()); 61 62 65 protected static RandomPortSocketFactory factory = new RandomPortSocketFactory(37002, 66 5000); 67 68 72 protected transient UniversalBody body; 73 74 public IbisRemoteBodyImpl() throws RemoteException { 78 } 79 80 public IbisRemoteBodyImpl(UniversalBody body) throws RemoteException { 81 if (logger.isDebugEnabled()) { 83 logger.debug(" IbisRemoteBodyImpl<init> "); 84 } 85 this.body = body; 86 } 87 88 public void receiveRequest(Request r) throws java.io.IOException , RenegotiateSessionException { 95 if (logger.isDebugEnabled()) { 96 logger.debug("body = " + body); 97 logger.debug("request = " + r.getMethodName()); 98 } 99 body.receiveRequest(r); 100 } 101 102 public void receiveReply(Reply r) throws java.io.IOException { 103 body.receiveReply(r); 104 } 105 106 public String getNodeURL() { 107 return body.getNodeURL(); 108 } 109 110 public UniqueID getID() { 111 return body.getID(); 112 } 113 114 public void updateLocation(UniqueID id, UniversalBody remoteBody) 115 throws java.io.IOException { 116 body.updateLocation(id, remoteBody); 117 } 118 119 public void unreferenced() { 120 if (logger.isDebugEnabled()) { 121 } 123 System.gc(); 124 } 125 126 public void enableAC() throws java.io.IOException { 127 body.enableAC(); 128 } 129 130 public void disableAC() throws java.io.IOException { 131 body.disableAC(); 132 } 133 134 public void setImmediateService(String methodName) 135 throws java.io.IOException { 136 body.setImmediateService(methodName); 137 } 138 139 public void initiateSession(int type,UniversalBody rbody) 141 throws IOException , CommunicationForbiddenException, 142 AuthenticationException, RenegotiateSessionException, 143 SecurityNotAvailableException { 144 body.initiateSession(type,rbody); 145 } 146 147 public void terminateSession(long sessionID) 148 throws IOException , SecurityNotAvailableException { 149 body.terminateSession(sessionID); 150 } 151 152 public X509Certificate getCertificate() 153 throws SecurityNotAvailableException, IOException { 154 X509Certificate cert = body.getCertificate(); 155 return cert; 156 } 157 158 public ProActiveSecurityManager getProActiveSecurityManager() 159 throws SecurityNotAvailableException, IOException { 160 return body.getProActiveSecurityManager(); 161 } 162 163 public Policy getPolicyFrom(X509Certificate certificate) 164 throws SecurityNotAvailableException, IOException { 165 return body.getPolicyFrom(certificate); 166 } 167 168 public long startNewSession(Communication policy) 169 throws SecurityNotAvailableException, IOException , 170 RenegotiateSessionException { 171 return body.startNewSession(policy); 172 } 173 174 public ConfidentialityTicket negociateKeyReceiverSide( 175 ConfidentialityTicket confidentialityTicket, long sessionID) 176 throws SecurityNotAvailableException, KeyExchangeException, IOException { 177 return body.negociateKeyReceiverSide(confidentialityTicket, sessionID); 178 } 179 180 public PublicKey getPublicKey() 181 throws SecurityNotAvailableException, IOException { 182 return body.getPublicKey(); 183 } 184 185 public byte[] randomValue(long sessionID, byte[] cl_rand) 186 throws Exception { 187 return body.randomValue(sessionID, cl_rand); 188 } 189 190 public byte[][] publicKeyExchange(long sessionID, 191 UniversalBody distantBody, byte[] my_pub, byte[] my_cert, 192 byte[] sig_code) throws Exception { 193 return body.publicKeyExchange(sessionID, distantBody, my_pub, my_cert, 194 sig_code); 195 } 196 197 public byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1, 198 byte[] tmp2, byte[] tmp3, byte[] tmp4) throws Exception { 199 return body.secretKeyExchange(sessionID, tmp, tmp1, tmp2, tmp3, tmp4); 200 } 201 202 public Communication getPolicyTo(String type, String from, String to) 203 throws java.io.IOException , SecurityNotAvailableException { 204 return body.getPolicyTo(type, from, to); 205 } 206 207 210 public String getVNName() throws IOException , SecurityNotAvailableException { 211 return body.getVNName(); 212 } 213 214 217 public byte[] getCertificateEncoded() 218 throws IOException , SecurityNotAvailableException { 219 return body.getCertificateEncoded(); 220 } 221 222 225 public SecurityContext getPolicy(SecurityContext securityContext) 226 throws IOException , SecurityNotAvailableException { 227 return body.getPolicy(securityContext); 228 } 229 230 233 public ArrayList getEntities() throws SecurityNotAvailableException, IOException { 234 return body.getEntities(); 235 } 236 237 244 245 private void readObject(java.io.ObjectInputStream in) 246 throws java.io.IOException , ClassNotFoundException { 247 System.out.println("----- IbisRemoteBodyImpl.readObject() "); 248 in.defaultReadObject(); 249 250 } 251 252 265 } 266 | Popular Tags |