1 package jfun.yan.xfire; 2 3 import jfun.yan.factory.Factory; 4 5 import org.codehaus.xfire.MessageContext; 6 import org.codehaus.xfire.fault.XFireFault; 7 import org.codehaus.xfire.service.binding.ObjectInvoker; 8 9 15 public class FactoryInvoker extends ObjectInvoker { 16 private final Factory factory; 17 private final ScopePolicy scope; 18 23 public FactoryInvoker(Factory factory, ScopePolicy scope) { 24 this.factory = factory; 25 this.scope = scope==null?ApplicationScopePolicy.instance():scope; 26 } 27 28 public Object getServiceObject(MessageContext context) 29 throws XFireFault{ 30 return getScopedFactory(context).create(); 31 } 32 private Factory getScopedFactory(MessageContext context){ 33 return scope.applyScope(factory, context); 34 } 35 } | Popular Tags |