Class FileManagerServiceImpl
- java.lang.Object
-
- com.github.akurilov.commons.concurrent.AsyncRunnableBase
-
- com.emc.mongoose.base.svc.ServiceBase
-
- com.emc.mongoose.base.load.step.service.file.FileManagerServiceImpl
-
- All Implemented Interfaces:
FileManager,FileManagerService,Service,com.github.akurilov.commons.concurrent.AsyncRunnable,java.lang.AutoCloseable,java.rmi.Remote
public final class FileManagerServiceImpl extends ServiceBase implements FileManagerService
-
-
Field Summary
-
Fields inherited from class com.emc.mongoose.base.svc.ServiceBase
port
-
Fields inherited from interface com.emc.mongoose.base.load.step.file.FileManager
APPEND_OPEN_OPTIONS, EMPTY, INSTANCE, READ_OPTIONS, TMP_DIR, WRITE_OPEN_OPTIONS
-
Fields inherited from interface com.emc.mongoose.base.load.step.service.file.FileManagerService
SVC_NAME
-
-
Constructor Summary
Constructors Constructor Description FileManagerServiceImpl(int port)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteFile(java.lang.String fileName)protected voiddoStart()longfileSize(java.lang.String fileName)java.lang.StringlogFileName(java.lang.String loggerName, java.lang.String testStepId)Determine the file name for the given logger and step id pairjava.lang.Stringname()java.lang.StringnewTmpFileName()Generate the temporary file namebyte[]readFromFile(java.lang.String fileName, long offset)Read the next batch of bytes from the remote filevoidtruncateFile(java.lang.String fileName, long size)voidwriteToFile(java.lang.String fileName, byte[] buff)Write some bytes to the remote file.-
Methods inherited from class com.emc.mongoose.base.svc.ServiceBase
doShutdown, doStop, registryPort
-
Methods inherited from class com.github.akurilov.commons.concurrent.AsyncRunnableBase
await, await, close, doClose, isClosed, isInitial, isShutdown, isStarted, isStopped, shutdown, start, state, stop
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.akurilov.commons.concurrent.AsyncRunnable
await, await, close, isClosed, isInitial, isShutdown, isStarted, isStopped, shutdown, start, state, stop
-
Methods inherited from interface com.emc.mongoose.base.svc.Service
registryPort
-
-
-
-
Method Detail
-
doStart
protected final void doStart()
- Overrides:
doStartin classServiceBase
-
logFileName
public final java.lang.String logFileName(java.lang.String loggerName, java.lang.String testStepId) throws java.io.IOExceptionDescription copied from interface:FileManagerDetermine the file name for the given logger and step id pair- Specified by:
logFileNamein interfaceFileManager- Returns:
- the file name
- Throws:
java.io.IOException
-
newTmpFileName
public final java.lang.String newTmpFileName() throws java.io.IOExceptionDescription copied from interface:FileManagerGenerate the temporary file name- Specified by:
newTmpFileNamein interfaceFileManager- Returns:
- the temporary file name
- Throws:
java.io.IOException
-
readFromFile
public final byte[] readFromFile(java.lang.String fileName, long offset) throws java.io.IOExceptionDescription copied from interface:FileManagerRead the next batch of bytes from the remote file- Specified by:
readFromFilein interfaceFileManager- Returns:
- The bytes been read, may return empty buffer in case of EOF
- Throws:
java.io.EOFException- if end of file is reachedjava.io.IOException
-
writeToFile
public final void writeToFile(java.lang.String fileName, byte[] buff) throws java.io.IOExceptionDescription copied from interface:FileManagerWrite some bytes to the remote file. Blocks until all the bytes are written.- Specified by:
writeToFilein interfaceFileManagerbuff- the bytes to write to the remote file another IOException- Throws:
java.io.IOException
-
fileSize
public final long fileSize(java.lang.String fileName) throws java.io.IOException- Specified by:
fileSizein interfaceFileManager- Throws:
java.io.IOException
-
truncateFile
public final void truncateFile(java.lang.String fileName, long size) throws java.io.IOException- Specified by:
truncateFilein interfaceFileManager- Throws:
java.io.IOException
-
deleteFile
public final void deleteFile(java.lang.String fileName) throws java.io.IOException- Specified by:
deleteFilein interfaceFileManager- Throws:
java.io.IOException
-
-