use of org.pentaho.ui.xul.XulServiceCallback in project data-access by pentaho.
the class ConnectionController 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("saveConnectionConfirmationDialogConnectionController");
overwriteConnectionConfirmationDialog = (XulDialog) document.getElementById("overwriteConnectionConfirmationDialogConnectionController");
renameConnectionConfirmationDialog = (XulDialog) document.getElementById("renameConnectionConfirmationDialogConnectionController");
// $NON-NLS-1$
errorDialog = (XulDialog) document.getElementById("errorDialog");
// $NON-NLS-1$
errorLabel = (XulLabel) document.getElementById("errorLabel");
// $NON-NLS-1$
successDialog = (XulDialog) document.getElementById("successDialog");
// $NON-NLS-1$
successLabel = (XulLabel) document.getElementById("successLabel");
// $NON-NLS-1$
removeConfirmationDialog = (XulDialog) document.getElementById("removeConfirmationDialogConnectionController");
// $NON-NLS-1$
successDetailsDialog = (XulDialog) document.getElementById("successDetailsDialogConnectionController");
}
use of org.pentaho.ui.xul.XulServiceCallback in project data-access by pentaho.
the class JdbcDatasourceService method remove.
/* (non-Javadoc)
* @see org.pentaho.platform.dataaccess.datasource.ui.service.IUIDatasourceAdminService#remove(org.pentaho.platform
* .dataaccess.datasource.IDatasourceInfo)
*/
@Override
public void remove(IDatasourceInfo dsInfo, Object callback) {
final XulServiceCallback<Boolean> responseCallback = (XulServiceCallback<Boolean>) callback;
RequestBuilder deleteConnectionBuilder = new RequestBuilder(RequestBuilder.DELETE, getBaseURL() + NameUtils.URLEncode("deletebyname?name={0}", dsInfo.getId()));
try {
deleteConnectionBuilder.sendRequest(null, new RequestCallback() {
public void onResponseReceived(Request request, Response response) {
responseCallback.success(response.getStatusCode() == Response.SC_OK);
}
public void onError(Request request, Throwable error) {
responseCallback.error(error.getLocalizedMessage(), error);
}
});
} catch (RequestException e) {
responseCallback.error(e.getLocalizedMessage(), e);
}
}
use of org.pentaho.ui.xul.XulServiceCallback 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.ui.xul.XulServiceCallback 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.ui.xul.XulServiceCallback in project data-access by pentaho.
the class DatasourceServiceManagerGwtImpl method remove.
/* (non-Javadoc)
* @see org.pentaho.platform.dataaccess.datasource.wizard.service.IXulAsyncDatasourceServiceManager#remove(org
* .pentaho.platform.dataaccess.datasource.IDatasourceInfo)
*/
@Override
public void remove(IDatasourceInfo dsInfo, final Object xulCallback) {
final String removeURL;
String datasourceId = NameUtils.URLEncode(dsInfo.getId());
if (dsInfo.getType() == MetadataUIDatasourceService.TYPE) {
removeURL = getWebAppRoot() + "plugin/data-access/api/datasource/metadata/" + datasourceId + "/remove";
} else if (dsInfo.getType() == MondrianUIDatasourceService.TYPE) {
removeURL = getWebAppRoot() + "plugin/data-access/api/datasource/analysis/" + datasourceId + "/remove";
} else if (dsInfo.getType() == DSWUIDatasourceService.TYPE) {
removeURL = getWebAppRoot() + "plugin/data-access/api/datasource/dsw/" + datasourceId + "/remove";
} else {
removeURL = null;
}
AuthenticatedGwtServiceUtil.invokeCommand(new IAuthenticatedGwtCommand<Boolean>() {
public void execute(final AsyncCallback<Boolean> callback) {
RequestBuilder requestBuilder = new RequestBuilder(RequestBuilder.POST, removeURL);
try {
requestBuilder.sendRequest(null, new RequestCallback() {
@Override
public void onError(Request request, Throwable exception) {
callback.onFailure(exception);
}
@Override
public void onResponseReceived(Request request, Response response) {
callback.onSuccess(response.getStatusCode() == Response.SC_OK);
}
});
} catch (RequestException e) {
XulServiceCallback<Boolean> responseCallback = (XulServiceCallback<Boolean>) xulCallback;
responseCallback.error(e.getLocalizedMessage(), e);
}
}
}, new AsyncCallback<Boolean>() {
public void onFailure(Throwable e) {
XulServiceCallback<Boolean> responseCallback = (XulServiceCallback<Boolean>) xulCallback;
responseCallback.error(e.getLocalizedMessage(), e);
}
public void onSuccess(Boolean arg) {
XulServiceCallback<Boolean> responseCallback = (XulServiceCallback<Boolean>) xulCallback;
responseCallback.success(arg);
}
});
}
Aggregations