01: /**********************************************************************************
02: * $URL: https://source.sakaiproject.org/svn/metaobj/tags/sakai_2-4-1/metaobj-impl/api-impl/src/java/org/sakaiproject/metaobj/utils/aop/AdvisorBeanNameAutoProxyCreator.java $
03: * $Id: AdvisorBeanNameAutoProxyCreator.java 14225 2006-09-05 17:39:44Z chmaurer@iupui.edu $
04: ***********************************************************************************
05: *
06: * Copyright (c) 2004, 2005, 2006 The Sakai Foundation.
07: *
08: * Licensed under the Educational Community License, Version 1.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.opensource.org/licenses/ecl1.php
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: **********************************************************************************/package org.sakaiproject.metaobj.utils.aop;
21:
22: import org.apache.commons.logging.Log;
23: import org.apache.commons.logging.LogFactory;
24: import org.springframework.aop.Advisor;
25: import org.springframework.aop.framework.ProxyFactory;
26: import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
27:
28: public class AdvisorBeanNameAutoProxyCreator extends
29: BeanNameAutoProxyCreator {
30: protected final transient Log logger = LogFactory
31: .getLog(getClass());
32:
33: private Advisor[] advisors;
34:
35: protected void customizeProxyFactory(ProxyFactory proxyFactory) {
36: setAdvisors(proxyFactory.getAdvisors());
37: }
38:
39: /**
40: * Subclasses may choose to implement this: for example,
41: * to change the interfaces exposed
42: *
43: * @param bean bean about to be autoproxied
44: * @param pf ProxyFactory that will be used to create the proxy
45: * immediably after this method returns
46: * protected void customizeProxyFactory(Object bean, ProxyFactory pf) {
47: * super.customizeProxyFactory(bean, pf);
48: * setAdvisors(pf.getAdvisors());
49: * }
50: */
51:
52: public Advisor[] getAdvisors() {
53: return advisors;
54: }
55:
56: public void setAdvisors(Advisor[] advisors) {
57: this.advisors = advisors;
58: }
59: }
|