KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ejb3 > entity > FlushModeInterceptorFactory


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.ejb3.entity;
8
9 import org.jboss.aop.Advisor;
10 import org.jboss.aop.InstanceAdvisor;
11 import org.jboss.aop.joinpoint.Joinpoint;
12 import org.jboss.aop.joinpoint.MethodJoinpoint;
13
14 import javax.persistence.FlushMode;
15 import javax.persistence.FlushMode;
16
17 /**
18  * This interceptor handles transactions for AOP
19  *
20  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
21  * @version $Revision: 1.2.6.2 $
22  */

23 public class FlushModeInterceptorFactory implements org.jboss.aop.advice.AspectFactory
24 {
25    public Object JavaDoc createPerVM()
26    {
27       throw new RuntimeException JavaDoc("NOT ALLOWED");
28    }
29
30    public Object JavaDoc createPerClass(Advisor advisor)
31    {
32       throw new RuntimeException JavaDoc("NOT ALLOWED");
33    }
34
35    public Object JavaDoc createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
36    {
37       throw new RuntimeException JavaDoc("NOT ALLOWED");
38    }
39
40    public Object JavaDoc createPerJoinpoint(Advisor advisor, Joinpoint jp)
41    {
42       MethodJoinpoint m = (MethodJoinpoint)jp;
43       FlushMode mode = (FlushMode)advisor.resolveAnnotation(m.getMethod(), FlushMode.class);
44       if (mode == null) throw new RuntimeException JavaDoc("FLUSH MODE WAS NULL!!!!");
45       return new FlushModeInterceptor(mode.value());
46    }
47
48    public Object JavaDoc createPerJoinpoint(Advisor advisor, InstanceAdvisor instanceAdvisor, Joinpoint jp)
49    {
50       throw new RuntimeException JavaDoc("NOT ALLOWED");
51    }
52
53    public String JavaDoc getName()
54    {
55       return getClass().getName();
56    }
57 }
58
Popular Tags