code: public void setState(int state) throws RepositoryException
     {
        if (getState() != ONLINE && !(state == ONLINE || state == OFFLINE))
        {
           throw new RepositoryException("First switch repository to ONLINE and then to needed state.\n" + toString());
        }
  
        String[] workspaces = getWorkspaceNames();
        if (workspaces.length > 0)
        {
           // set state for all workspaces
           for (String workspaceName : workspaces)
           {
              if (!workspaceName.equals(systemWorkspaceName))
              {
                 getWorkspaceContainer(workspaceName).setState(state);
              }
           }
           getWorkspaceContainer(systemWorkspaceName).setState(state);
        }
  
        isOffline = state == OFFLINE;
     }
docs: {@inheritDoc}