edu.internet2.middleware.shibboleth.common.resource
Class SVNResource

java.lang.Object
  extended by org.opensaml.util.resource.AbstractFilteredResource
      extended by edu.internet2.middleware.shibboleth.common.resource.SVNResource
All Implemented Interfaces:
org.opensaml.util.resource.Resource

public class SVNResource
extends org.opensaml.util.resource.AbstractFilteredResource

A resource representing a file fetch from a Subversion server. This resource will fetch the given resource as follows:

The behavior of multiple SVNResource operating on the same local copy are undefined.

Since:
1.1

Constructor Summary
SVNResource(org.tmatesoft.svn.core.wc.SVNClientManager svnClientMgr, org.tmatesoft.svn.core.SVNURL repositoryUrl, File workingCopy, long workingRevision, String resourceFile)
          Constructor.
 
Method Summary
protected  void checkoutOrUpdateResource()
          Checks out the resource specified by the remoteRepository in to the working copy workingCopyDirectory.
protected  void checkWorkingCopyDirectory(File directory)
          Checks that the given file exists, or can be created, is a directory, and is read/writable by this process.
 boolean exists()
          
 InputStream getInputStream()
          
 org.joda.time.DateTime getLastModifiedTime()
          
 String getLocation()
          
protected  File getResourceFile()
          Gets File for the resource.
 
Methods inherited from class org.opensaml.util.resource.AbstractFilteredResource
applyFilter, getResourceFilter, setResourceFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNResource

public SVNResource(org.tmatesoft.svn.core.wc.SVNClientManager svnClientMgr,
                   org.tmatesoft.svn.core.SVNURL repositoryUrl,
                   File workingCopy,
                   long workingRevision,
                   String resourceFile)
            throws org.opensaml.util.resource.ResourceException
Constructor.

Parameters:
svnClientMgr - manager used to create SVN clients
repositoryUrl - URL of the remote repository
workingCopy - directory that will serve as the root of the local working copy
workingRevision - revision of the resource to retrieve or -1 for HEAD revision
resourceFile - file, within the working copy, represented by this resource
Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem initializing the SVN resource
Method Detail

exists

public boolean exists()
               throws org.opensaml.util.resource.ResourceException

Throws:
org.opensaml.util.resource.ResourceException

getInputStream

public InputStream getInputStream()
                           throws org.opensaml.util.resource.ResourceException

Throws:
org.opensaml.util.resource.ResourceException

getLastModifiedTime

public org.joda.time.DateTime getLastModifiedTime()
                                           throws org.opensaml.util.resource.ResourceException

Throws:
org.opensaml.util.resource.ResourceException

getLocation

public String getLocation()


getResourceFile

protected File getResourceFile()
                        throws org.opensaml.util.resource.ResourceException
Gets File for the resource.

Returns:
file for the resource
Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem fetching the resource or checking on its status

checkWorkingCopyDirectory

protected void checkWorkingCopyDirectory(File directory)
                                  throws org.opensaml.util.resource.ResourceException
Checks that the given file exists, or can be created, is a directory, and is read/writable by this process.

Parameters:
directory - the directory to check
Throws:
org.opensaml.util.resource.ResourceException - thrown if the file is invalid

checkoutOrUpdateResource

protected void checkoutOrUpdateResource()
                                 throws org.opensaml.util.resource.ResourceException
Checks out the resource specified by the remoteRepository in to the working copy workingCopyDirectory. If the working copy is empty than an SVN checkout is performed if the working copy already exists then an SVN update is performed.

Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem communicating with the remote repository, the revision does not exist, or the working copy is unusable


Copyright © 2006-2011 Internet2. All Rights Reserved.