diff --git a/common/plugins/eu.esdihumboldt.hale.common.align/help/join.xhtml b/common/plugins/eu.esdihumboldt.hale.common.align/help/join.xhtml index ff307988a6..7c37412f6c 100644 --- a/common/plugins/eu.esdihumboldt.hale.common.align/help/join.xhtml +++ b/common/plugins/eu.esdihumboldt.hale.common.align/help/join.xhtml @@ -42,6 +42,19 @@

To create a condition, select a property on the left and on the right side, then click on the button in the middle.

+ +

+ Index Join Handler (experimental) +

+

+ To activate the use of the Index Join Handler for all Join and Groovy + Join transformations, set the Java system property hale.functions.use_index_join_handler + or the environment variable HALE_FUNCTIONS_USE_INDEX_JOIN_HANDLER. +

+

+ The Index Join Handler is experimental and can potentially have a + negative impact on the performance of Join and Groovy Join transformations. +

\ No newline at end of file diff --git a/common/plugins/eu.esdihumboldt.hale.common.align/help/merge/help.xhtml b/common/plugins/eu.esdihumboldt.hale.common.align/help/merge/help.xhtml index a5993c76b8..5ce7278984 100644 --- a/common/plugins/eu.esdihumboldt.hale.common.align/help/merge/help.xhtml +++ b/common/plugins/eu.esdihumboldt.hale.common.align/help/merge/help.xhtml @@ -20,6 +20,20 @@

+ +

+ Index Merge Handler (experimental) +

+

+ To activate the use of the Index Merge Handler for all Merge and Groovy + Merge transformations, set the Java system property hale.functions.use_index_merge_handler + or the environment variable HALE_FUNCTIONS_USE_INDEX_MERGE_HANDLER. +

+

+ The Index Merge Handler is experimental and can potentially have a + negative impact on the performance of Merge and Groovy Merge transformations. +

+ diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.core/META-INF/MANIFEST.MF b/cst/plugins/eu.esdihumboldt.cst.functions.core/META-INF/MANIFEST.MF index e55e9d6355..50f73fbe6a 100644 --- a/cst/plugins/eu.esdihumboldt.cst.functions.core/META-INF/MANIFEST.MF +++ b/cst/plugins/eu.esdihumboldt.cst.functions.core/META-INF/MANIFEST.MF @@ -9,6 +9,7 @@ Require-Bundle: eu.esdihumboldt.hale.common.align;bundle-version="2.2.0", Import-Package: com.google.common.base;version="9.0.0", com.google.common.collect, de.fhg.igd.osgi.util;version="1.0.0", + de.fhg.igd.slf4jplus, eu.esdihumboldt.hale.common.convert, eu.esdihumboldt.hale.common.core, eu.esdihumboldt.hale.common.core.io, @@ -34,6 +35,7 @@ Import-Package: com.google.common.base;version="9.0.0", eu.esdihumboldt.util.groovy.paths, net.jcip.annotations, org.locationtech.jts.geom;version="1.13.0", + org.slf4j;version="1.7.36", org.springframework.core.convert;version="5.2.0" Export-Package: eu.esdihumboldt.cst.functions.core, eu.esdihumboldt.cst.functions.core.join, diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Join.java b/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Join.java index a84e48eb12..fda3195315 100644 --- a/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Join.java +++ b/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Join.java @@ -21,7 +21,10 @@ import java.util.Collections; import java.util.List; +import de.fhg.igd.slf4jplus.ALogger; +import de.fhg.igd.slf4jplus.ALoggerFactory; import eu.esdihumboldt.cst.functions.core.join.IndexJoinHandler; +import eu.esdihumboldt.cst.functions.core.join.JoinHandler; import eu.esdihumboldt.hale.common.align.model.Cell; import eu.esdihumboldt.hale.common.align.model.functions.JoinFunction; import eu.esdihumboldt.hale.common.align.model.functions.join.JoinParameter; @@ -34,17 +37,38 @@ /** * Type transformation that joins multiple instances of different source types * into one target instance, based on matching properties. - * + * * @author Kai Schwierczek */ public class Join extends Retype implements JoinFunction, InstanceIndexContribution { + /** + * The log + */ + private static final ALogger LOG = ALoggerFactory.getLogger(Join.class); + /** * @see eu.esdihumboldt.hale.common.align.transformation.function.impl.AbstractTypeTransformation#getInstanceHandler() */ @Override public InstanceHandler getInstanceHandler() { - return new IndexJoinHandler(); + boolean useIndexJoinHandler = false; + + String setting = System.getProperty("hale.functions.join.use_index_join_handler"); + + if (setting == null) { + setting = System.getenv("HALE_FUNCTIONS_USE_INDEX_JOIN_HANDLER"); + } + + if (setting != null) { + try { + useIndexJoinHandler = Boolean.valueOf(setting); + } catch (Throwable e) { + LOG.error("Error applying index join handler setting: " + setting, e); + } + } + + return useIndexJoinHandler ? new IndexJoinHandler() : new JoinHandler(); } /** diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Merge.java b/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Merge.java index 6b13c54cd4..3f6c81386e 100644 --- a/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Merge.java +++ b/cst/plugins/eu.esdihumboldt.cst.functions.core/src/eu/esdihumboldt/cst/functions/core/Merge.java @@ -20,7 +20,10 @@ import java.util.Collections; import java.util.List; +import de.fhg.igd.slf4jplus.ALogger; +import de.fhg.igd.slf4jplus.ALoggerFactory; import eu.esdihumboldt.cst.functions.core.merge.IndexMergeHandler; +import eu.esdihumboldt.cst.functions.core.merge.PropertiesMergeHandler; import eu.esdihumboldt.hale.common.align.model.Cell; import eu.esdihumboldt.hale.common.align.model.functions.MergeFunction; import eu.esdihumboldt.hale.common.align.model.functions.merge.MergeUtil; @@ -32,17 +35,38 @@ /** * Type transformation that merges multiple instances of the same source type * into one target instance, based on matching properties. - * + * * @author Simon Templer */ public class Merge extends Retype implements MergeFunction, InstanceIndexContribution { + /** + * The log + */ + private static final ALogger LOG = ALoggerFactory.getLogger(Merge.class); + /** * @see eu.esdihumboldt.hale.common.align.transformation.function.impl.AbstractTypeTransformation#getInstanceHandler() */ @Override public InstanceHandler getInstanceHandler() { - return new IndexMergeHandler(); + boolean useIndexMergeHandler = false; + + String setting = System.getProperty("hale.functions.use_index_merge_handler"); + + if (setting == null) { + setting = System.getenv("HALE_FUNCTIONS_USE_INDEX_MERGE_HANDLER"); + } + + if (setting != null) { + try { + useIndexMergeHandler = Boolean.valueOf(setting); + } catch (Throwable e) { + LOG.error("Error applying index merge handler setting: " + setting, e); + } + } + + return useIndexMergeHandler ? new IndexMergeHandler() : new PropertiesMergeHandler(); } /** diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyJoin.java b/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyJoin.java index fac74e7d4b..d208c6c568 100644 --- a/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyJoin.java +++ b/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyJoin.java @@ -18,8 +18,11 @@ import java.util.Collection; import java.util.List; +import de.fhg.igd.slf4jplus.ALogger; +import de.fhg.igd.slf4jplus.ALoggerFactory; import eu.esdihumboldt.cst.functions.core.Join; import eu.esdihumboldt.cst.functions.core.join.IndexJoinHandler; +import eu.esdihumboldt.cst.functions.core.join.JoinHandler; import eu.esdihumboldt.hale.common.align.model.Cell; import eu.esdihumboldt.hale.common.align.model.functions.JoinFunction; import eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition; @@ -32,11 +35,16 @@ * into one target instance, based on matching properties. The transformation * also applies a Groovy script that can be used to control the target instance * creation. - * + * * @author Simon Templer */ public class GroovyJoin extends GroovyRetype implements JoinFunction, InstanceIndexContribution { + /** + * The log + */ + private static final ALogger LOG = ALoggerFactory.getLogger(GroovyJoin.class); + /** * The function ID. Not named ID to avoid shadowing * {@link JoinFunction#ID}. @@ -50,7 +58,23 @@ public class GroovyJoin extends GroovyRetype implements JoinFunction, InstanceIn @Override public InstanceHandler getInstanceHandler() { - return new IndexJoinHandler(); + boolean useIndexJoinHandler = false; + + String setting = System.getProperty("hale.functions.use_index_join_handler"); + + if (setting == null) { + setting = System.getenv("HALE_FUNCTIONS_USE_INDEX_JOIN_HANDLER"); + } + + if (setting != null) { + try { + useIndexJoinHandler = Boolean.valueOf(setting); + } catch (Throwable e) { + LOG.error("Error applying index join handler setting: " + setting, e); + } + } + + return useIndexJoinHandler ? new IndexJoinHandler() : new JoinHandler(); } /** diff --git a/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyMerge.java b/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyMerge.java index 892b66fff6..f6b0d9ef8c 100644 --- a/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyMerge.java +++ b/cst/plugins/eu.esdihumboldt.cst.functions.groovy/src/eu/esdihumboldt/cst/functions/groovy/GroovyMerge.java @@ -19,8 +19,11 @@ import java.util.Collection; import java.util.List; +import de.fhg.igd.slf4jplus.ALogger; +import de.fhg.igd.slf4jplus.ALoggerFactory; import eu.esdihumboldt.cst.functions.core.Merge; import eu.esdihumboldt.cst.functions.core.merge.IndexMergeHandler; +import eu.esdihumboldt.cst.functions.core.merge.PropertiesMergeHandler; import eu.esdihumboldt.hale.common.align.model.Cell; import eu.esdihumboldt.hale.common.align.model.functions.MergeFunction; import eu.esdihumboldt.hale.common.align.model.impl.PropertyEntityDefinition; @@ -33,11 +36,16 @@ * into one target instance, based on matching properties. The transformation * also applies a Groovy script that can be used to control the target instance * creation. - * + * * @author Simon Templer */ public class GroovyMerge extends GroovyRetype implements MergeFunction, InstanceIndexContribution { + /** + * The log + */ + private static final ALogger LOG = ALoggerFactory.getLogger(GroovyMerge.class); + /** * The function ID. Not named ID to avoid shadowing * {@link MergeFunction#ID}. @@ -51,7 +59,23 @@ public class GroovyMerge extends GroovyRetype implements MergeFunction, Instance @Override public InstanceHandler getInstanceHandler() { - return new IndexMergeHandler(); + boolean useIndexMergeHandler = false; + + String setting = System.getProperty("hale.functions.use_index_merge_handler"); + + if (setting == null) { + setting = System.getenv("HALE_FUNCTIONS_USE_INDEX_MERGE_HANDLER"); + } + + if (setting != null) { + try { + useIndexMergeHandler = Boolean.valueOf(setting); + } catch (Throwable e) { + LOG.error("Error applying index merge handler setting: " + setting, e); + } + } + + return useIndexMergeHandler ? new IndexMergeHandler() : new PropertiesMergeHandler(); } /**