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 org.apache.tapestry.ioc.Configuration;
18: import org.apache.tapestry.ioc.MappedConfiguration;
19: import org.apache.tapestry.ioc.ModuleBuilderSource;
20: import org.apache.tapestry.ioc.ObjectLocator;
21: import org.apache.tapestry.ioc.OrderedConfiguration;
22: import org.apache.tapestry.ioc.def.ContributionDef;
23: import org.apache.tapestry.ioc.services.SymbolProvider;
24:
25: /** Makes a contribution to the SymbolSource service configuration. */
26: public class SyntheticSymbolSourceContributionDef implements
27: ContributionDef {
28: private final String _contributionName;
29:
30: private final SymbolProvider _provider;
31:
32: private final String[] _constraints;
33:
34: public SyntheticSymbolSourceContributionDef(
35: String contributionName, SymbolProvider provider,
36: String... constraints) {
37: _contributionName = contributionName;
38: _provider = provider;
39: _constraints = constraints;
40: }
41:
42: public void contribute(ModuleBuilderSource moduleBuilderSource,
43: ObjectLocator locator, Configuration configuration) {
44: }
45:
46: @SuppressWarnings("unchecked")
47: public void contribute(ModuleBuilderSource moduleBuilderSource,
48: ObjectLocator locator, OrderedConfiguration configuration) {
49: configuration.add(_contributionName, _provider, _constraints);
50: }
51:
52: public void contribute(ModuleBuilderSource moduleBuilderSource,
53: ObjectLocator locator, MappedConfiguration configuration) {
54: }
55:
56: /** Returns "SymbolSource". */
57: public String getServiceId() {
58: return "SymbolSource";
59: }
60:
61: }
|