code: protected void removeRepository(RepositoryService repositoryService, String repositoryName)
        throws RepositoryException,
        RepositoryConfigurationException
     {
        ManageableRepository mr = null;
  
        try
        {
           mr = repositoryService.getRepository(repositoryName);
        }
        catch (RepositoryException e)
        {
           // The repository not exist.
           if (LOG.isTraceEnabled())
           {
              LOG.trace("An exception occurred: " + e.getMessage());
           }
        }
  
        if (mr != null)
        {
           closeAllSession(mr);
           repositoryService.removeRepository(repositoryName);
           repositoryService.getConfig().retain(); // save configuration to persistence (file or persister)
        }
     }
docs: Remove repository.
  
  @param repositoryService
  RepositoryService, the repository service
  @param repositoryName
  String, the repository name
  @throws RepositoryException
  will be generated the RepositoryException
  @throws RepositoryConfigurationException