001: // Copyright 2006, 2007 The Apache Software Foundation
002: //
003: // Licensed under the Apache License, Version 2.0 (the "License");
004: // you may not use this file except in compliance with the License.
005: // You may obtain a copy of the License at
006: //
007: // http://www.apache.org/licenses/LICENSE-2.0
008: //
009: // Unless required by applicable law or agreed to in writing, software
010: // distributed under the License is distributed on an "AS IS" BASIS,
011: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: // See the License for the specific language governing permissions and
013: // limitations under the License.
014:
015: package org.apache.tapestry.ioc.internal;
016:
017: import java.util.Collection;
018: import java.util.List;
019: import java.util.Map;
020:
021: import org.apache.commons.logging.Log;
022: import org.apache.tapestry.ioc.AnnotationProvider;
023: import org.apache.tapestry.ioc.ObjectProvider;
024: import org.apache.tapestry.ioc.Registry;
025: import org.apache.tapestry.ioc.ServiceDecorator;
026: import org.apache.tapestry.ioc.ServiceLifecycle;
027: import org.apache.tapestry.ioc.ObjectLocator;
028: import org.apache.tapestry.ioc.def.ServiceDef;
029: import org.apache.tapestry.ioc.services.ClassFab;
030: import org.apache.tapestry.ioc.services.RegistryShutdownHub;
031:
032: /**
033: * Internal view of the module registry, adding additional methods needed by modules.
034: */
035: public interface InternalRegistry extends Registry, RegistryShutdownHub {
036: /**
037: * Returns a service lifecycle by service scope name.
038: *
039: * @param scope
040: * the name of the service scope (case insensitive)
041: * @return the lifecycle corresponding to the scope
042: * @throws RuntimeException
043: * if the lifecycle name does not match a known lifecycle
044: */
045: ServiceLifecycle getServiceLifecycle(String scope);
046:
047: /**
048: * Searches for decorators for a particular service. The resulting
049: * {@link org.apache.tapestry.ioc.def.DecoratorDef}s are ordered, then converted into
050: * {@link ServiceDecorator}s.
051: */
052: List<ServiceDecorator> findDecoratorsForService(
053: ServiceDef serviceDef);
054:
055: /**
056: * Builds up an unordered collection by invoking service contributor methods that target the
057: * service (from any module, unless the service is private).
058: *
059: * @param <T>
060: * @param serviceDef
061: * defines the service for which configuration data is being assembled
062: * @param valueType
063: * identifies the type of object allowed into the collection
064: * @return the final collection
065: */
066: <T> Collection<T> getUnorderedConfiguration(ServiceDef serviceDef,
067: Class<T> valueType);
068:
069: /**
070: * Builds up an ordered collection by invoking service contributor methods that target the
071: * service (from any module, unless the service is private). Once all values have been added
072: * (each with an id, and pre/post constraints), the values are ordered, null values dropped, and
073: * the final sorted list is returned.
074: *
075: * @param <T>
076: * @param serviceDef
077: * defines the service for which configuration data is being assembled
078: * @param valueType
079: * identifies the type of object allowed into the collection
080: * @return the final ordered list
081: */
082: <T> List<T> getOrderedConfiguration(ServiceDef serviceDef,
083: Class<T> valueType);
084:
085: /**
086: * Builds up a map of key/value pairs by invoking service contribution methods that tharget the
087: * service (from any module, unless the service is private). Values and keys may not be null.
088: * Invalid values (keys or values that are the wrong type, or duplicate keys) result in warnings
089: * and are ignored.
090: *
091: * @param <K,
092: * V>
093: * @param serviceDef
094: * defines the service for which configuration data is being assembled
095: * @param keyType
096: * identifies the type of key object allowed into the map
097: * @param valueType
098: * identifies the type of value object allowed into the map
099: * @return the final ordered list
100: */
101: <K, V> Map<K, V> getMappedConfiguration(ServiceDef serviceDef,
102: Class<K> keyType, Class<V> valueType);
103:
104: /**
105: * Convieience for creating a new {@link ClassFab} instance using a
106: * {@link org.apache.tapestry.ioc.services.ClassFactory}.
107: *
108: * @param serviceInterface
109: * the interface to be implemented by the provided class
110: */
111: ClassFab newClass(Class serviceInterface);
112:
113: /**
114: * Given an input string that <em>may</em> contain symbols, returns the string with any and
115: * all symbols fully expanded.
116: *
117: * @param input
118: * @return expanded input
119: */
120: String expandSymbols(String input);
121:
122: /**
123: * Returns a log for the service, which consists of the Module's
124: * {@link Module#getLogName() log name} suffixed with a period and the service id.
125: *
126: * @param serviceId
127: * @return the log instance for the service
128: */
129: Log logForService(String serviceId);
130: }
|