openlsd.network.server.legacy.LSDPathConstants Class Reference

Collaboration diagram for openlsd.network.server.legacy.LSDPathConstants:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class for static values and functions associated to a Path and for some general static values for the server part.

Author:
Frederic Bregier LGPL

Static Public Member Functions

static long[] pathToIdUnique (String path)
static String computeStringMD5 (File file)
static String computeStringMD5NIO (File file)
static String computeStringMD5NoNIO (File file)
static String computeStringMD5 (CipherInputStream cipherInputStream)
static boolean createDir (String path)
static boolean deleteDir (String path)
static boolean deleteRecursiveDir (String path)
static boolean isDirEmpty (String path)
static boolean isDirRecursiveEmpty (String path)
static String getListOfFiles (IoSession session, LSDMsgAnswear lma, String path)
static String getListOfFilesMD5 (IoSession session, LSDMsgAnswear lma, String path)
static void main (String[]args)

Static Public Attributes

static final int DIHSessionWait = 30000
static final int RKAdmin = 0
static final int RKDel = 1
static final int RKGet = 2
static final int RKGetNA = 3
static final int RKInfo = 4
static final int RKMove = 5
static final int RKPut = 6
static final int RKPutNA = 7
static final int RKPutFile = 8
static final int lsdlevel = 7

Static Protected Member Functions

static String[] idUniqueToStrings (long idUnique)
static LSDStringList listRecursiveFileDir (IoSession session, LSDMsgAnswear lma, File dir, LSDStringList stringList)

Static Protected Attributes

static final int KEY_SIZE = 128
static final int globalPathRank = 0
static final int fileNameRank = 1
static final int pathRank = 2
static final int abstractPathRank = 3

Static Private Member Functions

static boolean deleteRecursiveFileDir (File dir)
static boolean isFileDirRecursiveEmpty (File dir)
static String getListOfFilesInC (IoSession session, LSDMsgAnswear lma, String path)
static String getListOfFilesinJava (IoSession session, LSDMsgAnswear lma, String path)
static LSDStringList listRecursiveFileDirMD5 (IoSession session, LSDMsgAnswear lma, File dirsource, LSDStringList stringList)

Static Private Attributes

static final long nbByDir = 0x100L
static final long nbPByDir = 8
static final long minVal = LSDConstants.minimal_idx
static final long maxVal = LSDConstants.maximal_idx
static final long nullVal = LSDConstants.invalide_idx
static final long baseDir = 0x80000000000000L

Member Function Documentation

static String [] openlsd.network.server.legacy.LSDPathConstants.idUniqueToStrings ( long  idUnique  )  [static, protected]

Constructs the paths

Parameters:
idUnique 
Returns:
the array of String (GlobalPath,Basename,PathwoBasename,AbstractPath)

static long [] openlsd.network.server.legacy.LSDPathConstants.pathToIdUnique ( String  path  )  [static]

Constructs the IDs from path

Parameters:
path 
Returns:
the array of IDs corresponding to the path or null if an error occurs

static String openlsd.network.server.legacy.LSDPathConstants.computeStringMD5 ( File  file  )  [static]

Compute the MD5 in String Hex for the file

Parameters:
file 
Returns:
the MD5 in a String Hex format or NULL if an error occurs

static String openlsd.network.server.legacy.LSDPathConstants.computeStringMD5NIO ( File  file  )  [static]

Compute the MD5 in String Hex for the file

Parameters:
file 
Returns:
the MD5 in a String Hex format or NULL if an error occurs

static String openlsd.network.server.legacy.LSDPathConstants.computeStringMD5NoNIO ( File  file  )  [static]

Compute the MD5 in String Hex for the file

Parameters:
file 
Returns:
the MD5 in a String Hex format or NULL if an error occurs

static String openlsd.network.server.legacy.LSDPathConstants.computeStringMD5 ( CipherInputStream  cipherInputStream  )  [static]

Compute the MD5 in String Hex for the file

Parameters:
cipherInputStream 
Returns:
the MD5 in a String Hex format or NULL if an error occurs

static boolean openlsd.network.server.legacy.LSDPathConstants.createDir ( String  path  )  [static]

Create the directory associated with the String path

Parameters:
path 
Returns:
True if created, False else.

static boolean openlsd.network.server.legacy.LSDPathConstants.deleteDir ( String  path  )  [static]

Delete the directory associated with the path if empty

Parameters:
path 
Returns:
True if deleted, False else.

static boolean openlsd.network.server.legacy.LSDPathConstants.deleteRecursiveDir ( String  path  )  [static]

Delete the directory and its subdirs associated with the path if empty

Parameters:
path 
Returns:
True if deleted, False else.

static boolean openlsd.network.server.legacy.LSDPathConstants.deleteRecursiveFileDir ( File  dir  )  [static, private]

Delete the directory and its subdirs associated with the File dir if empty

Parameters:
dir 
Returns:
True if deleted, False else.

static boolean openlsd.network.server.legacy.LSDPathConstants.isDirEmpty ( String  path  )  [static]

Returns True if the directory is empty, False if not empty or not exist or is not a directory.

Parameters:
path 
Returns:
True if the directory is empty, else False.

static boolean openlsd.network.server.legacy.LSDPathConstants.isDirRecursiveEmpty ( String  path  )  [static]

Returns True if the directory and its subdirs are empty, False if not empty or not exist or is not a directory.

Parameters:
path 
Returns:
True if the directory and its subdirs are empty, else False.

static boolean openlsd.network.server.legacy.LSDPathConstants.isFileDirRecursiveEmpty ( File  dir  )  [static, private]

Returns True if the directory and its subdirs are empty, False if not empty or not exist or is not a directory.

Parameters:
dir 
Returns:
True if the directory and its subdirs are empty, else False.

static String openlsd.network.server.legacy.LSDPathConstants.getListOfFiles ( IoSession  session,
LSDMsgAnswear  lma,
String  path 
) [static]

Get the list of Files under the path. When the number of files is reached, the file list is send as non last message. When it is finished, the caller is responsable to send the last file list.

Parameters:
session 
lma is only use as a source to create a copy
path 
Returns:
the string containing triplet of index lid sid did of all files under the path

static String openlsd.network.server.legacy.LSDPathConstants.getListOfFilesInC ( IoSession  session,
LSDMsgAnswear  lma,
String  path 
) [static, private]

Get the list of Files under the path. When the number of files is reached, the file list is send as non last message. When it is finished, the caller is responsable to send the last file list.

Based on C program. Maybe slower than full JAVA.

Parameters:
session 
lma is only use as a source to create a copy
path 
Returns:
the string containing triplet of index lid sid did of all files under the path

static String openlsd.network.server.legacy.LSDPathConstants.getListOfFilesinJava ( IoSession  session,
LSDMsgAnswear  lma,
String  path 
) [static, private]

Get the list of Files under the path. When the number of files is reached, the file list is send as non last message. When it is finished, the caller is responsable to send the last file list.

Parameters:
session 
lma is only use as a source to create a copy
path 
Returns:
the string containing triplet of index lid sid did of all files under the path

static LSDStringList openlsd.network.server.legacy.LSDPathConstants.listRecursiveFileDir ( IoSession  session,
LSDMsgAnswear  lma,
File  dir,
LSDStringList  stringList 
) [static, protected]

Get recursively th list of files in the StringBuilder from the dir. When the maximum number of files is reached (LSDConstants.MAXIMUM_FILELIST), the file list is send as non last message. When it is finished, the caller is responsable to send the last file list. Used a recursive version.

Parameters:
session 
lma is only use as a source to create a copy
dir 
stringList 
Returns:
the LSDStringList which contains the StringBuilder with the list of file (sid did) and the number of files

static String openlsd.network.server.legacy.LSDPathConstants.getListOfFilesMD5 ( IoSession  session,
LSDMsgAnswear  lma,
String  path 
) [static]

Get the list of Files under the path. When the number of files is reached, the file list is send as non last message. When it is finished, the caller is responsable to send the last file list.

Parameters:
session 
lma is only use as a source to create a copy
path 
Returns:
the string containing triplet of index lid sid did of all files under the path and the associated MD5.

static LSDStringList openlsd.network.server.legacy.LSDPathConstants.listRecursiveFileDirMD5 ( IoSession  session,
LSDMsgAnswear  lma,
File  dirsource,
LSDStringList  stringList 
) [static, private]

Get the list of files in the StringBuilder from the dir and recursively. When the maximum number of files is reached (LSDConstants.MAXIMUM_FILELIST), the file list is send as non last message. When it is finished, the caller is responsable to send the last file list. This version does used a recursive algorithm.

Parameters:
session 
lma is only use as a source to create a copy
dirsource 
stringList 
Returns:
the LSDStringList which contains the StringBuilder with the list of file (sid did md5) and the number of files

static void openlsd.network.server.legacy.LSDPathConstants.main ( String[]  args  )  [static]

Function to test the path functions

Parameters:
args is ignored


Member Data Documentation

Default time in ms to wait in DIHSessionWait

Identifiant for handler Admin

Identifiant for handler Del

Identifiant for handler Get

Identifiant for handler GetNA

Identifiant for handler Info

Identifiant for handler Move

Identifiant for handler Put

Identifiant for handler PutNA

Identifiant for handler PutFile

Default max level of storage (7)

final long openlsd.network.server.legacy.LSDPathConstants.nbByDir = 0x100L [static, private]

Default number of files/directory by level

Default number of files/directory by level in power of 2

Min Value

Max Value

Invalid Value

final long openlsd.network.server.legacy.LSDPathConstants.baseDir = 0x80000000000000L [static, private]

Value to add to move base from negative values to 0 (MAX+1-MIN)/2/nbByDir 2^63-1+1-(-2^63) / 2 /nbByDir= 2^63 / nbByDir = 2^55

final int openlsd.network.server.legacy.LSDPathConstants.KEY_SIZE = 128 [static, protected]

Number of bit for the crypto key [32..448]

Full Relative Path index

Basename of the full Path

Full Relative path except the basename

Full Relative Path for extraction using '_' as separator


The documentation for this class was generated from the following file: