Added various log4j2 configurations.
Change-Id: I638d2dd0e1edd80006d0c8d476505f2bc43931e2
diff --git a/core/Changes b/core/Changes
index 1541f93..ec10f8e 100644
--- a/core/Changes
+++ b/core/Changes
@@ -1,6 +1,11 @@
+version 0.61.2
+12/09/2018
+ - Removed log4j loader and old OAuth2 implementation codes(margaretha)
+
version 0.61.1
28/08/2018
- Added API URL versioning (margaretha)
+
30/08/2018
- Added backwards compability for URL versioning (margaretha)
- Updated API version filter (margaretha)
diff --git a/core/pom.xml b/core/pom.xml
index 3b7af23..df8478e 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.ids_mannheim.korap</groupId>
<artifactId>Kustvakt-core</artifactId>
- <version>0.61.1</version>
+ <version>0.61.2</version>
<properties>
<java.version>1.8</java.version>
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java b/core/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java
deleted file mode 100644
index 66cc6a0..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/config/ClientInfo.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package de.ids_mannheim.korap.config;
-
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.utils.JsonUtils;
-import lombok.Data;
-
-/**
- * @author hanl
- * @date 22/01/2014
- */
-@Deprecated
-@Data
-public class ClientInfo {
-
- private Integer id;
- private String client_id;
- private String application_name;
- private boolean confidential;
- private String client_secret;
- // fixme: keep type?
- private String client_type;
- private String url;
- private String redirect_uri;
-
-
- public ClientInfo (String client_id, String client_secret) {
- this.client_id = client_id;
- this.client_secret = client_secret;
- }
-
-
- public String toJSON () throws KustvaktException {
- ObjectNode node = JsonUtils.createObjectNode();
- node.put("client_id", client_id);
- node.put("client_secret", client_secret);
- node.put("application_name", application_name);
- node.put("url", url);
- node.put("redirect_uri", redirect_uri);
- return JsonUtils.toJSON(node);
- }
-
-
- public String toString () {
- return "client_id: " + client_id + "\n" + "application_name: "
- + application_name + "\n" + "url: " + url + "\n"
- + "redirect_uri: " + redirect_uri + "\n";
- }
-
-
- //todo:
- public static ClientInfo fromJSON (String json) {
- return null;
- }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
index 761911d..84dfaf7 100644
--- a/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
+++ b/core/src/main/java/de/ids_mannheim/korap/config/KustvaktConfiguration.java
@@ -11,10 +11,6 @@
import java.util.Set;
import java.util.stream.Collectors;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-// import org.apache.logging.log4j.PropertyConfigurator;
-
import de.ids_mannheim.korap.util.KrillProperties;
import de.ids_mannheim.korap.utils.TimeUtils;
import lombok.Getter;
@@ -23,8 +19,11 @@
* if configuration class is extended, loadSubTypes method should be
* overriden
*
- * @author hanl, margaretha
+ * @author hanl
* @date 05/02/2014
+ *
+ * @author margaretha
+ * - cleaned up log4j loader
*/
@Getter
@@ -32,8 +31,6 @@
public static final Map<String, Object> KUSTVAKT_USER = new HashMap<>();
- private static final Logger jlog =
- LogManager.getLogger(KustvaktConfiguration.class);
private String indexDir;
private int port;
// todo: make exclusive so that the containg languages can really
@@ -203,57 +200,6 @@
return Enum.valueOf(BACKENDS.class, value.toUpperCase());
}
- public static void loadLogger () {
- // InputStream stream =
- // ConfigLoader.loadConfigStream("log4j.properties");
- // PropertyConfigurator.configure(stream);
- jlog.info("Done loading logging framework Log4j!");
- }
-
- // @Deprecated
- // public static void loadLog4jLogger () {
- // /** loadSubTypes log4j configuration file programmatically */
- // Properties log4j = new Properties();
- // try {
- // File f = new File(System.getProperty("user.dir"),
- // "log4j.properties");
- // if (f.exists()) {
- // log4j.load(new FileInputStream(f));
- // PropertyConfigurator.configure(log4j);
- // jlog.info(
- // "using local logging properties file ({}) to configure logging
- // system",
- // "./log4j.properties");
- // return;
- // }
- // }
- // catch (Exception e) {
- // // do nothing
- // }
- // loadClassLogger();
- // }
-
- // @Deprecated
- // private static void loadClassLogger () {
- // Properties log4j = new Properties();
- // jlog.info(
- // "using class path logging properties file to configure logging
- // system");
- //
- // try {
- // log4j.load(KustvaktConfiguration.class.getClassLoader()
- // .getResourceAsStream("log4j.properties"));
- // }
- // catch (IOException e) {
- // // do nothing
- // }
- //
- // PropertyConfigurator.configure(log4j);
- // jlog.warn(
- // "No logger properties detected. Using default logger
- // properties");
- // }
-
public enum BACKENDS {
NEO4J, LUCENE
}
diff --git a/core/src/main/java/de/ids_mannheim/korap/config/UserClientInfo.java b/core/src/main/java/de/ids_mannheim/korap/config/UserClientInfo.java
deleted file mode 100644
index c76d6b3..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/config/UserClientInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package de.ids_mannheim.korap.config;
-
-import lombok.Data;
-
-/**
- * @author hanl
- * @date 22/01/2014
- */
-@Data
-public class UserClientInfo {
-
-
- private String OSName;
- private String userAgent;
- private String clientIP;
-
-
- public UserClientInfo () {
- this.clientIP = "";
- this.userAgent = "";
- this.OSName = "";
- }
-
-
- public UserClientInfo (String os, String ua, String ip) {
- this.OSName = os;
- this.userAgent = ua;
- this.clientIP = ip;
- }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java b/core/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
deleted file mode 100644
index 76438b4..0000000
--- a/core/src/main/java/de/ids_mannheim/korap/exceptions/NotAuthorizedException.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package de.ids_mannheim.korap.exceptions;
-
-import lombok.Data;
-
-/**
- * @author hanl
- * @date 11/12/2013
- */
-// a security table registers all these exceptions (failed authentication, failed access to a resource, etc.)
-@Data
-@Deprecated
-public class NotAuthorizedException extends KustvaktException {
-
- public NotAuthorizedException (int status) {
- super(status);
- }
-
-
- public NotAuthorizedException (int status, String entity) {
- super(status, "", entity);
- }
-
-
- public NotAuthorizedException (int status, String message, String entity) {
- super(status, message, entity);
- }
-
-
- public NotAuthorizedException (Throwable cause, int status) {
- super(cause, status);
- }
-
-
- public NotAuthorizedException (String message, Throwable cause, int status) {
- super(message, cause, status);
- }
-}
diff --git a/core/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java b/core/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
index 2b5694b..3285d1b 100644
--- a/core/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
+++ b/core/src/main/java/de/ids_mannheim/korap/web/KustvaktBaseServer.java
@@ -28,10 +28,7 @@
protected static String rootPackages;
protected static KustvaktArgs kargs;
- public KustvaktBaseServer () {
- KustvaktConfiguration.loadLogger();
- }
-
+ public KustvaktBaseServer () {}
protected KustvaktArgs readAttributes (String[] args) {
KustvaktArgs kargs = new KustvaktArgs();
@@ -49,7 +46,6 @@
b.append("Parameter description: \n")
.append("--spring-config <Spring XML configuration filename in classpath>\n")
.append("--port <Server port number>\n")
- // .append("--props <Path to kustvakt properties> : list of configuration properties\n")
.append("--help : This help menu\n");
System.out.println(b.toString());
System.out.println();
@@ -110,7 +106,6 @@
private String springConfig;
private int port;
-
public KustvaktArgs () {
this.port = -1;
this.springConfig = null;