KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > bussinessproxy > target > TargetServiceFactoryVisitable


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.bussinessproxy.target;
17
18 import com.jdon.container.access.TargetMetaRequest;
19 import com.jdon.container.visitor.Visitable;
20
21 /**
22  * this class supply accessing TargetServiceFactory by cache visitor
23  * if ServiceMethodInvoker call this class, ejb service instance
24  * or pojo instance will be cached.
25  *
26  * active it by two steps:
27  * 1. configure in container.xml
28  * <component name="targetServiceFactoryVisitable" class="com.jdon.bussinessproxy.target.TargetServiceFactoryVisitable" />
29  * 2. uncomment the line in AopClient's invoke method
30  * this.methodInvoker.setVisitor(cm);
31  *
32  * this.methodInvoker.setVisitor(cm);
33  * @author <a HREF="mailto:banqiao@jdon.com">banq</a>
34  *
35  */

36 public class TargetServiceFactoryVisitable implements Visitable{
37
38     private TargetServiceFactory targetServiceFactory;
39     public TargetServiceFactoryVisitable(TargetServiceFactory targetServiceFactory){
40         this.targetServiceFactory = targetServiceFactory;
41     }
42     
43     public Object JavaDoc accept(TargetMetaRequest targetMetaRequest) {
44         return targetServiceFactory.create(targetMetaRequest.getTargetMetaDef());
45     }
46 }
47
Popular Tags