001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: *
017: * $Header:$
018: */
019: package org.apache.beehive.controls.spi.svc;
020:
021: /**
022: * The InterceptorPivotException class declares a checked exception that is thrown by
023: * an Interceptor upon pivoting. For example, if an interceptor wishes to stop a method
024: * from executing further and return a value, it can throw this exception and embed in
025: * the exception the return value that it wishes the method to return.
026: */
027: public class InterceptorPivotException extends Exception {
028: /**
029: * Comment for <code>serialVersionUID</code>
030: */
031: private static final long serialVersionUID = 1L;
032: private Object returnValue;
033: private String interceptorName;
034:
035: /**
036: * Constructs a InterceptorPivotException object with the specified interceptor.
037: *
038: * @param interceptorName name of the interceptor that generated this exception
039: */
040: public InterceptorPivotException(String interceptorName) {
041: super ();
042: this .interceptorName = interceptorName;
043: }
044:
045: /**
046: * Constructs a InterceptorPivotException object with the specified interceptor
047: * and return value for the method that is intercepted.
048: *
049: * @param interceptorName name of the interceptor that generated this exception
050: * @param returnValue the return value of the method that is intercepted.
051: */
052: public InterceptorPivotException(String interceptorName,
053: Object returnValue) {
054: super ();
055: this .interceptorName = interceptorName;
056: this .returnValue = returnValue;
057: }
058:
059: /**
060: * Constructs a ServiceException object using the specified interceptor, the
061: * return value for the method that is intercepted and message.
062: *
063: * @param interceptorName name of the interceptor that generated this exception
064: * @param returnValue the return value of the method that is intercepted.
065: * @param message The message to use.
066: */
067: public InterceptorPivotException(String interceptorName,
068: Object returnValue, String message) {
069: super (message);
070: this .interceptorName = interceptorName;
071: this .returnValue = returnValue;
072: }
073:
074: /**
075: * Constructs a ServiceException object using the specified interceptor and
076: * a message.
077: *
078: * @param interceptorName name of the interceptor that generated this exception
079: * @param message The message to use.
080: */
081: public InterceptorPivotException(String interceptorName,
082: String message) {
083: super (message);
084: this .interceptorName = interceptorName;
085: }
086:
087: /**
088: * @return Returns the interceptorName.
089: */
090: public String getInterceptorName() {
091: return interceptorName;
092: }
093:
094: /**
095: * @return Returns the returnValue.
096: */
097: public Object getReturnValue() {
098: return returnValue;
099: }
100:
101: /**
102: * @param interceptorName The interceptorName to set.
103: */
104: public void setInterceptorName(String interceptorName) {
105: this.interceptorName = interceptorName;
106: }
107: }
|