001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.kuali.rice.krad.data.provider;
017    
018    import java.util.List;
019    
020    /**
021     * Registry of KRAD Data Providers.
022     *
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public interface ProviderRegistry {
026    
027        /**
028         * Register a Provider.
029         *
030         * @param provider the provider to register
031         */
032        void registerProvider(Provider provider);
033    
034        /**
035         * Unregister a Provider if it exists.
036         *
037         * @param provider the provider to unregister
038         *
039         * @return true if provider was unregistered
040         */
041        boolean unregisterProvider(Provider provider);
042    
043        /**
044         * Obtain list of all registered providers.
045         *
046         * @return non-null and immutable list of all registered providers
047         */
048        List<Provider> getProviders();
049    
050        /**
051         * Obtain list of all registered providers of a given type.
052         *
053         * @param providerType the provider type
054         *
055         * @return non-null and immutable list of all registered providers of a given type
056         */
057        List<Provider> getProvidersForType(Class<? extends Provider> providerType);
058    
059        /**
060         * Obtain list of all registered MetadataProviders
061         *
062         * @return non-null and immutable list of all registered MetadataProviders
063         */
064        List<MetadataProvider> getMetadataProviders();
065    
066        /**
067             * Obtain the first MetadataProvider which handles the gives type.
068         *
069         * @return the MetadataProvider which handles the given type, or null if none could be found
070             */
071            MetadataProvider getMetadataProvider(Class<?> type);
072    
073        /**
074         * Return the persistence provider for a given type.
075         *
076         * @param type the data object type
077         *
078         * @return persistence provider for given type, or null if no matching provider is registered
079         */
080        PersistenceProvider getPersistenceProvider(Class<?> type);
081    
082    }