Search in sources :

Example 26 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project pentaho-platform by pentaho.

the class AggregateObjectFactory method get.

@Override
public <T> T get(Class<T> clazz, IPentahoSession session, Map<String, String> properties) throws ObjectFactoryException {
    IPentahoObjectReference<T> highestRef = this.getObjectReference(clazz, session, properties);
    if (highestRef != null) {
        return highestRef.getObject();
    }
    readLock.lock();
    try {
        for (IPentahoObjectFactory fact : factories) {
            if (fact.objectDefined(clazz.getSimpleName())) {
                T object = fact.get(clazz, clazz.getSimpleName(), session);
                return object;
            }
        }
    } finally {
        readLock.unlock();
    }
    String msg = Messages.getInstance().getString("AbstractSpringPentahoObjectFactory.WARN_FAILED_TO_RETRIEVE_OBJECT", clazz.getSimpleName());
    throw new ObjectFactoryException(msg);
}
Also used : IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException)

Example 27 with ObjectFactoryException

use of org.pentaho.platform.api.engine.ObjectFactoryException in project data-access by pentaho.

the class DebugModelerService method getSession.

private IPentahoSession getSession() {
    IPentahoSession session = null;
    IPentahoObjectFactory pentahoObjectFactory = PentahoSystem.getObjectFactory();
    if (pentahoObjectFactory != null) {
        try {
            // $NON-NLS-1$
            session = pentahoObjectFactory.get(IPentahoSession.class, "systemStartupSession", null);
        } catch (ObjectFactoryException e) {
            e.printStackTrace();
        }
    }
    return session;
}
Also used : IPentahoObjectFactory(org.pentaho.platform.api.engine.IPentahoObjectFactory) ObjectFactoryException(org.pentaho.platform.api.engine.ObjectFactoryException) IPentahoSession(org.pentaho.platform.api.engine.IPentahoSession)

Aggregations

ObjectFactoryException (org.pentaho.platform.api.engine.ObjectFactoryException)27 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)10 StandaloneSession (org.pentaho.platform.engine.core.system.StandaloneSession)10 StandaloneObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneObjectFactory)7 IPentahoObjectFactory (org.pentaho.platform.api.engine.IPentahoObjectFactory)5 DataSource (javax.sql.DataSource)4 IDBDatasourceService (org.pentaho.platform.api.data.IDBDatasourceService)4 ArrayList (java.util.ArrayList)3 DBDatasourceServiceException (org.pentaho.platform.api.data.DBDatasourceServiceException)3 StandaloneSpringPentahoObjectFactory (org.pentaho.platform.engine.core.system.objfac.StandaloneSpringPentahoObjectFactory)3 SQLException (java.sql.SQLException)2 List (java.util.List)2 IOException (java.io.IOException)1 InvocationHandler (java.lang.reflect.InvocationHandler)1 Method (java.lang.reflect.Method)1 Principal (java.security.Principal)1 LinkedList (java.util.LinkedList)1 Properties (java.util.Properties)1 PBEKeySpec (javax.crypto.spec.PBEKeySpec)1 PBEParameterSpec (javax.crypto.spec.PBEParameterSpec)1