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 java.util.Collection;
018    
019    import org.apache.hivemind.ApplicationRuntimeException;
020    
021    /**
022     * Defines a service extension point.
023     * The definition includes the service interface, implementations and interceptors.
024     * 
025     * @author Achim Huegen
026     */
027    public interface ServicePointDefinition extends ExtensionPointDefinition
028    {
029        /**
030         * @return  the fully qualified class name of the service interface. 
031         * This may be the name of a ordinary class or an interface.
032         */
033        public String getInterfaceClassName();
034    
035        /**
036         * @return  the default implementation of the service. The default is selected 
037         *   by {@link ImplementationDefinition#isDefault()} if multiple exist.
038         */
039        public ImplementationDefinition getDefaultImplementation();
040    
041        /**
042         * Adds an implementation definition to the service point.
043         * @param implementation  the implementation
044         * @throws ApplicationRuntimeException  if this point is not visible from the module
045         *    that defines the implementation
046         */
047        public void addImplementation(ImplementationDefinition implementation);
048    
049        /**
050         * @return the impelementations of this service point as instances of {@link ImplementationDefinition}
051         */
052        public Collection getImplementations();
053    
054        /**
055         * @return the interceptors of this service point as instances of {@link InterceptorDefinition}
056         */
057        public Collection getInterceptors();
058    
059        /**
060         * Adds an interceptor definition to the service point.
061         * @param interceptor  the interceptor
062         * @throws ApplicationRuntimeException  if this point is not visible from the module 
063         *   that defines the interceptor.
064         */
065        public void addInterceptor(InterceptorDefinition interceptor);
066    
067    }