code: public void configWorkspace(final WorkspaceEntry wsConfig) throws RepositoryConfigurationException,
        RepositoryException
     {
        SecurityHelper.validateSecurityPermission(JCRRuntimePermissions.MANAGE_REPOSITORY_PERMISSION);
  
        if (isWorkspaceInitialized(wsConfig.getName()))
        {
           throw new RepositoryConfigurationException("Workspace '" + wsConfig.getName()
              + "' is presumably initialized. config canceled");
        }
  
        try
        {
           repositoryContainer.initWorkspaceComponentEntries((SystemParametersPersistenceConfigurator)repositoryContainer
              .getComponentInstanceOfType(SystemParametersPersistenceConfigurator.class), wsConfig);
  
           repositoryContainer.registerWorkspace(wsConfig);
        }
        catch (RepositoryConfigurationException e)
        {
           final WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
           SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
           {
              public Void run()
              {
                 repositoryContainer.unregisterComponent(wsConfig.getName());
                 return null;
              }
           });
           throw new RepositoryConfigurationException(e);
        }
        catch (RepositoryException e)
        {
           final WorkspaceContainer workspaceContainer = repositoryContainer.getWorkspaceContainer(wsConfig.getName());
           SecurityHelper.doPrivilegedAction(new PrivilegedAction<Void>()
           {
              public Void run()
              {
                 repositoryContainer.unregisterComponent(wsConfig.getName());
                 return null;
              }
           });
           throw new RepositoryException(e);
        }
     }
docs: {@inheritDoc}