Search in sources :

Example 1 with KettleDatabaseRepositoryMetaStore

use of org.pentaho.di.repository.kdr.delegates.metastore.KettleDatabaseRepositoryMetaStore in project pentaho-kettle by pentaho.

the class KettleDatabaseRepository method connect.

/**
 * Connect to the repository.
 *
 * @throws KettleException
 *           in case there is a general unexpected error or if we're already connected
 */
public void connect(String username, String password, boolean upgrade) throws KettleException {
    // first disconnect if already connected
    connectionDelegate.connect(upgrade, upgrade);
    try {
        IUser userinfo = userDelegate.loadUserInfo(new UserInfo(), username, password);
        securityProvider = new KettleDatabaseRepositorySecurityProvider(this, repositoryMeta, userinfo);
        // We need to add services in the list in the order of dependencies
        registerRepositoryService(RepositorySecurityProvider.class, securityProvider);
        registerRepositoryService(RepositorySecurityManager.class, securityProvider);
        // Apparently, MySQL InnoDB opens a new transaction simply by doing a
        // lookup.
        // 
        connectionDelegate.closeReadTransaction();
        // Open the metaStore for business too...
        // 
        metaStore = new KettleDatabaseRepositoryMetaStore(this);
    } catch (KettleDatabaseException e) {
        // if we fail to log in, disconnect and then rethrow the exception
        connectionDelegate.disconnect();
        throw e;
    }
}
Also used : KettleDatabaseRepositoryMetaStore(org.pentaho.di.repository.kdr.delegates.metastore.KettleDatabaseRepositoryMetaStore) KettleDatabaseException(org.pentaho.di.core.exception.KettleDatabaseException) IUser(org.pentaho.di.repository.IUser) UserInfo(org.pentaho.di.repository.UserInfo)

Aggregations

KettleDatabaseException (org.pentaho.di.core.exception.KettleDatabaseException)1 IUser (org.pentaho.di.repository.IUser)1 UserInfo (org.pentaho.di.repository.UserInfo)1 KettleDatabaseRepositoryMetaStore (org.pentaho.di.repository.kdr.delegates.metastore.KettleDatabaseRepositoryMetaStore)1