-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReposcapewebApplication.java
More file actions
96 lines (80 loc) · 3.62 KB
/
ReposcapewebApplication.java
File metadata and controls
96 lines (80 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
package de.exbio.reposcapeweb;
import de.exbio.reposcapeweb.communication.jobs.JobController;
import de.exbio.reposcapeweb.communication.reponses.WebGraphService;
import de.exbio.reposcapeweb.db.DbCommunicationService;
import de.exbio.reposcapeweb.db.io.ImportService;
import de.exbio.reposcapeweb.db.services.controller.EdgeController;
import de.exbio.reposcapeweb.db.services.controller.NodeController;
import de.exbio.reposcapeweb.db.services.edges.ProteinInteractsWithProteinService;
import de.exbio.reposcapeweb.db.updates.UpdateService;
import de.exbio.reposcapeweb.tools.ToolService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.event.EventListener;
import org.springframework.core.env.Environment;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Objects;
import java.util.TreeSet;
@SpringBootApplication
public class ReposcapewebApplication extends SpringBootServletInitializer {
private Logger log = LoggerFactory.getLogger(ReposcapewebApplication.class);
public static void main(String[] args) {
SpringApplication.run(ReposcapewebApplication.class, args);
}
@Autowired
private UpdateService updateService;
@Autowired
private Environment env;
@Autowired
private ImportService importService;
@Autowired
private ToolService toolService;
@Autowired
private JobController jobController;
@Autowired
private EdgeController edgeController;
@Autowired
private NodeController nodeController;
@Autowired
private DbCommunicationService dbService;
@Autowired
WebGraphService webGraphService;
public int hash(String params, TreeSet<Integer> ids, String method) {
return Objects.hash(params, Arrays.hashCode(ids.toArray()), method);
}
@Autowired
ProteinInteractsWithProteinService ppiService;
@EventListener(ApplicationReadyEvent.class)
public void postConstruct() throws IOException {
long start = System.currentTimeMillis();
updateService.readMetadata();
dbService.setImportInProgress(true);
importService.importNodeData();
toolService.validateTools();
dbService.setImportInProgress(false);
// webGraphService.remapHistory(new File(env.getProperty("path.usr.cache")));
if (Boolean.parseBoolean(env.getProperty("update.onstartup"))) {
updateService.scheduleDataUpdate();
} else {
importService.importEdges(false);
log.warn("Startup Database update is deactivated! Activate it by setting 'update.onstartup=true' in the application.properties.");
}
jobController.importJobsHistory();
importService.importHistory();
if (env.getProperty("update.db-dump").equals("true"))
updateService.renewDBDumps();
webGraphService.remapHistory(new File(env.getProperty("path.usr.cache")));
log.info("Startup took " + (int) ((System.currentTimeMillis() - start) / 1000) + "s");
log.debug("Current RAM usage: " + (int) ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1024 / 1024)
+ "MB");
log.info("Loaded " + nodeController.getCount() + " nodes and " + edgeController.getSize() + " edges!");
log.info("Service can be used!");
}
}