added logging to detect build failure

This commit is contained in:
Markus Geiss
2015-05-12 07:17:17 +02:00
parent e47cee6cd9
commit 9c32945c2c
2 changed files with 10 additions and 2 deletions
@@ -11,6 +11,8 @@ import org.apache.commons.lang3.StringUtils;
import org.mifosplatform.commands.annotation.CommandType;
import org.mifosplatform.commands.exception.UnsupportedCommandException;
import org.mifosplatform.commands.handler.NewCommandSourceHandler;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
@@ -36,6 +38,8 @@ import java.util.HashMap;
@Scope("singleton")
public class CommandHandlerProvider implements ApplicationContextAware {
private static final Logger LOGGER = LoggerFactory.getLogger(CommandHandlerProvider.class);
private ApplicationContext applicationContext;
private HashMap<String, String> registeredHandlers;
@@ -70,8 +74,13 @@ public class CommandHandlerProvider implements ApplicationContextAware {
final String[] commandHandlerBeans = this.applicationContext.getBeanNamesForAnnotation(CommandType.class);
if (ArrayUtils.isNotEmpty(commandHandlerBeans)) {
for (final String commandHandlerName : commandHandlerBeans) {
LOGGER.info("Register command handler '" + commandHandlerName + "' ...");
final CommandType commandType = this.applicationContext.getType(commandHandlerName).getAnnotation(CommandType.class);
this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName);
try {
this.registeredHandlers.put(commandType.entity() + "|" + commandType.action(), commandHandlerName);
} catch (final Throwable th) {
LOGGER.error("Unable to register command handler '" + commandHandlerName + "'!", th);
}
}
}
}
@@ -1,5 +1,4 @@
/**
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.