use of org.talend.core.ITDQRepositoryService in project tdi-studio-se by Talend.
the class ExportRulesToRepository method widgetSelected.
public void widgetSelected(SelectionEvent e) {
IElementParameter elementParameter = node.getElementParameter("RULE_TABLE");
ArrayList<HashMap<String, Object>> value = (ArrayList<HashMap<String, Object>>) elementParameter.getValue();
;
ITDQRepositoryService tdqRepService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
}
String elementName = node.getProcess().getName() + "_" + node.getNodeLabel().getElementName();
tdqRepService.createParserRuleItem(value, elementName);
}
use of org.talend.core.ITDQRepositoryService in project tdq-studio-se by Talend.
the class ConnectionsView method init.
@Override
public void init(IViewSite site, IMemento memento) throws PartInitException {
super.init(site, memento);
// MOD qiongli 2012-11-9 TDQ-6166,init the propertyFileMap when this view init and the map is empty.
ITDQRepositoryService tdqRepService = null;
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
if (tdqRepService != null) {
tdqRepService.initAllConnectionsToSQLExplorer();
}
}
}
use of org.talend.core.ITDQRepositoryService in project tdq-studio-se by Talend.
the class User method createNewConnection.
/**
* Creates a new connection, MOD xqliu 2013-04-03 TDQ-7003
*
* @return
* @throws ExplorerException
* @throws SQLException
*/
protected synchronized SQLConnection createNewConnection() throws SQLException {
SQLConnection connection = null;
// need use DynamicClassLoader to deal with it
if (databaseConnection != null && EDatabaseTypeName.HIVE.getXmlName().equalsIgnoreCase(databaseConnection.getDatabaseType())) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
ITDQRepositoryService tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
if (tdqRepService != null) {
IMetadataConnection mdConn = ConvertionHelper.convert(databaseConnection);
Connection hiveConnection = tdqRepService.createHiveConnection(mdConn);
if (hiveConnection != null) {
connection = new SQLConnection(this, hiveConnection, alias.getDriver(), "HiveConnection");
}
}
}
} else {
connection = alias.getDriver().getConnection(this);
}
return connection;
}
use of org.talend.core.ITDQRepositoryService in project tdq-studio-se by Talend.
the class NewDatabaseStructureViewAction method setMetadataToUserAndUpdateDriver.
/**
* set the MetadataConnection To User and Update Driver if needed.
*
* @param user
*/
protected void setMetadataToUserAndUpdateDriver(User user) {
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQRepositoryService.class)) {
ITDQRepositoryService tdqRepService = (ITDQRepositoryService) GlobalServiceRegister.getDefault().getService(ITDQRepositoryService.class);
if (tdqRepService != null) {
Collection<Connection> allDataProviders = tdqRepService.getAllDataProviders();
for (Connection connection : allDataProviders) {
if (user.getAlias().getName().equals(connection.getName())) {
// set IMetadataConnection into the user, if the db type is hive, should use
// IMetadataConnection to create the hive connection
DatabaseConnection databaseConnection = SwitchHelpers.DATABASECONNECTION_SWITCH.doSwitch(connection);
if (databaseConnection != null) {
user.setDatabaseConnection(databaseConnection);
// if ManagedDriver class is not Loaded,check if it lack jars then update the
// realted jar.
SqlexplorerService.getInstance().updateDriverIfClassNotLoad(databaseConnection);
}
break;
}
}
}
}
}
use of org.talend.core.ITDQRepositoryService in project tdq-studio-se by Talend.
the class ColumnAnalysisSqlExecutor method executeQuery.
/**
* DOC scorreia Comment method "executeQuery".
*
* @param indicator
* @param connection
* @param queryStmt
* @return
* @throws SQLException
*/
protected boolean executeQuery(final Indicator indicator, Connection connection, String queryStmt) throws SQLException {
String cat = getCatalogOrSchemaName(indicator.getAnalyzedElement());
if (log.isInfoEnabled()) {
log.info(Messages.getString("ColumnAnalysisSqlExecutor.COMPUTINGINDICATOR", // $NON-NLS-1$
AnalysisExecutorHelper.getIndicatorName(indicator)) + "\t" + // $NON-NLS-1$ //$NON-NLS-2$
Messages.getString("ColumnAnalysisSqlExecutor.EXECUTINGQUERY", queryStmt));
}
// give result to indicator so that it handles the results
boolean ret = false;
// MOD qiongli 2012-3-7 TDQ-4632 delete some redundancy code for DistinctIndicator.modify directly the sql
// expression in definition file.
List<Object[]> myResultSet = executeQuery(cat, connection, queryStmt);
if (!continueRun()) {
return false;
}
ret = indicator.storeSqlResults(myResultSet);
// Added TDQ-8787 publish the related event when one indicator is finished: to refresh the chart with new result
// of the current indicator
final ITDQRepositoryService tdqRepositoryService = AnalysisExecutorHelper.getTDQService();
if (tdqRepositoryService != null) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
tdqRepositoryService.publishDynamicEvent(indicator, IndicatorCommonUtil.getIndicatorValue(indicator));
}
});
}
// MOD delete the try/catch TDQ-8388
return ret;
}
Aggregations