populate version to DB
This commit is contained in:
		
							parent
							
								
									11c11d0f7d
								
							
						
					
					
						commit
						48cd54ae70
					
				
					 4 changed files with 24 additions and 13 deletions
				
			
		|  | @ -19,6 +19,7 @@ import ch.ethz.seb.sebserver.gbl.profile.GuiProfile; | ||||||
| @GuiProfile | @GuiProfile | ||||||
| public class GuiServiceInfo { | public class GuiServiceInfo { | ||||||
| 
 | 
 | ||||||
|  |     private final String sebServerVersion; | ||||||
|     private final String externalScheme; |     private final String externalScheme; | ||||||
|     private final String internalServer; |     private final String internalServer; | ||||||
|     private final String externalServer; |     private final String externalServer; | ||||||
|  | @ -29,8 +30,10 @@ public class GuiServiceInfo { | ||||||
|     private final UriComponentsBuilder internalServerURIBuilder; |     private final UriComponentsBuilder internalServerURIBuilder; | ||||||
|     private final UriComponentsBuilder externalServerURIBuilder; |     private final UriComponentsBuilder externalServerURIBuilder; | ||||||
|     private final boolean distributedSetup; |     private final boolean distributedSetup; | ||||||
|  |     private final boolean multilingualGUI; | ||||||
| 
 | 
 | ||||||
|     public GuiServiceInfo( |     public GuiServiceInfo( | ||||||
|  |             @Value("${sebserver.version:--}") final String sebServerVersion, | ||||||
|             @Value("${server.address}") final String internalServer, |             @Value("${server.address}") final String internalServer, | ||||||
|             @Value("${server.port}") final String internalPort, |             @Value("${server.port}") final String internalPort, | ||||||
|             @Value("${sebserver.gui.http.external.scheme}") final String externalScheme, |             @Value("${sebserver.gui.http.external.scheme}") final String externalScheme, | ||||||
|  | @ -38,7 +41,8 @@ public class GuiServiceInfo { | ||||||
|             @Value("${sebserver.gui.http.external.port}") final String externalPort, |             @Value("${sebserver.gui.http.external.port}") final String externalPort, | ||||||
|             @Value("${sebserver.gui.entrypoint:/gui}") final String entryPoint, |             @Value("${sebserver.gui.entrypoint:/gui}") final String entryPoint, | ||||||
|             @Value("${server.servlet.context-path:/}") final String contextPath, |             @Value("${server.servlet.context-path:/}") final String contextPath, | ||||||
|             @Value("${sebserver.webservice.distributed:false}") final boolean distributedSetup) { |             @Value("${sebserver.webservice.distributed:false}") final boolean distributedSetup, | ||||||
|  |             @Value("${sebserver.gui.multilingual:false}") final boolean multilingualGUI) { | ||||||
| 
 | 
 | ||||||
|         if (StringUtils.isBlank(externalScheme)) { |         if (StringUtils.isBlank(externalScheme)) { | ||||||
|             throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); |             throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); | ||||||
|  | @ -48,6 +52,7 @@ public class GuiServiceInfo { | ||||||
|             throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); |             throw new RuntimeException("Missing mandatory inital parameter sebserver.gui.http.external.servername"); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |         this.sebServerVersion = sebServerVersion; | ||||||
|         this.externalScheme = externalScheme; |         this.externalScheme = externalScheme; | ||||||
|         this.internalServer = internalServer; |         this.internalServer = internalServer; | ||||||
|         this.externalServer = externalServer; |         this.externalServer = externalServer; | ||||||
|  | @ -73,6 +78,7 @@ public class GuiServiceInfo { | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         this.distributedSetup = distributedSetup; |         this.distributedSetup = distributedSetup; | ||||||
|  |         this.multilingualGUI = multilingualGUI; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     public String getExternalScheme() { |     public String getExternalScheme() { | ||||||
|  | @ -115,4 +121,12 @@ public class GuiServiceInfo { | ||||||
|         return this.distributedSetup; |         return this.distributedSetup; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     public String getSebServerVersion() { | ||||||
|  |         return this.sebServerVersion; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public boolean isMultilingualGUI() { | ||||||
|  |         return this.multilingualGUI; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ import java.io.ByteArrayInputStream; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
| 
 | 
 | ||||||
| import org.apache.commons.codec.binary.Base64InputStream; | import org.apache.commons.codec.binary.Base64InputStream; | ||||||
| import org.apache.commons.lang3.BooleanUtils; |  | ||||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||||
| import org.eclipse.rap.rwt.RWT; | import org.eclipse.rap.rwt.RWT; | ||||||
| import org.eclipse.rap.rwt.client.service.UrlLauncher; | import org.eclipse.rap.rwt.client.service.UrlLauncher; | ||||||
|  | @ -31,11 +30,10 @@ import org.eclipse.swt.widgets.MessageBox; | ||||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||||
| import org.springframework.context.annotation.Lazy; | import org.springframework.context.annotation.Lazy; | ||||||
| import org.springframework.core.env.Environment; |  | ||||||
| import org.springframework.stereotype.Component; | import org.springframework.stereotype.Component; | ||||||
| 
 | 
 | ||||||
| import ch.ethz.seb.sebserver.gbl.Constants; |  | ||||||
| import ch.ethz.seb.sebserver.gbl.api.API; | import ch.ethz.seb.sebserver.gbl.api.API; | ||||||
|  | import ch.ethz.seb.sebserver.gui.GuiServiceInfo; | ||||||
| import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; | import ch.ethz.seb.sebserver.gui.service.i18n.I18nSupport; | ||||||
| import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | import ch.ethz.seb.sebserver.gui.service.i18n.LocTextKey; | ||||||
| import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; | import ch.ethz.seb.sebserver.gui.service.i18n.PolyglotPageService; | ||||||
|  | @ -70,19 +68,17 @@ public class DefaultPageLayout implements TemplateComposer { | ||||||
|     private final PolyglotPageService polyglotPageService; |     private final PolyglotPageService polyglotPageService; | ||||||
|     private final AuthorizationContextHolder authorizationContextHolder; |     private final AuthorizationContextHolder authorizationContextHolder; | ||||||
|     private final PageService pageService; |     private final PageService pageService; | ||||||
|     private final String sebServerVersion; |     private final GuiServiceInfo guiServiceInfo; | ||||||
|     private final boolean multilingual; |  | ||||||
| 
 | 
 | ||||||
|     public DefaultPageLayout( |     public DefaultPageLayout( | ||||||
|             final PageService pageService, |             final PageService pageService, | ||||||
|             final Environment environment) { |             final GuiServiceInfo guiServiceInfo) { | ||||||
| 
 | 
 | ||||||
|         this.widgetFactory = pageService.getWidgetFactory(); |         this.widgetFactory = pageService.getWidgetFactory(); | ||||||
|         this.polyglotPageService = pageService.getPolyglotPageService(); |         this.polyglotPageService = pageService.getPolyglotPageService(); | ||||||
|         this.authorizationContextHolder = pageService.getAuthorizationContextHolder(); |         this.authorizationContextHolder = pageService.getAuthorizationContextHolder(); | ||||||
|         this.pageService = pageService; |         this.pageService = pageService; | ||||||
|         this.sebServerVersion = environment.getProperty("sebserver.version", Constants.EMPTY_NOTE); |         this.guiServiceInfo = guiServiceInfo; | ||||||
|         this.multilingual = BooleanUtils.toBoolean(environment.getProperty("sebserver.gui.multilingual", "false")); |  | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     @Override |     @Override | ||||||
|  | @ -198,7 +194,7 @@ public class DefaultPageLayout implements TemplateComposer { | ||||||
|         rowLayout.marginRight = 70; |         rowLayout.marginRight = 70; | ||||||
|         langSupport.setLayout(rowLayout); |         langSupport.setLayout(rowLayout); | ||||||
| 
 | 
 | ||||||
|         if (this.multilingual) { |         if (this.guiServiceInfo.isMultilingualGUI()) { | ||||||
|             this.polyglotPageService.createLanguageSelector(pageContext.copyOf(langSupport)); |             this.polyglotPageService.createLanguageSelector(pageContext.copyOf(langSupport)); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  | @ -332,7 +328,7 @@ public class DefaultPageLayout implements TemplateComposer { | ||||||
|         this.widgetFactory.labelLocalized( |         this.widgetFactory.labelLocalized( | ||||||
|                 footerRight, |                 footerRight, | ||||||
|                 CustomVariant.FOOTER, |                 CustomVariant.FOOTER, | ||||||
|                 new LocTextKey("sebserver.overall.version", this.sebServerVersion)); |                 new LocTextKey("sebserver.overall.version", this.guiServiceInfo.getSebServerVersion())); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     private void loadInstitutionalLogo(final PageContext pageContext, final Composite logo) { |     private void loadInstitutionalLogo(final PageContext pageContext, final Composite logo) { | ||||||
|  |  | ||||||
|  | @ -77,7 +77,6 @@ public class WebserviceInfo { | ||||||
|             final Environment environment) { |             final Environment environment) { | ||||||
| 
 | 
 | ||||||
|         this.webserviceInfoDAO = webserviceInfoDAO; |         this.webserviceInfoDAO = webserviceInfoDAO; | ||||||
|         this.webserviceUUID = UUID.randomUUID().toString(); |  | ||||||
|         this.sebServerVersion = environment.getRequiredProperty(VERSION_KEY); |         this.sebServerVersion = environment.getRequiredProperty(VERSION_KEY); | ||||||
|         this.testProperty = environment.getProperty(WEB_SERVICE_TEST_PROPERTY, "NOT_AVAILABLE"); |         this.testProperty = environment.getProperty(WEB_SERVICE_TEST_PROPERTY, "NOT_AVAILABLE"); | ||||||
|         this.httpScheme = environment.getRequiredProperty(WEB_SERVICE_HTTP_SCHEME_KEY); |         this.httpScheme = environment.getRequiredProperty(WEB_SERVICE_HTTP_SCHEME_KEY); | ||||||
|  | @ -87,6 +86,9 @@ public class WebserviceInfo { | ||||||
|         this.webserverPort = environment.getProperty(WEB_SERVICE_HTTP_PORT); |         this.webserverPort = environment.getProperty(WEB_SERVICE_HTTP_PORT); | ||||||
|         this.discoveryEndpoint = environment.getRequiredProperty(WEB_SERVICE_EXAM_API_DISCOVERY_ENDPOINT_KEY); |         this.discoveryEndpoint = environment.getRequiredProperty(WEB_SERVICE_EXAM_API_DISCOVERY_ENDPOINT_KEY); | ||||||
|         this.contextPath = environment.getProperty(WEB_SERVICE_CONTEXT_PATH, ""); |         this.contextPath = environment.getProperty(WEB_SERVICE_CONTEXT_PATH, ""); | ||||||
|  |         this.webserviceUUID = UUID.randomUUID().toString() | ||||||
|  |                 + Constants.UNDERLINE | ||||||
|  |                 + this.getSEBServerVersion(); | ||||||
| 
 | 
 | ||||||
|         this.distributedUpdateInterval = environment.getProperty( |         this.distributedUpdateInterval = environment.getProperty( | ||||||
|                 "sebserver.webservice.distributed.updateInterval", |                 "sebserver.webservice.distributed.updateInterval", | ||||||
|  |  | ||||||
|  | @ -91,7 +91,6 @@ public class WebserviceInit implements ApplicationListener<ApplicationReadyEvent | ||||||
|             SEBServerInit.INIT_LOGGER.info("----> "); |             SEBServerInit.INIT_LOGGER.info("----> "); | ||||||
| 
 | 
 | ||||||
|             this.registerWebservice(); |             this.registerWebservice(); | ||||||
| 
 |  | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         SEBServerInit.INIT_LOGGER.info("----> "); |         SEBServerInit.INIT_LOGGER.info("----> "); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti