01: // Copyright 2007 The Apache Software Foundation
02: //
03: // Licensed under the Apache License, Version 2.0 (the "License");
04: // you may not use this file except in compliance with the License.
05: // You may obtain a copy of the License at
06: //
07: // http://www.apache.org/licenses/LICENSE-2.0
08: //
09: // 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: package org.apache.tapestry.internal;
16:
17: import java.util.Collections;
18: import java.util.Set;
19:
20: import org.apache.tapestry.ioc.def.ContributionDef;
21: import org.apache.tapestry.ioc.def.DecoratorDef;
22: import org.apache.tapestry.ioc.def.ModuleDef;
23: import org.apache.tapestry.ioc.def.ServiceDef;
24: import org.apache.tapestry.ioc.internal.util.CollectionFactory;
25:
26: /**
27: * A synthetic module definition, used to mix in some additional "pre-built" service configuration
28: * contributions.
29: */
30: public class SyntheticModuleDef implements ModuleDef {
31: private final Set<ContributionDef> _contributionDefs;
32:
33: public SyntheticModuleDef(ContributionDef... contributionDefs) {
34: _contributionDefs = CollectionFactory.newSet(contributionDefs);
35: }
36:
37: /** Returns null. */
38: public Class getBuilderClass() {
39: return null;
40: }
41:
42: /** Returns the configured set. */
43: public Set<ContributionDef> getContributionDefs() {
44: return _contributionDefs;
45: }
46:
47: /** Returns an empty set. */
48: public Set<DecoratorDef> getDecoratorDefs() {
49: return Collections.emptySet();
50: }
51:
52: /** Returns "SyntheticModule". */
53: public String getLogName() {
54: return "SyntheticModule";
55: }
56:
57: /** Returns null. */
58: public ServiceDef getServiceDef(String serviceId) {
59: return null;
60: }
61:
62: /** Returns an empty set. */
63: public Set<String> getServiceIds() {
64: return Collections.emptySet();
65: }
66: }
|