1 17 18 package org.apache.avalon.fortress.util; 19 20 import org.apache.avalon.fortress.impl.handler.ComponentHandler; 21 import org.apache.avalon.fortress.impl.handler.PrepareHandlerCommand; 22 import org.apache.avalon.framework.logger.AbstractLogEnabled; 23 24 import org.apache.excalibur.event.command.Command; 25 import org.apache.excalibur.event.command.CommandFailureHandler; 26 27 35 public class FortressCommandFailureHandler 36 extends AbstractLogEnabled 37 implements CommandFailureHandler 38 { 39 48 public boolean handleCommandFailure( final Command command, final Throwable throwable ) 49 { 50 if ( command instanceof PrepareHandlerCommand ) 51 { 52 PrepareHandlerCommand phc = (PrepareHandlerCommand)command; 53 ComponentHandler handler = phc.getHandler(); 54 55 if ( getLogger().isErrorEnabled() ) 56 { 57 getLogger().error( "Could not prepare ComponentHandler for: " 58 + handler.getComponentClass().getName(), throwable ); 59 } 60 } 61 else 62 { 63 if ( getLogger().isErrorEnabled() ) 64 { 65 getLogger().error( "Command failed: " + command, throwable ); 66 } 67 } 68 69 return false; 71 } 72 } 73 74 | Popular Tags |