-
Notifications
You must be signed in to change notification settings - Fork 37
/
UiHtmlConfigProperties.java
179 lines (144 loc) · 5.71 KB
/
UiHtmlConfigProperties.java
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
/*
* Copyright (c) 2010-2023 BSI Business Systems Integration AG.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* BSI Business Systems Integration AG - initial API and implementation
*/
package org.eclipse.scout.rt.ui.html;
import static java.util.Collections.unmodifiableList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.eclipse.scout.rt.platform.BEANS;
import org.eclipse.scout.rt.platform.config.AbstractConfigProperty;
import org.eclipse.scout.rt.platform.config.AbstractLongConfigProperty;
import org.eclipse.scout.rt.platform.config.AbstractPositiveIntegerConfigProperty;
import org.eclipse.scout.rt.platform.config.AbstractPositiveLongConfigProperty;
import org.eclipse.scout.rt.platform.config.AbstractStringConfigProperty;
import org.eclipse.scout.rt.platform.util.StringUtility;
/**
* This class provides all properties configured in the config.properties file that affect the HTML UI module.
*/
public final class UiHtmlConfigProperties {
private UiHtmlConfigProperties() {
}
public static class UiThemeProperty extends AbstractStringConfigProperty {
public static final String DEFAULT_THEME = "default";
@Override
public String getKey() {
return "scout.ui.theme";
}
@Override
public String description() {
return "The name of the UI theme which is activated when the application starts.";
}
@Override
public String getDefaultValue() {
return DEFAULT_THEME;
}
}
public static class UiLocalesProperty extends AbstractConfigProperty<List<String>, String> {
@Override
public String getKey() {
return "scout.ui.locales";
}
@Override
protected List<String> parse(String value) {
String[] tokens = StringUtility.tokenize(value, ',');
// Prevent accidental modification by returning an unmodifiable list because property is cached and always returns the same instance
return unmodifiableList(Arrays.asList(tokens));
}
@Override
public String description() {
return "Contains a comma separated list of supported locales (e.g. en,en-US,de-CH). To support all locales, use the keyword 'all' instead.\n" +
"This is only relevant if locales.json and texts.json should be sent to the client, which is not the case for remote apps. So this property is only used for JS only apps.\n"
+ "By default no locales are supported.";
}
@Override
public List<String> getDefaultValue() {
return Collections.emptyList();
}
}
public static class MaxUserIdleTimeProperty extends AbstractPositiveLongConfigProperty {
@Override
public Long getDefaultValue() {
return TimeUnit.HOURS.toSeconds(4);
}
@Override
public String description() {
return "If a user is inactive (no user action) for the specified number of seconds, the session is stopped and the user is logged out.\n"
+ "By default this property is set to 4 hours.";
}
@Override
public String getKey() {
return "scout.ui.maxUserIdleTime";
}
}
public static class BackgroundPollingIntervalProperty extends AbstractPositiveLongConfigProperty {
@Override
public Long getDefaultValue() {
return TimeUnit.SECONDS.toSeconds(60);
}
@Override
@SuppressWarnings("findbugs:VA_FORMAT_STRING_USES_NEWLINE")
public String description() {
return String.format("The polling request (which waits for a background job to complete) stays open until a background job has completed or the specified number of seconds elapsed.\n"
+ "This property must have a value between 3 and the value of property '%s'.\n"
+ "By default this property is set to 1 minute.", BEANS.get(MaxUserIdleTimeProperty.class).getKey());
}
@Override
public String getKey() {
return "scout.ui.backgroundPollingMaxWaitTime";
}
}
public static class UiModelJobsAwaitTimeoutProperty extends AbstractPositiveLongConfigProperty {
@Override
public Long getDefaultValue() {
return TimeUnit.HOURS.toSeconds(1);
}
@Override
public String description() {
return "The maximal timeout in seconds to wait for model jobs to complete during a UI request. After that timeout the model jobs will be aborted so that the request may return to the client.\n"
+ "By default this property is set to 1 hour.";
}
@Override
public String getKey() {
return "scout.ui.modelJobTimeout";
}
}
public static class SessionStoreHousekeepingDelayProperty extends AbstractPositiveIntegerConfigProperty {
@Override
public String getKey() {
return "scout.ui.sessionstore.housekeepingDelay";
}
@Override
public String description() {
return "Number of seconds before the housekeeping job starts after a UI session has been unregistered from the store.\n"
+ "By default this property is set to 30 seconds.";
}
@Override
public Integer getDefaultValue() {
return 30;
}
}
public static class MaxUploadFileCountProperty extends AbstractLongConfigProperty {
@Override
public Long getDefaultValue() {
return 100L;
}
@Override
public String description() {
return "For security reasons, file upload is limited to a maximum number of file that can be processed at once.\n"
+ "By default this property is set to 100. A value of -1 means no limit";
}
@Override
public String getKey() {
return "scout.ui.maxUploadFileCount";
}
}
}