Class AbstractSpringPentahoObjectFactory
- java.lang.Object
-
- org.pentaho.platform.engine.core.system.objfac.AbstractSpringPentahoObjectFactory
-
- All Implemented Interfaces:
org.pentaho.platform.api.engine.IPentahoObjectFactory
- Direct Known Subclasses:
StandaloneSpringPentahoObjectFactory
public abstract class AbstractSpringPentahoObjectFactory extends Object implements org.pentaho.platform.api.engine.IPentahoObjectFactory
Framework for Spring-based object factories. Subclasses are required only to implement the init method, which is responsible for setting theApplicationContext
. A note on creation and management of objects: Object creation and scoping is handled by Spring with one exception: in the case of aStandaloneSession
. Spring's session scope relates a bean to an javax.servlet.http.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 theStandaloneSession
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.- Author:
- Aaron Phillips
- See Also:
IPentahoObjectFactory
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
AbstractSpringPentahoObjectFactory.BeanDefinitionNamePair
Struct class used internally to maintain a mapping between bean name and definitionprotected class
AbstractSpringPentahoObjectFactory.BeanDefinitionPriorityComparitor
Used to order the lists of implementations based on their priority
-
Field Summary
Fields Modifier and Type Field Description protected org.springframework.context.ConfigurableApplicationContext
beanFactory
protected static org.apache.commons.logging.Log
logger
protected static String
PRIORITY
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSpringPentahoObjectFactory()
protected
AbstractSpringPentahoObjectFactory(String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
<T> T
get(Class<T> interfaceClass, String key, org.pentaho.platform.api.engine.IPentahoSession session)
<T> T
get(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession session)
<T> T
get(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession session, Map<String,String> props)
<T> List<T>
getAll(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession)
<T> List<T>
getAll(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties)
Class
getImplementingClass(String key)
String
getName()
<T> org.pentaho.platform.api.engine.IPentahoObjectReference<T>
getObjectReference(Class<T> clazz, org.pentaho.platform.api.engine.IPentahoSession curSession)
<T> org.pentaho.platform.api.engine.IPentahoObjectReference<T>
getObjectReference(Class<T> clazz, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties)
<T> List<org.pentaho.platform.api.engine.IPentahoObjectReference<T>>
getObjectReferences(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession)
<T> List<org.pentaho.platform.api.engine.IPentahoObjectReference<T>>
getObjectReferences(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties)
int
hashCode()
protected Object
instanceClass(Class<?> interfaceClass, String key)
protected Object
instanceClass(String simpleName)
protected Object
instanceClass(String simpleName, String key)
boolean
objectDefined(Class<?> clazz)
boolean
objectDefined(String key)
protected <T> List<T>
retreiveObjects(Class<T> type, org.pentaho.platform.api.engine.IPentahoSession session, Map<String,String> properties)
protected Object
retrieveViaSpring(String beanId)
protected void
setBeanFactory(org.springframework.context.ConfigurableApplicationContext context)
-
-
-
Field Detail
-
beanFactory
protected org.springframework.context.ConfigurableApplicationContext beanFactory
-
logger
protected static final org.apache.commons.logging.Log logger
-
PRIORITY
protected static final String PRIORITY
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractSpringPentahoObjectFactory
protected AbstractSpringPentahoObjectFactory()
-
AbstractSpringPentahoObjectFactory
protected AbstractSpringPentahoObjectFactory(String name)
-
-
Method Detail
-
get
public <T> T get(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession session) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
get
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
- See Also:
IPentahoObjectFactory.get(Class, IPentahoSession)
-
get
public <T> T get(Class<T> interfaceClass, String key, org.pentaho.platform.api.engine.IPentahoSession session) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
get
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
- See Also:
IPentahoObjectFactory.get(Class, String, IPentahoSession)
-
get
public <T> T get(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession session, Map<String,String> props) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
get
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getAll
public <T> List<T> getAll(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getAll
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getAll
public <T> List<T> getAll(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getAll
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
instanceClass
protected Object instanceClass(String simpleName) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
instanceClass
protected Object instanceClass(String simpleName, String key) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
instanceClass
protected Object instanceClass(Class<?> interfaceClass, String key) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
retrieveViaSpring
protected Object retrieveViaSpring(String beanId) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
retreiveObjects
protected <T> List<T> retreiveObjects(Class<T> type, org.pentaho.platform.api.engine.IPentahoSession session, Map<String,String> properties) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
objectDefined
public boolean objectDefined(String key)
- Specified by:
objectDefined
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- See Also:
IPentahoObjectFactory.objectDefined(String)
-
objectDefined
public boolean objectDefined(Class<?> clazz)
- Specified by:
objectDefined
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Parameters:
clazz
- Interface or class literal to search for- Returns:
- true if a definition exists
-
getImplementingClass
public Class getImplementingClass(String key)
- Specified by:
getImplementingClass
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- See Also:
IPentahoObjectFactory.getImplementingClass(String)
-
setBeanFactory
protected void setBeanFactory(org.springframework.context.ConfigurableApplicationContext context)
-
getObjectReference
public <T> org.pentaho.platform.api.engine.IPentahoObjectReference<T> getObjectReference(Class<T> clazz, org.pentaho.platform.api.engine.IPentahoSession curSession) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getObjectReference
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getObjectReference
public <T> org.pentaho.platform.api.engine.IPentahoObjectReference<T> getObjectReference(Class<T> clazz, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getObjectReference
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getObjectReferences
public <T> List<org.pentaho.platform.api.engine.IPentahoObjectReference<T>> getObjectReferences(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getObjectReferences
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getObjectReferences
public <T> List<org.pentaho.platform.api.engine.IPentahoObjectReference<T>> getObjectReferences(Class<T> interfaceClass, org.pentaho.platform.api.engine.IPentahoSession curSession, Map<String,String> properties) throws org.pentaho.platform.api.engine.ObjectFactoryException
- Specified by:
getObjectReferences
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
- Throws:
org.pentaho.platform.api.engine.ObjectFactoryException
-
getName
public String getName()
- Specified by:
getName
in interfaceorg.pentaho.platform.api.engine.IPentahoObjectFactory
-
-