01: // Copyright 2006, 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.ioc.def;
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.OrderedConfiguration;
21: import org.apache.tapestry.ioc.ObjectLocator;
22:
23: /**
24: * Contribution to a service configuration.
25: * <p>
26: * The toString() method of the ContributionDef will be used for some exception reporting and should
27: * clearly identify where the contribution comes from; the normal behavior is to identify the class
28: * and method of the contribution method.
29: */
30: public interface ContributionDef {
31: /** Identifies the service contributed to. */
32: String getServiceId();
33:
34: /**
35: * Performs the work needed to contribute into the standard, unordered configuration.
36: *
37: * @param moduleBuilderSource
38: * the source, if needed, of the module builder instance associated with the
39: * contribution
40: * @param locator
41: * allows access to services visible to the module builder instance
42: * @param configuration
43: * the unordered configuration into which values should be loaded. This instance will
44: * encapsulate all related error checks (such as passing of nulls or inappropriate
45: * classes).
46: */
47: void contribute(ModuleBuilderSource moduleBuilderSource,
48: ObjectLocator locator, Configuration configuration);
49:
50: /**
51: * Performs the work needed to contribute into the ordered configuration.
52: *
53: * @param moduleBuilderSource
54: * the source, if needed, of the module builder instance associated with the
55: * contribution
56: * @param locator
57: * allows access to services visible to the module builder instance
58: * @param configuration
59: * the ordered configuration into which values should be loaded. This instance will
60: * encapsulate all related error checks (such as passing of nulls or inappropriate
61: * classes).
62: */
63: void contribute(ModuleBuilderSource moduleBuilderSource,
64: ObjectLocator locator, OrderedConfiguration configuration);
65:
66: /**
67: * Performs the work needed to contribute into the mapped configuration.
68: *
69: * @param moduleBuilderSource
70: * the source, if needed, of the module builder instance associated with the
71: * contribution
72: * @param locator
73: * allows access to services visible to the module builder instance
74: * @param configuration
75: * the mapped configuration into which values should be loaded. This instance will
76: * encapsulate all related error checks (such as passing of null keys or values or
77: * inappropriate classes, or duplicate keys).
78: */
79: void contribute(ModuleBuilderSource moduleBuilderSource,
80: ObjectLocator locator, MappedConfiguration configuration);
81: }
|