Skip to content

Commit 928c527

Browse files
committed
Merge branch 'release/UV_Core_v3.0.0'
2 parents d61a223 + 2ca725f commit 928c527

150 files changed

Lines changed: 2608 additions & 1640 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
## UnifiedViews Core travis build file
22

33
language: java
4+
5+
jdk:
6+
- oraclejdk8
7+
8+
install:
9+
- mvn clean install -B -V

backend/conf/config.sample.properties

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ database.rdf.platform = localRDF
9999
#database.rdf.password = dba
100100
# }
101101

102+
# or GraphDB {
103+
# database.rdf.platform = graphdb
104+
# database.rdf.url = http://localhost:7200/repositories/uv
105+
# database.rdf.user = admin
106+
# database.rdf.password = admin
107+
# }
108+
109+
102110
# Administrator contact email for sending reports and failure notifications
103111
email.enabled = false
104112
email.admin = admin@example.com

backend/pom.xml

Lines changed: 41 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
<parent>
55
<groupId>eu.unifiedviews</groupId>
66
<artifactId>uv-core</artifactId>
7-
<version>2.3.2</version>
7+
<version>3.0.0</version>
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010
<artifactId>backend</artifactId>
11-
<version>2.3.2</version>
11+
<version>3.0.0</version>
1212
<packaging>jar</packaging>
1313
<name>backend</name>
1414
<description />
@@ -69,6 +69,17 @@
6969
<artifactId>jetty-server</artifactId>
7070
<version>${jetty.server.version}</version>
7171
</dependency>
72+
<dependency>
73+
<groupId>com.fasterxml.jackson.core</groupId>
74+
<artifactId>jackson-core</artifactId>
75+
<version>2.8.3</version>
76+
</dependency>
77+
<dependency>
78+
<groupId>com.microsoft.sqlserver</groupId>
79+
<artifactId>sqljdbc4</artifactId>
80+
<version>4.0</version>
81+
<type>jar</type>
82+
</dependency>
7283
</dependencies>
7384

7485
<build>
@@ -86,46 +97,42 @@
8697
<plugin>
8798
<groupId>org.apache.maven.plugins</groupId>
8899
<artifactId>maven-jar-plugin</artifactId>
89-
<version>2.4</version>
100+
<version>3.0.2</version>
90101
<configuration>
91102
<archive>
92103
<manifest>
93104
<addClasspath>true</addClasspath>
94105
<mainClass>cz.cuni.mff.xrg.odcs.backend.AppEntry</mainClass>
95106
<classpathPrefix>lib/</classpathPrefix>
96-
<classpathLayoutType>custom</classpathLayoutType>
97-
<customClasspathLayout>$${artifact.artifactId}-$${artifact.version}$${dashClassifier?}-$${artifact.extension}/</customClasspathLayout>
98-
99-
</manifest>
100-
</archive>
101-
</configuration>
107+
<!-- so that manifest does not contain e.g. commons-app-3.0.0-20170503.092434-10.jar but rather commons-app-3.0.0-SNAPSHOT -->
108+
<useUniqueVersions>false</useUniqueVersions>
109+
</manifest>
110+
</archive>
111+
</configuration>
112+
</plugin>
113+
114+
<plugin>
115+
<groupId>org.apache.maven.plugins</groupId>
116+
<artifactId>maven-dependency-plugin</artifactId>
117+
<version>3.0.0</version>
118+
<executions>
119+
<execution>
120+
<id>copy-dependencies</id>
121+
<phase>package</phase>
122+
<goals>
123+
<goal>copy-dependencies</goal>
124+
</goals>
125+
<configuration>
126+
<outputDirectory>${project.build.directory}/lib</outputDirectory>
127+
<!-- the two lines below tell Maven not to include
128+
test scoped dependencies -->
129+
<includeScope>runtime</includeScope>
130+
<excludeScope>provided</excludeScope>
131+
</configuration>
132+
</execution>
133+
</executions>
102134
</plugin>
103135

104-
<plugin>
105-
<groupId>org.apache.maven.plugins</groupId>
106-
<artifactId>maven-dependency-plugin</artifactId>
107-
<version>2.9</version>
108-
<executions>
109-
<execution>
110-
<!-- Dependencies are not just copied, but also unpacked - this is a workaround to solve the eclipselink lazy loading issue, see https://github.com/UnifiedViews/Core/pull/555:
111-
the eclipselink core packages are signed which causes the backend to fail on start because on backend packaging it copies all the dependencies which somehow messes up the signatures.
112-
The solution proposed in the web is to filter the *.SF and *.RSA files from META-INF to remove the signature information when preparing the jar -->
113-
<id>unpack-dependencies</id>
114-
<phase>package</phase>
115-
<goals>
116-
<goal>unpack-dependencies</goal>
117-
</goals>
118-
<configuration>
119-
<excludes>**\/*.SF,**\/*.DSA,**\/*.RSA</excludes>
120-
<outputDirectory>${project.build.directory}/lib</outputDirectory>
121-
<includeScope>runtime</includeScope>
122-
<excludeScope>provided</excludeScope>
123-
<useSubDirectoryPerArtifact>true</useSubDirectoryPerArtifact>
124-
</configuration>
125-
</execution>
126-
</executions>
127-
</plugin>
128-
129136
</plugins>
130137

131138

backend/src/main/java/cz/cuni/mff/xrg/odcs/backend/AppEntry.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
66
import ch.qos.logback.classic.filter.ThresholdFilter;
77
import ch.qos.logback.core.rolling.RollingFileAppender;
8-
import ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP;
9-
import ch.qos.logback.core.rolling.TimeBasedRollingPolicy;
8+
import ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy;
9+
import ch.qos.logback.core.util.FileSize;
1010
import cz.cuni.mff.xrg.odcs.backend.auxiliaries.AppLock;
1111
import cz.cuni.mff.xrg.odcs.backend.auxiliaries.DatabaseInitializer;
1212
import cz.cuni.mff.xrg.odcs.backend.communication.EmbeddedHttpServer;
@@ -15,6 +15,7 @@
1515
import cz.cuni.mff.xrg.odcs.backend.logback.SqlAppender;
1616
import cz.cuni.mff.xrg.odcs.commons.app.conf.AppConfig;
1717
import cz.cuni.mff.xrg.odcs.commons.app.conf.ConfigProperty;
18+
import cz.cuni.mff.xrg.odcs.commons.app.conf.MissingConfigPropertyException;
1819
import cz.cuni.mff.xrg.odcs.commons.app.execution.log.Log;
1920
import cz.cuni.mff.xrg.odcs.commons.app.facade.ModuleFacade;
2021
import org.h2.store.fs.FileUtils;
@@ -54,39 +55,25 @@ public class AppEntry {
5455
private EmbeddedHttpServer httpProbeServer;
5556

5657
private RollingFileAppender createAppender(LoggerContext loggerContext,
57-
String logDirectory, String logFile, int logHistory) {
58+
String logDirectory, String logFile, int logHistory, String logMaxSize) {
5859
final RollingFileAppender rfAppender = new RollingFileAppender();
5960
rfAppender.setContext(loggerContext);
6061
rfAppender.setFile(logDirectory + logFile + ".log");
6162
{
62-
TimeBasedRollingPolicy rollingPolicy = new TimeBasedRollingPolicy();
63+
SizeAndTimeBasedRollingPolicy rollingPolicy = new SizeAndTimeBasedRollingPolicy();
6364
rollingPolicy.setContext(loggerContext);
6465
// rolling policies need to know their parent
6566
// it's one of the rare cases, where a sub-component knows about its parent
6667
rollingPolicy.setParent(rfAppender);
6768
rollingPolicy.setFileNamePattern(logDirectory + logFile + ".%d{yyyy-MM-dd}.%i.log");
68-
//rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(timeBasedTriggeringPolicy);
6969
rollingPolicy.setMaxHistory(logHistory);
70+
rollingPolicy.setTotalSizeCap(FileSize.valueOf(logMaxSize));
71+
rollingPolicy.setMaxFileSize(FileSize.valueOf("10MB"));
7072

7173
rfAppender.setRollingPolicy(rollingPolicy);
7274

73-
SizeAndTimeBasedFNATP triggeringPolicy;
74-
{
75-
// triger for name changing
76-
triggeringPolicy = new SizeAndTimeBasedFNATP();
77-
triggeringPolicy.setMaxFileSize("10MB");
78-
triggeringPolicy.setTimeBasedRollingPolicy(rollingPolicy);
79-
rfAppender.setTriggeringPolicy(triggeringPolicy);
80-
}
81-
82-
rollingPolicy.setTimeBasedFileNamingAndTriggeringPolicy(triggeringPolicy);
8375
rollingPolicy.start();
8476

85-
{
86-
// we need TimeBasedRollingPolicy to have the
87-
// FileNamePattern pattern initialized which is done in rollingPolicy.start();
88-
triggeringPolicy.start();
89-
}
9077
}
9178
PatternLayoutEncoder encoder = new PatternLayoutEncoder();
9279
encoder.setContext(loggerContext);
@@ -112,11 +99,13 @@ private void initLogbackAppender() {
11299
logDirectory = logDirectory + File.separator;
113100
}
114101
} catch (Exception e) {
102+
//not logging exception, default value is used in this case
115103
}
116104

117105
try {
118106
logHistory = appConfig.getInteger(ConfigProperty.BACKEND_LOG_KEEP);
119107
} catch (Exception e) {
108+
//not logging exception, default value is used in this case
120109
}
121110

122111
// check existance of directory
@@ -132,16 +121,27 @@ private void initLogbackAppender() {
132121
}
133122
}
134123

124+
125+
//check if there is any preferred max size for logs
126+
String logMaxSize = "1GB";
127+
// we try to load values from configuration
128+
try {
129+
logMaxSize = appConfig.getString(ConfigProperty.BACKEND_LOG_MAX_SIZE);
130+
// user set path, ensure that it end's on file separator
131+
} catch (MissingConfigPropertyException e) {
132+
//not logging exception, default value is used in this case
133+
}
134+
135135
// now prepare the logger
136136

137137
final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory();
138138

139139
RollingFileAppender allLog = createAppender(loggerContext, logDirectory,
140-
"backend", logHistory);
140+
"backend", logHistory, logMaxSize);
141141
allLog.start();
142142

143143
RollingFileAppender errorLog = createAppender(loggerContext, logDirectory,
144-
"backend_err", logHistory);
144+
"backend_err", logHistory, logMaxSize);
145145
{
146146
// add filter
147147
ThresholdFilter levelFilter = new ThresholdFilter();
@@ -199,7 +199,7 @@ private void run() throws Exception {
199199
lockKey.append(appConfig.getInteger(ConfigProperty.BACKEND_PORT));
200200
if (!AppLock.setLock(lockKey.toString())) {
201201
// another application is already running
202-
LOG.info("Another instance of UnifiedViews is probably running.");
202+
LOG.warn("Another instance of UnifiedViews is already running on this machine.");
203203
return;
204204
}
205205

backend/src/main/java/cz/cuni/mff/xrg/odcs/backend/auxiliaries/AppLock.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package cz.cuni.mff.xrg.odcs.backend.auxiliaries;
22

3+
import org.slf4j.Logger;
4+
import org.slf4j.LoggerFactory;
5+
36
import java.io.File;
47
import java.io.FileOutputStream;
58
import java.nio.channels.FileChannel;
69
import java.nio.channels.FileLock;
710

8-
import org.slf4j.Logger;
9-
import org.slf4j.LoggerFactory;
10-
1111
/**
12-
* The Class AppLock taken from
13-
* http://nerdydevel.blogspot.com/2012/07/run-only-single-java-application-instance.html
14-
*
15-
* @author rumatoest
12+
* Ensures that only single instance of UnifiedViews runs on a single machine.
13+
* Inspired by: https://github.com/javaplugs/javaplugs/blob/master/src/main/java/com/github/javaplugs/app/AppLock.java
1614
*/
1715
public class AppLock {
1816

backend/src/main/java/cz/cuni/mff/xrg/odcs/backend/auxiliaries/DatabaseInitializer.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,23 @@ public void initialize() {
4646
userRole.setName("User");
4747

4848
User admin = new User();
49-
admin.setFullName("John Admin");
49+
admin.setFullName("admin");
5050
admin.setPassword("test");
5151
admin.setTableRows(20);
5252
admin.setUsername("admin");
5353
admin.setEmail(adminEmailAddress);
5454
admin.addRole(adminRole);
55-
admin.setExternalIdentifier("http://www.johnadmin.cz");
55+
admin.setExternalIdentifier("admin");
5656
admin.addRole(userRole);
5757

5858
User user = new User();
59-
user.setFullName("John User");
59+
user.setFullName("user");
6060
user.setPassword("test");
6161
user.setTableRows(20);
6262
user.setUsername("user");
6363
user.setEmail(userEmailAddress);
6464
user.addRole(userRole);
65-
user.setExternalIdentifier("http://johnuser.at");
65+
user.setExternalIdentifier("user");
6666

6767
UserNotificationRecord userNotificationRecordAdmin = new UserNotificationRecord();
6868
userNotificationRecordAdmin.setUser(admin);
@@ -93,10 +93,10 @@ public void initialize() {
9393
//set properties holding version of UV in DB (used by Debian installation to detect the version)
9494
Property property1 = new Property();
9595
property1.setKey("UV.Core.version");
96-
property1.setValue("002.003.000");
96+
property1.setValue("003.000.000");
9797
Property property2 = new Property();
9898
property2.setKey("UV.Plugin-DevEnv.version");
99-
property2.setValue("002.001.005");
99+
property2.setValue("003.000.000");
100100

101101
addNewPermissionToRoles("administrator", adminRole);
102102
addNewPermissionToRoles("pipeline.delete", true, adminRole, userRole);

0 commit comments

Comments
 (0)