|
||||||||||
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.PentahoObjectFactory
public class PentahoObjectFactory
NOTICE: This class is deprecated and will not exist in platform version 2.1.
Below is a guide for how to use the new API for factory-ing dynamic objects:
The old way of creating objects via a factory was:
1. PentahoObjectFactory fac = new PentahoObjectFactory();
//set the object specifications (as a map of object creators)
//the object creator classes provided scoping to objects,
//allowing us to bind object to particular scopes
2. SessionObjectCreator creator = SessionObjectCreator("org.pentaho.platform.api.repository.ISolutionRepository")
3. Map objCreatorMap = new HashMap()
4. objCreatorMap.put("ISolutionRepository", creator)
5. fac.setObjectCreators(objCreatorMap);
6. ISolutionEngine eng = (ISolutionEngine)fac.getObject("ISolutionEngine", session);
The new way of factory-ing objects is:
1. IPentahoObjectFactory fac = new MyPentahoObjectFactory();
//configure the factory with an object specification file and/or a runtime context object
2. fac.init(objectSpecFile, contextObject) IPentahoObjectFactory.init(String, Object)
3. ISolutionEngine eng = fac.get(ISolutionEngine.class, session) IPentahoObjectFactory.get(Class, IPentahoSession)
You will notice that the new way of serving up objects does not expose an API for scoping of objects like the old way did.
This behavior is now 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 objectSpecFile (see
new way step #2 in the instructions above).
Constructor Summary | |
---|---|
PentahoObjectFactory()
Deprecated. |
Method Summary | |
---|---|
Object |
getObject(String key,
IPentahoSession session)
Deprecated. |
boolean |
hasObject(String key)
Deprecated. |
void |
setObjectCreators(Map objectMap)
Deprecated. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PentahoObjectFactory()
PentahoObjectFactory
Method Detail |
---|
public Object getObject(String key, IPentahoSession session) throws ObjectFactoryException
PentahoObjectFactory
ObjectFactoryException
public boolean hasObject(String key)
PentahoObjectFactory
public void setObjectCreators(Map objectMap)
PentahoObjectFactory
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |