View Javadoc
1   /**
2    * Copyright 2005-2016 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.data.provider;
17  
18  import java.util.List;
19  
20  /**
21   * Registry of KRAD Data Providers.
22   *
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public interface ProviderRegistry {
26  
27      /**
28       * Register a Provider.
29       *
30       * @param provider the provider to register
31       */
32      void registerProvider(Provider provider);
33  
34      /**
35       * Unregister a Provider if it exists.
36       *
37       * @param provider the provider to unregister
38       *
39       * @return true if provider was unregistered
40       */
41      boolean unregisterProvider(Provider provider);
42  
43      /**
44       * Obtain list of all registered providers.
45       *
46       * @return non-null and immutable list of all registered providers
47       */
48      List<Provider> getProviders();
49  
50      /**
51       * Obtain list of all registered providers of a given type.
52       *
53       * @param providerType the provider type
54       *
55       * @return non-null and immutable list of all registered providers of a given type
56       */
57      List<Provider> getProvidersForType(Class<? extends Provider> providerType);
58  
59      /**
60       * Obtain list of all registered MetadataProviders
61       *
62       * @return non-null and immutable list of all registered MetadataProviders
63       */
64      List<MetadataProvider> getMetadataProviders();
65  
66      /**
67  	 * Obtain the first MetadataProvider which handles the gives type.
68       *
69       * @return the MetadataProvider which handles the given type, or null if none could be found
70  	 */
71  	MetadataProvider getMetadataProvider(Class<?> type);
72  
73      /**
74       * Return the persistence provider for a given type.
75       *
76       * @param type the data object type
77       *
78       * @return persistence provider for given type, or null if no matching provider is registered
79       */
80      PersistenceProvider getPersistenceProvider(Class<?> type);
81  
82  }