use of org.pentaho.di.core.database.DatabaseMeta in project data-access by pentaho.
the class JoinSelectionDebugGwtServlet method getTableFields.
public List<String> getTableFields(String table, IDatabaseConnection connection) throws Exception {
DatabaseMeta databaseMeta = this.getDatabaseMeta(connection);
MultitableDatasourceService service = new MultitableDatasourceService(databaseMeta);
return service.getTableFields(table, connection);
}
use of org.pentaho.di.core.database.DatabaseMeta in project mondrian by pentaho.
the class Workbench method getDbMeta.
/**
* Convenience method for retrieving the dbMeta instance that handles
* required Kettle initialization.
*
* @param xml output of {@link DatabaseMeta#getXML()} or <code>null</code>
* @return the current {@link DatabaseMeta} instance
*/
private DatabaseMeta getDbMeta(String xml) {
try {
if (!KettleClientEnvironment.isInitialized()) {
System.setProperty("KETTLE_PLUGIN_BASE_FOLDERS", KETTLE_PLUGIN_BASE_FOLDERS);
KettleClientEnvironment.init();
}
if (dbMeta != null) {
return dbMeta;
}
if (xml == null) {
dbMeta = new DatabaseMeta();
} else {
dbMeta = new DatabaseMeta(xml);
}
} catch (KettleException e) {
throw new RuntimeException(getResourceConverter().getFormattedString("workbench.new.Kettle.exception", "Kettle failed to initialize."), e);
}
return dbMeta;
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-metaverse by pentaho.
the class JobEntryAnalyzerTest method addConnectionNodes.
@Test
public void addConnectionNodes() throws MetaverseAnalyzerException {
DatabaseMeta[] dbs = new DatabaseMeta[] { mockDatabaseMeta };
analyzer.jobEntryInterface = mockJobEntryInterface;
// analyzer.addConnectionNodes( mockDescriptor );
DatabaseConnectionAnalyzer dbAnalyzer = new JobEntryDatabaseConnectionAnalyzer();
dbAnalyzer.setMetaverseBuilder(mockBuilder);
analyzer.setConnectionAnalyzer(dbAnalyzer);
when(analyzer.getConnectionAnalyzer()).thenReturn(dbAnalyzer);
when(mockJobEntryInterface.getUsedDatabaseConnections()).thenReturn(dbs);
analyzer.addConnectionNodes(mockDescriptor);
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-metaverse by pentaho.
the class DatabaseConnectionAnalyzerTest method testGetUsedConnections.
@Test
public void testGetUsedConnections() throws Exception {
DatabaseMeta dbMeta = mock(DatabaseMeta.class);
when(baseStepMeta.getUsedDatabaseConnections()).thenReturn(new DatabaseMeta[] { dbMeta });
List<DatabaseMeta> dbMetaList = dbConnectionAnalyzer.getUsedConnections(baseStepMeta);
assertEquals(1, dbMetaList.size());
assertEquals(dbMeta, dbMetaList.get(0));
}
use of org.pentaho.di.core.database.DatabaseMeta in project pentaho-metaverse by pentaho.
the class TableInputExternalResourceConsumer method getResourcesFromMeta.
@Override
public Collection<IExternalResourceInfo> getResourcesFromMeta(TableInputMeta meta, IAnalysisContext context) {
Set<IExternalResourceInfo> resources = new HashSet<IExternalResourceInfo>();
DatabaseMeta dbMeta = meta.getDatabaseMeta();
if (dbMeta != null) {
IExternalResourceInfo databaseResource = ExternalResourceInfoFactory.createDatabaseResource(dbMeta, true);
String query = context.equals(DictionaryConst.CONTEXT_RUNTIME) ? meta.getParentStepMeta().getParentTransMeta().environmentSubstitute(meta.getSQL()) : meta.getSQL();
databaseResource.getAttributes().put(DictionaryConst.PROPERTY_QUERY, query);
resources.add(databaseResource);
}
return resources;
}
Aggregations