public interface IPentahoObjectFactory
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)
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRIORTIY |
Modifier and Type | Method and Description |
---|---|
<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,
IPentahoSession session,
Map<String,String> properties)
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.
|
<T> List<T> |
getAll(Class<T> interfaceClass,
IPentahoSession curSession)
Returns all objects implementing the provided interface or extending the provided class if the Class is not an
Interface.
|
<T> List<T> |
getAll(Class<T> interfaceClass,
IPentahoSession curSession,
Map<String,String> properties)
Returns all objects implementing the provided interface or extending the provided class if the Class is not an
Interface.
|
Class<?> |
getImplementingClass(String key)
Provides the concrete Class defined for the given object key.
|
String |
getName()
Return the name for this factory.
|
<T> IPentahoObjectReference<T> |
getObjectReference(Class<T> interfaceClass,
IPentahoSession curSession)
Returns an IPentahoObjectReference for the requested Object containing registered Object Properties.
|
<T> IPentahoObjectReference<T> |
getObjectReference(Class<T> interfaceClass,
IPentahoSession curSession,
Map<String,String> properties)
Returns an IPentahoObjectReference for the requested Object containing registered Object Properties.
|
<T> List<IPentahoObjectReference<T>> |
getObjectReferences(Class<T> interfaceClass,
IPentahoSession curSession)
Returns an IPentahoObjectReference for the requested Object containing registered Object Properties.
|
<T> List<IPentahoObjectReference<T>> |
getObjectReferences(Class<T> interfaceClass,
IPentahoSession curSession,
Map<String,String> properties)
Returns an IPentahoObjectReference for the requested Object containing registered Object Properties.
|
void |
init(String configFile,
Object context)
Initialize the factory with optional configuration file and runtime context.
|
boolean |
objectDefined(Class<?> clazz)
Checks if the implementation for the given interface is defined.
|
boolean |
objectDefined(String key)
Checks if the implementation for the given interface is defined.
|
static final int DEFAULT_PRIORTIY
<T> T get(Class<T> interfaceClass, IPentahoSession session) throws ObjectFactoryException
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 retrieved<T> T get(Class<T> interfaceClass, String key, IPentahoSession session) throws ObjectFactoryException
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 retrieved<T> T get(Class<T> interfaceClass, IPentahoSession session, Map<String,String> properties) throws ObjectFactoryException
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.properties
- Map of properties to filter matches in the ObjectFactory byObjectFactoryException
- if the object cannot be retrievedboolean objectDefined(String key)
key
- the object identifier, typically the interface nameboolean objectDefined(Class<?> clazz)
clazz
- Interface or class literal to search forClass<?> getImplementingClass(String key)
key
- the object identifier, typically the interface nameRuntimeException
- of some type indicating a problem loading or finding the implementing classvoid init(String configFile, Object context)
configFile
- an object configuration definition file understandable by the factory implementationcontext
- 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.<T> List<T> getAll(Class<T> interfaceClass, IPentahoSession curSession) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsObjectFactoryException
<T> List<T> getAll(Class<T> interfaceClass, IPentahoSession curSession, Map<String,String> properties) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsproperties
- Map of properties to filter matches in the ObjectFactory byObjectFactoryException
<T> IPentahoObjectReference<T> getObjectReference(Class<T> interfaceClass, IPentahoSession curSession) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsObjectFactoryException
<T> IPentahoObjectReference<T> getObjectReference(Class<T> interfaceClass, IPentahoSession curSession, Map<String,String> properties) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsproperties
- Map of properties to filter matches in the ObjectFactory byObjectFactoryException
<T> List<IPentahoObjectReference<T>> getObjectReferences(Class<T> interfaceClass, IPentahoSession curSession) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsObjectFactoryException
<T> List<IPentahoObjectReference<T>> getObjectReferences(Class<T> interfaceClass, IPentahoSession curSession, Map<String,String> properties) throws ObjectFactoryException
interfaceClass
- Interface or Class literal for which implementations of will be foundcurSession
- current session to be used for session-based implementationsproperties
- Map of properties to filter matches in the ObjectFactory byObjectFactoryException
String getName()
Copyright © 2020 Hitachi Vantara. All rights reserved.