openlsd.common
Class LSDConstants

java.lang.Object
  extended by openlsd.common.LSDConstants

public class LSDConstants
extends java.lang.Object

Global Constants for Client and Server. Some are static final, some are static only.

Author:
Frederic Bregier LGPL

Field Summary
static int BACKLOG
          Queue length of ServerSocket (Acceptor) (Backlog)
static int BLOCKSIZE
          Size by default of block size for receive/sending files.
static int BUFFERSIZEDEFAULT
          Default size for buffers (NIO)
static java.lang.String BUSINESSCLASSNAME
          LSDBusinessImpl full class name
static int CLIENT_INSTANCE_THREAD
          Default number of instance for Client (different than Thread in Mina Pool)
static int CLIENT_THREAD
          Default number of threads in pool for Client (Mina's pool)
static boolean DEBUG
          Mode debug: very verbose if logging enabled
static double DSIZEBLOCKFS
          Size of one block in the filesystem (double version): could be later in the Legacy definition.
static java.lang.String FASTMD5_LIBPATH
          Default position of MD5 library (C) for FAST MD5 Package
static java.lang.String GETFILEFROMPATH_PATH
          Default position of getFileFromPath (C) functions
static long invalide_idx
          Default invalid value index : -2^63 values
static boolean ISJAVA6
          Is this running under JAVA6 (some optimisation)
static boolean isSGBDLocal
          Is the SGBD local to the OpenLSD Server
static boolean ISUNIX
          Hack to say Windows or Unix (USR1 not OK on Windows)
static boolean ISWEB
          Is the Client in Web format
static ch.qos.logback.classic.Logger logger
          Default logger
static boolean LOGGING
          Mode logging: partially verbose
static byte LSD_AEXIST
          Admin : List
are the file in array (string) exist physically
static byte LSD_AEXISTMD5
          Admin : List
are the file in array (string) exist physically and same MD5
static byte LSD_COPY
          Admin : Copy
copy the file in the out dir
static byte LSD_CREATEDIR
          Admin : Admin
Create the drectories for Legacy(with or without storage)
static byte LSD_DEL
          Protected : Del
delete a file
static byte LSD_DISABLE
          Admin : Admin
disable the Legacy dynamically
static byte LSD_ENABLE
          Admin : Admin
enable the Legacy dynamically
static byte LSD_EXIST
          Admin : Info
is file exist physically (and optionally tests its MD5)
static byte LSD_GET
          Client (with or without compression) : Get
get a file
static byte LSD_GETASYNC
          Client (with or without compression) : GetNAck
get a file in async mode (1 ack only)
static byte LSD_LEGMOVE
          Admin or Protected : Move
move between legacy
static byte LSD_LIST
          Admin : List
list all files in the legacy
static byte LSD_LISTMD5
          Admin : List
list all files in the legacy with their MD5
static byte LSD_MOVE
          Admin or Protected : Move
move an existing file inside one same legacy
static byte LSD_MSG_CONTINUE
          The status is OK and should continue (not final block)
static byte LSD_MSG_KOBADCLIENT
          The status is KO since the client arguments are in bad status
static byte LSD_MSG_KOBADREQ
          The status is KO since a bad request failure (bad command or bad arguments)
static byte LSD_MSG_KONOPREVIOUS
          The status is KO since a System failure but cannot get back to previous stable state (very bad)
static byte LSD_MSG_KONOSERVICE
          The status is KO since the service or LSD is not available
static byte LSD_MSG_KOSYSTEM
          The status is KO since a System failure
static byte LSD_MSG_KOUNAVAIL
          The status is KO since the given resource is unavailable
static byte LSD_MSG_OK
          The status is OK and is the final block or unique block
static byte LSD_NULL
          null command
static byte LSD_PUT
          Client (with or without compression) or Admin or Protected : Put
put a new file
static byte LSD_PUTASYNC
          Client (with or without compression) or Admin or Protected : PutNAck
put a new file in async mode (1 ack only)
static byte LSD_PUTFILE
          Client (direct access for the server to the filesystem) or Admin or Protected : PutFilename
put a new file with a path to access to the file
static byte LSD_RESTART
          Admin : Admin
stop then start user service (legacy = 0 => not compressed, 1 => compressed)
static int LSD_RKADMIN
          Id for Admin server
static int LSD_RKCOMP
          Id for User with Compression server
static int LSD_RKPROTECTED
          Id for Protected server
static int LSD_RKUSER
          Id for User server
static byte LSD_SESSIONINFO
          Admin : Info
list all sessions and their status
static byte LSD_SHUTDOWN
          Admin : Admin
shutdown all services
static byte LSD_SHUTDOWNIMMEDIATE
          Admin : Admin
shutdown all services immediately
static byte LSD_SIZE
          Admin : Info
size of file
static byte LSD_START
          Admin : Admin
start user service (legacy = 0 => not compressed, 1 => compressed)
static byte LSD_STOP
          Admin : Admin
stop user service (legacy = 0 => not compressed, 1 => compressed)
static byte LSD_UNAVAILABLE
          UNAVAILABLE : All
static byte LSD_WIPEDIR
          Admin : Admin
Wipe directory for Legacy(with or without storage)
static byte LSD_WIPERECURDIR
          Admin : Admin
Wipe recursively directories for Legacy(with or without storage)
static java.lang.String LSDSESSIONATTR
          Identify LSD Session as an attribute
static long maximal_idx
          Default maximal value index : 2^63-2 values
static int MAXIMUM_FILELIST
          Maximum number of file in list (AEXIST, LIST) : nb*100
static int MESSAGESIZE
          General Size of one Message except bytes array
static int MINBLOCKSIZE
          Minimum size for block for receive/sending files
static long minimal_idx
          Default minimal value index : -2^63+1 values
static int NBLINEOP
          Number of Line to get in OpHandler at a time (ORACLE VARCHAR2 as a result of Procedure is limited to 4000 bytes, so up to 190 indexes)
static long RETRYINMS
          Time elapse for retry in ms
static int RETRYNB
          Number of retry before error
static java.lang.String RUNWEBLSDCHECK_PATH
          Default position for running Check of LSD Legacies from Tomcat Admin
static java.lang.String RUNWEBLSDSERVER_PATH
          Default position for running LSD Server from Tomcat Admin
static char separator
          Default separator in String buffer in case of List
static int SERVER_THREAD
          Default number of threads in pool for Server
static long SIZEBLOCKFS
          Size of one block in the filesystem: could be later in the Legacy definition.
static java.lang.String SLF4J_PATH
          Default position of the SLF4J configuration file
static java.lang.String sseparator
          Same as separator in String format
static int TCPBLOCKSIZE
          Real TCP BlockSize
static int TIMEEXIT
          Nb of milliseconds before exit
static int TIMEOUT
          Nb of seconds after idle is in timeout (MUST BE MORE THAN TIMEOUTKEEPALIVE)
static int TIMEOUTCON
          Nb of milliseconds after connexion is in timeout
static int TIMEOUTCONMIN
          Minimal Nb of milliseconds after connexion is in timeout
static int TIMEOUTKEEPALIVE
          Nb of seconds after idle is in timeout for Keep Alive module (MUST BE LESS THAN TIMEOUT)
static int TIMEOUTMIN
          Minimal Nb of seconds after idle is in timeout (MUST BE LESS THAN TIMEOUT)
static int typeDriver
          0 = MySQL, 1 = Oracle, ...
static int typeMySQL
          Type of DB: MySQL
static int typeOracle
          Type of DB: Oracle
static int typePostgresql
          Type of DB: PostGreSQL
static boolean useCFunctions
          Use C functions
static boolean useNIO
          Use NIO in MD5 functions
static java.lang.String WEBDF_PATH
          Default command for getting df -k if JAVA5
static java.lang.String WEBOPENDU_PATH
          Default command for getting openlsddu (almost same as du but faster)
static int WEBRETRIEVENOACKLIMIT
          Limit size where NoAck method will be used (in Web retrieve functions)
 
Constructor Summary
LSDConstants()
           
 
Method Summary
static void computeNbThreads()
          Compute number of threads for server from the real number of available processors.
static long computeSize(long size)
          Compute size according to the Size of Block
static double[] getGlobalUsedFreeSpace(java.io.File storage)
          Get the Global Used and Free space in KB
static double[] getUsedSpace(java.io.File storage)
          Get the Used space in KB with openlsddu command
static double[] getUsedSpace(java.io.File storage, boolean useCFunc)
          Get the Used space in KB with openlsddu command
static java.lang.String idUniqueTosubPath(long idUnique)
          Constructs the subpath
static void initConfigLogger(java.lang.String file)
          Function to initialized the Logger from the Configuration file
static boolean isIdUniqueKO(long idUnique)
          Test if ths idUnique is KO
static void startLogger(java.lang.Class classtype)
          Start the logger function with level
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISJAVA6

public static final boolean ISJAVA6
Is this running under JAVA6 (some optimisation)

See Also:
Constant Field Values

RETRYINMS

public static final long RETRYINMS
Time elapse for retry in ms

See Also:
Constant Field Values

RETRYNB

public static final int RETRYNB
Number of retry before error

See Also:
Constant Field Values

BUFFERSIZEDEFAULT

public static final int BUFFERSIZEDEFAULT
Default size for buffers (NIO)

See Also:
Constant Field Values

NBLINEOP

public static final int NBLINEOP
Number of Line to get in OpHandler at a time (ORACLE VARCHAR2 as a result of Procedure is limited to 4000 bytes, so up to 190 indexes)

See Also:
Constant Field Values

useCFunctions

public static final boolean useCFunctions
Use C functions

See Also:
Constant Field Values

DEBUG

public static final boolean DEBUG
Mode debug: very verbose if logging enabled

See Also:
Constant Field Values

LOGGING

public static final boolean LOGGING
Mode logging: partially verbose

See Also:
Constant Field Values

SIZEBLOCKFS

public static final long SIZEBLOCKFS
Size of one block in the filesystem: could be later in the Legacy definition.
JFS2 supports multiple file system block sizes of 512, 1024, 2048, and 4096, with 4 KBytes as standard.
EXT3 supports multiple file system block sizes of 1024, 2048 and 4096, with 4 KBytes as standard.
NTFS supports sizes of clusters from 512 bytes up to 64 KBytes, with 4 KBytes as standard.

See Also:
Constant Field Values

DSIZEBLOCKFS

public static final double DSIZEBLOCKFS
Size of one block in the filesystem (double version): could be later in the Legacy definition.

See Also:
Constant Field Values

useNIO

public static boolean useNIO
Use NIO in MD5 functions


TIMEEXIT

public static int TIMEEXIT
Nb of milliseconds before exit


TIMEOUT

public static int TIMEOUT
Nb of seconds after idle is in timeout (MUST BE MORE THAN TIMEOUTKEEPALIVE)


TIMEOUTMIN

public static final int TIMEOUTMIN
Minimal Nb of seconds after idle is in timeout (MUST BE LESS THAN TIMEOUT)

See Also:
Constant Field Values

TIMEOUTKEEPALIVE

public static int TIMEOUTKEEPALIVE
Nb of seconds after idle is in timeout for Keep Alive module (MUST BE LESS THAN TIMEOUT)


TIMEOUTCON

public static int TIMEOUTCON
Nb of milliseconds after connexion is in timeout


TIMEOUTCONMIN

public static final int TIMEOUTCONMIN
Minimal Nb of milliseconds after connexion is in timeout

See Also:
Constant Field Values

BACKLOG

public static int BACKLOG
Queue length of ServerSocket (Acceptor) (Backlog)


BLOCKSIZE

public static int BLOCKSIZE
Size by default of block size for receive/sending files. MAX should be close to 8192-104 or (x*8192)-104


MESSAGESIZE

public static final int MESSAGESIZE
General Size of one Message except bytes array

See Also:
Constant Field Values

TCPBLOCKSIZE

public static int TCPBLOCKSIZE
Real TCP BlockSize


MINBLOCKSIZE

public static final int MINBLOCKSIZE
Minimum size for block for receive/sending files

See Also:
Constant Field Values

WEBRETRIEVENOACKLIMIT

public static final int WEBRETRIEVENOACKLIMIT
Limit size where NoAck method will be used (in Web retrieve functions)

See Also:
Constant Field Values

SERVER_THREAD

public static int SERVER_THREAD
Default number of threads in pool for Server


CLIENT_THREAD

public static int CLIENT_THREAD
Default number of threads in pool for Client (Mina's pool)


CLIENT_INSTANCE_THREAD

public static int CLIENT_INSTANCE_THREAD
Default number of instance for Client (different than Thread in Mina Pool)


BUSINESSCLASSNAME

public static java.lang.String BUSINESSCLASSNAME
LSDBusinessImpl full class name


FASTMD5_LIBPATH

public static java.lang.String FASTMD5_LIBPATH
Default position of MD5 library (C) for FAST MD5 Package


GETFILEFROMPATH_PATH

public static java.lang.String GETFILEFROMPATH_PATH
Default position of getFileFromPath (C) functions


WEBOPENDU_PATH

public static java.lang.String WEBOPENDU_PATH
Default command for getting openlsddu (almost same as du but faster)


WEBDF_PATH

public static java.lang.String WEBDF_PATH
Default command for getting df -k if JAVA5


RUNWEBLSDSERVER_PATH

public static java.lang.String RUNWEBLSDSERVER_PATH
Default position for running LSD Server from Tomcat Admin


RUNWEBLSDCHECK_PATH

public static java.lang.String RUNWEBLSDCHECK_PATH
Default position for running Check of LSD Legacies from Tomcat Admin


SLF4J_PATH

public static java.lang.String SLF4J_PATH
Default position of the SLF4J configuration file


ISUNIX

public static final boolean ISUNIX
Hack to say Windows or Unix (USR1 not OK on Windows)


ISWEB

public static boolean ISWEB
Is the Client in Web format


LSDSESSIONATTR

public static final java.lang.String LSDSESSIONATTR
Identify LSD Session as an attribute

See Also:
Constant Field Values

typeDriver

public static int typeDriver
0 = MySQL, 1 = Oracle, ...
default value but modified dynamically


typeMySQL

public static final int typeMySQL
Type of DB: MySQL

See Also:
Constant Field Values

typeOracle

public static final int typeOracle
Type of DB: Oracle

See Also:
Constant Field Values

typePostgresql

public static final int typePostgresql
Type of DB: PostGreSQL

See Also:
Constant Field Values

isSGBDLocal

public static boolean isSGBDLocal
Is the SGBD local to the OpenLSD Server


MAXIMUM_FILELIST

public static final int MAXIMUM_FILELIST
Maximum number of file in list (AEXIST, LIST) : nb*100

See Also:
Constant Field Values

LSD_GET

public static final byte LSD_GET
Client (with or without compression) : Get
get a file

See Also:
Constant Field Values

LSD_GETASYNC

public static final byte LSD_GETASYNC
Client (with or without compression) : GetNAck
get a file in async mode (1 ack only)

See Also:
Constant Field Values

LSD_PUT

public static final byte LSD_PUT
Client (with or without compression) or Admin or Protected : Put
put a new file

See Also:
Constant Field Values

LSD_PUTASYNC

public static final byte LSD_PUTASYNC
Client (with or without compression) or Admin or Protected : PutNAck
put a new file in async mode (1 ack only)

See Also:
Constant Field Values

LSD_PUTFILE

public static final byte LSD_PUTFILE
Client (direct access for the server to the filesystem) or Admin or Protected : PutFilename
put a new file with a path to access to the file

See Also:
Constant Field Values

LSD_MOVE

public static final byte LSD_MOVE
Admin or Protected : Move
move an existing file inside one same legacy

See Also:
Constant Field Values

LSD_LEGMOVE

public static final byte LSD_LEGMOVE
Admin or Protected : Move
move between legacy

See Also:
Constant Field Values

LSD_SIZE

public static final byte LSD_SIZE
Admin : Info
size of file

See Also:
Constant Field Values

LSD_EXIST

public static final byte LSD_EXIST
Admin : Info
is file exist physically (and optionally tests its MD5)

See Also:
Constant Field Values

LSD_COPY

public static final byte LSD_COPY
Admin : Copy
copy the file in the out dir

See Also:
Constant Field Values

LSD_LIST

public static final byte LSD_LIST
Admin : List
list all files in the legacy

See Also:
Constant Field Values

LSD_LISTMD5

public static final byte LSD_LISTMD5
Admin : List
list all files in the legacy with their MD5

See Also:
Constant Field Values

LSD_AEXIST

public static final byte LSD_AEXIST
Admin : List
are the file in array (string) exist physically

See Also:
Constant Field Values

LSD_AEXISTMD5

public static final byte LSD_AEXISTMD5
Admin : List
are the file in array (string) exist physically and same MD5

See Also:
Constant Field Values

LSD_SESSIONINFO

public static final byte LSD_SESSIONINFO
Admin : Info
list all sessions and their status

See Also:
Constant Field Values

LSD_START

public static final byte LSD_START
Admin : Admin
start user service (legacy = 0 => not compressed, 1 => compressed)

See Also:
Constant Field Values

LSD_STOP

public static final byte LSD_STOP
Admin : Admin
stop user service (legacy = 0 => not compressed, 1 => compressed)

See Also:
Constant Field Values

LSD_SHUTDOWN

public static final byte LSD_SHUTDOWN
Admin : Admin
shutdown all services

See Also:
Constant Field Values

LSD_SHUTDOWNIMMEDIATE

public static final byte LSD_SHUTDOWNIMMEDIATE
Admin : Admin
shutdown all services immediately

See Also:
Constant Field Values

LSD_RESTART

public static final byte LSD_RESTART
Admin : Admin
stop then start user service (legacy = 0 => not compressed, 1 => compressed)

See Also:
Constant Field Values

LSD_ENABLE

public static final byte LSD_ENABLE
Admin : Admin
enable the Legacy dynamically

See Also:
Constant Field Values

LSD_DISABLE

public static final byte LSD_DISABLE
Admin : Admin
disable the Legacy dynamically

See Also:
Constant Field Values

LSD_CREATEDIR

public static final byte LSD_CREATEDIR
Admin : Admin
Create the drectories for Legacy(with or without storage)

See Also:
Constant Field Values

LSD_WIPEDIR

public static final byte LSD_WIPEDIR
Admin : Admin
Wipe directory for Legacy(with or without storage)

See Also:
Constant Field Values

LSD_WIPERECURDIR

public static final byte LSD_WIPERECURDIR
Admin : Admin
Wipe recursively directories for Legacy(with or without storage)

See Also:
Constant Field Values

LSD_DEL

public static final byte LSD_DEL
Protected : Del
delete a file

See Also:
Constant Field Values

LSD_UNAVAILABLE

public static final byte LSD_UNAVAILABLE
UNAVAILABLE : All

See Also:
Constant Field Values

LSD_NULL

public static final byte LSD_NULL
null command

See Also:
Constant Field Values

LSD_MSG_CONTINUE

public static final byte LSD_MSG_CONTINUE
The status is OK and should continue (not final block)

See Also:
Constant Field Values

LSD_MSG_OK

public static final byte LSD_MSG_OK
The status is OK and is the final block or unique block

See Also:
Constant Field Values

LSD_MSG_KOSYSTEM

public static final byte LSD_MSG_KOSYSTEM
The status is KO since a System failure

See Also:
Constant Field Values

LSD_MSG_KOBADREQ

public static final byte LSD_MSG_KOBADREQ
The status is KO since a bad request failure (bad command or bad arguments)

See Also:
Constant Field Values

LSD_MSG_KOUNAVAIL

public static final byte LSD_MSG_KOUNAVAIL
The status is KO since the given resource is unavailable

See Also:
Constant Field Values

LSD_MSG_KONOPREVIOUS

public static final byte LSD_MSG_KONOPREVIOUS
The status is KO since a System failure but cannot get back to previous stable state (very bad)

See Also:
Constant Field Values

LSD_MSG_KOBADCLIENT

public static final byte LSD_MSG_KOBADCLIENT
The status is KO since the client arguments are in bad status

See Also:
Constant Field Values

LSD_MSG_KONOSERVICE

public static final byte LSD_MSG_KONOSERVICE
The status is KO since the service or LSD is not available

See Also:
Constant Field Values

LSD_RKADMIN

public static final int LSD_RKADMIN
Id for Admin server

See Also:
Constant Field Values

LSD_RKUSER

public static final int LSD_RKUSER
Id for User server

See Also:
Constant Field Values

LSD_RKCOMP

public static final int LSD_RKCOMP
Id for User with Compression server

See Also:
Constant Field Values

LSD_RKPROTECTED

public static final int LSD_RKPROTECTED
Id for Protected server

See Also:
Constant Field Values

logger

public static ch.qos.logback.classic.Logger logger
Default logger


invalide_idx

public static final long invalide_idx
Default invalid value index : -2^63 values

See Also:
Constant Field Values

minimal_idx

public static final long minimal_idx
Default minimal value index : -2^63+1 values

See Also:
Constant Field Values

maximal_idx

public static final long maximal_idx
Default maximal value index : 2^63-2 values

See Also:
Constant Field Values

separator

public static final char separator
Default separator in String buffer in case of List

See Also:
Constant Field Values

sseparator

public static final java.lang.String sseparator
Same as separator in String format

See Also:
Constant Field Values
Constructor Detail

LSDConstants

public LSDConstants()
Method Detail

computeSize

public static long computeSize(long size)
Compute size according to the Size of Block

Parameters:
size -
Returns:
the new size closest to the number of bytes as a integer number of blocks

getGlobalUsedFreeSpace

public static double[] getGlobalUsedFreeSpace(java.io.File storage)
Get the Global Used and Free space in KB

Parameters:
storage -
Returns:
the global and used and free space in KB in long[] or null in error

getUsedSpace

public static double[] getUsedSpace(java.io.File storage)
Get the Used space in KB with openlsddu command

Parameters:
storage -
Returns:
the used space in KB, the number of directories and the number of files

getUsedSpace

public static double[] getUsedSpace(java.io.File storage,
                                    boolean useCFunc)
Get the Used space in KB with openlsddu command

Parameters:
storage -
useCFunc -
Returns:
the used space in KB, the number of directories and the number of files

idUniqueTosubPath

public static java.lang.String idUniqueTosubPath(long idUnique)
Constructs the subpath

Parameters:
idUnique -
Returns:
the String for the subPath /a/b/c

computeNbThreads

public static void computeNbThreads()
Compute number of threads for server from the real number of available processors.


isIdUniqueKO

public static boolean isIdUniqueKO(long idUnique)
Test if ths idUnique is KO

Parameters:
idUnique -
Returns:
True if idUnique is KO, else False

initConfigLogger

public static void initConfigLogger(java.lang.String file)
Function to initialized the Logger from the Configuration file

Parameters:
file -

startLogger

public static void startLogger(java.lang.Class classtype)
Start the logger function with level

Parameters:
classtype -