KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > jdon > container > factory > ContainerFactory


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.factory;
17
18 import java.util.Map JavaDoc;
19
20 import com.jdon.container.ContainerWrapper;
21 import com.jdon.container.config.ContainerComponents;
22 import com.jdon.container.config.ContainerComponentsXmlLoader;
23 import com.jdon.container.config.aspect.AopInterceptorsXmlLoader;
24 import com.jdon.container.pico.PicoContainerWrapper;
25 import com.jdon.controller.config.XmlParser;
26 import com.jdon.util.Debug;
27
28 /**
29  * Factory that creating the container and its basic components
30  *
31  * @author <a HREF="mailto:banqiao@jdon.com">banq</a>
32  *
33  */

34 public class ContainerFactory {
35     public final static String JavaDoc module = ContainerFactory.class.getName();
36     
37     public ContainerWrapper create(){
38         return new PicoContainerWrapper();
39     }
40     
41     public ContainerComponents fetchBasicComponents(String JavaDoc configFile){
42             //load container.xml and parse it into BasicComponents
43
XmlParser xmlParser = new ContainerComponentsXmlLoader();
44             Map JavaDoc components = xmlParser.load(configFile);
45         Debug.logVerbose("[JdonFramework] found components in "+ configFile + " size:" + components.size(), module);
46         
47         ContainerComponents configComponents = new ContainerComponents(components);
48         return configComponents;
49     }
50
51     public ContainerComponents fetchAspectComponents(String JavaDoc configFile){
52             //load aspect.xml and parse it into Aspect Components
53
XmlParser xmlParser = new AopInterceptorsXmlLoader();
54             Map JavaDoc components = xmlParser.load(configFile);
55         Debug.logVerbose("[JdonFramework] found aspect components in "+ configFile + " size:" + components.size(), module);
56                 
57         ContainerComponents configComponents = new ContainerComponents(components);
58         return configComponents;
59     }
60     
61     
62 }
63
Popular Tags