code: private DataSource getDataSource(ComponentHelper cmp, Resource resource) {
      try {
        /*
         * by default the path is read from request "path" parameter
         * here we overwrite it via a synthetic resource because the path may be overwritten by validation logic
         * to ensure the path is not beyond the configured root path
         */
        ValueMap overwriteProperties = new ValueMapDecorator(ImmutableMap.<String, Object>of("path", resource.getPath()));
        Resource dataSourceResourceWrapper = GraniteUiSyntheticResource.wrapMerge(request.getResource(), overwriteProperties);
        return cmp.getItemDataSource(dataSourceResourceWrapper);
      }
      catch (ServletException | IOException ex) {
        throw new RuntimeException("Unable to get data source.", ex);
      }
    }
docs: Get data source to list children of given resource.
  @param cmp Component helper
  @param resource Given resource
  @return Data source