|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.pentaho.platform.engine.core.system.objfac.AbstractSpringPentahoObjectFactory
public abstract class AbstractSpringPentahoObjectFactory
Framework for Spring-based object factories. Subclasses are required only to implement
the init method, which is responsible for setting the ApplicationContext
.
A note on creation and management of objects:
Object creation and scoping is handled by Spring with one exception: in the case of
a StandaloneSession
. Spring's session scope relates a bean to an HttpSession
,
and as such it does not know about custom sessions. The correct approach to solve this problem
is to write a custom Spring scope (called something like "pentahosession"). Unfortunately, we
cannot implement a custom scope to handle the StandaloneSession
because the custom scope
would not be able to access it. There is currently no way to statically obtain a reference to a
pentaho session. So we are left with using custom logic in this factory to execute a different non-Spring logic path
when the IPentahoSession is of type StandaloneSession.
TODO (BISERVER-2380) remove the custom logic in retreiveObject(String, IPentahoSession)
and use
a custom Spring scope to handle any session types that Spring does not handle out-of-the-box,
such as StandaloneSession
. In order to do this, we need a way to access the
current IPentahoSession
from a static context (perhaps a ThreadLocal).
IPentahoObjectFactory
Constructor Summary | |
---|---|
AbstractSpringPentahoObjectFactory()
|
Method Summary | ||
---|---|---|
|
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. |
|
|
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. |
|
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 |
Methods inherited from interface org.pentaho.platform.api.engine.IPentahoObjectFactory |
---|
init |
Constructor Detail |
---|
public AbstractSpringPentahoObjectFactory()
Method Detail |
---|
public <T> T get(Class<T> interfaceClass, IPentahoSession session) throws ObjectFactoryException
IPentahoObjectFactory
get
in interface IPentahoObjectFactory
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.
ObjectFactoryException
- if the object cannot be retrievedIPentahoObjectFactory.get(Class, IPentahoSession)
public <T> T get(Class<T> interfaceClass, String key, IPentahoSession session) throws ObjectFactoryException
IPentahoObjectFactory
get
in interface IPentahoObjectFactory
interfaceClass
- the type of object to retrieve (retrieved object will be
returned as this type)key
- the object identifier, typically the interface namesession
- 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.
ObjectFactoryException
- if the object cannot be retrievedIPentahoObjectFactory.get(Class, String, IPentahoSession)
public Object getObject(String key, IPentahoSession session) throws ObjectFactoryException
IPentahoObjectFactory
IPentahoObjectFactory.get(Class, IPentahoSession)
or IPentahoObjectFactory.get(Class, String, IPentahoSession)
getObject
in interface IPentahoObjectFactory
ObjectFactoryException
IPentahoObjectFactory.getObject(String, IPentahoSession)
public boolean objectDefined(String key)
IPentahoObjectFactory
objectDefined
in interface IPentahoObjectFactory
key
- the object identifier, typically the interface name
IPentahoObjectFactory.objectDefined(String)
public Class getImplementingClass(String key)
IPentahoObjectFactory
getImplementingClass
in interface IPentahoObjectFactory
key
- the object identifier, typically the interface name
IPentahoObjectFactory.getImplementingClass(String)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |