code: protected void removeWorkspace(ManageableRepository mr, String workspaceName) throws RepositoryException
     {
  
        boolean isExists = false;
        for (String wsName : mr.getWorkspaceNames())
           if (workspaceName.equals(wsName))
           {
              isExists = true;
              break;
           }
  
        if (isExists)
        {
           if (!mr.canRemoveWorkspace(workspaceName))
           {
              WorkspaceContainerFacade wc = mr.getWorkspaceContainer(workspaceName);
              SessionRegistry sessionRegistry = (SessionRegistry)wc.getComponent(SessionRegistry.class);
              sessionRegistry.closeSessions(workspaceName);
           }
  
           mr.removeWorkspace(workspaceName);
        }
     }
docs: Remove workspace.
  
  @param mr
  ManageableRepository, the manageable repository
  @param workspaceName
  String, the workspace name
  @throws RepositoryException
  will be generated the RepositoryException