001/* 002 * Copyright 2012 Anyware Services 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.ametys.runtime.plugin; 017 018import java.util.Set; 019 020import org.apache.avalon.framework.configuration.Configuration; 021import org.apache.avalon.framework.configuration.ConfigurationException; 022 023/** 024 * Superclass of all known extension points. <br> 025 * <br> 026 * This class contains all required methods to build an extension point :<br> 027 * <ul> 028 * <li>configure(Configuration) to configure the extension point itself 029 * <li>configureExtension(Configure) to add an extension to this point 030 * </ul> 031 * @param <T> the type of the managed extensions 032 */ 033public interface ExtensionPoint<T> 034{ 035 /** 036 * Add an extension to this point. Each implementation knows the meaning of 037 * the given configuration. 038 * @param id the unique identifier of the extension. 039 * @param pluginName Unique identifier for the plugin hosting the extension 040 * @param featureName Unique feature identifier (unique for a given pluginName) 041 * @param configuration the information about the extension to be added 042 * @throws ConfigurationException when a configuration problem occurs 043 */ 044 public void addExtension(String id, String pluginName, String featureName, Configuration configuration) throws ConfigurationException; 045 046 /** 047 * Finalize the initialization of the extensions.<br> 048 * This method is called after all <code>addExtension()</code> calls.<br> 049 * This is the last step before the actual startup of the application. 050 * @throws Exception if something wrong occurs 051 */ 052 public void initializeExtensions() throws Exception; 053 054 /** 055 * Returns true if the named extension exists 056 * @param id the unique id of the extension 057 * @return true if the named extension exists 058 */ 059 public boolean hasExtension(String id); 060 061 /** 062 * Returns the named extension 063 * @param id the unique id of the extension 064 * @return the named extension 065 */ 066 public T getExtension(String id); 067 068 /** 069 * Returns a Set containing the ids of all known extensions 070 * @return a Set containing the ids of all known extensions 071 */ 072 public Set<String> getExtensionsIds(); 073}