ComponentLocator ties together several different concepts. First, it deals with how a system should be put together. It manages different types of components: - Manager: Singleton implementation of a certain process. - Adapter: Different singleton implementations for the same functions. - SystemIntegrityChecker: Singletons that are called at the load time. - Dao: Data Access Objects. These components can be declared in several ways: - ComponentLibrary - A Java class that declares the above components. The advantage of declaring components here is they change automatically with any refactoring. - components specification - An xml file that overrides the ComponentLibrary. The advantage of declaring components here is they can change by hand on every deployment. The two are NOT mutually exclusive. ComponentLocator basically locates the components specification, which specifies the ComponentLibrary within. Components found in the ComponentLibrary are overridden by components found in components specification. Components specification can also be nested. One components specification can point to another components specification and, therefore, "inherits" those components but still override one or more components. ComponentLocator reads the child components specification first and follow the chain up. the child's components overrides the ones in the parent. ComponentLocator looks for the components specification as follows: 1. By following the path specified by "cloud-stack-components-specification" within the environment.properties file. 2. Look for components.xml in the class path. ComponentLocator also ties in component injection. Components can specify an @Inject annotation to components ComponentLocator knows. When instantiating components, ComponentLocator attempts to inject these components.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.