annotate src/main/java/org/mpi/openmind/scheduling/utils/Scheduling.java @ 127:3e772f7f43e0 default tip

ismi-date with long month names in xml dump.
author Robert Casties <casties@mpiwg-berlin.mpg.de>
date Thu, 11 May 2023 18:15:45 +0200
parents 2f19cdf8e60b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
jurzua
parents:
diff changeset
1 package org.mpi.openmind.scheduling.utils;
jurzua
parents:
diff changeset
2
jurzua
parents:
diff changeset
3 import java.text.DateFormat;
jurzua
parents:
diff changeset
4 import java.text.SimpleDateFormat;
jurzua
parents:
diff changeset
5 import java.util.Date;
jurzua
parents:
diff changeset
6
jurzua
parents:
diff changeset
7 import org.apache.commons.lang.StringUtils;
jurzua
parents:
diff changeset
8 import org.apache.log4j.Logger;
jurzua
parents:
diff changeset
9 import org.mpi.openmind.configuration.ConfigurationService;
jurzua
parents:
diff changeset
10 import org.mpi.openmind.repository.services.PersistenceService;
jurzua
parents:
diff changeset
11 import org.mpi.openmind.repository.utils.OM4StreamWriter;
jurzua
parents:
diff changeset
12
jurzua
parents:
diff changeset
13
jurzua
parents:
diff changeset
14 public class Scheduling {
jurzua
parents:
diff changeset
15
jurzua
parents:
diff changeset
16 private static Logger logger = Logger.getLogger(Scheduling.class);
jurzua
parents:
diff changeset
17
jurzua
parents:
diff changeset
18 private PersistenceService persistenceService;
jurzua
parents:
diff changeset
19 private ConfigurationService configurationService;
jurzua
parents:
diff changeset
20
jurzua
parents:
diff changeset
21 public synchronized void dailyKickOff(){
jurzua
parents:
diff changeset
22 if(configurationService.isSchedulingEnable() && StringUtils.isNotEmpty(configurationService.getSchedulingPath())){
30
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
23 // get path from configuration service
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
24 String schedulingPath = configurationService.getSchedulingPath();
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
25 if(schedulingPath.charAt(schedulingPath.length() - 1) != '/'){
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
26 schedulingPath += "/";
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
27 }
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
28 // add date
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
29 Date now = new Date();
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
30 DateFormat formatter = new SimpleDateFormat("yyMMdd-HHmm");
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
31 String defFn = "openmind-defs-" + formatter.format(now) + ".xml";
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
32 String entFn = "openmind-data-" + formatter.format(now) + ".xml";
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
33 // export XML
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
34 logger.info("Backup Definitions as: " + defFn);
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
35 OM4StreamWriter.backupDefinitions(schedulingPath + defFn, persistenceService);
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
36 logger.info("Backup Entities as: " + entFn);
2f19cdf8e60b nicer filenames for automatic XML export.
casties
parents: 20
diff changeset
37 OM4StreamWriter.backupEntities(schedulingPath + entFn, persistenceService);
1
jurzua
parents:
diff changeset
38 }
jurzua
parents:
diff changeset
39 }
jurzua
parents:
diff changeset
40
jurzua
parents:
diff changeset
41
jurzua
parents:
diff changeset
42 public ConfigurationService getConfigurationService() {
jurzua
parents:
diff changeset
43 return configurationService;
jurzua
parents:
diff changeset
44 }
jurzua
parents:
diff changeset
45 public void setConfigurationService(ConfigurationService configurationService) {
jurzua
parents:
diff changeset
46 this.configurationService = configurationService;
jurzua
parents:
diff changeset
47 }
jurzua
parents:
diff changeset
48
jurzua
parents:
diff changeset
49 public PersistenceService getPersistenceService() {
jurzua
parents:
diff changeset
50 return persistenceService;
jurzua
parents:
diff changeset
51 }
jurzua
parents:
diff changeset
52
jurzua
parents:
diff changeset
53
jurzua
parents:
diff changeset
54 public void setPersistenceService(PersistenceService persistenceService) {
jurzua
parents:
diff changeset
55 this.persistenceService = persistenceService;
jurzua
parents:
diff changeset
56 }
jurzua
parents:
diff changeset
57
jurzua
parents:
diff changeset
58
jurzua
parents:
diff changeset
59 }