Permalink
Browse files

Merge branch 'feature/fix-start-triggers' into develop

  • Loading branch information...
2 parents 977cbbf + 60432de commit 12b5e4530f1c92724c5365226a4684169e4fb566 @dizzzz dizzzz committed Sep 15, 2013
View
@@ -421,7 +421,7 @@
this index in the database core. These will be removed
once the redesign has been completed.
-->
- <module id="ft-legacy-index" class="org.exist.fulltext.FTIndex"/>
+ <!--module id="ft-legacy-index" class="org.exist.fulltext.FTIndex"/-->
<!--
The following module is not really an index (though it sits
@@ -1205,37 +1205,62 @@ public String getClazz() {
}
private void configureStartup(final Element startup) {
+ // Retrieve <triggers>
final NodeList nlTriggers = startup.getElementsByTagName("triggers");
+
+ // If <triggers> exists
if(nlTriggers != null && nlTriggers.getLength() > 0) {
+ // Get <triggers>
final Element triggers = (Element)nlTriggers.item(0);
+
+ // Get <trigger>
final NodeList nlTrigger = triggers.getElementsByTagName("trigger");
+
+ // If <trigger> exists and there are more than 0
if(nlTrigger != null && nlTrigger.getLength() > 0) {
+
+ // Initialize trigger configuration
+ List<StartupTriggerConfig> startupTriggers = (List<StartupTriggerConfig>)config.get(BrokerPool.PROPERTY_STARTUP_TRIGGERS);
+ if(startupTriggers == null) {
+ startupTriggers = new ArrayList<StartupTriggerConfig>();
+ config.put(BrokerPool.PROPERTY_STARTUP_TRIGGERS, startupTriggers);
+ }
+
+ // Iterate over <trigger> elements
for(int i = 0; i < nlTrigger.getLength(); i++) {
+
+ // Get <trigger> element
final Element trigger = (Element)nlTrigger.item(i);
- List<StartupTriggerConfig> startupTriggers = (List<StartupTriggerConfig>)config.get(BrokerPool.PROPERTY_STARTUP_TRIGGERS);
- if(startupTriggers == null) {
- startupTriggers = new ArrayList<StartupTriggerConfig>();
- config.put(BrokerPool.PROPERTY_STARTUP_TRIGGERS, startupTriggers);
- }
+ // Get @class
final String startupTriggerClass = trigger.getAttribute("class");
boolean isStartupTrigger = false;
try {
+ // Verify if class is StartupTrigger
for(final Class iface : Class.forName(startupTriggerClass).getInterfaces()) {
if("org.exist.storage.StartupTrigger".equals(iface.getName())) {
isStartupTrigger = true;
break;
}
}
+ // if it actually is a StartupTrigger
if(isStartupTrigger) {
- final Map<String, List<? extends Object>> params = ParametersExtractor.extract(trigger.getElementsByTagName(ParametersExtractor.PARAMETER_ELEMENT_NAME));
+ // Parse additional parameters
+ final Map<String, List<? extends Object>> params
+ = ParametersExtractor.extract(trigger.getElementsByTagName(ParametersExtractor.PARAMETER_ELEMENT_NAME));
+
+ // Register trigger
startupTriggers.add(new StartupTriggerConfig(startupTriggerClass, params));
- LOG.debug("Registered StartupTrigger: " + startupTriggerClass);
+
+ // Done
+ LOG.info("Registered StartupTrigger: " + startupTriggerClass);
+
} else {
LOG.warn("StartupTrigger: " + startupTriggerClass + " does not implement org.exist.storage.StartupTrigger. IGNORING!");
}
+
} catch(final ClassNotFoundException cnfe) {
LOG.error("Could not find StartupTrigger class: " + startupTriggerClass + ". " + cnfe.getMessage(), cnfe);
}
@@ -1,7 +1,6 @@
package org.exist;
import org.exist.collections.triggers.AllTriggerTests;
-import org.exist.fulltext.AllFulltextTests;
import org.exist.xmldb.XmldbLocalTests;
import org.exist.xquery.AllXqueryTests;
import org.exist.xquery.OptimizerTest;
@@ -17,8 +16,7 @@
// AllXupdateTests.class,
AllXqueryTests.class,
OptimizerTest.class,
- AllTriggerTests.class,
- AllFulltextTests.class
+ AllTriggerTests.class
})
public class LocalTestSuite {
}
@@ -1,16 +0,0 @@
-package org.exist.fulltext;
-
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-/**
- */
-@RunWith(Suite.class)
-@Suite.SuiteClasses({
- FTIndexTest.class,
- FtQueryTest.class,
- FTMatchListenerTest.class
-})
-public class AllFulltextTests {
- //TODO: rewrite to use others indexes (FT will be removed)
-}
Oops, something went wrong.

0 comments on commit 12b5e45

Please sign in to comment.