Class AgentFileResourceImpl
- java.lang.Object
- 
- com.netflix.genie.web.agent.resources.AgentFileResourceImpl
 
- 
- All Implemented Interfaces:
- AgentFileStreamService.AgentFileResource,- org.springframework.core.io.InputStreamSource,- org.springframework.core.io.Resource
 
 public final class AgentFileResourceImpl extends java.lang.Object implements AgentFileStreamService.AgentFileResource Implementation ofResourcefor files local to an agent running a job that can be requested and streamed to the server (so they can be served via API).- Since:
- 4.0.0
 
- 
- 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description longcontentLength()org.springframework.core.io.ResourcecreateRelative(java.lang.String relativePath)booleanexists()static AgentFileStreamService.AgentFileResourceforAgentFile(java.net.URI uri, long size, java.time.Instant lastModifiedTime, java.nio.file.Path relativePath, java.lang.String jobId, java.io.InputStream inputStream)Factory method to create a resource for a remote file.static AgentFileResourceImplforNonExistingResource()Factory method to create a placeholder resource for a remote file that does not exist.java.lang.StringgetDescription()java.io.FilegetFile()java.lang.StringgetFilename()java.io.InputStreamgetInputStream()java.net.URIgetURI()java.net.URLgetURL()booleanisOpen()longlastModified()
 
- 
- 
- 
Method Detail- 
forNonExistingResourcepublic static AgentFileResourceImpl forNonExistingResource() Factory method to create a placeholder resource for a remote file that does not exist.- Returns:
- a AgentFileStreamService.AgentFileResource
 
 - 
forAgentFilepublic static AgentFileStreamService.AgentFileResource forAgentFile(java.net.URI uri, long size, java.time.Instant lastModifiedTime, java.nio.file.Path relativePath, java.lang.String jobId, java.io.InputStream inputStream) Factory method to create a resource for a remote file.- Parameters:
- uri- the resource URI
- size- the size of the file, as per latest manifest
- lastModifiedTime- the last modification time, as per latest manifest
- relativePath- the path of the file relative to the root of the job directory
- jobId- the id of the job this file belongs to
- inputStream- the input stream to read this file content
- Returns:
- a AgentFileStreamService.AgentFileResource
 
 - 
existspublic boolean exists() - Specified by:
- existsin interface- org.springframework.core.io.Resource
 
 - 
isOpenpublic boolean isOpen() - Specified by:
- isOpenin interface- org.springframework.core.io.Resource
 
 - 
getURLpublic java.net.URL getURL() throws java.io.IOException- Specified by:
- getURLin interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
getURIpublic java.net.URI getURI() throws java.io.IOException- Specified by:
- getURIin interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
getFilepublic java.io.File getFile() throws java.io.IOException- Specified by:
- getFilein interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
contentLengthpublic long contentLength() throws java.io.IOException- Specified by:
- contentLengthin interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
lastModifiedpublic long lastModified() throws java.io.IOException- Specified by:
- lastModifiedin interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
createRelativepublic org.springframework.core.io.Resource createRelative(java.lang.String relativePath) throws java.io.IOException- Specified by:
- createRelativein interface- org.springframework.core.io.Resource
- Throws:
- java.io.IOException
 
 - 
getFilenamepublic java.lang.String getFilename() - Specified by:
- getFilenamein interface- org.springframework.core.io.Resource
 
 - 
getDescriptionpublic java.lang.String getDescription() - Specified by:
- getDescriptionin interface- org.springframework.core.io.Resource
 
 - 
getInputStreampublic java.io.InputStream getInputStream() throws java.io.IOException- Specified by:
- getInputStreamin interface- org.springframework.core.io.InputStreamSource
- Throws:
- java.io.IOException
 
 
- 
 
-