001    // Copyright 2007 The Apache Software Foundation
002    //
003    // Licensed under the Apache License, Version 2.0 (the "License");
004    // you may not use this file except in compliance with the License.
005    // You may obtain a copy of the License at
006    //
007    //     http://www.apache.org/licenses/LICENSE-2.0
008    //
009    // Unless required by applicable law or agreed to in writing, software
010    // distributed under the License is distributed on an "AS IS" BASIS,
011    // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012    // See the License for the specific language governing permissions and
013    // limitations under the License.
014    
015    package org.apache.hivemind.definition;
016    
017    import org.apache.hivemind.internal.Module;
018    import org.apache.hivemind.internal.RegistryInfrastructure;
019    
020    /**
021     * Interface that provides access to information and services needed
022     * during the construction of an {@link ExtensionDefinition extension}
023     * or {@link ExtensionPointDefinition extension point}.
024     * 
025     * @author Achim Huegen
026     */
027    public interface ConstructionContext
028    {
029        /**
030         * @return  the module that defined the constructor that is constructed now.
031         */
032        public Module getDefiningModule();
033        
034        /**
035         * @see Module#getService(String, Class)
036         */
037        public Object getService(String serviceId, Class serviceInterface);
038        
039        /**
040         * @see Module#getService(Class)
041         */
042        public Object getService(Class serviceInterface);
043        
044        /**
045         * @see Module#containsService(Class)
046         */
047        public boolean containsService(Class serviceInterface);
048    
049        /**
050         * @see Module#getConfiguration(String)
051         */
052        public Object getConfiguration(String configurationId);
053        
054        /**
055         * Returns a reference to the {@link RegistryInfrastructure}. 
056         * This allows access to services and configurations without the visibility checks
057         * performed by the other getter methods. 
058         * 
059         * @return  the registry 
060         */
061        public RegistryInfrastructure getRegistry();
062    }