Exemplo n.º 1
0
  @Override
  protected void validateUpdatePopulation(
      SimpleDataSourceDescriptor bean, HttpServletRequest req, User user, URIParser uriParser)
      throws ValidationException, SQLException, Exception {

    if (bean.isEnabled()) {
      if (bean.getType().equals(DataSourceType.ContainerManaged)
          && !ContextUtils.isBound(bean.getUrl())) {
        throw new ValidationException(new ValidationError("nameNotBound"));
      } else if (!ReflectionUtils.isAvailable(bean.getDriver())) {
        throw new ValidationException(new ValidationError("driverNotAvailable"));
      }
    }
  }
Exemplo n.º 2
0
  @Override
  protected ForegroundModuleResponse beanUpdated(
      SimpleDataSourceDescriptor bean,
      HttpServletRequest req,
      HttpServletResponse res,
      User user,
      URIParser uriParser)
      throws Exception {

    if (bean.isEnabled()) {
      this.dataSourceCache.update(bean);
    } else {
      this.dataSourceCache.stop(bean.getDataSourceID());
    }

    return super.beanUpdated(bean, req, res, user, uriParser);
  }
Exemplo n.º 3
0
  @Override
  protected List<Breadcrumb> getUpdateBreadcrumbs(
      SimpleDataSourceDescriptor bean, HttpServletRequest req, User user, URIParser uriParser) {

    return CollectionUtils.getList(
        this.callback.getDefaultBreadcrumb(),
        new Breadcrumb(
            callback.getUpdateDataSourceBreadcrumbText() + bean.getName(),
            callback.getUpdateDataSourceBreadcrumbText() + bean.getName(),
            uriParser.getFormattedURI(),
            URLType.RELATIVE_FROM_CONTEXTPATH));
  }
Exemplo n.º 4
0
  @Override
  protected ForegroundModuleResponse beanDeleted(
      SimpleDataSourceDescriptor bean,
      HttpServletRequest req,
      HttpServletResponse res,
      User user,
      URIParser uriParser)
      throws Exception {

    this.dataSourceCache.delete(bean.getDataSourceID());

    return super.beanDeleted(bean, req, res, user, uriParser);
  }