1 15 16 package com.jdon.controller.service; 17 18 import javax.servlet.http.HttpServletRequest ; 19 20 import com.jdon.bussinessproxy.TargetMetaDef; 21 import com.jdon.container.ContainerWrapper; 22 import com.jdon.container.access.ServiceAccessor; 23 import com.jdon.container.access.TargetMetaRequest; 24 import com.jdon.container.access.UserTargetMetaDefFactory; 25 import com.jdon.container.finder.ContainerCallback; 26 import com.jdon.container.finder.ServletContainerFinder; 27 import com.jdon.util.Debug; 28 29 37 public class WebServiceFactory implements ServiceFactory { 38 39 private final static String module = WebServiceFactory.class.getName(); 40 41 private ContainerCallback containerCallback; 42 private WebServiceAccessor webServiceAccessor; 43 44 public WebServiceFactory(WebServiceAccessor webServiceAccessor, 45 ContainerCallback containerCallback){ 46 this.webServiceAccessor = webServiceAccessor; 47 this.containerCallback = containerCallback; 48 } 49 50 public Object getService(String name, HttpServletRequest request) { 51 Debug.logVerbose("<==============================>start: JdonFramework core entrance", module); 52 Debug.logVerbose("<===============>Looking up new service='"+ name + "'", module); 53 ContainerWrapper cw = containerCallback.getContainerWrapper(); 54 TargetMetaDef targetMetaDef = UserTargetMetaDefFactory.getTargetMetaDef(name, cw); 55 if (targetMetaDef == null) return null; 56 Debug.logVerbose("[JdonFramework] service=" + name + " found, and now return the service instance", module); 57 Object result = getService(targetMetaDef, request); 58 Debug.logVerbose("<===============>found service='" + name + "' instance and return it successfully!", module); 59 Debug.logVerbose("<==============================>over", module); 60 return result; 61 } 62 63 68 public Object getService(TargetMetaDef targetMetaDef, HttpServletRequest request) { 69 TargetMetaRequest targetMetaRequest = UserTargetMetaDefFactory.create(targetMetaDef, request); 70 return webServiceAccessor.getService(targetMetaRequest, request); 71 } 72 73 74 } 75 | Popular Tags |