code: public long getNodesCount() throws RepositoryException
     {
        try
        {
           ResultSet countNodes = findNodesCount();
           try
           {
              if (countNodes.next())
              {
                 return countNodes.getLong(1);
              }
              else
              {
                 throw new SQLException("ResultSet has't records.");
              }
           }
           finally
           {
              JDBCUtils.freeResources(countNodes, null, null);
           }
        }
        catch (SQLException e)
        {
           throw new RepositoryException("Can not calculate nodes count", e);
        }
     }
docs: Reads count of nodes in workspace.
  
  @return
  nodes count
  @throws RepositoryException
  if a database access error occurs