/** * This method configures and send a ACLMessage to start a new remote-Container. * * @param remConf the RemoteContainerConfig * @param preventUsageOfAlreadyUsedComputers the boolean prevent usage of already used computers * @return the name of the container */ private String sendMsgRemoteContainerRequest(RemoteContainerConfig inConf) { // --- Get the local Address of JADE ------------------------ String myPlatformAddress = myContainer.getPlatformID(); // --- If the remote-configuration is null configure it now - RemoteContainerConfig remConf = this.getRemoteContainerConfigAuto(); if (inConf != null) { if (inConf.getJadeContainerName() != null) { String name = inConf.getJadeContainerName(); int suf = getSuffixNo(inConf.getJadeContainerName()); name = name + suf; remConf.setJadeContainerName(name); } if (inConf.getJadeHost() != null) { remConf.setJadeHost(inConf.getJadeHost()); } if (inConf.getJadePort() != null) { remConf.setJadePort(inConf.getJadePort()); } if (inConf.getJadeServices() != null) { remConf.setJadeServices(inConf.getJadeServices()); } } // --- Define the AgentAction ------------------------------- ClientRemoteContainerRequest req = new ClientRemoteContainerRequest(); req.setRemoteConfig(remConf); Action act = new Action(); act.setActor(myContainer.getAMS()); act.setAction(req); // --- Define receiver of the Message ----------------------- AID agentGUIAgent = new AID("server.client" + "@" + myPlatformAddress, AID.ISGUID); // --- Build Message ---------------------------------------- ACLMessage msg = new ACLMessage(ACLMessage.INFORM); msg.setSender(myContainer.getAMS()); msg.addReceiver(agentGUIAgent); msg.setLanguage(new SLCodec().getName()); msg.setOntology(DistributionOntology.getInstance().getName()); try { msg.setContentObject(act); } catch (IOException errCont) { logger.error(errCont); } // --- Send message ----------------------------------------- myContainer.postMessageToLocalAgent(msg, agentGUIAgent); // --- Remind, that we're waiting for this container -------- loadInfo.setNewContainer2Wait4(remConf.getJadeContainerName()); // --- Return ----------------------------------------------- return remConf.getJadeContainerName(); }