Skip to content

Commit

Permalink
search: libs updates; removed some deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
smeyer-ilias committed Oct 18, 2023
1 parent e1e74b7 commit 54950dc
Show file tree
Hide file tree
Showing 7 changed files with 114 additions and 233 deletions.
82 changes: 46 additions & 36 deletions Services/WebServices/RPC/lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@
<build>
<finalName>ilServer</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand All @@ -20,6 +28,7 @@
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar>
<filters>
<filter>
Expand All @@ -33,6 +42,8 @@
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>META-INF/*.MF</exclude>
<exclude>META-INF/AL2.0</exclude>
<exclude>META-INF/LGPL2.1</exclude>
<exclude>META-INF/versions/9/module-info.class</exclude>
<exclude>license/**</exclude>
</excludes>
Expand All @@ -56,77 +67,83 @@
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-jcl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<!-- required for commons-configuration2 logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.20.0</version>
<version>2.21.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-1.2-api -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-1.2-api</artifactId>
<version>2.21.0</version>
</dependency>
<!-- used for ilServer.ini parsing -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-configuration2</artifactId>
<version>2.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-httpclient/commons-httpclient -->
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-highlighter</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-join</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-memory</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>9.5.0</version>
<version>9.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mariadb.jdbc/mariadb-java-client -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.6</version>
<version>3.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand All @@ -150,67 +167,60 @@
<version>2.0.6.1</version>
<scope>compile</scope>
</dependency>

<!-- tika core and parsers -->
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
<version>2.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-html-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-html-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-microsoft-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-miscoffice-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-pdf-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-text-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-parser-xml-module</artifactId>
<version>2.7.0</version>
<version>2.9.0</version>
</dependency>

<!-- fop pdf generation: all in one jar produces class duplication warnings -->
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-core</artifactId>
<version>2.8</version>
<version>2.9</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>fop-util</artifactId>
<version>2.8</version>
<version>2.9</version>
</dependency>

</dependencies>

<packaging>jar</packaging>
<name>ilServer</name>
<url>https://www.ilias.de</url>
<properties>
<showDeprecation>true</showDeprecation>
<encoding>UTF-8</encoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
import java.util.HashMap;

/**
* Capsulates the interaction between IndexReader and IndexWriter
* Capsules the interaction between IndexReader and IndexWriter
* This class is a singleton for each index path.
*
* @author Stefan Meyer <[email protected]>
* @version $Id$
*/
public class IndexHolder {
public class IndexHolder implements AutoCloseable
{

protected static Logger logger = LogManager.getLogger(IndexHolder.class);

Expand All @@ -56,9 +56,6 @@ public class IndexHolder {



/**
* @throws IOException
*/
private IndexHolder(String clientKey) throws IOException {

try {
Expand All @@ -70,29 +67,16 @@ private IndexHolder(String clientKey) throws IOException {

}

/**
*
* @param clientKey
* @return
* @throws IOException
*/
public static synchronized IndexHolder getInstance(String clientKey) throws
IOException {

String hash = clientKey;

if(instances.containsKey(hash)) {
return instances.get(hash);
public static synchronized IndexHolder getInstance(String clientKey) throws
IOException {

if(instances.containsKey(clientKey)) {
return instances.get(clientKey);
}
instances.put(hash,new IndexHolder(clientKey));
return instances.get(hash);
instances.put(clientKey,new IndexHolder(clientKey));
return instances.get(clientKey);
}

/**
*
* @return
* @throws IOException
*/
public static synchronized IndexHolder getInstance() throws IOException {

return getInstance(LocalSettings.getClientKey());
Expand All @@ -106,16 +90,11 @@ public static void deleteIndex() throws ConfigurationException
logger.info("Deleted index directory: " + indexPath.getAbsoluteFile());
}

/**
* Delete directory recursive
* @param path
* @return
*/
private static boolean deleteTree(File path) {
private static void deleteTree(File path) {

if(!path.exists() || !path.isDirectory())
{
return false;
return;
}
for(File del : path.listFiles()) {

Expand All @@ -127,21 +106,17 @@ private static boolean deleteTree(File path) {
}
}
path.delete();
return true;
}

/**
* Close all writers
*/
public static synchronized void closeAllWriters() {

logger.info("Closing document writers...");

for(Object key : instances.keySet()) {
for(String key : instances.keySet()) {
try {
logger.info("Closing writer: " + key);
IndexHolder holder = instances.get((String) key);
IndexDirectoryFactory.getDirectory(ClientSettings.getInstance((String) key).getIndexPath()).close();
IndexHolder holder = instances.get(key);
IndexDirectoryFactory.getDirectory(ClientSettings.getInstance(key).getIndexPath()).close();
holder.close();
}
catch (ConfigurationException | IOException ex)
Expand All @@ -156,7 +131,6 @@ public static synchronized void closeAllWriters() {

/**
* @todo obtain lock for index writer
* @throws IOException
*/
public void init() throws IOException, ConfigurationException {

Expand All @@ -180,16 +154,10 @@ public void init() throws IOException, ConfigurationException {

}

/**
* @return the writer
*/
public IndexWriter getWriter() {
return writer;
}

/**
* @param writer the writer to set
*/
public void setWriter(IndexWriter writer) {
this.writer = writer;
}
Expand All @@ -209,18 +177,4 @@ public void close() {
logger.fatal("Error closing writer." + e);
}
}

/* (non-Javadoc)
* @see java.lang.Object#finalize()
*/
@Override
protected void finalize() throws Throwable {

try {
close();
}
finally {
super.finalize();
}
}
}
Loading

0 comments on commit 54950dc

Please sign in to comment.