Search in sources :

Example 6 with IDatabaseType

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"));
    }
}
Also used : IDatabaseType(org.pentaho.database.model.IDatabaseType) SqlQueriesNotSupportedException(org.pentaho.platform.dataaccess.datasource.wizard.service.SqlQueriesNotSupportedException) IDatabaseConnection(org.pentaho.database.model.IDatabaseConnection)

Example 7 with IDatabaseType

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");
}
Also used : XulServiceCallback(org.pentaho.ui.xul.XulServiceCallback) IDatabaseType(org.pentaho.database.model.IDatabaseType) DatabaseTypeHelper(org.pentaho.database.util.DatabaseTypeHelper) ArrayList(java.util.ArrayList) List(java.util.List) Bindable(org.pentaho.ui.xul.stereotype.Bindable)

Example 8 with IDatabaseType

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;
}
Also used : IDatabaseType(org.pentaho.database.model.IDatabaseType)

Example 9 with IDatabaseType

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);
}
Also used : GwtModelerServiceImpl(org.pentaho.agilebi.modeler.services.impl.GwtModelerServiceImpl) RequestBuilder(com.google.gwt.http.client.RequestBuilder) JdbcDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.JdbcDatasourceService) Request(com.google.gwt.http.client.Request) RequestException(com.google.gwt.http.client.RequestException) UIDatasourceServiceManager(org.pentaho.platform.dataaccess.datasource.ui.service.UIDatasourceServiceManager) XulServiceCallback(org.pentaho.ui.xul.XulServiceCallback) Response(com.google.gwt.http.client.Response) IDatabaseType(org.pentaho.database.model.IDatabaseType) DatasourceServiceManagerGwtImpl(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.DatasourceServiceManagerGwtImpl) RequestCallback(com.google.gwt.http.client.RequestCallback) DatabaseTypeHelper(org.pentaho.database.util.DatabaseTypeHelper) MondrianUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.MondrianUIDatasourceService) List(java.util.List) DSWDatasourceServiceGwtImpl(org.pentaho.platform.dataaccess.datasource.wizard.service.impl.DSWDatasourceServiceGwtImpl) DSWUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.DSWUIDatasourceService) MetadataUIDatasourceService(org.pentaho.platform.dataaccess.datasource.ui.service.MetadataUIDatasourceService) BogoPojo(org.pentaho.agilebi.modeler.gwt.BogoPojo)

Example 10 with IDatabaseType

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);
}
Also used : IDatabaseType(org.pentaho.database.model.IDatabaseType) DatabaseAccessType(org.pentaho.database.model.DatabaseAccessType) DatabaseType(org.pentaho.database.model.DatabaseType) IDatabaseType(org.pentaho.database.model.IDatabaseType) LinkedList(java.util.LinkedList) Test(org.junit.Test)

Aggregations

IDatabaseType (org.pentaho.database.model.IDatabaseType)11 DatabaseTypeHelper (org.pentaho.database.util.DatabaseTypeHelper)5 List (java.util.List)4 XulServiceCallback (org.pentaho.ui.xul.XulServiceCallback)4 ArrayList (java.util.ArrayList)3 DatabaseType (org.pentaho.database.model.DatabaseType)3 LinkedList (java.util.LinkedList)2 Test (org.junit.Test)2 DatabaseAccessType (org.pentaho.database.model.DatabaseAccessType)2 IDatabaseConnectionList (org.pentaho.ui.database.event.IDatabaseConnectionList)2 Bindable (org.pentaho.ui.xul.stereotype.Bindable)2 Request (com.google.gwt.http.client.Request)1 RequestBuilder (com.google.gwt.http.client.RequestBuilder)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 HashMap (java.util.HashMap)1 BogoPojo (org.pentaho.agilebi.modeler.gwt.BogoPojo)1 GwtModelerServiceImpl (org.pentaho.agilebi.modeler.services.impl.GwtModelerServiceImpl)1 DatabaseConnection (org.pentaho.database.model.DatabaseConnection)1