All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.tapestry.ioc.internal.InternalRegistry Maven / Gradle / Ivy

// Copyright 2006, 2007 The Apache Software Foundation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package org.apache.tapestry.ioc.internal;

import org.apache.tapestry.ioc.Registry;
import org.apache.tapestry.ioc.ServiceDecorator;
import org.apache.tapestry.ioc.ServiceLifecycle;
import org.apache.tapestry.ioc.def.ServiceDef;
import org.apache.tapestry.ioc.services.ClassFab;
import org.apache.tapestry.ioc.services.RegistryShutdownHub;
import org.slf4j.Logger;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * Internal view of the module registry, adding additional methods needed by modules.
 */
public interface InternalRegistry extends Registry, RegistryShutdownHub
{
    /**
     * Returns a service lifecycle by service scope name.
     *
     * @param scope the name of the service scope (case insensitive)
     * @return the lifecycle corresponding to the scope
     * @throws RuntimeException if the lifecycle name does not match a known lifecycle
     */
    ServiceLifecycle getServiceLifecycle(String scope);

    /**
     * Searches for decorators for a particular service. The resulting
     * {@link org.apache.tapestry.ioc.def.DecoratorDef}s are ordered, then converted into
     * {@link ServiceDecorator}s.
     */
    List findDecoratorsForService(ServiceDef serviceDef);

    /**
     * Builds up an unordered collection by invoking service contributor methods that target the
     * service (from any module, unless the service is private).
     *
     * @param 
     * @param serviceDef defines the service for which configuration data is being assembled
     * @param valueType  identifies the type of object allowed into the collection
     * @return the final collection
     */
     Collection getUnorderedConfiguration(ServiceDef serviceDef, Class valueType);

    /**
     * Builds up an ordered collection by invoking service contributor methods that target the
     * service (from any module, unless the service is private). Once all values have been added
     * (each with an id, and pre/post constraints), the values are ordered, null values dropped, and
     * the final sorted list is returned.
     *
     * @param 
     * @param serviceDef defines the service for which configuration data is being assembled
     * @param valueType  identifies the type of object allowed into the collection
     * @return the final ordered list
     */
     List getOrderedConfiguration(ServiceDef serviceDef, Class valueType);

    /**
     * Builds up a map of key/value pairs by invoking service contribution methods that tharget the
     * service (from any module, unless the service is private). Values and keys may not be null.
     * Invalid values (keys or values that are the wrong type, or duplicate keys) result in warnings
     * and are ignored.
     *
     * @param 
     * @param serviceDef defines the service for which configuration data is being assembled
     * @param keyType    identifies the type of key object allowed into the map
     * @param valueType  identifies the type of value object allowed into the map
     * @return the final ordered list
     */
     Map getMappedConfiguration(ServiceDef serviceDef, Class keyType,
                                            Class valueType);

    /**
     * Convieience for creating a new {@link ClassFab} instance using a
     * {@link org.apache.tapestry.ioc.services.ClassFactory}.
     *
     * @param serviceInterface the interface to be implemented by the provided class
     */
    ClassFab newClass(Class serviceInterface);

    /**
     * Given an input string that may contain symbols, returns the string with any and
     * all symbols fully expanded.
     *
     * @param input
     * @return expanded input
     */
    String expandSymbols(String input);

    /**
     * Returns a logger for the service, which consists of the Module's
     * {@link Module#getLoggerName() log name} suffixed with a period and the service id.
     *
     * @param serviceId
     * @return the logger for the service
     */
    Logger getServiceLogger(String serviceId);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy