private void unconfigureBinding(BindingInstance b) { if(b.getClient().getType().getIsRemote()){ ClientPortInstance client=b.getClient(); ServerPortInstance server=b.getServer(); Resource clientResource=b.getType().getClientResource(); Resource serverResource=b.getType().getServerResource(); //client resources unconfigureWithIP(clientResource,client); //server resources unconfigureWithIP(serverResource,server); } }
/** * Find the destination of an artefactInstance * @param a an instance of artefact * @return a nodeInstance */ private NodeInstance findDestination(ArtefactInstance a){ if(a.getDestination() != null){ return a.getDestination(); }else{ for(BindingInstance b: currentModel.getBindingInstances()){ if(a.getRequired().contains(b.getClient()) && !b.getClient().getType().getIsRemote()) return b.getServer().getOwner().getDestination(); if(a.getProvided().contains(b.getServer()) && !b.getServer().getType().getIsRemote()) return b.getClient().getOwner().getDestination(); } return null; } }
/** * Configure Artefacts according to the bindings * @param dm a deployment model * @throws MalformedURLException */ private void configureWithBindings(List<BindingInstance> bindings) { //Configure on the basis of the bindings //parameters transmitted to the configuration scripts are "ip ipDestination portDestination" for(BindingInstance bi : bindings){ if(bi.getClient().getType().getIsRemote()){ ClientPortInstance client=bi.getClient(); ServerPortInstance server=bi.getServer(); Resource clientResource=bi.getType().getClientResource(); Resource serverResource=bi.getType().getServerResource(); String destinationIpAddress=server.getOwner().getDestination().getPublicAddress(); int destinationPortNumber=server.getType().getPortNumber(); String ipAddress=client.getOwner().getDestination().getPublicAddress(); //client resources configureWithIP(clientResource,client,destinationIpAddress,ipAddress,destinationPortNumber); //server resources configureWithIP(serverResource,server,destinationIpAddress,ipAddress,destinationPortNumber); } } }
initProperties(ap, kap, factory); kap.setPortNumber(ap.getPortNumber()); kap.setIsRemote(ap.getIsRemote()); kap.setIsOptional(ap.getIsOptional()); ka.addRequired(kap);