code: public Set<VersionResource> getVersions() throws RepositoryException, IllegalResourceTypeException
     {
        Set<VersionResource> resources = new HashSet<VersionResource>();
        VersionIterator versions = versionHistory.getAllVersions();
        while (versions.hasNext())
        {
           Version version = versions.nextVersion();
           if ("jcr:rootVersion".equals(version.getName()))
           {
  
              continue;
           }
           resources
              .add(new VersionResource(versionURI(version.getName()), versionedResource, version, namespaceContext));
        }
        return resources;
     }
docs: Returns all versions of a resource.
  
  @return all versions of a resource
  @throws RepositoryException {@link RepositoryException}
  @throws IllegalResourceTypeException {@link IllegalResourceTypeException}