use of org.pentaho.database.model.IDatabaseType in project data-access by pentaho.
the class DSWDatasourceServiceImpl method checkSqlQueriesSupported.
/**
* Method is designed to check whether sql queries can be executed via connection with a {@core connName}.
* For now we can't allow sql queries for connections, that are based on Pentaho Data Services.
* See BISERVER-13225 for more info.
*
* @param connName
* name of connection, to be examined for sql queries support
* @throws ConnectionServiceException
* if an error occurs while receiving connection with {@code connectionName}
* @throws SqlQueriesNotSupportedException
* if query is not supported for a connection with a {@code connectionName}
*/
void checkSqlQueriesSupported(String connName) throws ConnectionServiceException, SqlQueriesNotSupportedException {
IDatabaseConnection conn = connService.getConnectionByName(connName);
IDatabaseType dbType = conn.getDatabaseType();
if (dbType.getName().equals(DB_TYPE_ID_PENTAHO_DATA_SERVICE)) {
throw new SqlQueriesNotSupportedException(Messages.getErrorString("DatasourceServiceImpl.ERROR_0024_SQL_QUERIES_NOT_SUPPORTED_FOR_PENTAHO_DATA_SERVICE"));
}
}
use of org.pentaho.database.model.IDatabaseType in project data-access by pentaho.
the class WizardConnectionController method init.
@Bindable
public void init() {
XulServiceCallback<List<IDatabaseType>> callback = new XulServiceCallback<List<IDatabaseType>>() {
public void error(String message, Throwable error) {
error.printStackTrace();
}
public void success(List<IDatabaseType> retVal) {
databaseTypeHelper = new DatabaseTypeHelper(retVal);
}
};
dialectService.getDatabaseTypes(callback);
saveConnectionConfirmationDialog = // $NON-NLS-1$
(XulDialog) document.getElementById("saveConnectionConfirmationDialog");
overwriteConnectionConfirmationDialog = (XulDialog) document.getElementById("overwriteConnectionConfirmationDialog");
renameConnectionConfirmationDialog = (XulDialog) document.getElementById("renameConnectionConfirmationDialog");
// $NON-NLS-1$
errorDialog = (XulDialog) document.getElementById("errorDialog");
// $NON-NLS-1$
errorDetailsDialog = (XulDialog) document.getElementById("errorDetailsDialog");
// $NON-NLS-1$
errorLabel = (XulLabel) document.getElementById("errorLabel");
// $NON-NLS-1$
successDialog = (XulDialog) document.getElementById("successDialog");
// $NON-NLS-1$
successDetailsDialog = (XulDialog) document.getElementById("successDetailsDialog");
// $NON-NLS-1$
successLabel = (XulLabel) document.getElementById("successLabel");
// $NON-NLS-1$
removeConfirmationDialog = (XulDialog) document.getElementById("removeConfirmationDialog");
}
use of org.pentaho.database.model.IDatabaseType in project pentaho-platform by pentaho.
the class DatasourceMgmtToWebServiceAdapterTest method mockDatabaseType.
private IDatabaseType mockDatabaseType(final String shortName) {
IDatabaseType dbType = mock(IDatabaseType.class);
doReturn(shortName).when(dbType).getShortName();
return dbType;
}
use of org.pentaho.database.model.IDatabaseType in project data-access by pentaho.
the class GwtDatasourceEditorEntryPoint method onModuleLoad.
public void onModuleLoad() {
datasourceServiceManager = new DatasourceServiceManagerGwtImpl();
datasourceServiceManager.isAdmin(new XulServiceCallback<Boolean>() {
public void error(String message, Throwable error) {
}
public void success(Boolean retVal) {
isAdmin = retVal;
datasourceService = new DSWDatasourceServiceGwtImpl();
modelerService = new GwtModelerServiceImpl();
BogoPojo bogo = new BogoPojo();
modelerService.gwtWorkaround(bogo, new XulServiceCallback<BogoPojo>() {
public void success(BogoPojo retVal) {
}
public void error(String message, Throwable error) {
}
});
// only init the app if the user has permissions
// $NON-NLS-1$
final String url = GWT.getHostPageBaseURL() + "plugin/data-access/api/permissions/hasDataAccess";
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
builder.setHeader("accept", "application/json");
builder.setHeader("If-Modified-Since", "01 Jan 1970 00:00:00 GMT");
try {
builder.sendRequest(null, new RequestCallback() {
public void onError(Request request, Throwable exception) {
setupStandardNativeHooks(GwtDatasourceEditorEntryPoint.this);
initDashboardButtons(false);
}
public void onResponseReceived(Request request, Response response) {
hasPermissions = new Boolean(response.getText());
setupStandardNativeHooks(GwtDatasourceEditorEntryPoint.this);
if (hasPermissions) {
csvService = (ICsvDatasourceServiceAsync) GWT.create(ICsvDatasourceService.class);
setupPrivilegedNativeHooks(GwtDatasourceEditorEntryPoint.this);
loadOverlay("startup.dataaccess");
}
initDashboardButtons(hasPermissions);
}
});
} catch (RequestException e) {
// TODO Auto-generated catch block
}
}
});
XulServiceCallback<List<IDatabaseType>> callback = new XulServiceCallback<List<IDatabaseType>>() {
public void error(String message, Throwable error) {
error.printStackTrace();
}
public void success(List<IDatabaseType> retVal) {
databaseTypeHelper = new DatabaseTypeHelper(retVal);
databaseConnectionConverter = new DatabaseConnectionConverter(databaseTypeHelper);
}
};
dialectService.getDatabaseTypes(callback);
UIDatasourceServiceManager manager = UIDatasourceServiceManager.getInstance();
manager.registerService(new JdbcDatasourceService());
manager.registerService(new MondrianUIDatasourceService(datasourceServiceManager));
manager.registerService(new MetadataUIDatasourceService(datasourceServiceManager));
manager.registerService(new DSWUIDatasourceService(datasourceServiceManager));
manager.getIds(null);
}
use of org.pentaho.database.model.IDatabaseType in project data-access by pentaho.
the class AutobeanUtilitiesTest method testDbTypeBeanToImpl.
@Test
public void testDbTypeBeanToImpl() {
List<DatabaseAccessType> accessTypes = new LinkedList<DatabaseAccessType>();
accessTypes.add(DatabaseAccessType.NATIVE);
DatabaseType dbType1 = new DatabaseType("name", "short name", accessTypes, 100500, "helpUri");
IDatabaseType dbType = AutobeanUtilities.dbTypeBeanToImpl(dbType1);
assertEquals(dbType.getName(), "name");
assertEquals(dbType.getShortName(), "short name");
assertEquals(dbType.getDefaultDatabasePort(), 100500);
assertEquals(dbType.getExtraOptionsHelpUrl(), "helpUri");
assertEquals(dbType.getSupportedAccessTypes().size(), 1);
}
Aggregations