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.runtime;
00032
00033 import java.io.IOException;
00034 import java.lang.reflect.InvocationTargetException;
00035 import java.rmi.AlreadyBoundException;
00036 import java.rmi.RemoteException;
00037 import java.security.PublicKey;
00038 import java.security.cert.X509Certificate;
00039 import java.util.ArrayList;
00040 import java.util.HashMap;
00041 import java.util.concurrent.ConcurrentHashMap;
00042
00043 import org.objectweb.proactive.Body;
00044 import org.objectweb.proactive.core.ProActiveException;
00045 import org.objectweb.proactive.core.UniqueRuntimeID;
00046 import org.objectweb.proactive.core.body.BodyAdapterForwarder;
00047 import org.objectweb.proactive.core.body.BodyForwarderImpl;
00048 import org.objectweb.proactive.core.body.RemoteBodyForwarder;
00049 import org.objectweb.proactive.core.body.UniversalBody;
00050 import org.objectweb.proactive.core.body.ft.checkpointing.Checkpoint;
00051 import org.objectweb.proactive.core.body.rmi.RmiRemoteBodyForwarderImpl;
00052 import org.objectweb.proactive.core.descriptor.data.ProActiveDescriptor;
00053 import org.objectweb.proactive.core.descriptor.data.VirtualNode;
00054 import org.objectweb.proactive.core.mop.ConstructorCall;
00055 import org.objectweb.proactive.core.mop.ConstructorCallExecutionFailedException;
00056 import org.objectweb.proactive.core.node.NodeException;
00057 import org.objectweb.proactive.core.process.ExternalProcess;
00058 import org.objectweb.proactive.core.process.HierarchicalProcess;
00059 import org.objectweb.proactive.core.process.JVMProcess;
00060 import org.objectweb.proactive.core.process.UniversalProcess;
00061 import org.objectweb.proactive.core.ssh.rmissh.SshRMIClientSocketFactory;
00062 import org.objectweb.proactive.core.ssh.rmissh.SshRMIServerSocketFactory;
00063 import org.objectweb.proactive.ext.security.Communication;
00064 import org.objectweb.proactive.ext.security.ProActiveSecurityManager;
00065 import org.objectweb.proactive.ext.security.SecurityContext;
00066 import org.objectweb.proactive.ext.security.crypto.KeyExchangeException;
00067 import org.objectweb.proactive.ext.security.exceptions.RenegotiateSessionException;
00068 import org.objectweb.proactive.ext.security.exceptions.SecurityNotAvailableException;
00069 import org.objectweb.proactive.ext.security.securityentity.Entity;
00070
00071
00078 public class ProActiveRuntimeForwarderImpl extends ProActiveRuntimeImpl
00079 implements ProActiveRuntimeForwarder, LocalProActiveRuntime {
00080
00083 protected ConcurrentHashMap<UniqueRuntimeID, ProActiveRuntime> registeredRuntimes;
00084
00087 private HashMap<Object, ExternalProcess> hierarchicalProcesses;
00088
00090 private ProActiveRuntime parentRuntime = null;
00091
00096 private BodyForwarderImpl bodyForwarder = null;
00097 private BodyAdapterForwarder bodyAdapterForwarder = null;
00098 private RemoteBodyForwarder remoteBodyForwarder = null;
00099
00100 protected ProActiveRuntimeForwarderImpl() {
00101 super();
00102 registeredRuntimes = new ConcurrentHashMap<UniqueRuntimeID, ProActiveRuntime>();
00103 hierarchicalProcesses = new HashMap<Object, ExternalProcess>();
00104 bodyForwarder = new BodyForwarderImpl();
00105
00106
00107 if ("ibis".equals(System.getProperty("proactive.communication.protocol"))) {
00108 if (logger.isDebugEnabled()) {
00109 logger.debug("Factory is ibis");
00110 }
00111
00112 logger.info("Ibis forwarding not yet implemented");
00113
00114
00115 } else if ("http".equals(System.getProperty(
00116 "proactive.communication.protocol"))) {
00117 if (logger.isDebugEnabled()) {
00118 logger.debug("Factory is http");
00119 }
00120
00121 logger.info("Http forwarding not yet implemented");
00122
00123
00124 } else if ("rmissh".equals(System.getProperty(
00125 "proactive.communication.protocol"))) {
00126 if (logger.isDebugEnabled()) {
00127 logger.debug("Factory is rmissh");
00128 }
00129
00130 try {
00131 remoteBodyForwarder = new RmiRemoteBodyForwarderImpl(bodyForwarder,
00132 new SshRMIServerSocketFactory(),
00133 new SshRMIClientSocketFactory());
00134 } catch (RemoteException e) {
00135 logger.info("Local forwarder cannot be created.");
00136 }
00137 } else {
00138 if (logger.isDebugEnabled()) {
00139 logger.debug("Factory is rmi");
00140 }
00141
00142 try {
00143 remoteBodyForwarder = new RmiRemoteBodyForwarderImpl(bodyForwarder);
00144 } catch (RemoteException e) {
00145 logger.info("Local forwarder cannot be created.");
00146 }
00147 }
00148
00149 bodyAdapterForwarder = new BodyAdapterForwarder(remoteBodyForwarder);
00150 }
00151
00152
00153
00154
00155 public BodyAdapterForwarder getBodyAdapterForwarder() {
00156 return bodyAdapterForwarder;
00157 }
00158
00159 public BodyForwarderImpl getBodyForwarder() {
00160 return bodyForwarder;
00161 }
00162
00163 public RemoteBodyForwarder getRemoteBodyForwarder() {
00164 return remoteBodyForwarder;
00165 }
00166
00167 public boolean isRoot() {
00168 String val = System.getProperty("proactive.hierarchicalRuntime");
00169
00170 return ((val != null) && val.equals("root"));
00171 }
00172
00173
00174
00175
00176 public void setParent(ProActiveRuntime parentPARuntime) {
00177 this.parentRuntime = parentPARuntime;
00178 super.setParent(parentPARuntime);
00179 }
00180
00181 public void register(ProActiveRuntime proActiveRuntimeDist,
00182 String proActiveRuntimeName, String creatorID, String creationProtocol,
00183 String vmName) {
00184
00185
00186
00187
00188
00189 try {
00190
00191 ProActiveRuntimeAdapterForwarderImpl adapter = new ProActiveRuntimeAdapterForwarderImpl((ProActiveRuntimeAdapterForwarderImpl) RuntimeFactory.getDefaultRuntime(),
00192 proActiveRuntimeDist);
00193
00194 if (parentRuntime != null) {
00195 parentRuntime.register(adapter, proActiveRuntimeName,
00196 creatorID, creationProtocol, vmName);
00197 } else {
00198 if (isRoot()) {
00199 super.register(proActiveRuntimeDist, proActiveRuntimeName,
00200 creatorID, creationProtocol, vmName);
00201 } else {
00202 logger.warn(
00203 "setParent() as not yet be called. Cannot forward the registration");
00204 }
00205 }
00206 } catch (ProActiveException e) {
00207 e.printStackTrace();
00208 logger.warn("Cannot register this runtime: " +
00209 proActiveRuntimeName);
00210 }
00211 }
00212
00213 static private Object buildKey(String padURL, String vmName) {
00214 return padURL + "??" + vmName;
00215 }
00216
00217 public ExternalProcess getProcessToDeploy(
00218 ProActiveRuntime proActiveRuntimeDist, String creatorID, String vmName,
00219 String padURL) throws ProActiveException {
00220 if (this.isRoot()) {
00221 return super.getProcessToDeploy(proActiveRuntimeDist, creatorID,
00222 vmName, padURL);
00223 } else {
00224
00225
00226 HierarchicalProcess hp = (HierarchicalProcess) hierarchicalProcesses.get(buildKey(
00227 padURL, vmName));
00228
00229 if (hp != null) {
00230 return hp.getHierarchicalProcess();
00231 } else {
00232 return null;
00233 }
00234 }
00235 }
00236
00244 protected void setProcessesToDeploy(String padURL, String vmName,
00245 ExternalProcess process) {
00246 JVMProcess jvmProcess = (JVMProcess) process.getFinalProcess();
00247 jvmProcess.resetParameters();
00248 hierarchicalProcesses.put(buildKey(padURL, vmName), process);
00249 }
00250
00251 public UniversalBody createBody(UniqueRuntimeID urid, String nodeName,
00252 ConstructorCall bodyConstructorCall, boolean isNodeLocal)
00253 throws ProActiveException, ConstructorCallExecutionFailedException,
00254 InvocationTargetException {
00255 if (urid == null) {
00256 return this.createBody(nodeName, bodyConstructorCall, isNodeLocal);
00257 }
00258
00259 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00260
00261 if (part == null) {
00262 logErrorAndDumpTable(urid);
00263
00264 return null;
00265 }
00266
00267 UniversalBody rBody = part.createBody(nodeName, bodyConstructorCall,
00268 isNodeLocal);
00269
00270 bodyForwarder.addcreatedBody(rBody.getID());
00271
00272 return rBody;
00273 }
00274
00275
00276
00277
00278 public String createLocalNode(UniqueRuntimeID urid, String nodeName,
00279 boolean replacePreviousBinding, ProActiveSecurityManager psm,
00280 String vnName, String jobId)
00281 throws NodeException, AlreadyBoundException {
00282 if (urid == null) {
00283 return this.createLocalNode(nodeName, replacePreviousBinding, psm,
00284 vnName, jobId);
00285 } else {
00286 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00287
00288 if (part != null) {
00289 return part.createLocalNode(nodeName, replacePreviousBinding,
00290 psm, vnName, jobId);
00291 } else {
00292 logErrorAndDumpTable(urid);
00293 }
00294 }
00295
00296 return null;
00297 }
00298
00299 public void killAllNodes(UniqueRuntimeID urid) throws ProActiveException {
00300 if (urid == null) {
00301 this.killAllNodes();
00302 } else {
00303 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00304
00305 if (part != null) {
00306 part.killAllNodes();
00307 } else {
00308 logErrorAndDumpTable(urid);
00309 }
00310 }
00311 }
00312
00313 public void killNode(UniqueRuntimeID urid, String nodeName)
00314 throws ProActiveException {
00315 if (urid == null) {
00316 this.killNode(nodeName);
00317 } else {
00318 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00319
00320 if (part != null) {
00321 part.killNode(nodeName);
00322 } else {
00323 logErrorAndDumpTable(urid);
00324 }
00325 }
00326 }
00327
00328 public void createVM(UniqueRuntimeID urid, UniversalProcess remoteProcess)
00329 throws IOException, ProActiveException {
00330 if (urid == null) {
00331 this.createVM(remoteProcess);
00332 } else {
00333 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00334
00335 if (part != null) {
00336 part.createVM(remoteProcess);
00337 } else {
00338 logErrorAndDumpTable(urid);
00339 }
00340 }
00341 }
00342
00343 public String[] getLocalNodeNames(UniqueRuntimeID urid)
00344 throws ProActiveException {
00345 if (urid == null) {
00346 return this.getLocalNodeNames();
00347 } else {
00348 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00349
00350 if (part != null) {
00351 return part.getLocalNodeNames();
00352 } else {
00353 logErrorAndDumpTable(urid);
00354 }
00355 }
00356
00357 return null;
00358 }
00359
00360 public VMInformation getVMInformation(UniqueRuntimeID urid) {
00361 if (urid == null) {
00362 return this.getVMInformation();
00363 } else {
00364 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00365
00366 if (part != null) {
00367 return part.getVMInformation();
00368 } else {
00369 logErrorAndDumpTable(urid);
00370 }
00371 }
00372
00373 return null;
00374 }
00375
00376 public void register(UniqueRuntimeID urid,
00377 ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeUrl,
00378 String creatorID, String creationProtocol, String rurid)
00379 throws ProActiveException {
00380 if (urid == null) {
00381 this.register(proActiveRuntimeDist, proActiveRuntimeUrl, creatorID,
00382 creationProtocol, rurid);
00383 } else {
00384 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00385
00386 if (part != null) {
00387 part.register(proActiveRuntimeDist, proActiveRuntimeUrl,
00388 creatorID, creationProtocol, rurid);
00389 } else {
00390 logErrorAndDumpTable(urid);
00391 }
00392 }
00393 }
00394
00395 public void unregister(UniqueRuntimeID urid,
00396 ProActiveRuntime proActiveRuntimeDist, String proActiveRuntimeUrl,
00397 String creatorID, String creationProtocol, String rurid)
00398 throws ProActiveException {
00399 if (urid == null) {
00400 this.unregister(proActiveRuntimeDist, proActiveRuntimeUrl,
00401 creatorID, creationProtocol, rurid);
00402 } else {
00403 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00404
00405 if (part != null) {
00406 part.unregister(proActiveRuntimeDist, proActiveRuntimeUrl,
00407 creatorID, creationProtocol, rurid);
00408 } else {
00409 logErrorAndDumpTable(urid);
00410 }
00411 }
00412 }
00413
00414 public ProActiveRuntime[] getProActiveRuntimes(UniqueRuntimeID urid)
00415 throws ProActiveException {
00416 if (urid == null) {
00417 return this.getProActiveRuntimes();
00418 } else {
00419 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00420
00421 if (part != null) {
00422 return part.getProActiveRuntimes();
00423 } else {
00424 logErrorAndDumpTable(urid);
00425 }
00426 }
00427
00428 return null;
00429 }
00430
00431 public ProActiveRuntime getProActiveRuntime(UniqueRuntimeID urid,
00432 String proActiveRuntimeName) throws ProActiveException {
00433 if (urid == null) {
00434 return this.getProActiveRuntime(proActiveRuntimeName);
00435 } else {
00436 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00437
00438 if (part != null) {
00439 return part.getProActiveRuntime(proActiveRuntimeName);
00440 } else {
00441 logErrorAndDumpTable(urid);
00442 }
00443 }
00444
00445 return null;
00446 }
00447
00448 public void addAcquaintance(UniqueRuntimeID urid,
00449 String proActiveRuntimeName) throws ProActiveException {
00450 if (urid == null) {
00451 this.addAcquaintance(proActiveRuntimeName);
00452 } else {
00453 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00454
00455 if (part != null) {
00456 part.addAcquaintance(proActiveRuntimeName);
00457 } else {
00458 logErrorAndDumpTable(urid);
00459 }
00460 }
00461 }
00462
00463 public String[] getAcquaintances(UniqueRuntimeID urid)
00464 throws ProActiveException {
00465 if (urid == null) {
00466 return this.getAcquaintances();
00467 } else {
00468 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00469
00470 if (part != null) {
00471 return part.getAcquaintances();
00472 } else {
00473 logErrorAndDumpTable(urid);
00474 }
00475 }
00476
00477 return null;
00478 }
00479
00480 public void rmAcquaintance(UniqueRuntimeID urid, String proActiveRuntimeName)
00481 throws ProActiveException {
00482 if (urid == null) {
00483 this.rmAcquaintance(proActiveRuntimeName);
00484 } else {
00485 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00486
00487 if (part != null) {
00488 part.rmAcquaintance(proActiveRuntimeName);
00489 } else {
00490 logErrorAndDumpTable(urid);
00491 }
00492 }
00493 }
00494
00495 public void killRT(UniqueRuntimeID urid, boolean softly)
00496 throws Exception {
00497 if (urid == null) {
00498 this.killRT(softly);
00499 } else {
00500 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00501
00502 if (part != null) {
00503 part.killRT(softly);
00504 } else {
00505 logErrorAndDumpTable(urid);
00506 }
00507 }
00508 }
00509
00510 public String getURL(UniqueRuntimeID urid) {
00511 if (urid == null) {
00512 return this.getURL();
00513 } else {
00514 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00515
00516 if (part != null) {
00517 return part.getURL();
00518 } else {
00519 logErrorAndDumpTable(urid);
00520 }
00521 }
00522
00523 return null;
00524 }
00525
00526 public ArrayList getActiveObjects(UniqueRuntimeID urid, String nodeName)
00527 throws ProActiveException {
00528 if (urid == null) {
00529 return this.getActiveObjects(nodeName);
00530 } else {
00531 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00532
00533 if (part != null) {
00534 return part.getActiveObjects(nodeName);
00535 } else {
00536 logErrorAndDumpTable(urid);
00537 }
00538 }
00539
00540 return null;
00541 }
00542
00543 public ArrayList getActiveObjects(UniqueRuntimeID urid, String nodeName,
00544 String className) throws ProActiveException {
00545 if (urid == null) {
00546 return this.getActiveObjects(nodeName, className);
00547 } else {
00548 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00549
00550 if (part != null) {
00551 return part.getActiveObjects(nodeName, className);
00552 } else {
00553 logErrorAndDumpTable(urid);
00554 }
00555 }
00556
00557 return null;
00558 }
00559
00560 public VirtualNode getVirtualNode(UniqueRuntimeID urid,
00561 String virtualNodeName) throws ProActiveException {
00562 if (urid == null) {
00563 return this.getVirtualNode(virtualNodeName);
00564 } else {
00565 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00566
00567 if (part != null) {
00568 return part.getVirtualNode(virtualNodeName);
00569 } else {
00570 logErrorAndDumpTable(urid);
00571 }
00572 }
00573
00574 return null;
00575 }
00576
00577 public void registerVirtualNode(UniqueRuntimeID urid,
00578 String virtualNodeName, boolean replacePreviousBinding)
00579 throws ProActiveException, AlreadyBoundException {
00580 if (urid == null) {
00581 this.registerVirtualNode(virtualNodeName, replacePreviousBinding);
00582 } else {
00583 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00584
00585 if (part != null) {
00586 part.registerVirtualNode(virtualNodeName, replacePreviousBinding);
00587 } else {
00588 logErrorAndDumpTable(urid);
00589 }
00590 }
00591 }
00592
00593 public void unregisterVirtualNode(UniqueRuntimeID urid,
00594 String virtualNodeName) throws ProActiveException {
00595 if (urid == null) {
00596 this.unregisterVirtualNode(virtualNodeName);
00597 } else {
00598 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00599
00600 if (part != null) {
00601 part.unregisterVirtualNode(virtualNodeName);
00602 } else {
00603 logErrorAndDumpTable(urid);
00604 }
00605 }
00606 }
00607
00608 public void unregisterAllVirtualNodes(UniqueRuntimeID urid)
00609 throws ProActiveException {
00610 if (urid == null) {
00611 this.unregisterAllVirtualNodes();
00612 } else {
00613 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00614
00615 if (part != null) {
00616 part.unregisterAllVirtualNodes();
00617 } else {
00618 logErrorAndDumpTable(urid);
00619 }
00620 }
00621 }
00622
00623 public String getJobID(UniqueRuntimeID urid, String nodeUrl)
00624 throws ProActiveException {
00625 if (urid == null) {
00626 return this.getJobID(nodeUrl);
00627 } else {
00628 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00629
00630 if (part != null) {
00631 return part.getJobID(nodeUrl);
00632 } else {
00633 logErrorAndDumpTable(urid);
00634 }
00635 }
00636
00637 return null;
00638 }
00639
00640 public UniversalBody receiveBody(UniqueRuntimeID urid, String nodeName,
00641 Body body) throws ProActiveException {
00642 if (urid == null) {
00643 return this.receiveBody(nodeName, body);
00644 } else {
00645 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00646
00647 if (part != null) {
00648 return part.receiveBody(nodeName, body);
00649 } else {
00650 logErrorAndDumpTable(urid);
00651 }
00652 }
00653
00654 return null;
00655 }
00656
00657 public UniversalBody receiveCheckpoint(UniqueRuntimeID urid,
00658 String nodeURL, Checkpoint ckpt, int inc) throws ProActiveException {
00659 if (urid == null) {
00660 return this.receiveCheckpoint(nodeURL, ckpt, inc);
00661 } else {
00662 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00663
00664 if (part != null) {
00665 return part.receiveCheckpoint(nodeURL, ckpt, inc);
00666 } else {
00667 logErrorAndDumpTable(urid);
00668 }
00669 }
00670
00671 return null;
00672 }
00673
00674 public ExternalProcess getProcessToDeploy(UniqueRuntimeID urid,
00675 ProActiveRuntime proActiveRuntimeDist, String creatorID, String vmName,
00676 String padURL) throws ProActiveException {
00677 if (urid == null) {
00678 return this.getProcessToDeploy(proActiveRuntimeDist, creatorID,
00679 vmName, padURL);
00680 } else {
00681 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00682
00683 if (part != null) {
00684 return part.getProcessToDeploy(proActiveRuntimeDist, creatorID,
00685 vmName, padURL);
00686 } else {
00687 logErrorAndDumpTable(urid);
00688 }
00689 }
00690
00691 return null;
00692 }
00693
00694 public String getVNName(UniqueRuntimeID urid, String Nodename)
00695 throws ProActiveException {
00696 if (urid == null) {
00697 return this.getVNName(Nodename);
00698 } else {
00699 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00700
00701 if (part != null) {
00702 return part.getVNName(Nodename);
00703 } else {
00704 logErrorAndDumpTable(urid);
00705 }
00706 }
00707
00708 return null;
00709 }
00710
00711 public ArrayList<Entity> getEntities(UniqueRuntimeID urid)
00712 throws IOException, SecurityNotAvailableException {
00713 if (urid == null) {
00714 return this.getEntities();
00715 } else {
00716 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00717
00718 if (part != null) {
00719 return part.getEntities();
00720 } else {
00721 logErrorAndDumpTable(urid);
00722 }
00723 }
00724
00725 return null;
00726 }
00727
00728 public SecurityContext getPolicy(UniqueRuntimeID urid, SecurityContext sc)
00729 throws SecurityNotAvailableException, IOException {
00730 if (urid == null) {
00731 return this.getPolicy(sc);
00732 } else {
00733 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00734
00735 if (part != null) {
00736 return part.getPolicy(sc);
00737 } else {
00738 logErrorAndDumpTable(urid);
00739 }
00740 }
00741
00742 return null;
00743 }
00744
00745 public byte[] getClassDataFromThisRuntime(UniqueRuntimeID urid,
00746 String className) throws ProActiveException {
00747 if (urid == null) {
00748 return this.getClassDataFromThisRuntime(className);
00749 } else {
00750 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00751
00752 if (part != null) {
00753 return part.getClassDataFromThisRuntime(className);
00754 } else {
00755 logErrorAndDumpTable(urid);
00756 }
00757 }
00758
00759 return null;
00760 }
00761
00762 public byte[] getClassDataFromParentRuntime(UniqueRuntimeID urid,
00763 String className) throws ProActiveException {
00764 if (urid == null) {
00765 return this.getClassDataFromParentRuntime(className);
00766 } else {
00767 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00768
00769 if (part != null) {
00770 return part.getClassDataFromParentRuntime(className);
00771 } else {
00772 logErrorAndDumpTable(urid);
00773 }
00774 }
00775
00776 return null;
00777 }
00778
00779 public X509Certificate getCertificate(UniqueRuntimeID urid)
00780 throws SecurityNotAvailableException, IOException {
00781 if (urid == null) {
00782 return this.getCertificate();
00783 } else {
00784 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00785
00786 if (part != null) {
00787 return part.getCertificate();
00788 } else {
00789 logErrorAndDumpTable(urid);
00790 }
00791 }
00792
00793 return null;
00794 }
00795
00796 public byte[] getCertificateEncoded(UniqueRuntimeID urid)
00797 throws SecurityNotAvailableException, IOException {
00798 if (urid == null) {
00799 return this.getCertificateEncoded();
00800 } else {
00801 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00802
00803 if (part != null) {
00804 return part.getCertificateEncoded();
00805 } else {
00806 logErrorAndDumpTable(urid);
00807 }
00808 }
00809
00810 return null;
00811 }
00812
00813 public PublicKey getPublicKey(UniqueRuntimeID urid)
00814 throws SecurityNotAvailableException, IOException {
00815 if (urid == null) {
00816 return this.getPublicKey();
00817 } else {
00818 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00819
00820 if (part != null) {
00821 return part.getPublicKey();
00822 } else {
00823 logErrorAndDumpTable(urid);
00824 }
00825 }
00826
00827 return null;
00828 }
00829
00830 public byte[][] publicKeyExchange(UniqueRuntimeID urid, long sessionID,
00831 byte[] myPublicKey, byte[] myCertificate, byte[] signature)
00832 throws SecurityNotAvailableException, RenegotiateSessionException,
00833 KeyExchangeException, IOException {
00834 if (urid == null) {
00835 return this.publicKeyExchange(sessionID, myPublicKey,
00836 myCertificate, signature);
00837 } else {
00838 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00839
00840 if (part != null) {
00841 return part.publicKeyExchange(sessionID, myPublicKey,
00842 myCertificate, signature);
00843 } else {
00844 logErrorAndDumpTable(urid);
00845 }
00846 }
00847
00848 return null;
00849 }
00850
00851 public byte[] randomValue(UniqueRuntimeID urid, long sessionID,
00852 byte[] clientRandomValue)
00853 throws SecurityNotAvailableException, RenegotiateSessionException,
00854 IOException {
00855 if (urid == null) {
00856 return this.randomValue(sessionID, clientRandomValue);
00857 } else {
00858 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00859
00860 if (part != null) {
00861 return part.randomValue(sessionID, clientRandomValue);
00862 } else {
00863 logErrorAndDumpTable(urid);
00864 }
00865 }
00866
00867 return null;
00868 }
00869
00870 public byte[][] secretKeyExchange(UniqueRuntimeID urid, long sessionID,
00871 byte[] encodedAESKey, byte[] encodedIVParameters,
00872 byte[] encodedClientMacKey, byte[] encodedLockData,
00873 byte[] parametersSignature)
00874 throws SecurityNotAvailableException, RenegotiateSessionException,
00875 IOException {
00876 if (urid == null) {
00877 return this.secretKeyExchange(sessionID, encodedAESKey,
00878 encodedIVParameters, encodedClientMacKey, encodedLockData,
00879 parametersSignature);
00880 } else {
00881 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00882
00883 if (part != null) {
00884 return part.secretKeyExchange(sessionID, encodedAESKey,
00885 encodedIVParameters, encodedClientMacKey, encodedLockData,
00886 parametersSignature);
00887 } else {
00888 logErrorAndDumpTable(urid);
00889 }
00890 }
00891
00892 return null;
00893 }
00894
00895 public long startNewSession(UniqueRuntimeID urid, Communication policy)
00896 throws SecurityNotAvailableException, RenegotiateSessionException,
00897 IOException {
00898 if (urid == null) {
00899 return this.startNewSession(policy);
00900 } else {
00901 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00902
00903 if (part != null) {
00904 return part.startNewSession(policy);
00905 } else {
00906 logErrorAndDumpTable(urid);
00907 }
00908 }
00909
00910 return 0;
00911 }
00912
00913 public void terminateSession(UniqueRuntimeID urid, long sessionID)
00914 throws SecurityNotAvailableException, IOException {
00915 if (urid == null) {
00916 this.terminateSession(sessionID);
00917 } else {
00918 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00919
00920 if (part != null) {
00921 part.terminateSession(sessionID);
00922 } else {
00923 logErrorAndDumpTable(urid);
00924 }
00925 }
00926 }
00927
00928 public ProActiveDescriptor getDescriptor(UniqueRuntimeID urid, String url,
00929 boolean isHierarchicalSearch) throws IOException, ProActiveException {
00930 if (urid == null) {
00931 return this.getDescriptor(url, isHierarchicalSearch);
00932 } else {
00933 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00934
00935 if (part != null) {
00936 return part.getDescriptor(url, isHierarchicalSearch);
00937 } else {
00938 logErrorAndDumpTable(urid);
00939 }
00940 }
00941
00942 return null;
00943 }
00944
00945 public String getJobID(UniqueRuntimeID urid) {
00946 if (urid == null) {
00947 return this.getJobID();
00948 } else {
00949 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00950
00951 if (part != null) {
00952 return part.getJobID();
00953 } else {
00954 logErrorAndDumpTable(urid);
00955 }
00956 }
00957
00958 return null;
00959 }
00960
00961 public void launchMain(UniqueRuntimeID urid, String className,
00962 String[] parameters)
00963 throws ClassNotFoundException, NoSuchMethodException, ProActiveException {
00964 if (urid == null) {
00965 this.launchMain(className, parameters);
00966 } else {
00967 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00968
00969 if (part != null) {
00970 part.launchMain(className, parameters);
00971 } else {
00972 logErrorAndDumpTable(urid);
00973 }
00974 }
00975 }
00976
00977 public void newRemote(UniqueRuntimeID urid, String className)
00978 throws ClassNotFoundException, ProActiveException {
00979 if (urid == null) {
00980 this.newRemote(className);
00981 } else {
00982 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(urid);
00983
00984 if (part != null) {
00985 part.newRemote(className);
00986 } else {
00987 logErrorAndDumpTable(urid);
00988 }
00989 }
00990 }
00991
00992 public Object setLocalNodeProperty(UniqueRuntimeID runtimeID,
00993 String nodeName, String key, String value)
00994 throws ProActiveException, IOException {
00995 if (runtimeID == null) {
00996 return this.setLocalNodeProperty(nodeName, key, value);
00997 } else {
00998 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(runtimeID);
00999
01000 if (part != null) {
01001 return part.setLocalNodeProperty(nodeName, key, value);
01002 } else {
01003 }
01004 }
01005 return null;
01006 }
01007
01008 public void logErrorAndDumpTable(UniqueRuntimeID runtimeID) {
01009 logger.warn("No runtime associated to this urid :" + runtimeID);
01010 logger.warn("Registered runtimes are:");
01011 for (UniqueRuntimeID urid : registeredRuntimes.keySet()) {
01012 logger.warn("\t" + urid);
01013 }
01014 }
01015
01016 public String getLocalNodeProperty(UniqueRuntimeID runtimeID,
01017 String nodeName, String key) throws ProActiveException, IOException {
01018 if (runtimeID == null) {
01019 return this.getLocalNodeProperty(nodeName, key);
01020 } else {
01021 ProActiveRuntime part = (ProActiveRuntime) registeredRuntimes.get(runtimeID);
01022
01023 if (part != null) {
01024 return part.getLocalNodeProperty(nodeName, key);
01025 } else {
01026 logErrorAndDumpTable(runtimeID);
01027 }
01028 }
01029 return null;
01030 }
01031 }