1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.seasar.cubby.controller.impl;
17
18 import org.seasar.cubby.action.FormatPattern;
19 import org.seasar.cubby.action.impl.FormatPatternImpl;
20 import org.seasar.cubby.controller.CubbyConfiguration;
21 import org.seasar.framework.container.ComponentDef;
22 import org.seasar.framework.container.S2Container;
23 import org.seasar.framework.log.Logger;
24
25
26
27
28
29
30
31 public class CubbyConfigurationImpl implements CubbyConfiguration {
32
33
34 private static final Logger logger = Logger
35 .getLogger(CubbyConfiguration.class);
36
37
38 private final FormatPattern formatPattern;
39
40
41
42
43 public FormatPattern getFormatPattern() {
44 return formatPattern;
45 }
46
47
48
49
50
51
52
53
54
55
56 public CubbyConfigurationImpl(final S2Container container) {
57 final S2Container root = container.getRoot();
58
59 if (root.hasComponentDef(FormatPattern.class)) {
60 final ComponentDef componentDef = root
61 .getComponentDef(FormatPattern.class);
62 this.formatPattern = (FormatPattern) componentDef.getComponent();
63 if (logger.isDebugEnabled()) {
64 logger.log("DCUB0009", new Object[] { FormatPattern.class,
65 this.formatPattern });
66 }
67 } else {
68 this.formatPattern = new FormatPatternImpl();
69 if (logger.isDebugEnabled()) {
70 logger.log("DCUB0008", new Object[] { FormatPattern.class,
71 this.formatPattern });
72 }
73 }
74
75 }
76
77 }