1
2
3
4
5
6
7
8 package it.imolinfo.jbi4ejb.webservice.generator.bcm;
9
10 import org.objectweb.asm.ClassAdapter;
11 import org.objectweb.asm.ClassVisitor;
12 import org.objectweb.asm.MethodVisitor;
13
14
15
16
17
18
19
20 public class RemoteEnancherAdapter extends ClassAdapter {
21
22
23
24 private String completeName;
25
26
27 private String portTypeClassName;
28
29
30
31
32
33
34
35
36
37 public RemoteEnancherAdapter(ClassVisitor cv, String portTypeClassName) {
38 super(cv);
39 this.portTypeClassName = portTypeClassName;
40 }
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59 public void visit(int version,
60 int access,
61 String name,
62 String signature,
63 String superName,
64 String [] interfaces) {
65
66
67
68 String newName = portTypeClassName;
69
70 String [] newInterfaces;
71
72 if (interfaces == null){
73
74 newInterfaces = new String [] {"java/rmi/Remote"};
75
76 } else {
77
78 newInterfaces = new String[interfaces.length + 1];
79
80 for (int i = 0; i < interfaces.length; i++) {
81 newInterfaces[i] = interfaces[i];
82 }
83
84 newInterfaces[newInterfaces.length - 1] = "java/rmi/Remote";
85 }
86
87 super.visit(version, access, newName, signature, superName, newInterfaces);
88
89 completeName = newName;
90
91 }
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114 public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
115 String[] newExceptions;
116 if (exceptions==null) {
117 newExceptions=new String[]{"java/rmi/RemoteException"};
118 }
119 else {
120 newExceptions = new String[exceptions.length + 1];
121 if (exceptions!=null) {
122 for (int i = 0; i < exceptions.length; i++) {
123 newExceptions[i] = exceptions[i];
124 }
125 }
126 newExceptions[newExceptions.length - 1] = "java/rmi/RemoteException";
127 }
128 return super.visitMethod(access, name, desc, signature, newExceptions);
129 }
130
131
132
133
134
135
136 public String getCompleteName() {
137 return completeName;
138 }
139
140 }
141
142