for( Map.Entry<String,Set<String>> entry : app.getApplicationBindings().entrySet()) { String s = Utils.format( entry.getValue(), ", " ); format.put( entry.getKey(), s );
scopedInstance, app.getExternalExports(), app.getApplicationBindings(), scriptResources);
scopedInstance, ma.getApplication().getExternalExports(), ma.getApplication().getApplicationBindings(), scriptResources );
MsgCmdChangeBinding msg = new MsgCmdChangeBinding( externalExportPrefix, ma.getApplication().getApplicationBindings().get( externalExportPrefix ));
@Override public void bindOrUnbindApplication( ManagedApplication ma, String externalExportPrefix, String applicationName, boolean bind ) throws UnauthorizedActionException, IOException { // Checks Application app = findApplicationByName( applicationName ); if( app == null ) throw new UnauthorizedActionException( "Application " + applicationName + " does not exist." ); if( ! externalExportPrefix.equals( app.getTemplate().getExternalExportsPrefix())) throw new UnauthorizedActionException( "Application " + applicationName + "'s template does not have " + externalExportPrefix + " as external exports prefix." ); // Update the model boolean notify = true; if( bind ) ma.getApplication().bindWithApplication( externalExportPrefix, applicationName ); else notify = ma.getApplication().unbindFromApplication( externalExportPrefix, applicationName ); // Update and propagate the modification if( notify ) { // Save the configuration ConfigurationUtils.saveApplicationBindings( ma.getApplication()); this.logger.fine( "External prefix " + externalExportPrefix + " is now bound to application " + applicationName + " in " + ma.getName() + "." ); // Notify the agents for( Instance inst : InstanceHelpers.findAllScopedInstances( ma.getApplication())) { MsgCmdChangeBinding msg = new MsgCmdChangeBinding( externalExportPrefix, ma.getApplication().getApplicationBindings().get( externalExportPrefix )); this.messagingMngr.sendMessageSafely( ma, inst, msg ); } } }