1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.tuigwaa.cms.core;
17
18 import org.apache.commons.logging.Log;
19 import org.apache.commons.logging.LogFactory;
20 import org.seasar.tuigwaa.cms.core.wiki.base.WikiConfiguration;
21 import org.seasar.tuigwaa.cms.core.wiki.base.WikiConfigurationFactory;
22 import org.seasar.tuigwaa.cms.core.wiki.base.WikiException;
23 import org.seasar.tuigwaa.plugin.Plugin;
24
25
26 public class CmsContainer {
27
28 private static WikiConfiguration wikiconfig_;
29
30 private static Log log_ = LogFactory.getLog(CmsContainer.class);
31
32 static {
33 try {
34 WikiConfigurationFactory factory = WikiConfigurationFactory
35 .getInstance();
36 wikiconfig_ = factory.createConfiguration();
37 } catch (WikiException we) {
38 log_.error("wiki configuration is invalid.");
39 log_.error("all wiki related data cannot be processed.");
40 throw new RuntimeException(we);
41 }
42 }
43
44 public static CmsContainer INSTANCE = new CmsContainer();
45
46 private CmsContainer() {
47 }
48
49 public WikiConfiguration getConfiguration() {
50 return wikiconfig_;
51 }
52
53 public Plugin getPlugin(String pluginName){
54 return wikiconfig_.getPlugin(pluginName);
55 }
56
57 public void service(CmsRequest request, CmsResponse resonse){
58 String contentType = request.getPage().getResource().getContentType();
59 CmsEngine engine = wikiconfig_.getEngine(contentType);
60 engine.service(request, resonse);
61 }
62 }