mirror of
https://gitee.com/jmix/cuba.git
synced 2024-12-03 03:38:33 +08:00
Fixes #1120 Ability to specify release number / timestamp during project build
This commit is contained in:
parent
00e5a753f5
commit
550c3af0dc
@ -105,8 +105,25 @@ public interface ServerConfig extends Config {
|
||||
@DefaultBoolean(false)
|
||||
boolean getCutLoadListQueries();
|
||||
|
||||
/**
|
||||
* @return Scheduled tasks execution control.
|
||||
*/
|
||||
@Property("cuba.schedulingActive")
|
||||
@DefaultBoolean(false)
|
||||
boolean getSchedulingActive();
|
||||
void setSchedulingActive(boolean value);
|
||||
|
||||
/**
|
||||
* @return Path to resource containing the release number
|
||||
*/
|
||||
@Property("cuba.releaseNumberPath")
|
||||
@DefaultString("/com/haulmont/cuba/core/global/release.number")
|
||||
String getReleaseNumberPath();
|
||||
|
||||
/**
|
||||
* @return Path to resource containing the release timestamp
|
||||
*/
|
||||
@Property("cuba.releaseTimestampPath")
|
||||
@DefaultString("/com/haulmont/cuba/core/global/release.timestamp")
|
||||
String getReleaseTimestampPath();
|
||||
}
|
||||
|
@ -34,13 +34,16 @@ public class ServerInfo implements ServerInfoAPI, ServerInfoMBean
|
||||
private String releaseNumber = "?";
|
||||
private String releaseTimestamp = "?";
|
||||
|
||||
@Inject
|
||||
private Configuration configuration;
|
||||
|
||||
private volatile String serverId;
|
||||
|
||||
public ServerInfo() {
|
||||
InputStream stream = getClass().getResourceAsStream("/com/haulmont/cuba/core/global/release.number");
|
||||
@Inject
|
||||
public void setConfiguration(Configuration configuration) {
|
||||
this.configuration = configuration;
|
||||
ServerConfig config = configuration.getConfig(ServerConfig.class);
|
||||
|
||||
InputStream stream = getClass().getResourceAsStream(config.getReleaseNumberPath());
|
||||
if (stream != null)
|
||||
try {
|
||||
releaseNumber = IOUtils.toString(stream);
|
||||
@ -48,7 +51,7 @@ public class ServerInfo implements ServerInfoAPI, ServerInfoMBean
|
||||
log.warn("Unable to read release number", e);
|
||||
}
|
||||
|
||||
stream = getClass().getResourceAsStream("/com/haulmont/cuba/core/global/release.timestamp");
|
||||
stream = getClass().getResourceAsStream(config.getReleaseTimestampPath());
|
||||
if (stream != null)
|
||||
try {
|
||||
releaseTimestamp = IOUtils.toString(stream);
|
||||
|
Loading…
Reference in New Issue
Block a user