|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectopenlsd.network.server.legacy.LSDLegacy
public class LSDLegacy
LSDDbLegacy is the class that defines one particular set of Storages with equals properties on each (crypted or not, same key for crypto, same size, ...).
| Field Summary | |
|---|---|
boolean |
is_stopped
Is this Legacy running or not ? |
protected boolean |
isCrypted
This storage is in Crypted mode |
| Constructor Summary | |
|---|---|
LSDLegacy(java.lang.String sNameLID,
long lid,
boolean iscrypted,
byte[] key,
java.lang.String basepath,
java.lang.String outbase,
long size)
New LSDDbLegacy from parameters. |
|
| Method Summary | |
|---|---|
boolean |
createDir()
Force the creation of the basepath |
boolean |
createDir(long sid)
Force the creation of the basepath down to the storage with the given sid. |
boolean |
createDirOut()
Create the base Out Path |
boolean |
deleteDir(boolean recursive)
Delete the basepath (if not empty) |
boolean |
deleteDir(long sid,
boolean recursive)
Delete the basepath down to the storage with the given sid (if not empty) |
boolean |
deleteDirOut()
Delete the base Out Path if not empty |
byte[] |
get(long sid,
long did)
Get the full file in one array of byte (limited to 2^32 bytes). |
java.lang.String |
getBasePath()
Return the base path of this Legacy |
byte[] |
getBlock(LSDDocument document,
int sizeblock)
Get a block of the file associated with the LSDDocument argument from the same Legacy. |
LSDDocument |
getDocument(long sid,
long did)
Returns the LSDDocument object associated with the current Legacy lid, Storage sid, Document did |
LSDCrypto |
getFileCrypto()
Get the fileCrypto |
java.lang.String |
getInPath(long sid,
long did)
Get the the full path to access to a copy of the file in the base out path defined for this Legacy. |
long |
getLID()
Get the LID |
java.lang.String |
getName()
Get the name of the Legacy |
java.lang.String |
getOutPath()
Return the base Out path of this Legacy |
protected byte[] |
getSecretkey()
Get the sercretkey |
long |
getSize()
Get the max size of one Storage from this Legacy. |
boolean |
isDirEmpty(boolean recursive)
Returns True if the basepath is empty. |
boolean |
isDirEmpty(long sid,
boolean recursive)
Returns True if the basepath down to the storage with the given sid is empty. |
boolean |
isDirOutEmpty()
Returns True if the base out path is empty. |
boolean |
move(long sid,
long did,
long sidnew,
long didnew)
Move one document in the same Legacy from one couple sid/did to another couple sidnew/didnew |
boolean |
move(long sid,
long did,
LSDDocument newdoc)
Move one document from this Legacy (sid/did) to another document (newdoc) that can be outside the current Legacy. |
LSDDocument |
moveToDocument(long sid,
long did,
long sidnew,
long didnew)
Same as move(sid,did,sidnew,didnew) but returning the new LSDDocument associated to the new place of the document or null in case of error. |
long |
put(java.nio.channels.FileChannel fileChannelIn,
long sid,
long did)
Put a file from the fileChannelIn in the Storage (sid) and Document (did). |
long |
put(java.lang.String fileName,
LSDDocument doc)
Put a file from the filename in the Document. |
boolean |
putBlock(byte[] bytes,
LSDDocument document,
boolean lastblock)
Put a block of file from the array of byte to the document associated with the LSDDocument argument from the same Legacy. |
int |
remove(long sid,
long did,
java.lang.String shash)
Remove the physical file associated with this Storade sid and Document did if the hash String is the correct one. |
void |
setOutPath(java.lang.String outPath)
Set a new base out Path |
boolean |
start()
Start this Legacy (put and delete allowed). |
boolean |
stop()
Stop this Legacy (put and delete not allowed). |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected boolean isCrypted
public boolean is_stopped
| Constructor Detail |
|---|
public LSDLegacy(java.lang.String sNameLID,
long lid,
boolean iscrypted,
byte[] key,
java.lang.String basepath,
java.lang.String outbase,
long size)
throws java.lang.Exception
sNameLID - : logical name of this Legacylid - : unique id of the Legacyiscrypted - : status crypto for this Legacykey - : the key if crypted or nullbasepath - : the basepath for this Legacyoutbase - : the basepath for the export/extraction for this Legacysize - : the max size of each Storage in the Set of this Legacy
java.lang.Exception - if one value is incorrect| Method Detail |
|---|
public java.lang.String getBasePath()
public java.lang.String getOutPath()
public void setOutPath(java.lang.String outPath)
outPath - public boolean createDir()
public boolean createDir(long sid)
sid -
public boolean deleteDir(boolean recursive)
recursive - if the operation must be done recursively
public boolean deleteDir(long sid,
boolean recursive)
sid - recursive - if the operation must be done recursively
public boolean isDirEmpty(boolean recursive)
recursive - if the operation must be done recursively
public boolean isDirEmpty(long sid,
boolean recursive)
sid - recursive - if the operation must be done recursively
public boolean createDirOut()
public boolean deleteDirOut()
public boolean isDirOutEmpty()
public boolean stop()
public boolean start()
public long put(java.lang.String fileName,
LSDDocument doc)
fileName - doc -
public long put(java.nio.channels.FileChannel fileChannelIn,
long sid,
long did)
fileChannelIn - sid - did -
public boolean putBlock(byte[] bytes,
LSDDocument document,
boolean lastblock)
bytes - array of byte added to the corresponding documentdocument - LSDDocument from the same Legacylastblock - Says if this is the last block
public byte[] getBlock(LSDDocument document,
int sizeblock)
document - LSDDocument from the same Legacysizeblock - Size of block to read
public byte[] get(long sid,
long did)
sid - Storage iddid - Document id
public java.lang.String getInPath(long sid,
long did)
sid - Storage iddid - Document id
public int remove(long sid,
long did,
java.lang.String shash)
sid - Storage iddid - Document idshash -
public LSDDocument getDocument(long sid,
long did)
sid - Storage iddid - Document id
public boolean move(long sid,
long did,
long sidnew,
long didnew)
sid - Storage id sourcedid - Document id sourcesidnew - Storage id destinationdidnew - Document id destination
public boolean move(long sid,
long did,
LSDDocument newdoc)
sid - Storage id sourcedid - Document id sourcenewdoc - LSDDocument as destination
public LSDDocument moveToDocument(long sid,
long did,
long sidnew,
long didnew)
sid - Storage id sourcedid - Document id sourcesidnew - Storage id destinationdidnew - Document id destination
public java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public LSDCrypto getFileCrypto()
protected byte[] getSecretkey()
public long getLID()
public long getSize()
public java.lang.String getName()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||