use of org.pentaho.di.trans.HasDatabasesInterface in project pentaho-kettle by pentaho.
the class Spoon method exploreDatabase.
public void exploreDatabase() {
if (RepositorySecurityUI.verifyOperations(shell, rep, RepositoryOperation.EXPLORE_DATABASE)) {
return;
}
// Show a minimal window to allow you to quickly select the database
// connection to explore
//
List<DatabaseMeta> databases = new ArrayList<>();
// First load the connections from the loaded file
//
HasDatabasesInterface databasesInterface = getActiveHasDatabasesInterface();
if (databasesInterface != null) {
databases.addAll(databasesInterface.getDatabases());
}
//
if (rep != null) {
try {
List<DatabaseMeta> list = rep.readDatabases();
for (DatabaseMeta databaseMeta : list) {
int index = databases.indexOf(databaseMeta);
if (index < 0) {
databases.add(databaseMeta);
} else {
databases.set(index, databaseMeta);
}
}
} catch (KettleException e) {
log.logError("Unexpected repository error", e.getMessage());
}
}
if (databases.size() == 0) {
return;
}
// OK, get a list of all the database names...
//
String[] databaseNames = new String[databases.size()];
for (int i = 0; i < databases.size(); i++) {
databaseNames[i] = databases.get(i).getName();
}
// show the shell...
//
EnterSelectionDialog dialog = new EnterSelectionDialog(shell, databaseNames, BaseMessages.getString(PKG, "Spoon.ExploreDB.SelectDB.Title"), BaseMessages.getString(PKG, "Spoon.ExploreDB.SelectDB.Message"));
String name = dialog.open();
if (name != null) {
selectionObject = DatabaseMeta.findDatabase(databases, name);
exploreDB();
}
}
use of org.pentaho.di.trans.HasDatabasesInterface in project pentaho-kettle by pentaho.
the class Spoon method createDatabaseWizard.
/**
* Shows a wizard that creates a new database connection...
*/
public void createDatabaseWizard() {
HasDatabasesInterface hasDatabasesInterface = getActiveHasDatabasesInterface();
if (hasDatabasesInterface == null) {
// nowhere to put the new database
return;
}
CreateDatabaseWizard cdw = new CreateDatabaseWizard();
DatabaseMeta newDBInfo = cdw.createAndRunDatabaseWizard(shell, props, hasDatabasesInterface.getDatabases());
if (newDBInfo != null) {
// finished
hasDatabasesInterface.addDatabase(newDBInfo);
refreshTree();
refreshGraph();
}
}
use of org.pentaho.di.trans.HasDatabasesInterface in project pentaho-kettle by pentaho.
the class SpoonDBDelegate method newConnection.
public void newConnection() {
HasDatabasesInterface hasDatabasesInterface = spoon.getActiveHasDatabasesInterface();
if (hasDatabasesInterface == null && spoon.rep == null) {
return;
}
newConnection(hasDatabasesInterface);
}
use of org.pentaho.di.trans.HasDatabasesInterface in project pentaho-kettle by pentaho.
the class Spoon method dupeConnection.
public void dupeConnection() {
final DatabaseMeta databaseMeta = (DatabaseMeta) selectionObject;
final HasDatabasesInterface hasDatabasesInterface = (HasDatabasesInterface) selectionObjectParent;
delegates.db.dupeConnection(hasDatabasesInterface, databaseMeta);
}
Aggregations