Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
f837b1ae
Commit
f837b1ae
authored
Sep 17, 2021
by
Piotr Gawron
Browse files
StartupBean depends on the Populator
parent
1c9d80be
Changes
1
Hide whitespace changes
Inline
Side-by-side
web/src/main/java/lcsb/mapviewer/web/bean/utils/StartupBean.java
View file @
f837b1ae
...
...
@@ -2,6 +2,7 @@ package lcsb.mapviewer.web.bean.utils;
import
java.io.File
;
import
java.io.IOException
;
import
java.sql.SQLException
;
import
javax.annotation.PostConstruct
;
import
javax.servlet.ServletContext
;
...
...
@@ -10,6 +11,7 @@ import org.apache.logging.log4j.LogManager;
import
org.apache.logging.log4j.Logger
;
import
org.apache.logging.log4j.core.LoggerContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.jdbc.datasource.init.ScriptException
;
import
org.springframework.stereotype.Component
;
import
lcsb.mapviewer.common.Configuration
;
...
...
@@ -20,6 +22,7 @@ import lcsb.mapviewer.model.ProjectLogEntryType;
import
lcsb.mapviewer.model.ProjectStatus
;
import
lcsb.mapviewer.model.map.layout.ReferenceGenome
;
import
lcsb.mapviewer.model.user.ConfigurationElementType
;
import
lcsb.mapviewer.persist.CustomDatabasePopulator
;
import
lcsb.mapviewer.persist.DbUtils
;
import
lcsb.mapviewer.services.interfaces.IConfigurationService
;
import
lcsb.mapviewer.services.interfaces.IProjectService
;
...
...
@@ -39,26 +42,31 @@ public class StartupBean {
private
transient
IReferenceGenomeService
referenceGenomeService
;
private
transient
DbUtils
dbUtils
;
private
ServletContext
servletContext
;
private
CustomDatabasePopulator
flyway
;
@Autowired
public
StartupBean
(
final
IProjectService
projectService
,
final
IConfigurationService
configurationService
,
final
IReferenceGenomeService
referenceGenomeService
,
final
ServletContext
servletContext
,
final
DbUtils
dbUtils
)
{
final
DbUtils
dbUtils
,
final
CustomDatabasePopulator
flyway
)
{
this
.
projectService
=
projectService
;
this
.
configurationService
=
configurationService
;
this
.
referenceGenomeService
=
referenceGenomeService
;
this
.
servletContext
=
servletContext
;
this
.
dbUtils
=
dbUtils
;
this
.
flyway
=
flyway
;
}
/**
* Method that process initial script of application.
*/
@PostConstruct
public
void
init
()
{
loadCustomLog4jProperties
();
try
{
flyway
.
populate
(
flyway
.
getDataSource
().
getConnection
());
}
catch
(
ScriptException
|
SQLException
e
)
{
logger
.
error
(
e
,
e
);
}
logger
.
debug
(
"Application startup script starts"
);
Configuration
.
setWebAppDir
(
servletContext
.
getRealPath
(
"."
)
+
"/../"
);
setInterruptedProjectsStatuses
();
...
...
@@ -137,8 +145,8 @@ public class StartupBean {
}
/**
* Set {@link ProjectStatus#FAIL} statuses to projects that were uploading
when
* application was shutdown.
* Set {@link ProjectStatus#FAIL} statuses to projects that were uploading
*
when
application was shutdown.
*/
private
void
setInterruptedProjectsStatuses
()
{
try
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment