code: public List<String> getCategoryRepositories(CmsObject cms, String referencePath) {
  
          List<String> ret = new ArrayList<String>();
          if (referencePath == null) {
              ret.add(CmsCategoryService.CENTRALIZED_REPOSITORY);
              return ret;
          }
          String path = referencePath;
          if (!CmsResource.isFolder(path)) {
              path = CmsResource.getParentFolder(path);
          }
          if (CmsStringUtil.isEmptyOrWhitespaceOnly(path)) {
              path = "/";
          }
          String categoryBase = getRepositoryBaseFolderName(cms);
          do {
              String repositoryPath = internalCategoryRootPath(path, categoryBase);
              if (cms.existsResource(repositoryPath)) {
                  ret.add(repositoryPath);
              }
              path = CmsResource.getParentFolder(path);
          } while (path != null);
          ret.add(CmsCategoryService.CENTRALIZED_REPOSITORY);
          // the order is important in case of conflicts
          Collections.reverse(ret);
          return ret;
      }
docs: Returns all category repositories for the given reference path.<p>
  
  @param cms the cms context
  @param referencePath the reference path
  
  @return a list of root paths