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:

All operations operate on the local working copy.

Since:
1.1

Constructor Summary
SVNResource(String remote, String local, long revision)
          Constructor.
SVNResource(String remote, String local, long revision, String username, String password)
          Constructor.
 
Method Summary
protected  void checkoutOrUpdateResource()
          Checks out of updates the local resource.
protected  void checkoutResource()
          Checks out the remote resource and stores it locally.
 boolean exists()
          
 InputStream getInputStream()
          
 org.joda.time.DateTime getLastModifiedTime()
          
 String getLocation()
          
protected  org.tmatesoft.svn.core.wc.SVNStatus getResourceStatus()
          Gets the current status of the resource.
protected  void updateResource()
          Updates the current local working copy, replacing it with the revision from the remote repository.
protected  boolean workingCopyExists()
          Checks to see if a working copy of the file already exists.
 
Methods inherited from class org.opensaml.util.resource.AbstractFilteredResource
getResourceFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SVNResource

public SVNResource(String remote,
                   String local,
                   long revision)
Constructor.

Parameters:
remote - URL of the remote resource
local - file path to where the local working copy will be kept
revision - revision of the resource to retrieve or -1 for HEAD revision

SVNResource

public SVNResource(String remote,
                   String local,
                   long revision,
                   String username,
                   String password)
Constructor.

Parameters:
remote - URL of the remote resource
local - file path to where the local working copy will be kept
revision - revision of the resource to retrieve or -1 for HEAD revision
username - username used to authenticate to the remote server
password - password used to authenticate to the remote server
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()


workingCopyExists

protected boolean workingCopyExists()
Checks to see if a working copy of the file already exists.

Returns:
true if a working copy of the file exists, false if not

checkoutOrUpdateResource

protected void checkoutOrUpdateResource()
                                 throws org.opensaml.util.resource.ResourceException
Checks out of updates the local resource. Checkout is used of the local resource does not currently exist. An update is performed if the local working copy revision does not match the configured revision. If the configured version is the symbolic version HEAD then an update occurs if the current revision is not the most recent revision within the remote repository.

Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem communicating with the remote or local repository

getResourceStatus

protected org.tmatesoft.svn.core.wc.SVNStatus getResourceStatus()
                                                         throws org.opensaml.util.resource.ResourceException
Gets the current status of the resource.

Returns:
current status of the resource
Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem communicating with the remote or local repository

checkoutResource

protected void checkoutResource()
                         throws org.opensaml.util.resource.ResourceException
Checks out the remote resource and stores it locally.

Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem communicating with the remote or local repository

updateResource

protected void updateResource()
                       throws org.opensaml.util.resource.ResourceException
Updates the current local working copy, replacing it with the revision from the remote repository.

Throws:
org.opensaml.util.resource.ResourceException - thrown if there is a problem communicating with the remote or local repository


Copyright © 2006-2008 Internet2. All Rights Reserved.