Search in sources :

Example 1 with UIObjectCreationException

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException in project pentaho-kettle by pentaho.

the class BrowseController method init.

// end PDI-3326 hack
@SuppressWarnings("deprecation")
public void init(Repository repository) throws ControllerInitializationException {
    try {
        this.repository = repository;
        mainController = (MainController) this.getXulDomContainer().getEventHandler("mainController");
        RepositoryDirectoryInterface root;
        try {
            if (repository instanceof RepositoryExtended) {
                root = ((RepositoryExtended) repository).loadRepositoryDirectoryTree("/", "*.ktr|*.kjb", -1, BooleanUtils.isTrue(repository.getUserInfo().isAdmin()), true, true);
            } else {
                root = repository.loadRepositoryDirectoryTree();
            }
            this.repositoryDirectory = UIObjectRegistry.getInstance().constructUIRepositoryDirectory(root, null, repository);
        } catch (UIObjectCreationException uoe) {
            this.repositoryDirectory = new UIRepositoryDirectory(repository.loadRepositoryDirectoryTree(), null, repository);
        }
        dirMap = new HashMap<ObjectId, UIRepositoryDirectory>();
        populateDirMap(repositoryDirectory);
        bf = new SwtBindingFactory();
        bf.setDocument(this.getXulDomContainer().getDocumentRoot());
        messageBox = (XulMessageBox) document.createElement("messagebox");
        createBindings();
    } catch (Exception e) {
        throw new ControllerInitializationException(e);
    }
}
Also used : UIRepositoryDirectory(org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory) RepositoryDirectoryInterface(org.pentaho.di.repository.RepositoryDirectoryInterface) SwtBindingFactory(org.pentaho.ui.xul.swt.SwtBindingFactory) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) ObjectId(org.pentaho.di.repository.ObjectId) RepositoryExtended(org.pentaho.di.repository.RepositoryExtended) XulException(org.pentaho.ui.xul.XulException) ControllerInitializationException(org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException) KettleException(org.pentaho.di.core.exception.KettleException) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)

Example 2 with UIObjectCreationException

use of org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException in project pentaho-kettle by pentaho.

the class ConnectionsController method refreshConnectionList.

// package-local visibility for testing purposes
void refreshConnectionList() {
    final List<UIDatabaseConnection> tmpList = new ArrayList<UIDatabaseConnection>();
    Runnable r = new Runnable() {

        @Override
        public void run() {
            try {
                ObjectId[] dbIdList = repository.getDatabaseIDs(false);
                for (ObjectId dbId : dbIdList) {
                    DatabaseMeta dbMeta = repository.loadDatabaseMeta(dbId, null);
                    RepositoryElementMetaInterface repoMeta = repository.getObjectInformation(dbId, RepositoryObjectType.DATABASE);
                    UIDatabaseConnection conn = null;
                    try {
                        conn = UIObjectRegistry.getInstance().constructUIDatabaseConnection(dbMeta, repository);
                    } catch (UIObjectCreationException uoe) {
                        conn = new UIDatabaseConnection(dbMeta, repository);
                    }
                    if (conn != null) {
                        conn.setRepositoryElementMetaInterface(repoMeta);
                        tmpList.add(conn);
                    }
                }
            } catch (KettleException e) {
                if (mainController == null || !mainController.handleLostRepository(e)) {
                    // convert to runtime exception so it bubbles up through the UI
                    throw new RuntimeException(e);
                }
            }
        }
    };
    doWithBusyIndicator(r);
    dbConnectionList.setChildren(tmpList);
}
Also used : KettleException(org.pentaho.di.core.exception.KettleException) ObjectId(org.pentaho.di.repository.ObjectId) UIDatabaseConnection(org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection) ArrayList(java.util.ArrayList) DatabaseMeta(org.pentaho.di.core.database.DatabaseMeta) RepositoryElementMetaInterface(org.pentaho.di.repository.RepositoryElementMetaInterface) UIObjectCreationException(org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)

Aggregations

KettleException (org.pentaho.di.core.exception.KettleException)2 ObjectId (org.pentaho.di.repository.ObjectId)2 UIObjectCreationException (org.pentaho.di.ui.repository.repositoryexplorer.model.UIObjectCreationException)2 ArrayList (java.util.ArrayList)1 DatabaseMeta (org.pentaho.di.core.database.DatabaseMeta)1 RepositoryDirectoryInterface (org.pentaho.di.repository.RepositoryDirectoryInterface)1 RepositoryElementMetaInterface (org.pentaho.di.repository.RepositoryElementMetaInterface)1 RepositoryExtended (org.pentaho.di.repository.RepositoryExtended)1 ControllerInitializationException (org.pentaho.di.ui.repository.repositoryexplorer.ControllerInitializationException)1 UIDatabaseConnection (org.pentaho.di.ui.repository.repositoryexplorer.model.UIDatabaseConnection)1 UIRepositoryDirectory (org.pentaho.di.ui.repository.repositoryexplorer.model.UIRepositoryDirectory)1 XulException (org.pentaho.ui.xul.XulException)1 SwtBindingFactory (org.pentaho.ui.xul.swt.SwtBindingFactory)1