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.ObjectCreator;
18: import org.apache.tapestry.ioc.ServiceBuilderResources;
19:
20: /**
21: * Service definition derived, by default, from a service builder method.
22: */
23: public interface ServiceDef {
24: /**
25: * Returns an {@link ObjectCreator} that can create the core service implementation.
26: *
27: * @param resources
28: * used to resolve dependencies of the service, or access its configuration
29: * @return an object that can (later) be used to instantiate the service itself
30: */
31: ObjectCreator createServiceCreator(ServiceBuilderResources resources);
32:
33: /** Returns the service id, derived from the method name. */
34: String getServiceId();
35:
36: /**
37: * Returns the service interface associated with this service. This is the interface exposed to
38: * the outside world, as well as the one used to build proxies. In cases where the service is
39: * <em>not</em> defined in terms of an interface, this will return the actual implementation
40: * class of the service. Services without a true service interfaced are <strong>not proxied</strong>.
41: */
42: Class getServiceInterface();
43:
44: /**
45: * Returns the lifecycle defined for the service. This is indicated by adding a
46: * {@link org.apache.tapestry.ioc.annotations.Scope} annotation to the service builder method
47: * for the service.
48: * <p>
49: * Services that are not proxied will ignore thier scope; such services are always treated as
50: * singletons.
51: */
52: String getServiceScope();
53:
54: /**
55: * Returns true if the service should be eagerly loaded at Registry startup.
56: *
57: * @see org.apache.tapestry.ioc.annotations.EagerLoad
58: */
59: boolean isEagerLoad();
60: }
|