KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > container > access > ServiceAccessorImp


1 /*
2  * Copyright 2003-2006 the original author or authors.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  */

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 /**
25  * @author <a HREF="mailto:banqJdon<AT>jdon.com">banq</a>
26  *
27  */

28
29 public class ServiceAccessorImp implements ServiceAccessor {
30     private final static String JavaDoc module = ServiceAccessorImp.class.getName();
31     
32     /* (non-Javadoc)
33      * @see com.jdon.container.access.ServiceAccessor#getService(com.jdon.container.access.UserTargetMetaDef)
34      */

35     public Object JavaDoc 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     /* (non-Javadoc)
43      * @see com.jdon.container.access.ServiceAccessor#executeService(com.jdon.container.access.UserTargetMetaDef)
44      */

45     public Object JavaDoc executeService(TargetMetaRequest targetMetaRequest, ContainerWrapper cw) throws Exception JavaDoc{
46         Debug.logVerbose("[JdonFramework]enter service execution core ", module);
47         Object JavaDoc result = null;
48         try {
49           AopClient aopClient = (AopClient) cw.lookup(ComponentKeys.AOP_CLIENT);
50           result = aopClient.invoke(targetMetaRequest);
51         } catch (Exception JavaDoc ex) {
52           Debug.logError("[JdonFramework] execute the service error: " + ex, module);
53           throw new Exception JavaDoc("execute service error: " + ex);
54         } catch (Throwable JavaDoc ex) {
55           Debug.logError("[JdonFramework] execute Service error: " + ex, module);
56           throw new Exception JavaDoc(" execute Service error: " + ex);
57         }
58         return result; }
59
60 }
61
Popular Tags