1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package org.jboss.cache.pojo.interceptors; |
8 |
| |
9 |
| import org.apache.commons.logging.Log; |
10 |
| import org.apache.commons.logging.LogFactory; |
11 |
| import org.jboss.aop.advice.Interceptor; |
12 |
| import org.jboss.aop.joinpoint.Invocation; |
13 |
| import org.jboss.cache.CacheSPI; |
14 |
| import org.jboss.cache.Fqn; |
15 |
| import org.jboss.cache.pojo.impl.InternalConstant; |
16 |
| import org.jboss.cache.pojo.impl.PojoCacheImpl; |
17 |
| |
18 |
| import java.lang.reflect.Field; |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| public class StaticFieldInterceptor implements Interceptor |
27 |
| { |
28 |
| private final Log log_ = LogFactory.getLog(StaticFieldInterceptor.class); |
29 |
| private PojoCacheImpl pCache_; |
30 |
| private Fqn fqn_; |
31 |
| private String name_; |
32 |
| private String key_; |
33 |
| |
34 |
0
| public StaticFieldInterceptor()
|
35 |
| { |
36 |
| } |
37 |
| |
38 |
0
| public String getName()
|
39 |
| { |
40 |
0
| if (name_ == null)
|
41 |
| { |
42 |
0
| this.name_ = "StaticFieldInterceptor on [" + fqn_ + "]";
|
43 |
| } |
44 |
0
| return name_;
|
45 |
| } |
46 |
| |
47 |
0
| public Object invoke(Invocation invocation) throws Throwable
|
48 |
| { |
49 |
| |
50 |
| |
51 |
| |
52 |
| |
53 |
| |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
| |
59 |
| |
60 |
| |
61 |
| |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
| |
71 |
| |
72 |
| |
73 |
| |
74 |
| |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
| |
80 |
| |
81 |
0
| return invocation.invokeNext();
|
82 |
| |
83 |
| } |
84 |
| |
85 |
0
| private void needInit(Field field)
|
86 |
| { |
87 |
0
| if (pCache_ == null)
|
88 |
| { |
89 |
0
| String cn = field.getDeclaringClass().getName();
|
90 |
0
| fqn_ = Fqn.fromString(InternalConstant.JBOSS_INTERNAL_STATIC + "/" + cn);
|
91 |
0
| key_ = field.getName();
|
92 |
| } |
93 |
| } |
94 |
| |
95 |
0
| boolean isChildOf(Fqn parentFqn)
|
96 |
| { |
97 |
0
| return fqn_.isChildOf(parentFqn);
|
98 |
| } |
99 |
| |
100 |
0
| public Fqn getFqn()
|
101 |
| { |
102 |
0
| return fqn_;
|
103 |
| } |
104 |
| |
105 |
0
| public void setFqn(Fqn fqn)
|
106 |
| { |
107 |
0
| this.fqn_ = fqn;
|
108 |
| } |
109 |
| |
110 |
| } |