1 /* 2 * Copyright 2012 Capgemini 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 * 15 */ 16 package net.sf.appstatus.support.aop; 17 18 import net.sf.appstatus.core.services.IServiceMonitor; 19 20 import org.aopalliance.intercept.MethodInvocation; 21 22 /** 23 * Allows to define a custom service result analysis when using 24 * {@link AppStatusServiceInterceptor}. 25 * 26 * @author Nicolas Richeton 27 * 28 */ 29 public interface IPostServiceCallback { 30 31 /** 32 * This method allows to analyze an exception and call monitor#failure() or 33 * monitor#error() if necessary. 34 * 35 * @param monitor 36 * @param invocation 37 * @param e 38 */ 39 void handleException(IServiceMonitor monitor, MethodInvocation invocation, Exception e); 40 41 /** 42 * This method allows to analyze the result of a service call and call 43 * monitor#failure() or monitor#error() if necessary. 44 * 45 * @param monitor 46 * @param invocation 47 * @param result 48 * object returned by method call. 49 */ 50 void handleResult(IServiceMonitor monitor, MethodInvocation invocation, Object result); 51 }