1 31 package org.objectweb.proactive.core.body.rmi; 32 33 import java.io.IOException ; 34 import java.rmi.RemoteException ; 35 import java.security.PublicKey ; 36 import java.security.cert.X509Certificate ; 37 import java.util.ArrayList ; 38 39 import org.apache.log4j.Logger; 40 import org.objectweb.proactive.core.UniqueID; 41 import org.objectweb.proactive.core.body.UniversalBody; 42 import org.objectweb.proactive.core.body.reply.Reply; 43 import org.objectweb.proactive.core.body.request.Request; 44 import org.objectweb.proactive.core.rmi.RandomPortSocketFactory; 45 import org.objectweb.proactive.ext.security.Communication; 46 import org.objectweb.proactive.ext.security.CommunicationForbiddenException; 47 import org.objectweb.proactive.ext.security.Policy; 48 import org.objectweb.proactive.ext.security.ProActiveSecurityManager; 49 import org.objectweb.proactive.ext.security.RenegotiateSessionException; 50 import org.objectweb.proactive.ext.security.SecurityContext; 51 import org.objectweb.proactive.ext.security.SecurityNotAvailableException; 52 import org.objectweb.proactive.ext.security.crypto.AuthenticationException; 53 import org.objectweb.proactive.ext.security.crypto.ConfidentialityTicket; 54 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException; 55 56 57 62 public class RemoteBodyImpl extends java.rmi.server.UnicastRemoteObject 63 implements RemoteBody, java.rmi.server.Unreferenced { 64 protected static Logger logger = Logger.getLogger(RemoteBodyImpl.class.getName()); 65 66 69 protected static RandomPortSocketFactory factory = new RandomPortSocketFactory(37002, 70 5000); 71 72 76 protected transient UniversalBody body; 77 78 public RemoteBodyImpl() throws RemoteException { 82 } 83 84 public RemoteBodyImpl(UniversalBody body) throws RemoteException { 85 this.body = body; 87 } 88 89 public void receiveRequest(Request r) throws java.io.IOException , RenegotiateSessionException { 96 body.receiveRequest(r); 97 } 98 99 public void receiveReply(Reply r) throws java.io.IOException { 100 body.receiveReply(r); 101 } 102 103 public String getNodeURL() { 104 return body.getNodeURL(); 105 } 106 107 public UniqueID getID() { 108 return body.getID(); 109 } 110 111 public void updateLocation(UniqueID id, UniversalBody remoteBody) 112 throws java.io.IOException { 113 body.updateLocation(id, remoteBody); 114 } 115 116 public void unreferenced() { 117 System.gc(); 119 } 120 121 public void enableAC() throws java.io.IOException { 122 body.enableAC(); 123 } 124 125 public void disableAC() throws java.io.IOException { 126 body.disableAC(); 127 } 128 129 public void setImmediateService(String methodName) 130 throws java.io.IOException { 131 body.setImmediateService(methodName); 132 } 133 134 public void initiateSession(int type,UniversalBody rbody) 136 throws IOException , CommunicationForbiddenException, 137 AuthenticationException, RenegotiateSessionException, 138 SecurityNotAvailableException { 139 body.initiateSession(type,rbody); 140 } 141 142 public void terminateSession(long sessionID) 143 throws IOException , SecurityNotAvailableException { 144 body.terminateSession(sessionID); 145 } 146 147 public X509Certificate getCertificate() 148 throws SecurityNotAvailableException, IOException { 149 X509Certificate cert = body.getCertificate(); 150 return cert; 151 } 152 153 public ProActiveSecurityManager getProActiveSecurityManager() 154 throws SecurityNotAvailableException, IOException { 155 return body.getProActiveSecurityManager(); 156 } 157 158 public Policy getPolicyFrom(X509Certificate certificate) 159 throws SecurityNotAvailableException, IOException { 160 return body.getPolicyFrom(certificate); 161 } 162 163 public long startNewSession(Communication policy) 164 throws SecurityNotAvailableException, IOException , 165 RenegotiateSessionException { 166 return body.startNewSession(policy); 167 } 168 169 public ConfidentialityTicket negociateKeyReceiverSide( 170 ConfidentialityTicket confidentialityTicket, long sessionID) 171 throws SecurityNotAvailableException, KeyExchangeException, IOException { 172 return body.negociateKeyReceiverSide(confidentialityTicket, sessionID); 173 } 174 175 public PublicKey getPublicKey() 176 throws SecurityNotAvailableException, IOException { 177 return body.getPublicKey(); 178 } 179 180 public byte[] randomValue(long sessionID, byte[] cl_rand) 181 throws Exception { 182 return body.randomValue(sessionID, cl_rand); 183 } 184 185 public byte[][] publicKeyExchange(long sessionID, 186 UniversalBody distantBody, byte[] my_pub, byte[] my_cert, 187 byte[] sig_code) throws Exception { 188 return body.publicKeyExchange(sessionID, distantBody, my_pub, my_cert, 189 sig_code); 190 } 191 192 public byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1, 193 byte[] tmp2, byte[] tmp3, byte[] tmp4) throws Exception { 194 return body.secretKeyExchange(sessionID, tmp, tmp1, tmp2, tmp3, tmp4); 195 } 196 197 public Communication getPolicyTo(String type, String from, String to) 198 throws java.io.IOException , SecurityNotAvailableException { 199 return body.getPolicyTo(type, from, to); 200 } 201 202 205 public String getVNName() throws IOException , SecurityNotAvailableException { 206 return body.getVNName(); 207 } 208 209 212 public byte[] getCertificateEncoded() 213 throws IOException , SecurityNotAvailableException { 214 return body.getCertificateEncoded(); 215 } 216 217 220 public SecurityContext getPolicy(SecurityContext securityContext) 221 throws IOException , SecurityNotAvailableException { 222 return body.getPolicy(securityContext); 223 } 224 225 public ArrayList getEntities() throws SecurityNotAvailableException, IOException { 226 return body.getEntities(); 227 } 228 229 230 private void writeObject(java.io.ObjectOutputStream out) 237 throws java.io.IOException { 238 out.defaultWriteObject(); 241 } 245 246 } 251 | Popular Tags |