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