org.pentaho.platform.api.engine
Interface IPentahoObjectFactory

All Known Implementing Classes:
AbstractSpringPentahoObjectFactory, StandaloneSpringPentahoObjectFactory, WebSpringPentahoObjectFactory

public interface IPentahoObjectFactory

The way the BI platform creates and manages system objects.

Here is an example of how the API might be used:

1. IPentahoObjectFactory fac = new MyPentahoObjectFactory();
//configure the factory with an object specification file and/or a runtime context object
2. fac.init(objectSpecFile, contextObject) init(String, Object)
3. ISolutionEngine eng = fac.get(ISolutionEngine.class, session) get(Class, IPentahoSession)

You will notice that the this way of serving up objects does not expose an API for scoping of objects. This behavior is delegated to the particular IPentahoObjectFactory implementation, which means a factory implementation has total freedom to be as simple or sophisticated at it wants without being required to handle object scoping. Any kind of object binding/scoping or any other rules for the creation and management of objects is totally up the implementation. Typically, a factory implementation would be made aware of it's rules for object creation by way of a well-known object specification file, see init(String, Object)

Author:
Aaron Phillips

Method Summary
<T> T
get(Class<T> interfaceClass, IPentahoSession session)
          Retrieves an instance of a Pentaho BI Server API interface using the simple interface name (interfaceClass name without the package) as the object key.
<T> T
get(Class<T> interfaceClass, String key, IPentahoSession session)
          Retrieves an instance of a Pentaho BI Server API interface by the given object key.
 Class getImplementingClass(String key)
          Provides the concrete Class defined for the given object key.
 Object getObject(String key, IPentahoSession session)
          Deprecated.  
 void init(String configFile, Object context)
          Initialize the factory with optional configuration file and runtime context.
 boolean objectDefined(String key)
          Checks if the implementation for the given interface is defined.
 

Method Detail

get

<T> T get(Class<T> interfaceClass,
          IPentahoSession session)
      throws ObjectFactoryException
Retrieves an instance of a Pentaho BI Server API interface using the simple interface name (interfaceClass name without the package) as the object key. If an appropriate implementation does not exist the factory implementation should create it.

Parameters:
interfaceClass - the type of object to retrieve (retrieved object will be returned as this type)
session - the Pentaho session object. Can be used to associate an object instance to a Pentaho session. Value will be null if request to getObject does not originate in a session context.
Returns:
the implementation object typed to interfaceClass
Throws:
ObjectFactoryException - if the object cannot be retrieved

get

<T> T get(Class<T> interfaceClass,
          String key,
          IPentahoSession session)
      throws ObjectFactoryException
Retrieves an instance of a Pentaho BI Server API interface by the given object key. If an appropriate implementation does not exist the factory implementation should create it.

Parameters:
interfaceClass - the type of object to retrieve (retrieved object will be returned as this type)
key - the object identifier, typically the interface name
session - the Pentaho session object. Can be used to associate an object instance to a Pentaho session. Value will be null if request to getObject does not originate in a session context.
Returns:
the implementation object typed to interfaceClass
Throws:
ObjectFactoryException - if the object cannot be retrieved

getObject

Object getObject(String key,
                 IPentahoSession session)
                 throws ObjectFactoryException
Deprecated. 

Deprecated. Please use get(Class, IPentahoSession) or get(Class, String, IPentahoSession)

Throws:
ObjectFactoryException

objectDefined

boolean objectDefined(String key)
Checks if the implementation for the given interface is defined.

Parameters:
key - the object identifier, typically the interface name
Returns:
true if the object is defined

getImplementingClass

Class getImplementingClass(String key)
Provides the concrete Class defined for the given object key.

Parameters:
key - the object identifier, typically the interface name
Returns:
the type of object associated with key

init

void init(String configFile,
          Object context)
Initialize the factory with optional configuration file and runtime context.

Parameters:
configFile - an object configuration definition file understandable by the factory implementation
context - a context object whereby the factory implementation can access runtime information, type of object varies depending on the framework used by the factory and the environment in which the application is running.