@Override public Application deserialize( JsonParser parser, DeserializationContext context ) throws IOException { ObjectCodec oc = parser.getCodec(); JsonNode node = oc.readTree( parser ); Application application; JsonNode n; if(( n = node.get( APP_INST_TPL_NAME )) != null ) { ApplicationTemplate appTemplate = new ApplicationTemplate(); appTemplate.setName( n.textValue()); n = node.get( APP_INST_TPL_VERSION ); if( n != null ) appTemplate.setVersion( n.textValue()); n = node.get( APP_INST_TPL_EEP ); if( n != null ) appTemplate.setExternalExportsPrefix( n.textValue()); application = new Application( appTemplate ); } else { application = new Application( null ); } if(( n = node.get( DISPLAY_NAME )) != null ) application.setName( n.textValue()); else if(( n = node.get( NAME )) != null ) application.setName( n.textValue()); if(( n = node.get( DESC )) != null ) application.setDescription( n.textValue()); return application; } }
@Override public void updateApplication( ManagedApplication ma, String newDesc ) throws IOException { // Basic checks this.messagingMngr.checkMessagingConfiguration(); // Update it Application app = ma.getApplication(); app.setDescription( newDesc ); File targetDirectory = app.getDirectory(); File descFile = new File( targetDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ); Utils.createDirectory( descFile.getParentFile()); ApplicationDescriptor.save( descFile, app ); // Notify listeners this.notificationMngr.application( ma.getApplication(), EventType.CHANGED ); this.logger.fine( "The description of application " + ma.getApplication().getName() + " was successfully updated." ); }