public Resolution delete() throws DocumentException, IOException {
    DataProvider dataProvider =
        context.getRepoxManager().getDataProviderManager().getDataProvider(dataProviderId);

    context.getRepoxManager().getDataProviderManager().deleteDataProvider(dataProvider.getId());
    context
        .getMessages()
        .add(new LocalizableMessage("dataProvider.delete.success", dataProvider.getName()));

    return new RedirectResolution("/Homepage.action");
  }
  public Resolution delete() throws DocumentException, IOException {
    DataProvider dataProvider =
        context.getRepoxManager().getDataProviderManager().getDataProvider(dataProviderId);
    DataSource dataSource = dataProvider.getDataSource(dataSourceId);

    context.getRepoxManager().getDataProviderManager().deleteDataSource(dataSource.getId());
    dataProvider.getDataSources().remove(dataSource);
    context
        .getRepoxManager()
        .getDataProviderManager()
        .updateDataProvider(dataProvider, dataProvider.getId());
    context.getMessages().add(new LocalizableMessage("dataSource.delete.success", dataSourceId));

    return new RedirectResolution(
        "/dataProvider/ViewDataProvider.action?dataProviderId="
            + URLEncoder.encode(dataProviderId, "UTF-8"));
  }
  @ValidationMethod(on = {"delete"})
  public void validateDataSource(ValidationErrors errors) throws DocumentException, IOException {
    DataProvider dataProvider =
        context.getRepoxManager().getDataProviderManager().getDataProvider(dataProviderId);
    if (dataProvider == null) {
      errors.add(
          "dataProviderId",
          new LocalizableError("error.dataSource.delete.dataProviderId", dataProviderId));
    }

    DataSource dataSource = dataProvider.getDataSource(dataSourceId);
    if (dataSource == null) {
      errors.add(
          "dataProviderId",
          new LocalizableError("error.dataSource.delete.dataSourceId", dataSourceId));
    }
  }