1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
package org.mule.providers.soap.xfire; |
12 | |
|
13 | |
import org.mule.umo.lifecycle.Callable; |
14 | |
import org.mule.umo.lifecycle.Disposable; |
15 | |
import org.mule.umo.lifecycle.Initialisable; |
16 | |
import org.mule.util.ClassUtils; |
17 | |
|
18 | |
import java.lang.reflect.Method; |
19 | |
import java.lang.reflect.Modifier; |
20 | |
import java.util.HashSet; |
21 | |
import java.util.Set; |
22 | |
|
23 | |
import org.codehaus.xfire.service.binding.ObjectServiceFactory; |
24 | |
import org.codehaus.xfire.transport.TransportManager; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
public class MuleObjectServiceFactory extends ObjectServiceFactory |
30 | |
{ |
31 | |
|
32 | 66 | protected final Set excludedMethods = new HashSet(); |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
public MuleObjectServiceFactory(TransportManager transportManager) |
38 | |
{ |
39 | 66 | super(transportManager); |
40 | 66 | initExcludedMethods(); |
41 | 66 | } |
42 | |
|
43 | |
protected void initExcludedMethods() |
44 | |
{ |
45 | |
|
46 | 66 | addIgnoredMethods("java.lang.Object"); |
47 | 66 | addIgnoredMethods("java.lang.Throwable"); |
48 | 66 | addIgnoredMethods("org.omg.CORBA_2_3.portable.ObjectImpl"); |
49 | 66 | addIgnoredMethods("org.omg.CORBA.portable.ObjectImpl"); |
50 | 66 | addIgnoredMethods("javax.ejb.EJBObject"); |
51 | 66 | addIgnoredMethods("javax.rmi.CORBA.Stub"); |
52 | |
|
53 | |
|
54 | 72 | addIgnoredMethods(Callable.class.getName()); |
55 | 66 | addIgnoredMethods(Initialisable.class.getName()); |
56 | 66 | addIgnoredMethods(Disposable.class.getName()); |
57 | 66 | } |
58 | |
|
59 | |
|
60 | |
|
61 | |
|
62 | |
|
63 | |
|
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
|
73 | |
|
74 | |
|
75 | |
public void addIgnoredMethods(String className) |
76 | |
{ |
77 | |
try |
78 | |
{ |
79 | 594 | Class c = ClassUtils.loadClass(className, getClass()); |
80 | 9108 | for (int i = 0; i < c.getMethods().length; i++) |
81 | |
{ |
82 | 8580 | excludedMethods.add(getMethodName(c.getMethods()[i])); |
83 | |
} |
84 | |
} |
85 | 66 | catch (ClassNotFoundException e) |
86 | |
{ |
87 | |
|
88 | 528 | } |
89 | 594 | } |
90 | |
|
91 | |
protected boolean isValidMethod(final Method method) |
92 | |
{ |
93 | 1270 | if (excludedMethods.contains(getMethodName(method))) |
94 | |
{ |
95 | 856 | return false; |
96 | |
} |
97 | |
|
98 | 414 | final int modifiers = method.getModifiers(); |
99 | |
|
100 | 414 | return Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers); |
101 | |
} |
102 | |
|
103 | |
protected String getMethodName(Method method) |
104 | |
{ |
105 | 9850 | return method.getName(); |
106 | |
} |
107 | |
|
108 | |
} |