1 16 package com.jdon.container.access; 17 18 import com.jdon.aop.AopClient; 19 import com.jdon.container.ContainerWrapper; 20 import com.jdon.container.finder.ComponentKeys; 21 import com.jdon.container.visitor.ComponentVisitor; 22 import com.jdon.util.Debug; 23 24 28 29 public class ServiceAccessorImp implements ServiceAccessor { 30 private final static String module = ServiceAccessorImp.class.getName(); 31 32 35 public Object getService(TargetMetaRequest targetMetaRequest) { 36 Debug.logVerbose("[JdonFramework] enter getService: " + ComponentKeys.PROXYINSTANCE_FACTORY + " in action", module); 37 targetMetaRequest.setVisitableName(ComponentKeys.PROXYINSTANCE_FACTORY); 38 ComponentVisitor componentVisitor = targetMetaRequest.getComponentVisitor(); 39 return componentVisitor.visit(targetMetaRequest); 40 } 41 42 45 public Object executeService(TargetMetaRequest targetMetaRequest, ContainerWrapper cw) throws Exception { 46 Debug.logVerbose("[JdonFramework]enter service execution core ", module); 47 Object result = null; 48 try { 49 AopClient aopClient = (AopClient) cw.lookup(ComponentKeys.AOP_CLIENT); 50 result = aopClient.invoke(targetMetaRequest); 51 } catch (Exception ex) { 52 Debug.logError("[JdonFramework] execute the service error: " + ex, module); 53 throw new Exception ("execute service error: " + ex); 54 } catch (Throwable ex) { 55 Debug.logError("[JdonFramework] execute Service error: " + ex, module); 56 throw new Exception (" execute Service error: " + ex); 57 } 58 return result; } 59 60 } 61 | Popular Tags |