KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > springframework > aop > framework > autoproxy > metadata > DummyAttributes


1 /*
2  * Copyright 2002-2005 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.autoproxy.metadata;
18
19 import org.springframework.aop.framework.autoproxy.target.PoolingAttribute;
20 import org.springframework.metadata.support.MapAttributes;
21 import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
22 import org.springframework.transaction.interceptor.NoRollbackRuleAttribute;
23 import org.springframework.transaction.interceptor.RollbackRuleAttribute;
24 import org.springframework.transaction.interceptor.RuleBasedTransactionAttribute;
25
26 /**
27  * Hardcoded to return the same attributes as are on the TxClass and TxClassWithClassAttribute.
28  *
29  * @author Rod Johnson
30  */

31 public class DummyAttributes extends MapAttributes {
32
33     public DummyAttributes() throws Exception JavaDoc {
34         register(TxClassImpl.class.getMethod("defaultTxAttribute", (Class JavaDoc[]) null),
35             new Object JavaDoc[] { new DefaultTransactionAttribute()});
36
37         Object JavaDoc[] echoAtts = new Object JavaDoc[] {
38             new RuleBasedTransactionAttribute(),
39             new RollbackRuleAttribute("java.lang.Exception"),
40             new NoRollbackRuleAttribute("ServletException")
41         };
42
43         register(TxClassImpl.class.getMethod("echoException", new Class JavaDoc[] { Exception JavaDoc.class }), echoAtts);
44         
45         PoolingAttribute pa = new PoolingAttribute(10);
46         register(TxClassWithClassAttribute.class, new Object JavaDoc[] { new DefaultTransactionAttribute(), pa });
47         register(TxClassWithClassAttribute.class.getMethod("echoException", new Class JavaDoc[] { Exception JavaDoc.class }), echoAtts);
48         
49         register(ThreadLocalTestBean.class, new Object JavaDoc[] { new ThreadLocalAttribute() });
50         register(PrototypeTestBean.class, new Object JavaDoc[] { new PrototypeAttribute() });
51         
52         register(ModifiableTestBean.class, new Object JavaDoc[] { new ModifiableAttribute() });
53     }
54
55 }
56
Popular Tags