diff --git a/hideauto.sh b/hideauto.sh
deleted file mode 100755
index bc6b18d0..00000000
--- a/hideauto.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-subdir=src/main/java/org/lsc/configuration
-
-find $subdir -name '*.java' | xargs grep -l -e '\(Généré le\)\|\(Generated on\)' | {
- while read file; do git rm --cached $file ; done
-}
-
-pushd $subdir
-{
- echo "# ignore autogenerated java files"
- find -name '*.java' | xargs grep -l -e '\(Généré le\)\|\(Generated on\)' | sed 's/^\.\/\(.*\)$/\/\1/'
-} > .gitignore
-
-
-popd
diff --git a/pom.xml b/pom.xml
index fdc5fa16..cff4f867 100644
--- a/pom.xml
+++ b/pom.xml
@@ -72,7 +72,6 @@
${project.build.directory}/staging
1.5
22.3.1
- 2.12.7.1
${project.build.directory}/compiler
@@ -256,10 +255,9 @@
${project.build.directory}/${project.build.finalName}-dist/lsc-${project.version}
- src/install/install.xml
+ ${project.basedir}/src/install/install.xml
true
${project.artifactId}-${project.version}-installer.jar
- false
true
@@ -309,11 +307,11 @@
true
- ${basedir}/lsc.episode
- src/main/java
org.lsc.configuration
src/main/resources/schemas
- lsc-core-2.2.xjc
+
+ lsc-core-2.2.xjc
+
src/main/resources/schemas
lsc-core-2.2.xsd
@@ -696,7 +694,7 @@
commons-io
commons-io
- 2.11.0
+ 2.16.1
jar
false
@@ -710,7 +708,7 @@
commons-logging
commons-logging
- 1.2
+ 1.3.4
com.thoughtworks.xstream
@@ -722,7 +720,7 @@
org.slf4j
slf4j-api
- 2.0.9
+ 2.0.16
jar
false
@@ -750,7 +748,7 @@
org.mozilla
rhino
- 1.7.14
+ 1.7.15
jar
false
@@ -762,21 +760,21 @@
org.bouncycastle
bcprov-jdk18on
- 1.75
+ 1.78.1
jar
false
commons-cli
commons-cli
- 1.5.0
+ 1.9.0
jar
false
- org.samba.jcifs
+ jcifs
jcifs
- 1.3.3
+ 1.3.17
jar
false
@@ -802,7 +800,7 @@
junit
junit
- 4.13.1
+ 4.13.2
jar
false
@@ -814,7 +812,7 @@
com.google.guava
guava
- 32.0.0-jre
+ 33.3.0-jre
javax.transaction
@@ -830,19 +828,19 @@
jaxb 2.3.6 with maven-jaxb2-plugin 0.15.1
-->
- javax.xml.bind
- jaxb-api
- 2.3.1
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+ 2.3.3
org.glassfish.jaxb
jaxb-core
- 2.3.0.1
+ 3.0.0
com.sun.xml.bind
jaxb-impl
- 2.3.6
+ 4.0.5
net.java.xadisk
@@ -850,9 +848,9 @@
1.2.2
- javax.resource
- connector-api
- 1.5
+ jakarta.resource
+ jakarta.resource-api
+ 2.1.0
org.codehaus.btm
@@ -860,24 +858,25 @@
2.1.4
- org.codehaus.groovy
+ org.apache.groovy
groovy-all
- 2.4.21
+ 4.0.22
+ pom
org.apache.directory.api
api-all
- 2.1.3
+ 2.1.7
xml-apis
xml-apis
- 1.4.01
+ 2.0.2
com.fasterxml.jackson.core
jackson-databind
- ${jackson.version}
+ 2.17.2
diff --git a/src/install/check_lsc.sh b/src/install/check_lsc.sh
deleted file mode 100755
index 7de8a9a7..00000000
--- a/src/install/check_lsc.sh
+++ /dev/null
@@ -1,145 +0,0 @@
-#!/bin/bash
-
-#==========================================================================
-# Summary
-#==========================================================================
-# Log file analyzer for LSC for Nagios
-#
-# This can read LSC logs to detect time since last succesful execution.
-# An alert will be thrown if either of these durations exceeds a limit.
-#
-#
-# Copyright (c) 2009 - 2011 LSC Project
-# Copyright (C) 2008 Jonathan Clarke
-# Copyright (C) 2008 LINAGORA
-#
-#==========================================================================
-# Original license: GPLv2,
-#==========================================================================
-# Contributed by jclarke@linagora.com under LSC original BSD license
-#==========================================================================
-
-#==========================================================================
-# Changelog
-#==========================================================================
-# Version 1.0 (2008/02/28):
-# - First version
-# Author: Jonathan Clarke
-#==========================================================================
-
-#
-# Usage: ./check_lsc -F -w -c
-#
-
-# Pattern to match in log file
-SUCCESS_PATTERN="Starting LSC"
-
-# Paths to commands used in this script. These
-# may have to be modified to match your system setup.
-
-PROGNAME=`basename $0`
-PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
-REVISION=`echo '$Revision: 1.0 $' | sed -e 's/[^0-9.]//g'`
-
-. $PROGPATH/utils.sh
-
-print_usage() {
- echo "Usage: $PROGNAME -F logfile -w warnlevel -c criticallevel"
- echo "Usage: $PROGNAME --help"
- echo "Usage: $PROGNAME --version"
-}
-
-print_help() {
- print_revision $PROGNAME $REVISION
- echo ""
- print_usage
- echo ""
- echo "Log file analyzer for LSC for Nagios"
- echo ""
- support
-}
-
-# Make sure the correct number of command line
-# arguments have been supplied
-
-if [ $# -lt 6 ]; then
- print_usage
- exit $STATE_UNKNOWN
-fi
-
-# Grab the command line arguments
-
-exitstatus=$STATE_UNKNOWN #default
-while test -n "$1"; do
- case "$1" in
- --help)
- print_help
- exit $STATE_OK
- ;;
- -h)
- print_help
- exit $STATE_OK
- ;;
- --version)
- print_revision $PROGNAME $REVISION
- exit $STATE_OK
- ;;
- -V)
- print_revision $PROGNAME $REVISION
- exit $STATE_OK
- ;;
- --filename)
- logfile=$2
- shift
- ;;
- -F)
- logfile=$2
- shift
- ;;
- -w)
- warnlevel=$2
- shift
- ;;
- -c)
- criticallevel=$2
- shift
- ;;
- *)
- echo "Unknown argument: $1"
- print_usage
- exit $STATE_UNKNOWN
- ;;
- esac
- shift
-done
-
-# If the log file doesn't exist, exit
-
-if [ ! -e $logfile ]; then
- echo "Log check error: Log file $logfile does not exist!\n"
- exit $STATE_UNKNOWN
-elif [ ! -r $logfile ] ; then
- echo "Log check error: Log file $logfile is not readable!\n"
- exit $STATE_UNKNOWN
-fi
-
-# Get the last matching entry in the diff file
-lastentry=`grep "$SUCCESS_PATTERN" $logfile | tail -1`
-
-timeLastEntry=`echo $lastentry | sed 's/\([0-9]\{4\}\/[0-9]\{2\}\/[0-9]\{2\} [0-9]\{2\}:[0-9]\{2\}:[0-9]\{2\}\).*/\1/'`
-timestampLastEntry=`date -d "$timeLastEntry" +%s`
-timestampNow=`date +%s`
-age=$(( ($timestampNow - $timestampLastEntry) / 60))
-
-if [[ $age -lt $warnlevel ]]; then # recent execution, exit with no error
- echo "OK: Last successful execution $age minutes ago"
- exitstatus=$STATE_OK
-elif [[ $age -ge $warnlevel && $age -lt $criticallevel ]]; then
- echo "WARN: Last successful execution $age minutes ago"
- exitstatus=$STATE_WARNING
-elif [[ $age -ge $criticallevel ]]; then
- echo "CRITICAL: Last successful execution $age minutes ago"
- exitstatus=$STATE_CRITICAL
-fi
-
-exit $exitstatus
diff --git a/src/install/check_lsc_status_file.pl b/src/install/check_lsc_status_file.pl
index 5c64b42e..7c6a50cd 100755
--- a/src/install/check_lsc_status_file.pl
+++ b/src/install/check_lsc_status_file.pl
@@ -205,9 +205,9 @@ sub check_critical_param {
}
# Get statistics
-my ( $all, $modify, $modified, $errors ) =
+my ( $taskname, $taskmode, $all, $modify, $modified, $errors ) =
( $last =~
-/All entries: (\d+), to modify entries: (\d+), (?:successfully )?modified entries: (\d+), errors: (\d+)/mi
+/(\w+) - (\w+) - All entries: (\d+), to modify entries: (\d+), (?:successfully )?modified entries: (\d+), errors: (\d+)/mi
);
#==========================================================================
@@ -224,17 +224,17 @@ sub check_critical_param {
# Test the errors and exit
if ( $errors == 0 or $errors < $warning ) {
print
-"OK - LSC is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
+"OK - LSC task $taskname in mode $taskmode is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
exit $ERRORS{'OK'};
}
elsif ( $errors >= $warning and $errors < $critical ) {
print
-"WARNING - LSC is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
+"WARNING - LSC task $taskname in mode $taskmode is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
exit $ERRORS{'WARNING'};
}
else {
print
-"CRITICAL - LSC is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
+"CRITICAL - LSC task $taskname in mode $taskmode is running with $errors errors (W:$warning - C:$critical)$perfparse\n";
exit $ERRORS{'CRITICAL'};
}
diff --git a/src/main/java/org/lsc/AbstractSynchronize.java b/src/main/java/org/lsc/AbstractSynchronize.java
index 9fac88ff..d8dd0517 100644
--- a/src/main/java/org/lsc/AbstractSynchronize.java
+++ b/src/main/java/org/lsc/AbstractSynchronize.java
@@ -45,8 +45,6 @@
*/
package org.lsc;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -54,23 +52,16 @@
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import javax.naming.CommunicationException;
-
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.Options;
-import org.lsc.LscDatasetModification.LscDatasetModificationType;
-import org.lsc.beans.BeanComparator;
import org.lsc.beans.IBean;
import org.lsc.beans.InfoCounter;
-import org.lsc.beans.syncoptions.ISyncOptions;
import org.lsc.configuration.LscConfiguration;
-import org.lsc.configuration.PivotTransformationType.Transformation;
-import org.lsc.exception.LscServiceCommunicationException;
+import org.lsc.configuration.PivotTransformationType;
import org.lsc.exception.LscServiceException;
import org.lsc.runnable.AsynchronousRunner;
import org.lsc.runnable.CleanEntryRunner;
import org.lsc.runnable.SynchronizeEntryRunner;
-import org.lsc.service.IAsynchronousService;
import org.lsc.service.IService;
import org.lsc.utils.LSCStructuralLogger;
import org.lsc.utils.ScriptingEvaluator;
@@ -192,7 +183,7 @@ protected final boolean clean2Ldap(Task task) {
LOGGER.info("If you want to avoid this message, " + "increase the time limit by using dedicated parameter.");
}
- logStatus(counter);
+ logStatus(task.getName(), Task.Mode.clean.toString(), counter);
return counter.getCountError() == 0;
}
@@ -240,7 +231,7 @@ protected final boolean synchronize2Ldap(final Task task) {
LOGGER.info("If you want to avoid this message, " + "increase the time limit by using dedicated parameter.");
}
- logStatus(counter);
+ logStatus(task.getName(), Task.Mode.sync.toString(), counter);
return counter.getCountError() == 0;
}
@@ -307,7 +298,7 @@ public final String getTaskFullStatus(final String syncName) {
if(asyncThread != null && asyncThread.isAlive()) {
AsynchronousRunner asyncRunner = mapSTasks.get(syncName);
InfoCounter counter = asyncRunner.getCounter();
- return getLogStatus(counter);
+ return getLogStatus(syncName, Task.Mode.async.toString(), counter);
} else {
return null;
}
@@ -320,8 +311,8 @@ public final String getTaskFullStatus(final String syncName) {
/**
* Log all effective action.
*
- * @param jm List of modification to do on the Ldap server
- * @param identifier object identifier
+ * @param lm List of modification to do on the Ldap server
+ * @param data object identifier
* @param except synchronization process name
*/
public final void logActionError(final LscModifications lm,
@@ -340,7 +331,7 @@ public final void logActionError(final LscModifications lm,
/**
* Log all effective action.
*
- * @param jm List of modification to do on the Ldap server
+ * @param lm List of modification to do on the Ldap server
* @param id object identifier
* @param syncName synchronization process name
*/
@@ -372,9 +363,8 @@ public final void logAction(final LscModifications lm,
}
/**
- * @param jm
- * @param id
- * @param syncName
+ * @param lm List of modification to do on the Ldap server
+ * @param syncName synchronization process name
*/
public final void logShouldAction(final LscModifications lm, final String syncName) {
switch (lm.getOperation()) {
@@ -402,8 +392,8 @@ public final void logShouldAction(final LscModifications lm, final String syncNa
LSCStructuralLogger.DESTINATION.debug("", lm);
}
- protected void logStatus(InfoCounter counter) {
- String totalsLogMessage = getLogStatus(counter);
+ protected void logStatus(String taskName, String taskMode, InfoCounter counter) {
+ String totalsLogMessage = getLogStatus(taskName, taskMode, counter);
if (counter.getCountError() > 0) {
LOGGER.error(totalsLogMessage);
} else {
@@ -411,21 +401,23 @@ protected void logStatus(InfoCounter counter) {
}
}
- protected String getLogStatus(InfoCounter counter) {
+ protected String getLogStatus(String taskName, String taskMode, InfoCounter counter) {
+
String totalsLogMessage =
- "All entries: "+ counter.getCountAll() +
- ", to modify entries: "+ counter.getCountModifiable() +
- ", successfully modified entries: "+counter.getCountCompleted()+
- ", errors: "+counter.getCountError();
+ taskName + " - " + taskMode +
+ " - All entries: "+ counter.getCountAll() +
+ ", to modify entries: "+ counter.getCountModifiable() +
+ ", successfully modified entries: "+counter.getCountCompleted()+
+ ", errors: "+counter.getCountError();
return totalsLogMessage;
}
public IBean getBean(Task task, IService service, String pivotName, LscDatasets pivotAttributes, boolean fromSameService, boolean fromSource) throws LscServiceException {
- List transformations = LscConfiguration.getPivotTransformation(task.getTaskType());
+ List transformations = LscConfiguration.getPivotTransformation(task.getTaskType());
if (! fromSameService && transformations != null) {
LscDatasets newPivots = new LscDatasets(pivotAttributes.getDatasets());
for (Entry pivot: pivotAttributes.getDatasets().entrySet()) {
- for (Transformation transformation: transformations) {
+ for (PivotTransformationType.Transformation transformation: transformations) {
if (pivot.getKey().equalsIgnoreCase(transformation.getFromAttribute()) && LscConfiguration.pivotOriginMatchesFromSource(transformation.getPivotOrigin(), fromSource)) {
newPivots.put(transformation.getToAttribute(), transform(task, transformation, pivot.getValue()));
}
@@ -436,7 +428,7 @@ public IBean getBean(Task task, IService service, String pivotName, LscDatasets
return service.getBean(pivotName, pivotAttributes, fromSameService);
}
- protected Object transform(Task task, Transformation transformation, Object value) throws LscServiceException{
+ protected Object transform(Task task, PivotTransformationType.Transformation transformation, Object value) throws LscServiceException{
Map javaScriptObjects = new HashMap();
javaScriptObjects.put("value", value);
if (task.getCustomLibraries() != null) {
diff --git a/src/main/java/org/lsc/Hooks.java b/src/main/java/org/lsc/Hooks.java
index f8aa0a36..ab4f4b61 100644
--- a/src/main/java/org/lsc/Hooks.java
+++ b/src/main/java/org/lsc/Hooks.java
@@ -41,6 +41,7 @@
*/
package org.lsc;
+import org.slf4j.event.Level;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.ProcessBuilder;
@@ -125,13 +126,15 @@ public final static void callHook( LscModificationType operationType,
operationType.getDescription(),
hook,
outputFormat.toString(),
- identifier);
+ identifier,
+ Level.INFO);
printHookOutput(p.getErrorStream(),
"stderr",
operationType.getDescription(),
hook,
outputFormat.toString(),
- identifier);
+ identifier,
+ Level.ERROR);
}
catch(IOException e) {
LOGGER.error("Error while calling {} posthook {} with format {} for {}",
@@ -162,18 +165,20 @@ public final static String getJsonModifications(final LscModifications lm) {
private static void printHookOutput( final InputStream src, String output,
String operation, String hook,
- String outputFormat, String identifier) {
+ String outputFormat, String identifier,
+ Level level) {
new Thread(new Runnable() {
public void run() {
Scanner sc = new Scanner(src);
while (sc.hasNextLine()) {
- LOGGER.warn("Hook {} with format {} for identifier {} and operation {} returned {}: {}",
- hook,
- outputFormat,
- identifier,
- operation,
- output,
- sc.nextLine());
+ LOGGER.atLevel(level).log(
+ "Hook {} with format {} for identifier {} and operation {} returned on {}: {}",
+ hook,
+ outputFormat,
+ identifier,
+ operation,
+ output,
+ sc.nextLine());
}
}
}).start();
diff --git a/src/main/java/org/lsc/beans/BeanComparator.java b/src/main/java/org/lsc/beans/BeanComparator.java
index 632f3655..dea42ecf 100644
--- a/src/main/java/org/lsc/beans/BeanComparator.java
+++ b/src/main/java/org/lsc/beans/BeanComparator.java
@@ -66,7 +66,6 @@
import org.lsc.LscModificationType;
import org.lsc.LscModifications;
import org.lsc.Task;
-import org.lsc.beans.syncoptions.ISyncOptions;
import org.lsc.configuration.LscConfiguration;
import org.lsc.configuration.PolicyType;
import org.lsc.exception.LscServiceException;
@@ -442,9 +441,6 @@ private static LscDatasetModificationType getRequiredOperationForAttribute (
* attributes, and all force valued/default valued/create valued attributes.
*
*
- * @param syncOptions
- * Instance of {@link ISyncOptions} to provide transformation
- * configuration
* @param srcBean
* The original bean read from the source
* @return Set of attribute names to be updated
@@ -592,9 +588,6 @@ private static IBean cloneSrcBean(Task task, IBean srcBean, IBean dstBean) throw
* @param srcAttrValues
* {@link Set}