diff --git a/build.xml b/build.xml
index 924056d..38bdfe9 100644
--- a/build.xml
+++ b/build.xml
@@ -1,14 +1,14 @@
-
+
-
+
@@ -17,7 +17,7 @@
-
+
@@ -29,8 +29,8 @@
-
-
+
+
@@ -39,7 +39,8 @@
-
+
+
@@ -162,7 +163,12 @@
-
+
+
+
+
@@ -170,7 +176,14 @@
-
+
+
+
+
+
@@ -183,5 +196,8 @@
Distribution: ${delivery.dir}\\${name}\\${name}-${build.version}
-
+
+
+
+
diff --git a/doc/common/installation.xml b/doc/common/installation.xml
index 87e0359..3fea917 100644
--- a/doc/common/installation.xml
+++ b/doc/common/installation.xml
@@ -6,7 +6,8 @@
Installation
As of February 2013, XServices require Java 7. Older builds run against Java 5.
- Apache Tomcat 7
+ As of April 2018, XServices require Java 8 and Tomcat 8.5.
+
tbd.
In short: Deploy .WAR file to Apache Tomcat
diff --git a/ivy.xml b/ivy.xml
index 2bce7cb..a7bfd30 100644
--- a/ivy.xml
+++ b/ivy.xml
@@ -15,7 +15,8 @@
-
+
+
@@ -27,16 +28,16 @@
+
-
+
+
+
+
-
-
-
-
-
+
@@ -45,79 +46,95 @@
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+-->
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
diff --git a/src/java/log4j2.xml b/src/java/log4j2.xml
new file mode 100644
index 0000000..25130ec
--- /dev/null
+++ b/src/java/log4j2.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/java/net/brutex/xservices/security/DirectoryPermission.java b/src/java/net/brutex/xservices/security/DirectoryPermission.java
index 979cd00..a2421ad 100644
--- a/src/java/net/brutex/xservices/security/DirectoryPermission.java
+++ b/src/java/net/brutex/xservices/security/DirectoryPermission.java
@@ -16,7 +16,9 @@
package net.brutex.xservices.security;
-import org.apache.log4j.Logger;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.util.AntPathMatcher;
@@ -26,7 +28,8 @@ import org.apache.shiro.util.AntPathMatcher;
*/
public class DirectoryPermission implements Permission {
- private final Logger logger = Logger.getLogger(DirectoryPermission.class);
+ private final Logger logger = LogManager.getLogger();
+
private final String path;
public DirectoryPermission(String antlikepath) {
diff --git a/src/java/net/brutex/xservices/security/PermissionResolver.java b/src/java/net/brutex/xservices/security/PermissionResolver.java
index 478d58e..aad678a 100644
--- a/src/java/net/brutex/xservices/security/PermissionResolver.java
+++ b/src/java/net/brutex/xservices/security/PermissionResolver.java
@@ -19,7 +19,8 @@ package net.brutex.xservices.security;
import net.brutex.xservices.ws.XmlService;
import net.brutex.xservices.ws.rs.FileInfo;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.apache.shiro.authz.Permission;
import org.apache.shiro.authz.permission.InvalidPermissionStringException;
@@ -29,7 +30,7 @@ import org.apache.shiro.authz.permission.InvalidPermissionStringException;
*/
public class PermissionResolver implements org.apache.shiro.authz.permission.PermissionResolver {
- final Logger logger = Logger.getLogger(PermissionResolver.class);
+ private final Logger logger = LogManager.getLogger();
private final String DELIMITER = "||";
@Override
diff --git a/src/java/net/brutex/xservices/security/XServicesRealm.java b/src/java/net/brutex/xservices/security/XServicesRealm.java
index c8758df..41ae528 100644
--- a/src/java/net/brutex/xservices/security/XServicesRealm.java
+++ b/src/java/net/brutex/xservices/security/XServicesRealm.java
@@ -17,24 +17,30 @@
package net.brutex.xservices.security;
-import java.text.ParseException;
-import java.util.Collection;
-import java.util.Map;
+import org.apache.logging.log4j.Logger;
-import org.apache.log4j.Logger;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+
+import javax.servlet.ServletContext;
+
+import org.apache.catalina.core.ApplicationContext;
+import org.apache.logging.log4j.LogManager;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authz.AuthorizationInfo;
-import org.apache.shiro.authz.Permission;
-import org.apache.shiro.authz.permission.PermissionResolver;
+import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.config.Ini;
import org.apache.shiro.io.ResourceUtils;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.realm.text.IniRealm;
+import org.apache.shiro.realm.text.TextConfigurationRealm;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.Nameable;
-import org.apache.shiro.util.PermissionUtils;
+import org.apache.shiro.web.env.IniWebEnvironment;
+import org.apache.shiro.web.util.WebUtils;
// TODO: Auto-generated Javadoc
/*
@@ -51,7 +57,7 @@ import org.apache.shiro.util.PermissionUtils;
public class XServicesRealm extends IniRealm implements Nameable {
/** The logger. */
- private static Logger logger = Logger.getLogger(XServicesRealm.class);
+ private final Logger logger = LogManager.getLogger();
/** The name. */
private String name;
@@ -70,11 +76,25 @@ public class XServicesRealm extends IniRealm implements Nameable {
* 'shiro.ini' in classpath and {@link net.brutex.xservices.security.PermissionResolver PermissionResolver}.
*
*/
+
public XServicesRealm() {
super();
- this.setIni(Ini.fromResourcePath(ResourceUtils.CLASSPATH_PREFIX+"shiro.ini"));
+ /* needs review */
+ URI classesRootDir;
+ try {
+ classesRootDir = getClass().getProtectionDomain().getCodeSource().getLocation().toURI();
+ String dir = classesRootDir.toString().replaceAll("%20", " ");
+ dir = dir.substring(0, dir.lastIndexOf("WEB-INF"));
+ this.setIni(Ini.fromResourcePath(dir+"/WEB-INF/shiro.ini"));
+ } catch (URISyntaxException e) {
+ logger.error(e.getMessage(), e);
+ e.printStackTrace();
+ }
+
+
this.setPermissionResolver(new net.brutex.xservices.security.PermissionResolver());
- //this.setRolePermissionResolver(new RolePermissionResolver());
- init();
- }
+ }
+
+
+
}
diff --git a/src/java/net/brutex/xservices/security/XmlServicePermission.java b/src/java/net/brutex/xservices/security/XmlServicePermission.java
index 56343b2..114bb89 100644
--- a/src/java/net/brutex/xservices/security/XmlServicePermission.java
+++ b/src/java/net/brutex/xservices/security/XmlServicePermission.java
@@ -16,9 +16,9 @@
package net.brutex.xservices.security;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
import org.apache.shiro.authz.Permission;
-import org.apache.shiro.util.AntPathMatcher;
/**
* @author Brian Rosenberger, bru(at)brutex.de
@@ -26,7 +26,7 @@ import org.apache.shiro.util.AntPathMatcher;
*/
public class XmlServicePermission implements Permission {
- private final Logger logger = Logger.getLogger(XmlServicePermission.class);
+ private final Logger logger = LogManager.getLogger();
private final String permissionString;
public XmlServicePermission(String permissionString) {
diff --git a/src/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java b/src/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java
index 281e996..14ce0ae 100644
--- a/src/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java
+++ b/src/java/net/brutex/xservices/util/BrutexHSQLQuartzConnectionProvider.java
@@ -30,9 +30,9 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.quartz.utils.ConnectionProvider;
/**
@@ -42,7 +42,7 @@ import org.quartz.utils.ConnectionProvider;
public class BrutexHSQLQuartzConnectionProvider implements ConnectionProvider {
private Connection conn = null;
- private final Logger logger = Logger.getLogger(this.getClass().getCanonicalName());
+ private static final Logger logger = LogManager.getLogger();
public Connection getConnection() throws SQLException {
diff --git a/src/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java b/src/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java
index c27cc6b..f67d91b 100644
--- a/src/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java
+++ b/src/java/net/brutex/xservices/util/BrutexQuartzConnectionProvider.java
@@ -30,9 +30,9 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
-
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Level;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import org.quartz.utils.ConnectionProvider;
/**
@@ -42,7 +42,7 @@ import org.quartz.utils.ConnectionProvider;
public class BrutexQuartzConnectionProvider implements ConnectionProvider {
private Connection conn = null;
- private final Logger logger = Logger.getLogger(this.getClass().getCanonicalName());
+ private final Logger logger = LogManager.getLogger();
public Connection getConnection() throws SQLException {
diff --git a/src/java/net/brutex/xservices/util/CVSClient.java b/src/java/net/brutex/xservices/util/CVSClient.java
index dcf93a0..eebd800 100644
--- a/src/java/net/brutex/xservices/util/CVSClient.java
+++ b/src/java/net/brutex/xservices/util/CVSClient.java
@@ -2,11 +2,13 @@
/* */
/* */ import java.io.File;
/* */ import net.brutex.xservices.types.scm.ItemType;
-/* */ import net.brutex.xservices.ws.rs.CVSInfoImpl;
-/* */ import org.apache.commons.configuration.Configuration;
-/* */ import org.apache.commons.configuration.ConfigurationException;
-/* */ import org.apache.commons.configuration.PropertiesConfiguration;
-/* */ import org.apache.log4j.Logger;
+ import net.brutex.xservices.util.CVSRoot;
+
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.fluent.Configurations;
+import org.apache.commons.configuration2.ex.ConfigurationException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
/* */ import org.netbeans.lib.cvsclient.Client;
/* */ import org.netbeans.lib.cvsclient.admin.StandardAdminHandler;
/* */ import org.netbeans.lib.cvsclient.command.CommandAbortedException;
@@ -20,7 +22,7 @@
/* */ private final PServerConnection connection;
/* */ private final CVSRoot root;
/* */ private final GlobalOptions globalOptions;
-/* 41 */ final Logger logger = Logger.getLogger(CVSInfoImpl.class);
+/* 41 */ final Logger logger = LogManager.getLogger();
/* */ public final Client client;
/* */
/* */ public Client getClient()
@@ -34,7 +36,9 @@
/* 55 */ throw new ConfigurationException("Config file not found");
/* */ }
/* 57 */ this.configfile = config;
-/* 58 */ Configuration configuration = new PropertiesConfiguration(this.configfile);
+ Configurations configs = new Configurations();
+
+/* 58 */ PropertiesConfiguration configuration = configs.properties(this.configfile);
/* */
/* 60 */ String cvsroot = configuration.getString("CVSROOT");
/* 61 */ String workdir = configuration.getString("WORKDIR");
diff --git a/src/java/net/brutex/xservices/util/FileWalker.java b/src/java/net/brutex/xservices/util/FileWalker.java
index 4430695..be002fb 100644
--- a/src/java/net/brutex/xservices/util/FileWalker.java
+++ b/src/java/net/brutex/xservices/util/FileWalker.java
@@ -25,7 +25,9 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.List;
-import org.apache.log4j.Logger;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import net.brutex.xservices.types.FileInfoType;
@@ -50,7 +52,7 @@ public class FileWalker extends SimpleFileVisitor {
private final String pattern;
/** The logger. */
- final Logger logger = Logger.getLogger(FileWalker.class);
+ private static final Logger logger = LogManager.getLogger();
List list;
diff --git a/src/java/net/brutex/xservices/util/cache/CacheExecutorService.java b/src/java/net/brutex/xservices/util/cache/CacheExecutorService.java
index 0451897..5bff845 100644
--- a/src/java/net/brutex/xservices/util/cache/CacheExecutorService.java
+++ b/src/java/net/brutex/xservices/util/cache/CacheExecutorService.java
@@ -28,33 +28,28 @@ import javax.servlet.ServletContextListener;
*
*/
+public class CacheExecutorService implements ServletContextListener {
+ static final String EXECUTOR_NAME = "CACHE_EXECUTOR";
+ private ExecutorService executor;
+ public void contextInitialized(ServletContextEvent arg0) {
+ ServletContext context = arg0.getServletContext();
+ int nr_executors = 5;
+ ThreadFactory daemonFactory = new DaemonThreadFactory();
+ try {
+ nr_executors = Integer.parseInt(context.getInitParameter("cache:thread-count"));
+ } catch (NumberFormatException localNumberFormatException) {
+ }
+ if (nr_executors <= 1)
+ this.executor = Executors.newSingleThreadExecutor(daemonFactory);
+ else {
+ this.executor = Executors.newFixedThreadPool(nr_executors, daemonFactory);
+ }
+ context.setAttribute("CACHE_EXECUTOR", this.executor);
+ }
-public class CacheExecutorService
- implements ServletContextListener
-{
- static final String EXECUTOR_NAME = "CACHE_EXECUTOR";
- private ExecutorService executor;
-
- public void contextInitialized(ServletContextEvent arg0)
- {
- ServletContext context = arg0.getServletContext();
- int nr_executors = 5;
- ThreadFactory daemonFactory = new DaemonThreadFactory();
- try {
- nr_executors = Integer.parseInt(context.getInitParameter("cache:thread-count"));
- } catch (NumberFormatException localNumberFormatException) {
- }
- if (nr_executors <= 1)
- this.executor = Executors.newSingleThreadExecutor(daemonFactory);
- else {
- this.executor = Executors.newFixedThreadPool(nr_executors, daemonFactory);
- }
- context.setAttribute("CACHE_EXECUTOR", this.executor);
- }
-
- public void contextDestroyed(ServletContextEvent arg0) {
- ServletContext context = arg0.getServletContext();
- this.executor.shutdownNow();
- }
+ public void contextDestroyed(ServletContextEvent arg0) {
+ ServletContext context = arg0.getServletContext();
+ this.executor.shutdownNow();
+ }
}
\ No newline at end of file
diff --git a/src/java/net/brutex/xservices/util/cache/CacheServlet.java b/src/java/net/brutex/xservices/util/cache/CacheServlet.java
index 5fe7f38..a223083 100644
--- a/src/java/net/brutex/xservices/util/cache/CacheServlet.java
+++ b/src/java/net/brutex/xservices/util/cache/CacheServlet.java
@@ -21,11 +21,11 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.concurrent.ExecutorService;
-import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import net.brutex.xservices.types.scm.ObjectFactory;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
/**
* @author Brian Rosenberger, bru(at)brutex.de
@@ -35,8 +35,8 @@ import org.apache.log4j.Logger;
public class CacheServlet extends HttpServlet
{
- private final Logger logger = Logger.getLogger(CacheServlet.class);
- List configfiles = new ArrayList();
+ private static final Logger logger = LogManager.getLogger();
+ List configfiles = new ArrayList();
int cacheinterval;
private final ObjectFactory FACTORY = new ObjectFactory();
diff --git a/src/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java b/src/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java
index 1b99d88..c2a5bf8 100644
--- a/src/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java
+++ b/src/java/net/brutex/xservices/util/cache/FindingsCacheServlet.java
@@ -38,11 +38,13 @@ import net.brutex.xservices.types.scmfindings.FindingsListType;
import net.brutex.xservices.types.scmfindings.GroupMatchListType;
import net.brutex.xservices.types.scmfindings.ObjectFactory;
import net.brutex.xservices.ws.rs.CVSInfoImpl;
-import org.apache.commons.configuration.ConfigurationException;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.jcs.JCS;
-import org.apache.jcs.access.exception.CacheException;
-import org.apache.log4j.Logger;
+
+import org.apache.commons.configuration2.PropertiesConfiguration;
+import org.apache.commons.configuration2.builder.fluent.Configurations;
+import org.apache.commons.configuration2.ex.ConfigurationException;
+import org.apache.commons.jcs.access.exception.CacheException;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
/**
* @author Brian Rosenberger, bru(at)brutex.de
@@ -52,8 +54,7 @@ import org.apache.log4j.Logger;
public class FindingsCacheServlet extends HttpServlet {
private static final long serialVersionUID = 4041338473949999960L;
- private final static Logger logger = Logger
- .getLogger(FindingsCacheServlet.class);
+ private static final Logger logger = LogManager.getLogger();
private final List configfiles = new ArrayList();
private final ObjectFactory FACTORY = new ObjectFactory();
private ExecutorService executor;
@@ -70,7 +71,7 @@ public class FindingsCacheServlet extends HttpServlet {
int i = 1;
for(File f: configfiles) {
//Initialise configuration bean using default values
- FindingsConfigBean cbean = new FindingsConfigBean(i, Logger.getLogger("worker-"+i+ "." + this.getClass().getName()));
+ FindingsConfigBean cbean = new FindingsConfigBean(i, LogManager.getLogger("worker-"+i+ "." + this.getClass().getName()));
i++;
@@ -86,9 +87,10 @@ public class FindingsCacheServlet extends HttpServlet {
+ cbean.getCacheinterval()+ "' minutes");
}
+ Configurations configs = new Configurations();
PropertiesConfiguration config = null;
try {
- config = new PropertiesConfiguration(f);
+ config = configs.properties(f);
} catch (ConfigurationException e) {
logger.error("Could not read parameter file at '"+f.getAbsolutePath()+"'");
return;
diff --git a/src/java/net/brutex/xservices/util/cache/FindingsConfigBean.java b/src/java/net/brutex/xservices/util/cache/FindingsConfigBean.java
index a91d841..e9ed5f1 100644
--- a/src/java/net/brutex/xservices/util/cache/FindingsConfigBean.java
+++ b/src/java/net/brutex/xservices/util/cache/FindingsConfigBean.java
@@ -19,19 +19,17 @@ package net.brutex.xservices.util.cache;
import java.io.File;
import java.util.List;
-import org.apache.commons.configuration.PropertiesConfiguration;
-import org.apache.log4j.Logger;
+import org.apache.logging.log4j.Logger;
/**
* @author Brian Rosenberger, bru(at)brutex.de
*
*/
public class FindingsConfigBean {
-
- private final Logger logger;
-
+
+ private Logger logger;
private final int instanceid;
-
+
private File cvsconfig;
private int cacheinterval = 15;
private List