1 /***************************************************************************************
2 * Copyright (c) Jonas Bonér, Alexandre Vasseur. All rights reserved. *
3 * http://aspectwerkz.codehaus.org *
4 * ---------------------------------------------------------------------------------- *
5 * The software in this package is published under the terms of the LGPL license *
6 * a copy of which has been included with this distribution in the license.txt file. *
7 **************************************************************************************/
8 package test.clapp;
9
10 import org.codehaus.aspectwerkz.hook.ClassPreProcessor;
11
12 import java.io.ByteArrayInputStream;
13 import java.util.Arrays;
14 import java.util.Hashtable;
15
16 /***
17 * Add marker interface java.util.EventListener to processed class
18 *
19 * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur </a>
20 */
21 public class AddInterfacePreProcessor implements ClassPreProcessor {
22 private void log(String s) {
23 System.out.println(Thread.currentThread().getName() + ": AddInterfacePreProcessor: " + s);
24 }
25
26 public void initialize(Hashtable hashtable) {
27 ;
28 }
29
30 public byte[] preProcess(String klass, byte[] abyte, ClassLoader caller) {
31 try {
32 log(klass);
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54 return null;
55 } catch (Exception e) {
56 e.printStackTrace();
57 throw new RuntimeException(e.getMessage());
58 }
59 }
60 }