1 31 package org.objectweb.proactive.core.body.jini; 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 JiniBodyImpl extends java.rmi.server.UnicastRemoteObject 63 implements JiniBody, java.rmi.server.Unreferenced { 64 static Logger logger = Logger.getLogger(JiniBodyImpl.class.getName()); 65 66 69 protected static RandomPortSocketFactory factory = new RandomPortSocketFactory(37002, 70 5000); 71 72 76 protected transient UniversalBody body; 77 78 public JiniBodyImpl() throws RemoteException { 82 } 83 84 public JiniBodyImpl(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); 99 } 100 101 public void receiveReply(Reply r) throws java.io.IOException { 102 body.receiveReply(r); 103 } 104 105 public String getNodeURL() { 106 return body.getNodeURL(); 107 } 108 109 public UniqueID getID() { 110 return body.getID(); 111 } 112 113 public void updateLocation(UniqueID id, UniversalBody jiniBody) 114 throws java.io.IOException { 115 body.updateLocation(id, jiniBody); 116 } 117 118 public void enableAC() throws java.io.IOException { 119 body.enableAC(); 120 } 121 122 public void disableAC() throws java.io.IOException { 123 body.disableAC(); 124 } 125 126 public void setImmediateService(String methodName) 127 throws java.io.IOException { 128 body.setImmediateService(methodName); 129 } 130 131 public void unreferenced() { 132 logger.info("JiniBodyImpl: unreferenced()"); 133 System.gc(); 134 } 135 136 public void initiateSession(int type,UniversalBody body) 138 throws IOException , CommunicationForbiddenException, 139 AuthenticationException, RenegotiateSessionException, 140 SecurityNotAvailableException { 141 body.initiateSession(type,body); 142 } 143 144 public void terminateSession(long sessionID) 145 throws IOException , SecurityNotAvailableException { 146 body.terminateSession(sessionID); 147 } 148 149 public X509Certificate getCertificate() 150 throws SecurityNotAvailableException, IOException { 151 return body.getCertificate(); 152 } 153 154 public ProActiveSecurityManager getProActiveSecurityManager() 155 throws SecurityNotAvailableException, IOException { 156 return body.getProActiveSecurityManager(); 157 } 158 159 public Policy getPolicyFrom(X509Certificate certificate) 160 throws SecurityNotAvailableException, IOException { 161 return body.getPolicyFrom(certificate); 162 } 163 164 public long startNewSession(Communication policy) 165 throws SecurityNotAvailableException, IOException , 166 RenegotiateSessionException { 167 return body.startNewSession(policy); 168 } 169 170 public ConfidentialityTicket negociateKeyReceiverSide( 171 ConfidentialityTicket confidentialityTicket, long sessionID) 172 throws SecurityNotAvailableException, KeyExchangeException, IOException { 173 return body.negociateKeyReceiverSide(confidentialityTicket, sessionID); 174 } 175 176 public PublicKey getPublicKey() 177 throws SecurityNotAvailableException, IOException { 178 return body.getPublicKey(); 179 } 180 181 public byte[] randomValue(long sessionID, byte[] cl_rand) 182 throws Exception { 183 return body.randomValue(sessionID, cl_rand); 184 } 185 186 public byte[][] publicKeyExchange(long sessionID, 187 UniversalBody distantBody, byte[] my_pub, byte[] my_cert, 188 byte[] sig_code) throws Exception { 189 return body.publicKeyExchange(sessionID, distantBody, my_pub, my_cert, 190 sig_code); 191 } 192 193 public byte[][] secretKeyExchange(long sessionID, byte[] tmp, byte[] tmp1, 194 byte[] tmp2, byte[] tmp3, byte[] tmp4) throws Exception { 195 return body.secretKeyExchange(sessionID, tmp, tmp1, tmp2, tmp3, tmp4); 196 } 197 198 public Communication getPolicyTo(String type, String from, String to) 199 throws SecurityNotAvailableException, IOException { 200 return body.getPolicyTo(type, from, to); 201 } 202 203 206 public String getVNName() throws IOException , SecurityNotAvailableException { 207 return body.getVNName(); 208 } 209 210 213 public byte[] getCertificateEncoded() 214 throws IOException , SecurityNotAvailableException { 215 return body.getCertificateEncoded(); 216 } 217 218 public SecurityContext getPolicy(SecurityContext securityContext) 219 throws IOException , SecurityNotAvailableException { 220 return body.getPolicy(securityContext); 221 } 222 223 public ArrayList getEntities() throws SecurityNotAvailableException, IOException { 224 return body.getEntities(); 225 } 226 227 234 248 } 249 | Popular Tags |