public class SVNResource extends net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent implements Resource, BeanNameAware, InitializingBean, net.shibboleth.utilities.java.support.resource.Resource
Resource that communications with a Subversion server (via a spool directory).
This resource will fetch the given resource as follows:
SVNResource operating on the same local copy are undefined.| Modifier and Type | Class and Description |
|---|---|
private class |
SVNResource.SVNStatusHandler
Simple
ISVNStatusHandler implementation that just stores and returns the status. |
| Modifier and Type | Field and Description |
|---|---|
private org.tmatesoft.svn.core.wc.SVNClientManager |
clientManager
SVN Client manager.
|
private DateTime |
lastModified
Time the resource file was last modified.
|
private Logger |
log
Class logger.
|
private org.tmatesoft.svn.core.SVNURL |
remoteRepository
URL to the remote repository.
|
private String |
resourceFileName
File, within the working copy, represented by this resource.
|
private org.tmatesoft.svn.core.wc.SVNRevision |
retrievalRevision
Revision of the working copy.
|
private File |
workingCopyDirectory
Directory where the working copy will be kept.
|
| Constructor and Description |
|---|
SVNResource(org.tmatesoft.svn.core.wc.SVNClientManager svnClientMgr,
org.tmatesoft.svn.core.SVNURL repositoryUrl,
File workingCopy,
long workingRevision,
String resourceFile)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected void |
checkoutOrUpdateResource()
Checks out the resource specified by the
remoteRepository in to the working copy
workingCopyDirectory. |
private org.tmatesoft.svn.core.wc.SVNRevision |
checkoutResourceDirectory()
Fetches the content from the SVN repository and creates the local working copy.
|
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.
|
long |
contentLength() |
Resource |
createRelative(String relativePath) |
net.shibboleth.utilities.java.support.resource.Resource |
createRelativeResource(String relativePath) |
boolean |
exists() |
String |
getDescription() |
File |
getFile() |
String |
getFilename() |
protected String |
getFullPath()
Helper function to generate the full path for injecting into URLs and URIs.
|
InputStream |
getInputStream() |
private DateTime |
getLastModificationForRevision(org.tmatesoft.svn.core.wc.SVNRevision revision)
Gets the last modified time for the given revision.
|
protected String |
getProtocol()
Helper function to return a complex scheme - a conjunction of 'svn' and the underlying protocol.
|
URI |
getURI() |
URL |
getURL() |
boolean |
isOpen()
Our stream can be read multiple times.
|
boolean |
isReadable()
We always say yes.
|
long |
lastModified() |
void |
setBeanName(String name) |
void |
setFilename(String fileName)
Set the resourceFileName.
|
private org.tmatesoft.svn.core.wc.SVNRevision |
updateResourceDirectory()
Updates an existing local working copy from the repository.
|
private boolean |
workingCopyDirectoryExists()
Checks to see if the working copy directory exists.
|
doInitialize, getId, setIdprivate final Logger log
@Nonnull private final org.tmatesoft.svn.core.wc.SVNClientManager clientManager
@Nonnull private org.tmatesoft.svn.core.SVNURL remoteRepository
@Nonnull private File workingCopyDirectory
private org.tmatesoft.svn.core.wc.SVNRevision retrievalRevision
private String resourceFileName
private DateTime lastModified
public SVNResource(@Nonnull@ParameterName(name="svnClientMgr") org.tmatesoft.svn.core.wc.SVNClientManager svnClientMgr, @Nonnull@ParameterName(name="repositoryUrl") org.tmatesoft.svn.core.SVNURL repositoryUrl, @Nonnull@ParameterName(name="workingCopy") File workingCopy, @ParameterName(name="workingRevision") long workingRevision, @Nonnull@ParameterName(name="resourceFile") String resourceFile)
svnClientMgr - manager used to create SVN clientsrepositoryUrl - URL of the remote repositoryworkingCopy - directory that will serve as the root of the local working copyworkingRevision - revision of the resource to retrieve or -1 for HEAD revisionresourceFile - file, within the working copy, represented by this resourceBeanCreationException - thrown if there is a problem initializing the SVN resourcepublic String getFilename()
getFilename in interface net.shibboleth.utilities.java.support.resource.Resourcepublic void setFilename(@Nonnull String fileName)
fileName - the nameprotected String getFullPath()
protected String getProtocol()
protected void checkWorkingCopyDirectory(@Nonnull File directory) throws IOException
directory - the directory to checkIOException - thrown if the file is invalidprotected void checkoutOrUpdateResource()
throws IOException
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.IOException - thrown if there is a problem communicating with the remote repository, the revision does not
exist, or the working copy is unusableprivate boolean workingCopyDirectoryExists()
private org.tmatesoft.svn.core.wc.SVNRevision checkoutResourceDirectory()
throws IOException
IOException - thrown if there is a problem checking out the content from the repositoryprivate DateTime getLastModificationForRevision(org.tmatesoft.svn.core.wc.SVNRevision revision) throws IOException
revision - revision to get the last modified date forIOException - thrown if there is a problem getting the last modified timeprivate org.tmatesoft.svn.core.wc.SVNRevision updateResourceDirectory()
throws IOException
IOException - thrown if there is a problem updating the working copypublic InputStream getInputStream() throws IOException
getInputStream in interface net.shibboleth.utilities.java.support.resource.ResourcegetInputStream in interface InputStreamSourceIOExceptionpublic boolean exists()
exists in interface net.shibboleth.utilities.java.support.resource.Resourcepublic boolean isReadable()
isReadable in interface net.shibboleth.utilities.java.support.resource.Resourcepublic boolean isOpen()
isOpen in interface net.shibboleth.utilities.java.support.resource.Resourcepublic URL getURL() throws IOException
getURL in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic URI getURI() throws IOException
getURI in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic File getFile() throws IOException
getFile in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic long contentLength()
throws IOException
contentLength in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic long lastModified()
throws IOException
lastModified in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic Resource createRelative(String relativePath) throws IOException
IOExceptionpublic net.shibboleth.utilities.java.support.resource.Resource createRelativeResource(String relativePath) throws IOException
createRelativeResource in interface net.shibboleth.utilities.java.support.resource.ResourceIOExceptionpublic String getDescription()
getDescription in interface net.shibboleth.utilities.java.support.resource.Resourcepublic void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface InitializingBeanExceptionpublic void setBeanName(String name)
setBeanName in interface BeanNameAwareCopyright © 1999–2016 Shibboleth Consortium. All rights reserved.