use of org.pentaho.di.connections.ConnectionManager in project pentaho-kettle by pentaho.
the class ConnectionUtil method init.
/**
* Initialize the connected meta store with embedded named connections
*
* @param meta The meta containing named connections
*/
public static void init(AbstractMeta meta) {
ConnectionManager connectionManager = ConnectionManager.getInstance();
IMetaStore metaStore = null;
try {
if (meta.getRepository() != null) {
if (meta.getMetaStore() instanceof DelegatingMetaStore) {
metaStore = ((DelegatingMetaStore) meta.getMetaStore()).getActiveMetaStore();
} else {
metaStore = meta.getRepository().getMetaStore();
}
} else {
metaStore = MetaStoreConst.openLocalPentahoMetaStore();
}
} catch (MetaStoreException ignored) {
// Allow connectedMetaStore to be null
}
if (metaStore != null) {
final IMetaStore connectedMetaStore = metaStore;
connectionManager.setMetastoreSupplier(() -> connectedMetaStore);
}
}
use of org.pentaho.di.connections.ConnectionManager in project pentaho-kettle by pentaho.
the class ConnectionDelegate method delete.
public void delete(String label) {
ConnectionDeleteDialog connectionDeleteDialog = new ConnectionDeleteDialog(spoonSupplier.get().getShell());
if (connectionDeleteDialog.open(label) == SWT.YES) {
ConnectionManager connectionManager = ConnectionManager.getInstance();
connectionManager.delete(label);
spoonSupplier.get().getShell().getDisplay().asyncExec(() -> spoonSupplier.get().refreshTree(ConnectionFolderProvider.STRING_VFS_CONNECTIONS));
EngineMetaInterface engineMetaInterface = spoonSupplier.get().getActiveMeta();
if (engineMetaInterface instanceof AbstractMeta) {
((AbstractMeta) engineMetaInterface).setChanged();
}
}
}
Aggregations