1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.apache.geronimo.interceptor;
19
20 /**
21 * The result of an Invocation.
22 * There are two types of result:
23 * <ul>
24 * <li>normal - indicating the operation completed normally (e.g. the method returned)</li>
25 * <li>exception - indicating the operation completed abnormally (e.g. the method threw a checked exception)</li>
26 * </ul>
27 * <p>Note that these should both be considered a normal completion of the operation by the container. Abnormal
28 * completions, such as a RuntimeException or Error from the invocation, or any problem in the interceptor
29 * chain itself, should result in a Throwable being thrown up the chain rather than being contained in this
30 * result.</p>
31 * <p>This distinction mirrors the semantics for EJB invocations, where a business method is considered to have
32 * completed successfuly even if it throws declared Exception - the Exception there is indicating a business level
33 * issue and not a system problem.</p>
34 *
35 * @version $Rev: 476049 $ $Date: 2006-11-16 20:35:17 -0800 (Thu, 16 Nov 2006) $
36 */
37 public interface InvocationResult {
38 /**
39 * Was this a normal completion (return)?
40 * @return true if the invocation returned; false if a declared exception was thrown
41 */
42 boolean isNormal();
43
44 /**
45 * Get the return value from the invocation.
46 * It is an error to call this method if the invocation is not complete normally.
47 * @return the return value from the invocation; null if the operation was void
48 */
49 Object getResult();
50
51 /**
52 * Was an application exception raised by the invocation?
53 * Note, this indicates a checked application exception was thrown; this will never contain
54 * a system exception
55 * @return true if a declared exception was thrown; false if the invocation returned
56 */
57 boolean isException();
58
59 /**
60 * Get the application exception raised by the invocation.
61 * It is an error to call this method if the invocation did not raise an exception
62 * @return the checked Exception raised by the application
63 */
64 Exception getException();
65 }