1 /******************************************************************************* 2 * Copyright (c) 2005 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.ui.internal.components.framework; 12 13 /** 14 * An <code>ComponentFactory</code> is used to construct component handles. Most factories 15 * will construct a new component instance each time they are asked for a handle, however 16 * it is also possible for factories to return handles that point to a shared singleton or reference-counted 17 * instance. 18 * 19 * <p> 20 * A "component" is defined here to be "an object created by a ComponentFactory". This 21 * does not refer to a special kind of object, but rather an object created in a specific 22 * way.</p> 23 * 24 * <p>EXPERIMENTAL: The components framework is currently under active development. All 25 * aspects of this class including its existence, name, and public interface are likely 26 * to change during the development of Eclipse 3.1</p> 27 * 28 * @since 3.1 29 */ 30 public abstract class ComponentFactory { 31 /** 32 * Returns a new component handle, given an <code>IServiceProvider</code> 33 * that will contain all of the component's dependencies. If a required 34 * dependency is missing, it will throw a ComponentException. 35 * The caller is responsible for disposing the returned service by calling 36 * handle.dispose() when they are done with it. 37 * 38 * @param availableServices the IContainer that holds all services available 39 * to the newly constructed component (not null). 40 * @return the newly created component (not null) 41 * @throws ComponentException if unable to instatiate the component 42 */ 43 public abstract ComponentHandle createHandle(IServiceProvider availableServices) throws ComponentException; 44 45 } 46