Skip to content

Commit b076b4d

Browse files
committed
Merge branch 'release/v0.4.1'
2 parents 6434db3 + 1410fa7 commit b076b4d

16 files changed

Lines changed: 626 additions & 79 deletions

File tree

CHANGELOG

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# KeyServer Change Log
22

3+
v0.4.1
4+
--------------------------------------------------------------------------------
5+
Features:
6+
- HTTPs statistics page more descriptive.
7+
- Updated dependencies (and remove unused).
8+
- Simplified dependencies maintenance.
9+
- Improved output logs tree.
10+
11+
Bug fixes:
12+
- Improved version check system if there are new versions available.
13+
- Fixed Javadoc errors.
14+
15+
316
v0.4.0
417
--------------------------------------------------------------------------------
518
Features:

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# Open Source KeyServer [![Codacy Badge](https://api.codacy.com/project/badge/Grade/0ea08a24d820457fae1a921252965d3f)](https://www.codacy.com/app/jgm1986/KeyServer?utm_source=github.com&utm_medium=referral&utm_content=mami-project/KeyServer&utm_campaign=Badge_Grade)
22

3-
Repository branch build status:
3+
Repository branch status:
44

5-
| **Master** | **Develop** |
6-
|:---:|:---:|
7-
| [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=master)](https://travis-ci.org/mami-project/KeyServer) | [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=develop)](https://travis-ci.org/mami-project/KeyServer) |
5+
| | **Master** | **Develop** |
6+
|:--- |:---:|:---:|
7+
| **Build status** | [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=master)](https://travis-ci.org/mami-project/KeyServer) | [![Build Status](https://travis-ci.org/mami-project/KeyServer.svg?branch=develop)](https://travis-ci.org/mami-project/KeyServer) |
8+
| **Dependencies status** | [![Dependency Status](https://www.versioneye.com/user/projects/58457b180356f100336d0341/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/58457b180356f100336d0341) | [![Dependency Status](https://www.versioneye.com/user/projects/58457b1603d153004d8ec98b/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/58457b1603d153004d8ec98b) |
89

910
This software is a Key Server that implements the TLS Session Key Interface (SKI) defined in [draft-cairns-tls-session-key-interface-01](https://tools.ietf.org/html/draft-cairns-tls-session-key-interface-01 "Session Key Interface (SKI) for TLS and DTLS").
1011

pom.xml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<!-- The Basics -->
55
<groupId>es.tid.keyserver</groupId>
66
<artifactId>KeyServer</artifactId>
7-
<version>v0.4.0</version>
7+
<version>v0.4.1</version>
88
<packaging>jar</packaging>
99
<prerequisites>
1010
<maven>3.0</maven>
@@ -13,58 +13,53 @@
1313
<dependency>
1414
<groupId>redis.clients</groupId>
1515
<artifactId>jedis</artifactId>
16-
<version>2.9.0</version>
16+
<version>${jedis-version}</version>
1717
<type>jar</type>
1818
<scope>compile</scope>
1919
</dependency>
2020
<dependency>
2121
<groupId>com.googlecode.json-simple</groupId>
2222
<artifactId>json-simple</artifactId>
23-
<version>1.1.1</version>
24-
</dependency>
25-
<dependency>
26-
<groupId>commons-codec</groupId>
27-
<artifactId>commons-codec</artifactId>
28-
<version>1.10</version>
23+
<version>${json-simple-version}</version>
2924
</dependency>
3025
<dependency>
3126
<groupId>org.slf4j</groupId>
3227
<artifactId>slf4j-api</artifactId>
33-
<version>1.7.20</version>
28+
<version>${slf4j-api-version}</version>
3429
</dependency>
3530
<dependency>
3631
<groupId>ch.qos.logback</groupId>
3732
<artifactId>logback-classic</artifactId>
38-
<version>1.1.7</version>
33+
<version>${logback-classic-version}</version>
3934
</dependency>
4035
<dependency>
4136
<groupId>ch.qos.logback</groupId>
4237
<artifactId>logback-core</artifactId>
43-
<version>1.1.7</version>
38+
<version>${logback-core-version}</version>
4439
</dependency>
45-
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
46-
<!--<dependency>
47-
<groupId>javax.servlet</groupId>
48-
<artifactId>javax.servlet-api</artifactId>
49-
<version>4.0.0-b01</version>
50-
</dependency>-->
51-
5240
<dependency>
5341
<groupId>org.eclipse.jetty</groupId>
5442
<artifactId>jetty-server</artifactId>
55-
<version>9.3.14.v20161028</version>
43+
<version>${jetty-version}</version>
5644
</dependency>
5745
<dependency>
5846
<groupId>org.eclipse.jetty</groupId>
5947
<artifactId>jetty-servlet</artifactId>
60-
<version>9.3.8.v20160314</version>
48+
<version>${jetty-version}</version>
6149
<type>jar</type>
6250
</dependency>
6351
</dependencies>
6452
<properties>
6553
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
6654
<maven.compiler.source>1.8</maven.compiler.source>
6755
<maven.compiler.target>1.8</maven.compiler.target>
56+
<!-- Dependencies versions -->
57+
<jedis-version>2.9.0</jedis-version>
58+
<jetty-version>9.4.0.v20161208</jetty-version>
59+
<json-simple-version>1.1.1</json-simple-version>
60+
<logback-core-version>1.1.8</logback-core-version>
61+
<logback-classic-version>1.1.8</logback-classic-version>
62+
<slf4j-api-version>1.7.22</slf4j-api-version>
6863
</properties>
6964

7065
<!-- Build Settings -->

src/main/java/es/tid/keyserver/config/ConfigController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ public int getChkUpdateInterval(){
335335
return time;
336336
} else {
337337
// Warning level.
338-
LOGGER.warn("DB connection check interval value is not valid.");
338+
LOGGER.warn("KeyServer updates check interval value is not valid.");
339339
return -1;
340340
}
341341
}

src/main/java/es/tid/keyserver/core/KeyServer.java

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import es.tid.keyserver.core.status.KsMonitor;
2222
import es.tid.keyserver.https.HttpsServerController;
2323
import es.tid.keyserver.https.certificate.HttpsCert;
24+
import es.tid.keyserver.ui.GraphicalElements;
2425
import es.tid.keyserver.ui.UserInterfaceController;
2526
import java.util.Arrays;
2627
import java.util.Scanner;
@@ -54,17 +55,9 @@ public static void main(String[] args) {
5455
String [] configFields = getRequiredFields();
5556
// KeyServer Configuration Object
5657
ConfigController softwareConfig = new ConfigController("/application.properties", configFile, configFields);
57-
// Java Project properties (from MAVEN application properties).
58-
String appName = softwareConfig.getAppName();
59-
String appVersion = softwareConfig.getVersion();
60-
// Print KeyServer start box.
61-
LOGGER.debug("Starting {} tool {}", appName, appVersion);
62-
System.out.println("+------------------------------------------------------------------------+");
63-
System.out.println("| " + appName + " |");
64-
System.out.println("| -------------------- |");
65-
System.out.println("+------------------------------------------------------------------------+");
66-
System.out.println(printVersionLine(appVersion));
67-
58+
// KeyServer Title
59+
GraphicalElements graphicalElements = new GraphicalElements(softwareConfig);
60+
System.out.println(graphicalElements.ksTitle());
6861
checkObj(softwareConfig, "Configuration file correctly loaded.",
6962
"Can't load configuration file. Please check if the file exists and can be read.");
7063

@@ -201,23 +194,6 @@ private static void checkKeyServerUserInput(Scanner sc, UserInterfaceController
201194
}
202195
}
203196
}
204-
205-
/**
206-
* This method is used to represent the application version string correctly
207-
* according to the version string length.
208-
* @param version String with the tool version info.
209-
* @return String to be printed on screen with correct position for the
210-
* version string.
211-
*/
212-
private static String printVersionLine(String version) {
213-
String versionLine = "";
214-
// Length of line 74 characters
215-
for(int i=0; i< (74 - (version.length() + 1)); i++){
216-
versionLine += " ";
217-
}
218-
versionLine += version + " ";
219-
return versionLine;
220-
}
221197

222198
/**
223199
* This method returns an array with the name of configuration file fields.

src/main/java/es/tid/keyserver/core/lib/LastVersionAvailable.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ public String getLastVersionAvailable(){
9090
* @since v0.3.0
9191
*/
9292
public boolean isUpdated(String appVersion){
93-
return lastVersion.equalsIgnoreCase(appVersion);
93+
Version currentVersion = new Version(appVersion);
94+
Version lastAvailableVersion = new Version(lastVersion);
95+
return !lastAvailableVersion.greaterThan(currentVersion);
9496
}
9597

9698
/**
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
/*
2+
* Copyright 2016.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package es.tid.keyserver.core.lib;
17+
18+
/**
19+
* Version class controller.
20+
* This class provide an easy way for manipulate version strings or compare
21+
* between them.
22+
* @see <a href="http://semver.org/">Semantic Version 2.0.0</a>
23+
* @author <a href="mailto:jgm1986@hotmail.com">Javier Gusano Martinez</a>
24+
* @since v0.4.1
25+
*/
26+
public class Version {
27+
/**
28+
* Major version field vXX.xx.xx
29+
*/
30+
private int major;
31+
/**
32+
* Minor version field vxx.XX.xx
33+
*/
34+
private int minor;
35+
/**
36+
* Patch version field vxx.xx.XX
37+
*/
38+
private int patch;
39+
40+
/**
41+
* Class constructor.
42+
* @param strVer String with the version numbers. Example: v0.1.0
43+
* @since v0.4.1
44+
*/
45+
public Version(String strVer){
46+
String tmp=strVer;
47+
if(tmp.startsWith("v")){
48+
tmp = tmp.substring(1);
49+
}
50+
/* The period / dot is a special character in regex, you have to escape
51+
it either with a double backlash \\. */
52+
String [] values = tmp.split("\\.");
53+
major = Integer.valueOf(values[0]);
54+
minor = Integer.valueOf(values[1]);
55+
patch = Integer.valueOf(values[2]);
56+
}
57+
58+
/**
59+
* This method returns the major version field.
60+
* @return Major version field as integer.
61+
* @since v0.4.1
62+
*/
63+
public int getMajor(){
64+
return this.major;
65+
}
66+
67+
/**
68+
* This method returns the minor version field.
69+
* @return Minor version field as integer.
70+
* @since v0.4.1
71+
*/
72+
public int getMinor(){
73+
return this.minor;
74+
}
75+
76+
/**
77+
* This method returns the patch version field.
78+
* @return Patch version field.
79+
* @since v0.4.1
80+
*/
81+
public int getPatch(){
82+
return this.patch;
83+
}
84+
85+
/**
86+
* This method is used to compare if two Version objects are equals
87+
* (contains the same version fields).
88+
* @param extVer External Version object to be compared with the current
89+
* version object.
90+
* @return True if are equals.
91+
* @since v0.4.1
92+
*/
93+
public boolean equalsTo(Version extVer){
94+
return ((extVer.getMajor() == this.major) &&
95+
(extVer.getMinor() == this.minor) &&
96+
(extVer.getPatch() == this.patch));
97+
}
98+
99+
/**
100+
* Method used to compare two Version objects.
101+
* This method compare if the current object is major than the external
102+
* object.
103+
* @param extVer External version object used to be compared with the
104+
* current object.
105+
* @return True if the current object is greater than
106+
* @since v0.4.1
107+
*/
108+
public boolean greaterThan(Version extVer){
109+
if(this.major > extVer.getMajor()){
110+
return true;
111+
} else if(this.major == extVer.getMajor()){
112+
if(this.minor > extVer.getMinor()){
113+
return true;
114+
} else if(this.minor == extVer.getMinor()){
115+
return this.patch > extVer.getPatch();
116+
} else{
117+
return false;
118+
}
119+
} else {
120+
return false;
121+
}
122+
}
123+
124+
/**
125+
* Method used to compare two Version objects.
126+
* This method compare if the current object is lower than the external
127+
* object.
128+
* @param extVer External version object used to be compared with the
129+
* current object.
130+
* @return True if the current object is lower than
131+
* @since v0.4.1
132+
*/
133+
public boolean lowerThan(Version extVer){
134+
if(this.major < extVer.getMajor()){
135+
return true;
136+
} else if(this.major == extVer.getMajor()){
137+
if(this.minor < extVer.getMinor()){
138+
return true;
139+
} else if(this.minor == extVer.getMinor()){
140+
return this.patch < extVer.getPatch();
141+
} else{
142+
return false;
143+
}
144+
} else {
145+
return false;
146+
}
147+
}
148+
}

src/main/java/es/tid/keyserver/core/status/KsMonitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ public void actionPerformed(ActionEvent ae) {
136136
}
137137
}
138138
});
139-
// Timer 2: Checks KeyServer updates and certificate status every 12hours.
139+
// Timer 2: Checks KeyServer updates and certificate status. Value
140+
// specified by the user in milliseconds.
140141
t2 = new Timer(updTime, new ActionListener() {
141142
/**
142143
* Check every 12 hours the following objects.

src/main/java/es/tid/keyserver/https/jetty/KsJettyErrors.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@
2020
import javax.servlet.http.HttpServletRequest;
2121
import javax.servlet.http.HttpServletResponse;
2222
import org.eclipse.jetty.server.Request;
23-
import org.eclipse.jetty.servlet.ErrorPageErrorHandler;
23+
import org.eclipse.jetty.server.handler.ErrorHandler;
2424
import org.slf4j.LoggerFactory;
2525

2626
/**
2727
* Class for custom management of Jetty server errors.
2828
* @author <a href="mailto:jgm1986@hotmail.com">Javier Gusano Martinez</a>
2929
* @since v0.4.0
3030
*/
31-
public class KsJettyErrors extends ErrorPageErrorHandler {
31+
public class KsJettyErrors extends ErrorHandler {
3232
/**
3333
* Security logger object
3434
*/
@@ -40,7 +40,7 @@ public class KsJettyErrors extends ErrorPageErrorHandler {
4040
* @param baseRequest This is the base request.
4141
* @param request Request from the client.
4242
* @param response Response to the client.
43-
* @throws IOException
43+
* @throws IOException Problem during input/output operation.
4444
* @since v0.4.0
4545
*/
4646
@Override

0 commit comments

Comments
 (0)