1 16 package com.jdon.controller.service; 17 18 import javax.servlet.http.HttpServletRequest ; 19 20 import com.jdon.bussinessproxy.TargetMetaDef; 21 import com.jdon.bussinessproxy.meta.MethodMetaArgs; 22 import com.jdon.container.ContainerWrapper; 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.util.Debug; 27 28 32 public class WebServiceImp implements Service{ 33 34 private final static String module = WebServiceImp.class.getName(); 35 private ContainerCallback containerCallback; 36 private WebServiceAccessor webServiceAccessor; 37 38 public WebServiceImp(WebServiceAccessor webServiceAccessor, 39 ContainerCallback containerCallback){ 40 this.webServiceAccessor = webServiceAccessor; 41 this.containerCallback = containerCallback; 42 } 43 44 47 public Object execute(String name, 48 MethodMetaArgs methodMetaArgs, 49 HttpServletRequest request) throws Exception { 50 if ((methodMetaArgs == null) || (methodMetaArgs.getMethodName() == null)){ 51 Debug.logWarning(" methodMetaArgs is null. cann't invoke service.execute"); 52 } 53 Debug.logVerbose("++++++++++++++++++++++++++++++<begin: invoking from jdonframework.xml", module); 54 Debug.logVerbose("+++++++++++++++execute new service='"+ name + "' method='" + methodMetaArgs.getMethodName() +"'", module); 55 ContainerWrapper cw = containerCallback.getContainerWrapper(); 56 TargetMetaDef targetMetaDef = UserTargetMetaDefFactory.getTargetMetaDef(name, cw); 57 if (targetMetaDef == null) return null; 58 Object result = execute(targetMetaDef, methodMetaArgs, request); 59 Debug.logVerbose("+++++++++++++++execute service='"+ name + "' method='" + methodMetaArgs.getMethodName() + "' successfully!", module); 60 Debug.logVerbose("++++++++++++++++++++++++++++++<end:", module); 61 return result; 62 } 63 64 67 public Object execute( TargetMetaDef targetMetaDef, 68 MethodMetaArgs methodMetaArgs, 69 HttpServletRequest request) throws Exception { 70 Debug.logVerbose("[JdonFramework]enter service execution core ", module); 71 TargetMetaRequest targetMetaRequest = UserTargetMetaDefFactory.create(targetMetaDef, request); 72 targetMetaRequest.setMethodMetaArgs(methodMetaArgs); 73 return webServiceAccessor.execute(targetMetaRequest, request); 74 } 75 } 76 | Popular Tags |