1 8 package test.staticinitialization; 9 10 import org.codehaus.aspectwerkz.definition.Pointcut; 11 import org.codehaus.aspectwerkz.joinpoint.JoinPoint; 12 import org.codehaus.aspectwerkz.joinpoint.StaticJoinPoint; 13 14 15 22 public class StaticInitializationAspect { 23 26 Pointcut staticInitialization; 27 28 31 Pointcut staticServiceInitialization; 32 33 36 Pointcut staticPatternInitialization; 37 38 41 public void beforeStaticInitializer() { 42 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[0]); 43 } 44 45 48 public void beforeStaticServiceInitialization() { 49 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[0]); 50 } 51 52 55 public void beforeStaticPatternInitialization() { 56 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[0]); 57 } 58 59 62 public void beforeStaticInitialization(StaticJoinPoint sjp) { 63 StaticInitializationTest.s_staticJoinPoints.add(sjp); 64 } 65 66 69 public void beforeStaticServiceInitialization(StaticJoinPoint sjp) { 70 StaticInitializationTest.s_staticJoinPoints.add(sjp); 71 } 72 73 76 public void beforeStaticPatternInitialization(StaticJoinPoint sjp) { 77 StaticInitializationTest.s_staticJoinPoints.add(sjp); 78 } 79 80 83 public void beforeStaticInitialization(JoinPoint jp) { 84 StaticInitializationTest.s_joinPoints.add(jp); 85 } 86 87 90 public void beforeStaticServiceInitialization(JoinPoint jp) { 91 StaticInitializationTest.s_joinPoints.add(jp); 92 } 93 94 97 public void beforeStaticPatternInitialization(JoinPoint jp) { 98 StaticInitializationTest.s_joinPoints.add(jp); 99 } 100 101 104 public Object aroundStaticInitialization(StaticJoinPoint sjp) throws Throwable { 105 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[1]); 106 StaticInitializationTest.s_staticJoinPoints.add(sjp); 107 108 return sjp.proceed(); 109 } 110 111 114 public Object aroundStaticServiceInitialization(StaticJoinPoint sjp) throws Throwable { 115 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[1]); 116 StaticInitializationTest.s_staticJoinPoints.add(sjp); 117 118 return sjp.proceed(); 119 } 120 121 124 public Object aroundStaticPatternInitialization(StaticJoinPoint sjp) throws Throwable { 125 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[1]); 126 StaticInitializationTest.s_staticJoinPoints.add(sjp); 127 128 return sjp.proceed(); 129 } 130 131 134 public Object aroundStaticInitialization(JoinPoint jp) throws Throwable { 135 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[2]); 136 StaticInitializationTest.s_joinPoints.add(jp); 137 138 return jp.proceed(); 139 } 140 141 144 public Object aroundStaticServiceInitialization(JoinPoint jp) throws Throwable { 145 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[2]); 146 StaticInitializationTest.s_joinPoints.add(jp); 147 148 return jp.proceed(); 149 } 150 151 154 public Object aroundStaticPatternInitialization(JoinPoint jp) throws Throwable { 155 StaticInitializationTest.s_messages.add(StaticInitializationTest.BEFORE_EXPECTED_MESSAGES[2]); 156 StaticInitializationTest.s_joinPoints.add(jp); 157 158 return jp.proceed(); 159 } 160 161 164 public void afterReturningStaticInitializer() { 165 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[0]); 166 } 167 168 171 public void afterReturningServiceInitializer() { 172 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[0]); 173 } 174 175 178 public void afterReturningPatternInitializer() { 179 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[0]); 180 } 181 182 185 public void afterReturningStaticInitializer(StaticJoinPoint sjp) { 186 StaticInitializationTest.s_staticJoinPoints.add(sjp); 187 } 188 189 192 public void afterReturningServiceInitializer(StaticJoinPoint sjp) { 193 StaticInitializationTest.s_staticJoinPoints.add(sjp); 194 } 195 196 199 public void afterReturningPatternInitializer(StaticJoinPoint sjp) { 200 StaticInitializationTest.s_staticJoinPoints.add(sjp); 201 } 202 203 206 public void afterReturningStaticInitializer(JoinPoint jp) { 207 StaticInitializationTest.s_joinPoints.add(jp); 208 } 209 210 213 public void afterReturningServiceInitializer(JoinPoint jp) { 214 StaticInitializationTest.s_joinPoints.add(jp); 215 } 216 217 220 public void afterReturningPatternInitializer(JoinPoint jp) { 221 StaticInitializationTest.s_joinPoints.add(jp); 222 } 223 224 227 public void afterStaticInitializer() { 228 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[1]); 229 } 230 231 234 public void afterServiceInitializer() { 235 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[1]); 236 } 237 238 241 public void afterPatternInitializer() { 242 StaticInitializationTest.s_messages.add(StaticInitializationTest.AFTER_EXPECTED_MESSAGES[1]); 243 } 244 245 248 public void afterStaticInitializer(StaticJoinPoint sjp) { 249 StaticInitializationTest.s_staticJoinPoints.add(sjp); 250 } 251 252 255 public void afterServiceInitializer(StaticJoinPoint sjp) { 256 StaticInitializationTest.s_staticJoinPoints.add(sjp); 257 } 258 259 262 public void afterPatternInitializer(StaticJoinPoint sjp) { 263 StaticInitializationTest.s_staticJoinPoints.add(sjp); 264 } 265 266 269 public void afterStaticInitializer(JoinPoint jp) { 270 StaticInitializationTest.s_joinPoints.add(jp); 271 } 272 273 276 public void afterServiceInitializer(JoinPoint jp) { 277 StaticInitializationTest.s_joinPoints.add(jp); 278 } 279 280 283 public void afterPatternInitializer(JoinPoint jp) { 284 StaticInitializationTest.s_joinPoints.add(jp); 285 } 286 } 287 | Popular Tags |