code: public void removeRepository(final String name, boolean forceRemove) throws RepositoryException
     {
        // Need privileges to manage repository.
        SecurityManager security = System.getSecurityManager();
        if (security != null)
        {
           security.checkPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
        }
  
        if (!forceRemove && !canRemoveRepository(name))
        {
           throw new RepositoryException("Repository " + name + " in use. If you want to "
              + " remove repository close all open sessions");
        }
  
        try
        {
           final RepositoryEntry repconfig = config.getRepositoryConfiguration(name);
           final RepositoryImpl repo = (RepositoryImpl)getRepository(name);
           repo.setState(ManageableRepository.OFFLINE);
           SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>()
           {
              public Void run() throws RepositoryException
              {
                 List<WorkspaceEntry> workspaces = new ArrayList<WorkspaceEntry>(repconfig.getWorkspaceEntries());
                 for (WorkspaceEntry entry : workspaces)
                 {
                    repo.internalRemoveWorkspace(entry.getName());
                 }
                 RepositoryContainer repositoryContainer = repositoryContainers.get(name);
                 repositoryContainer.stop();
                 repositoryContainers.remove(name);
                 config.getRepositoryConfigurations().remove(repconfig);
                 parentContainer.unregisterComponent(repositoryContainer.getName());
                 return null;
              }
           });
        }
        catch (PrivilegedActionException e)
        {
           Throwable cause = e.getCause();
           if (cause instanceof RepositoryException)
           {
              throw (RepositoryException)cause;
           }
           else
           {
              throw new RepositoryException(cause);
           }
        }
        catch (RepositoryConfigurationException e)
        {
           throw new RepositoryException(e);
        }
        catch (Exception e)
        {
           throw new RepositoryException(e);
        }
     }
docs: {@inheritDoc}