KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > framework > adapter > AdvisorAdapterRegistry


1 /*
2  * Copyright 2002-2007 the original author or authors.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.springframework.aop.framework.adapter;
18
19 import org.aopalliance.intercept.MethodInterceptor;
20
21 import org.springframework.aop.Advisor;
22
23 /**
24  * Interface for registries of Advisor adapters.
25  *
26  * <p><i>This is an SPI interface, not to be implemented by any Spring user.</i>
27  *
28  * @author Rod Johnson
29  * @author Rob Harrop
30  */

31 public interface AdvisorAdapterRegistry {
32
33     /**
34      * Return an Advisor wrapping the given advice.
35      * <p>Should by default at least support
36      * {@link org.aopalliance.intercept.MethodInterceptor},
37      * {@link org.springframework.aop.MethodBeforeAdvice},
38      * {@link org.springframework.aop.AfterReturningAdvice},
39      * {@link org.springframework.aop.ThrowsAdvice}.
40      * @param advice object that should be an advice
41      * @return an Advisor wrapping the given advice. Never returns <code>null</code>.
42      * If the advice parameter is an Advisor, return it.
43      * @throws UnknownAdviceTypeException if no registered advisor adapter
44      * can wrap the supposed advice
45      */

46     Advisor wrap(Object JavaDoc advice) throws UnknownAdviceTypeException;
47
48     /**
49      * Return an array of AOP Alliance MethodInterceptors to allow use of the
50      * given Advisor in an interception-based framework.
51      * <p>Don't worry about the pointcut associated with the Advisor,
52      * if it's a PointcutAdvisor: just return an interceptor.
53      * @param advisor Advisor to find an interceptor for
54      * @return an array of MethodInterceptors to expose this Advisor's behavior
55      * @throws UnknownAdviceTypeException if the Advisor type is
56      * not understood by any registered AdvisorAdapter.
57      */

58     MethodInterceptor[] getInterceptors(Advisor advisor) throws UnknownAdviceTypeException;
59
60     /**
61      * Register the given AdvisorAdapter. Note that it is not necessary to register
62      * adapters for an AOP Alliance Interceptors or Spring Advices: these must be
63      * automatically recognized by an AdvisorAdapterRegistry implementation.
64      * @param adapter AdvisorAdapter that understands a particular Advisor
65      * or Advice types
66      */

67     void registerAdvisorAdapter(AdvisorAdapter adapter);
68
69 }
70
Popular Tags