use of org.pentaho.database.util.DatabaseTypeHelper 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.util.DatabaseTypeHelper in project pentaho-platform by pentaho.
the class DatabaseConnectionAdapter method unmarshal.
@Override
public DatabaseConnection unmarshal(DatabaseConnectionDto dbConnDto) throws Exception {
if (dbConnDto != null) {
IDatabaseDialectService databaseDialectService = new DatabaseDialectService();
DatabaseTypeHelper databaseTypeHelper = new DatabaseTypeHelper(databaseDialectService.getDatabaseTypes());
DatabaseConnection dbConn = new DatabaseConnection();
dbConn.setId(dbConnDto.getId());
dbConn.setAccessType(dbConnDto.getAccessType());
dbConn.setAccessTypeValue(dbConnDto.getAccessTypeValue());
dbConn.setChanged(dbConnDto.getChanged());
dbConn.setConnectionPoolingProperties(dbConnDto.getConnectionPoolingProperties());
dbConn.setConnectSql(dbConnDto.getConnectSql());
dbConn.setDatabaseName(dbConnDto.getDatabaseName());
dbConn.setDatabasePort(dbConnDto.getDatabasePort());
if (dbConnDto.getDatabaseType() != null) {
dbConn.setDatabaseType(databaseTypeHelper.getDatabaseTypeByShortName(dbConnDto.getDatabaseType()));
}
dbConn.setDataTablespace(dbConnDto.getDataTablespace());
dbConn.setForcingIdentifiersToLowerCase(dbConnDto.isForcingIdentifiersToLowerCase());
dbConn.setForcingIdentifiersToUpperCase(dbConnDto.isForcingIdentifiersToUpperCase());
dbConn.setHostname(dbConnDto.getHostname());
dbConn.setIndexTablespace(dbConnDto.getIndexTablespace());
dbConn.setInformixServername(dbConnDto.getInformixServername());
dbConn.setInitialPoolSize(dbConnDto.getInitialPoolSize());
dbConn.setMaximumPoolSize(dbConnDto.getMaximumPoolSize());
dbConn.setName(dbConnDto.getName());
dbConn.setPartitioned(dbConnDto.isPartitioned());
dbConn.setPartitioningInformation(dbConnDto.getPartitioningInformation());
dbConn.setPassword(dbConnDto.getPassword());
dbConn.setQuoteAllFields(dbConnDto.isQuoteAllFields());
dbConn.setSQLServerInstance(dbConnDto.getSQLServerInstance());
dbConn.setStreamingResults(dbConnDto.isStreamingResults());
dbConn.setUsername(dbConnDto.getUsername());
dbConn.setUsingConnectionPool(dbConnDto.isUsingConnectionPool());
dbConn.setUsingDoubleDecimalAsSchemaTableSeparator(dbConnDto.isUsingDoubleDecimalAsSchemaTableSeparator());
return dbConn;
} else {
return null;
}
}
use of org.pentaho.database.util.DatabaseTypeHelper in project pentaho-platform by pentaho.
the class PooledDatasourceHelperTest method testCreatePoolNoDialectService.
@Test
public void testCreatePoolNoDialectService() throws Exception {
DatabaseDialectService dialectService = new DatabaseDialectService(false);
final DatabaseTypeHelper databaseTypeHelper = new DatabaseTypeHelper(dialectService.getDatabaseTypes());
final DatabaseConnection con = new DatabaseConnection();
con.setId("Postgres");
con.setName("Postgres");
con.setAccessType(DatabaseAccessType.NATIVE);
con.setDatabaseType(databaseTypeHelper.getDatabaseTypeByShortName("GENERIC"));
con.setUsername("pentaho_user");
con.setPassword("password");
final HashMap<String, String> attrs = new HashMap<>();
attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_DRIVER_CLASS, "org.postgresql.Driver");
attrs.put(DatabaseConnection.ATTRIBUTE_CUSTOM_URL, "jdbc:postgresql://localhost:5432/hibernate");
con.setAttributes(attrs);
try {
PooledDatasourceHelper.setupPooledDataSource(con);
fail("Expecting the exception to be thrown");
} catch (DBDatasourceServiceException ex) {
assertNotNull(ex);
}
}
use of org.pentaho.database.util.DatabaseTypeHelper 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.util.DatabaseTypeHelper in project data-access by pentaho.
the class ConnectionController method createNewDatabaseDialog.
private void createNewDatabaseDialog() {
if (databaseTypeHelper == null) {
XulServiceCallback<List<IDatabaseType>> callback = new XulServiceCallback<List<IDatabaseType>>() {
public void error(String message, Throwable error) {
Window.alert(message + ": " + error.getLocalizedMessage());
// error.printStackTrace();
}
public void success(List<IDatabaseType> retVal) {
databaseTypeHelper = new DatabaseTypeHelper(retVal);
databaseDialog = new GwtDatabaseDialog(databaseTypeHelper, GWT.getModuleBaseURL() + "dataaccess-databasedialog.xul", // $NON-NLS-1$
connectionSetter);
}
};
dialectService.getDatabaseTypes(callback);
} else {
databaseDialog = new GwtDatabaseDialog(databaseTypeHelper, GWT.getModuleBaseURL() + "dataaccess-databasedialog.xul", // $NON-NLS-1$
connectionSetter);
}
}
Aggregations