public class FileTemplate extends Object implements org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
| Constructor and Description |
|---|
FileTemplate(org.lokra.seaweedfs.core.Connection connection)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
void |
deleteFile(String fileId)
Delete file.
|
void |
deleteFiles(ArrayList<String> fileIds)
Delete files.
|
void |
destroy() |
String |
getCollection() |
String |
getDataCenter() |
int |
getDiffDataCenterCount() |
int |
getDiffRackCount() |
FileHandleStatus |
getFileStatus(String fileId)
Get file status without file stream.
|
StreamResponse |
getFileStream(String fileId)
Get file stream, this is the faster method to get file stream from server.
|
String |
getFileUrl(String fileId)
Get file url, could get file directly from coinstack-storage volume server.
|
int |
getSameRackCount() |
StampResult |
getStamp(String fileId)
Get stamp information from coinstack.
|
String |
getTimeToLive() |
boolean |
isLoadBalance() |
boolean |
isUsingPublicUrl() |
FileHandleStatus |
saveFileByStream(String fileName,
InputStream stream)
Save a file.
|
FileHandleStatus |
saveFileByStream(String fileName,
InputStream stream,
org.apache.http.entity.ContentType contentType)
Save a file.
|
LinkedHashMap<String,FileHandleStatus> |
saveFilesByStreamMap(LinkedHashMap<String,InputStream> streamMap)
Save files by stream map.
|
LinkedHashMap<String,FileHandleStatus> |
saveFilesByStreamMap(LinkedHashMap<String,InputStream> streamMap,
org.apache.http.entity.ContentType contentType)
Save files by stream map.
|
void |
setCollection(String collection) |
void |
setDataCenter(String dataCenter) |
void |
setDiffDataCenterCount(int diffDataCenterCount) |
void |
setDiffRackCount(int diffRackCount) |
void |
setLoadBalance(boolean loadBalance) |
void |
setSameRackCount(int sameRackCount) |
void |
setTimeToLive(String timeToLive) |
void |
setUsingPublicUrl(boolean usingPublicUrl) |
FileHandleStatus |
updateFileByStream(String fileId,
String fileName,
InputStream stream)
Update file, if file id is not exist, it wouldn't throw any exception.
|
FileHandleStatus |
updateFileByStream(String fileId,
String fileName,
InputStream stream,
org.apache.http.entity.ContentType contentType)
Update file, if file id is not exist, it wouldn't throw any exception.
|
VerifyFileResult |
verifyFile(String fileId)
Verify File Data with coinstack.
|
public FileTemplate(org.lokra.seaweedfs.core.Connection connection)
connection - Connection from file source.public FileHandleStatus saveFileByStream(String fileName, InputStream stream) throws IOException
fileName - File name, that can be gzipped based on the file name extension and zip it.stream - File stream.IOException - Http connection is fail or server response within some error message.public FileHandleStatus saveFileByStream(String fileName, InputStream stream, org.apache.http.entity.ContentType contentType) throws IOException
fileName - File name, that can be gzipped based on the file name extension and zip it.stream - File stream.contentType - File content type.IOException - Http connection is fail or server response within some error message.public LinkedHashMap<String,FileHandleStatus> saveFilesByStreamMap(LinkedHashMap<String,InputStream> streamMap) throws IOException
streamMap - Map of file name and file stream.IOException - Http connection is fail or server response within some error message.public LinkedHashMap<String,FileHandleStatus> saveFilesByStreamMap(LinkedHashMap<String,InputStream> streamMap, org.apache.http.entity.ContentType contentType) throws IOException
streamMap - Map of file name and file stream.contentType - File content type.IOException - Http connection is fail or server response within some error message.public void deleteFile(String fileId) throws IOException
fileId - File id whatever file is not exist.IOException - Http connection is fail or server response within some error message.public void deleteFiles(ArrayList<String> fileIds) throws IOException
fileIds - File id list whatever file is not exist.IOException - Http connection is fail or server response within some error message.public FileHandleStatus updateFileByStream(String fileId, String fileName, InputStream stream, org.apache.http.entity.ContentType contentType) throws IOException
fileId - File id whatever it is not exist.fileName - File name.stream - File stream.contentType - File content type.IOException - Http connection is fail or server response within some error message.public FileHandleStatus updateFileByStream(String fileId, String fileName, InputStream stream) throws IOException
fileId - File id whatever it is not exist.fileName - File name.stream - File stream.IOException - Http connection is fail or server response within some error message.public StreamResponse getFileStream(String fileId) throws IOException
fileId - File id.IOException - Http connection is fail or server response within some error message.public FileHandleStatus getFileStatus(String fileId) throws IOException
fileId - File id.IOException - Http connection is fail or server response within some error message.public VerifyFileResult verifyFile(String fileId) throws IOException
fileId - File id.IOException - Http connection is fail or server response within some error message.public StampResult getStamp(String fileId) throws IOException
fileId - File id.IOException - Http connection is fail or server response within some error message.public String getFileUrl(String fileId) throws IOException
fileId - File id.IOException - Http connection is fail or server response within some error message.public int getSameRackCount()
public void setSameRackCount(int sameRackCount)
public int getDiffRackCount()
public void setDiffRackCount(int diffRackCount)
public int getDiffDataCenterCount()
public void setDiffDataCenterCount(int diffDataCenterCount)
public String getTimeToLive()
public void setTimeToLive(String timeToLive)
public String getDataCenter()
public void setDataCenter(String dataCenter)
public String getCollection()
public void setCollection(String collection)
public boolean isUsingPublicUrl()
public void setUsingPublicUrl(boolean usingPublicUrl)
public boolean isLoadBalance()
public void setLoadBalance(boolean loadBalance)
public void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionCopyright © 2017 Blocko Inc.. All rights reserved.