org.pentaho.platform.engine.core.system.objfac
Class StandaloneObjectFactory

java.lang.Object
  extended by org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory
All Implemented Interfaces:
IPentahoDefinableObjectFactory, IPentahoObjectFactory

public class StandaloneObjectFactory
extends Object
implements IPentahoDefinableObjectFactory


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.pentaho.platform.api.engine.IPentahoDefinableObjectFactory
IPentahoDefinableObjectFactory.Scope
 
Constructor Summary
StandaloneObjectFactory()
           
 
Method Summary
 void defineObject(String key, String className, IPentahoDefinableObjectFactory.Scope scope)
          Defines a new object.
 void defineObject(String key, String className, IPentahoDefinableObjectFactory.Scope scope, ClassLoader loader)
          Defines a new object that must be loaded with a specific classloader
<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.
 void init(String arg0, Object arg1)
          Initialize the factory with optional configuration file and runtime context.
 boolean objectDefined(String key)
          Checks if the implementation for the given interface is defined.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandaloneObjectFactory

public StandaloneObjectFactory()
Method Detail

get

public <T> T get(Class<T> interfaceClass,
                 IPentahoSession session)
      throws ObjectFactoryException
Description copied from interface: IPentahoObjectFactory
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.

Specified by:
get in interface IPentahoObjectFactory
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

public <T> T get(Class<T> interfaceClass,
                 String key,
                 IPentahoSession session)
      throws ObjectFactoryException
Description copied from interface: IPentahoObjectFactory
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.

Specified by:
get in interface IPentahoObjectFactory
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

getImplementingClass

public Class getImplementingClass(String key)
Description copied from interface: IPentahoObjectFactory
Provides the concrete Class defined for the given object key.

Specified by:
getImplementingClass in interface IPentahoObjectFactory
Parameters:
key - the object identifier, typically the interface name
Returns:
the type of object associated with key

init

public void init(String arg0,
                 Object arg1)
Description copied from interface: IPentahoObjectFactory
Initialize the factory with optional configuration file and runtime context. Calling this method should also reset any state the factory may be holding, such as object definitions.

Specified by:
init in interface IPentahoObjectFactory
Parameters:
arg0 - an object configuration definition file understandable by the factory implementation
arg1 - 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.

objectDefined

public boolean objectDefined(String key)
Description copied from interface: IPentahoObjectFactory
Checks if the implementation for the given interface is defined.

Specified by:
objectDefined in interface IPentahoObjectFactory
Parameters:
key - the object identifier, typically the interface name
Returns:
true if the object is defined

defineObject

public void defineObject(String key,
                         String className,
                         IPentahoDefinableObjectFactory.Scope scope)
Description copied from interface: IPentahoDefinableObjectFactory
Defines a new object.

Specified by:
defineObject in interface IPentahoDefinableObjectFactory
Parameters:
key - - typically the interface name
className - - the name of the class to instatiate
scope - - the scope of the object

defineObject

public void defineObject(String key,
                         String className,
                         IPentahoDefinableObjectFactory.Scope scope,
                         ClassLoader loader)
Description copied from interface: IPentahoDefinableObjectFactory
Defines a new object that must be loaded with a specific classloader

Specified by:
defineObject in interface IPentahoDefinableObjectFactory
Parameters:
key - - typically the interface name
className - - the name of the class to instatiate
scope - - the scope of the object
loader - - the loader to be used to create the class