Module net.shibboleth.ext.spring
Class RunnableFileSystemResource
- java.lang.Object
-
- org.springframework.core.io.AbstractResource
-
- org.springframework.core.io.FileSystemResource
-
- net.shibboleth.ext.spring.resource.RunnableFileSystemResource
-
- All Implemented Interfaces:
Resource,InputStreamSource,Resource,WritableResource
public class RunnableFileSystemResource extends FileSystemResource implements Resource, Resource
A file backed resource which calls out to a providedRunnableas appropriate such that the resource becomes reloadable.
-
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogThe log.private StringthePrefixLog prefix.private RunnabletheRunnableWhat to run at the appropriate time.
-
Constructor Summary
Constructors Constructor Description RunnableFileSystemResource(File file, Runnable runnable)Constructor.RunnableFileSystemResource(String path, Runnable runnable)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcallRunnable()Call the runnable and catch every event thrown.RunnableFileSystemResourcecreateRelativeResource(String relativePath)booleanexists()InputStreamgetInputStream()longlastModified()-
Methods inherited from class org.springframework.core.io.FileSystemResource
contentLength, createRelative, equals, getDescription, getFile, getFilename, getOutputStream, getPath, getURI, getURL, hashCode, isFile, isReadable, isWritable, readableChannel, writableChannel
-
Methods inherited from class org.springframework.core.io.AbstractResource
getFileForLastModifiedCheck, isOpen, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.shibboleth.utilities.java.support.resource.Resource
contentLength, getDescription, getFile, getFilename, getURI, getURL, isOpen, isReadable
-
Methods inherited from interface org.springframework.core.io.Resource
contentLength, createRelative, getDescription, getFile, getFilename, getURI, getURL, isFile, isOpen, isReadable, readableChannel
-
-
-
-
Constructor Detail
-
RunnableFileSystemResource
public RunnableFileSystemResource(@Nonnull @ParameterName(name="file") File file, @Nonnull @ParameterName(name="runnable") Runnable runnable)
Constructor.- Parameters:
file- The file to back.runnable- aRunnableto call at appropriate times
-
RunnableFileSystemResource
public RunnableFileSystemResource(@Nonnull @NotEmpty @ParameterName(name="path") String path, @Nonnull @ParameterName(name="runnable") Runnable runnable)
Constructor.- Parameters:
path- the path to the file to look at.runnable- aRunnableto call at appropriate times
-
-
Method Detail
-
createRelativeResource
public RunnableFileSystemResource createRelativeResource(String relativePath) throws IOException
- Specified by:
createRelativeResourcein interfaceResource- Throws:
IOException
-
exists
public boolean exists()
-
getInputStream
@Nonnull public InputStream getInputStream() throws IOException
- Specified by:
getInputStreamin interfaceInputStreamSource- Specified by:
getInputStreamin interfaceResource- Overrides:
getInputStreamin classFileSystemResource- Throws:
IOException
-
lastModified
public long lastModified() throws IOException- Specified by:
lastModifiedin interfaceResource- Specified by:
lastModifiedin interfaceResource- Overrides:
lastModifiedin classFileSystemResource- Throws:
IOException
-
callRunnable
protected void callRunnable() throws IOExceptionCall the runnable and catch every event thrown.- Throws:
IOException- if anything bad happens
-
-