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 Object
implements AgentFileStreamService.AgentFileResource
Implementation of
Resource for 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 Summary
Modifier and TypeMethodDescriptionlongorg.springframework.core.io.ResourcecreateRelative(String relativePath) booleanexists()forAgentFile(URI uri, long size, Instant lastModifiedTime, Path relativePath, String jobId, InputStream inputStream) Factory method to create a resource for a remote file.static AgentFileResourceImplFactory method to create a placeholder resource for a remote file that does not exist.getFile()getURI()getURL()booleanisOpen()longMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.core.io.Resource
isFile, isReadable, readableChannel
-
Method Details
-
forNonExistingResource
Factory method to create a placeholder resource for a remote file that does not exist.- Returns:
- a
AgentFileStreamService.AgentFileResource
-
forAgentFile
public static AgentFileStreamService.AgentFileResource forAgentFile(URI uri, long size, Instant lastModifiedTime, Path relativePath, String jobId, InputStream inputStream) Factory method to create a resource for a remote file.- Parameters:
uri- the resource URIsize- the size of the file, as per latest manifestlastModifiedTime- the last modification time, as per latest manifestrelativePath- the path of the file relative to the root of the job directoryjobId- the id of the job this file belongs toinputStream- the input stream to read this file content- Returns:
- a
AgentFileStreamService.AgentFileResource
-
exists
public boolean exists()- Specified by:
existsin interfaceorg.springframework.core.io.Resource
-
isOpen
public boolean isOpen()- Specified by:
isOpenin interfaceorg.springframework.core.io.Resource
-
getURL
- Specified by:
getURLin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getURI
- Specified by:
getURIin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getFile
- Specified by:
getFilein interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
contentLength
- Specified by:
contentLengthin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
lastModified
- Specified by:
lastModifiedin interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
createRelative
- Specified by:
createRelativein interfaceorg.springframework.core.io.Resource- Throws:
IOException
-
getFilename
- Specified by:
getFilenamein interfaceorg.springframework.core.io.Resource
-
getDescription
- Specified by:
getDescriptionin interfaceorg.springframework.core.io.Resource
-
getInputStream
- Specified by:
getInputStreamin interfaceorg.springframework.core.io.InputStreamSource- Throws:
IOException
-