generator.writeStringField( VERSION, app.getVersion()); if( app.getExternalExportsPrefix() != null ) generator.writeStringField( EEP, app.getExternalExportsPrefix());
if( Utils.isEmptyOrWhitespaces( app.getExternalExportsPrefix())) errors.add( new ModelError( RM_MISSING_APPLICATION_EXPORT_PREFIX, app )); else if( ! app.getExternalExportsPrefix().matches( ParsingConstants.PATTERN_ID )) errors.add( new ModelError( RM_INVALID_APPLICATION_EXPORT_PREFIX, app ));
if( otherTpl.getExternalExportsPrefix() != null ) externExportPrefixes.add( otherTpl.getExternalExportsPrefix()); if( externExportPrefixes.contains( tpl.getExternalExportsPrefix())) throw new IOException( "The external exports prefix is already used by another template." );
generator.writeStringField( APP_INST_TPL_VERSION, app.getTemplate().getVersion()); if( app.getTemplate().getExternalExportsPrefix() != null ) generator.writeStringField( APP_INST_TPL_EEP, app.getTemplate().getExternalExportsPrefix());
app.externalExports.put( entry.getKey(), app.getExternalExportsPrefix() + "." + entry.getValue());
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." );
@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 ); } } }