1 // Copyright 2007 The Apache Software Foundation 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // 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.hivemind.definition; 16 17 import java.util.Collection; 18 import java.util.List; 19 20 import org.apache.hivemind.ApplicationRuntimeException; 21 import org.apache.hivemind.events.RegistryInitializationListener; 22 import org.apache.hivemind.impl.RegistryBuilder; 23 24 /** 25 * Defines all modules and their service and configuration points 26 * which build a registry. The definition is a blueprint from which 27 * a registry instance is constructed. 28 * 29 * The definition is passed to {@link RegistryBuilder} for the next phase: 30 * the registry construction. 31 * From that moment on the definition shouldn't be changed any longer. 32 * 33 * @author Achim Huegen 34 */ 35 public interface RegistryDefinition 36 { 37 38 /** 39 * Adds a module definition. 40 * @param module the module 41 * @throws ApplicationRuntimeException if another module with the same id already exists. 42 */ 43 public void addModule(ModuleDefinition module) throws ApplicationRuntimeException; 44 45 /** 46 * @return a collection of all added {@link ModuleDefinition modules} 47 */ 48 public Collection getModules(); 49 50 /** 51 * Returns a module that is identified by its module id. 52 * @param id the module id 53 * @return the module 54 */ 55 public ModuleDefinition getModule(String id); 56 57 /** 58 * Adds a {@link RegistryDefinitionPostProcessor}. The processor is called after all 59 * module definitions have been processed. 60 * @param postProcessor the processor 61 */ 62 public void addPostProcessor(RegistryDefinitionPostProcessor postProcessor); 63 64 /** 65 * @return a collection of all registered {@link RegistryDefinitionPostProcessor}s 66 */ 67 public List getPostProcessors(); 68 69 /** 70 * Adds a {@link RegistryInitializationListener} which is called after the 71 * construction of the registry. 72 * @param listener the listener 73 */ 74 public void addRegistryInitializationListener(RegistryInitializationListener listener); 75 76 /** 77 * @return a collection of all registered {@link RegistryInitializationListener}s 78 */ 79 public List getRegistryInitializationListeners(); 80 81 /** 82 * Returns a service point that is identified by its id. 83 * @param qualifiedServicePointId the fully qualified service point id 84 * @return the service point definition 85 */ 86 public ServicePointDefinition getServicePoint(String qualifiedServicePointId); 87 88 /** 89 * Returns a configuration point that is identified by its id. 90 * @param qualifiedConfigurationPointId the fully qualified configuration point id 91 * @return the configuration point definition 92 */ 93 public ConfigurationPointDefinition getConfigurationPoint(String qualifiedConfigurationPointId); 94 95 }