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 protected final Set excludedMethods = new HashSet();
33
34
35
36
37 public MuleObjectServiceFactory(TransportManager transportManager)
38 {
39 super(transportManager);
40 initExcludedMethods();
41 }
42
43 protected void initExcludedMethods()
44 {
45
46 addIgnoredMethods("java.lang.Object");
47 addIgnoredMethods("java.lang.Throwable");
48 addIgnoredMethods("org.omg.CORBA_2_3.portable.ObjectImpl");
49 addIgnoredMethods("org.omg.CORBA.portable.ObjectImpl");
50 addIgnoredMethods("javax.ejb.EJBObject");
51 addIgnoredMethods("javax.rmi.CORBA.Stub");
52
53
54 addIgnoredMethods(Callable.class.getName());
55 addIgnoredMethods(Initialisable.class.getName());
56 addIgnoredMethods(Disposable.class.getName());
57 }
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 Class c = ClassUtils.loadClass(className, getClass());
80 for (int i = 0; i < c.getMethods().length; i++)
81 {
82 excludedMethods.add(getMethodName(c.getMethods()[i]));
83 }
84 }
85 catch (ClassNotFoundException e)
86 {
87
88 }
89 }
90
91 protected boolean isValidMethod(final Method method)
92 {
93 if (excludedMethods.contains(getMethodName(method)))
94 {
95 return false;
96 }
97
98 final int modifiers = method.getModifiers();
99
100 return Modifier.isPublic(modifiers) && !Modifier.isStatic(modifiers);
101 }
102
103 protected String getMethodName(Method method)
104 {
105 return method.getName();
106 }
107
108 }