/* * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright 2006 - 2009 Pentaho Corporation. All rights reserved. * * Created Mar 16, 2009 * @author jdixon */ package org.pentaho.platform.api.engine; /** * This class subclasses IPentahoObjectFactory and adds methods that enables the * implementation to allow objects to be defined through public classes. * The main use case for this is a system where the objects created by the * factory are defined in code via an API. Examples are when the Pentaho system * is fully embedded into an application, and unit tests. * @author jamesdixon * */ public interface IPentahoDefinableObjectFactory extends IPentahoObjectFactory { /** * The different object scopes that are supported * @author jamesdixon * */ public static enum Scope { GLOBAL, SESSION, REQUEST, THREAD, LOCAL }; /** * Defines a new object. * @param key - typically the interface name * @param className - the name of the class to instatiate * @param scope - the scope of the object */ public void defineObject( String key, String className, Scope scope ); /** * Defines a new object that must be loaded with a specific classloader * @param key - typically the interface name * @param className - the name of the class to instatiate * @param scope - the scope of the object * @param loader - the loader to be used to create the class */ public void defineObject( String key, String className, Scope scope, ClassLoader loader ); }