openlsd.database.data.LSDDbStorage Class Reference

Collaboration diagram for openlsd.database.data.LSDDbStorage:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class for Storage manipulation
Author:
Frederic Bregier LGPL

Public Member Functions

 LSDDbStorage ()
 LSDDbStorage (long lid, long sid, long size, long fda)
void assign (long lid, long sid, long size, long fda, int hasdel)
boolean get (ResultSet resultSet)
boolean get (LSDDbAdmin admin, long lid, long sid)
boolean getForUpdateAdd (LSDDbAdmin admin, long lid, long sid, long filesize, int hasdel)
boolean setAdd (LSDDbAdmin admin, long filesize)
boolean setAddNoCommit (LSDDbAdmin admin, long filesize)
boolean insertNoCommit (LSDDbAdmin admin, long filesize)
boolean update (LSDDbAdmin admin, long size, long fdanew, int hasdel)
boolean updateNoCommit (LSDDbAdmin admin, long size, long fdanew, int hasdel)
String toString ()

Static Public Member Functions

static String getWhereCondPls ()
static String getWhereCondPl (String id)
static String getWhereCond (String id, String slid)
static LSDDbPreparedStatement setPGet (LSDDbAdmin admin, long lid)
static boolean setAddSizeNoCommit (LSDDbAdmin admin, long lid, long sid, long did, long filesize)
static LSDLinkedLongList
< LSDDbStorage
getStorages (LSDDbAdmin admin, long lid)
static boolean del (LSDDbAdmin admin, long lid, long sid)
static boolean delIfEmpty (LSDDbAdmin admin, long lid, long sid)
static int delStoragesIfEmpty (LSDDbAdmin admin, long lid)
static void checkStorageMT (LSDDbAdmin admin, LSDDbLegacy legacy, boolean repair)
static void purgeStorageMT (LSDDbAdmin admin, LSDDbLegacy legacy, boolean repair, int nbthread)
static boolean alterIndex (LSDDbAdmin admin)

Public Attributes

long lid = LSDConstants.invalide_idx
long sid = LSDConstants.invalide_idx
long size = 0
long fda = LSDConstants.invalide_idx
int hasdel = 0

Static Public Attributes

static final String table = " lsdstorage "
static final String[] fields
static final int rlid = 0
static final int rsid = 1
static final int rsize = 2
static final int rfda = 3
static final int rhasdel = 4
static final String allfields
static final String index

Static Private Member Functions

static String getFieldsSetPsplussfh ()
static String getFieldsValuesPlssf_h (long lid, long sid, long filesize, long fda)
static LSDDbPreparedStatement setPGet (LSDDbAdmin admin, long lid, long sid)
static LSDDbPreparedStatement setPGetForUpdate (LSDDbAdmin admin, long lid, long sid)
static LSDDbPreparedStatement setPUpdateAdd (LSDDbAdmin admin, long lid, long sid, long filesize, long fda, int hasdel)
static int setPInsert (LSDDbAdmin admin, long lid, long sid, long filesize, long fda)
static LSDDbPreparedStatement setPUpdateSet (LSDDbAdmin admin, long lid, long sid, long filesize, long fda, int hasdel)
static LSDDbPreparedStatement getMaxIdxDocument (LSDDbAdmin admin)
static LSDDbPreparedStatement getHasDelDocument (LSDDbAdmin admin)
static LSDDbPreparedStatement getSizeDocument (LSDDbAdmin admin)
static void checkOneStorage (LSDDbAdmin admin, LSDDbStorage storage, LSDDbPreparedStatement prepstmt1, LSDDbPreparedStatement prepstmt2, LSDDbPreparedStatement prepstmt3, LSDDbLegacy legacy, FutureTask< Long >[]tasks, ExecutorService executorService, boolean repair)
static LSDDbPreparedStatement getMaxValidFromStorage (LSDDbAdmin admin)
static LSDDbPreparedStatement deleteInvalidFromStorage (LSDDbAdmin admin)
static FutureTask< Long > purgeOneStorage (LSDDbAdmin admin, LSDDbStorage storage, LSDDbLegacy legacy, ExecutorService executorService, boolean repair)

Static Private Attributes

static final String insertfields

Constructor & Destructor Documentation

openlsd.database.data.LSDDbStorage.LSDDbStorage (  ) 

Create an empty Storage

openlsd.database.data.LSDDbStorage.LSDDbStorage ( long  lid,
long  sid,
long  size,
long  fda 
)

Create a Storage from args

Parameters:
lid 
sid 
size 
fda 


Member Function Documentation

void openlsd.database.data.LSDDbStorage.assign ( long  lid,
long  sid,
long  size,
long  fda,
int  hasdel 
)

Assign values to object

Parameters:
lid 
sid 
size 
fda 
hasdel 

boolean openlsd.database.data.LSDDbStorage.get ( ResultSet  resultSet  ) 

Get Values from ResultSet

Parameters:
resultSet 
Returns:
True if OK, else False

static String openlsd.database.data.LSDDbStorage.getFieldsSetPsplussfh (  )  [static, private]

Get String for Setting as Set

Returns:
the string as result

static String openlsd.database.data.LSDDbStorage.getFieldsValuesPlssf_h ( long  lid,
long  sid,
long  filesize,
long  fda 
) [static, private]

Get String for Setting as Values (INSERT)

Parameters:
lid 
sid 
filesize 
fda 
Returns:
the string as result

static String openlsd.database.data.LSDDbStorage.getWhereCondPls (  )  [static]

Get String for Where Condition

Returns:
the string as result

static String openlsd.database.data.LSDDbStorage.getWhereCondPl ( String  id  )  [static]

Get String for Where Condition

Parameters:
id 
Returns:
the string as result

static String openlsd.database.data.LSDDbStorage.getWhereCond ( String  id,
String  slid 
) [static]

Get String for Where Condition

Parameters:
id 
slid 
Returns:
the string as result

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.setPGet ( LSDDbAdmin  admin,
long  lid,
long  sid 
) [static, private]

Create the PreparedStatement for Get

Parameters:
admin 
lid 
sid 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.setPGet ( LSDDbAdmin  admin,
long  lid 
) [static]

Create the PreparedStatement for Get

Parameters:
admin 
lid 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.setPGetForUpdate ( LSDDbAdmin  admin,
long  lid,
long  sid 
) [static, private]

Create the PreparedStatement for Get for Update

Parameters:
admin 
lid 
sid 
Returns:
LSDDbPreparedStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.setPUpdateAdd ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  filesize,
long  fda,
int  hasdel 
) [static, private]

Create the PreparedStatement for Update

Parameters:
admin 
lid 
sid 
filesize 
fda 
hasdel 
Returns:
LSDDbPreparedStatement

static int openlsd.database.data.LSDDbStorage.setPInsert ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  filesize,
long  fda 
) [static, private]

Create the PreparedStatement for Insert

Parameters:
admin 
lid 
sid 
filesize 
fda 
Returns:
the number of inserted line

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.setPUpdateSet ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  filesize,
long  fda,
int  hasdel 
) [static, private]

Create the PreparedStatement for Update

Parameters:
admin 
lid 
sid 
filesize 
fda 
hasdel 
Returns:
LSDDbPreparedStatement

boolean openlsd.database.data.LSDDbStorage.get ( LSDDbAdmin  admin,
long  lid,
long  sid 
)

Get the Storage object from DB

Parameters:
admin 
lid 
sid 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.getForUpdateAdd ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  filesize,
int  hasdel 
)

Get for update the Storage object (lid, sid) from DB (the parameter filesize is added to the existing Storage size)
This version is correct since fda is not changed. CheckStorage has an internal function to correct this fda.

Parameters:
admin 
lid 
sid 
filesize 
hasdel 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.setAdd ( LSDDbAdmin  admin,
long  filesize 
)

Update or Insert data into DB from object. lid and sid must be ok. The filesize is added to the size of the Storage.

Parameters:
admin 
filesize 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.setAddNoCommit ( LSDDbAdmin  admin,
long  filesize 
)

Update or Insert data into DB from object. lid and sid must be ok. The filesize is added to the size of the Storage. No Commit is done.

Parameters:
admin 
filesize 
Returns:
True if OK, else False

static boolean openlsd.database.data.LSDDbStorage.setAddSizeNoCommit ( LSDDbAdmin  admin,
long  lid,
long  sid,
long  did,
long  filesize 
) [static]

Update or Insert size into DB. lid and sid must be ok. The filesize is added to the size of the Storage. No Commit is done.

Parameters:
admin 
lid 
sid 
did 
filesize 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.insertNoCommit ( LSDDbAdmin  admin,
long  filesize 
)

Insert data into DB from object. lid and sid must be ok. The filesize is added to the size of the Storage. No Commit is done.

Parameters:
admin 
filesize 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.update ( LSDDbAdmin  admin,
long  size,
long  fdanew,
int  hasdel 
)

Update some Values into BD (size is set, not added)

Parameters:
admin 
size 
fdanew 
hasdel 
Returns:
True if OK, else False

boolean openlsd.database.data.LSDDbStorage.updateNoCommit ( LSDDbAdmin  admin,
long  size,
long  fdanew,
int  hasdel 
)

Update some Values into BD (size is set, not added) without commit

Parameters:
admin 
size 
fdanew 
hasdel 
Returns:
True if OK, else False

static LSDLinkedLongList<LSDDbStorage> openlsd.database.data.LSDDbStorage.getStorages ( LSDDbAdmin  admin,
long  lid 
) [static]

Get all Storages associated with the lid from the DB.

Parameters:
admin 
lid 
Returns:
the list of storage or null if an error occurs

static boolean openlsd.database.data.LSDDbStorage.del ( LSDDbAdmin  admin,
long  lid,
long  sid 
) [static]

Del the Legacy object from DB

Parameters:
admin 
lid 
sid 
Returns:
True if OK, else False

static boolean openlsd.database.data.LSDDbStorage.delIfEmpty ( LSDDbAdmin  admin,
long  lid,
long  sid 
) [static]

Del the Legacy object from DB if size <= 0

Parameters:
admin 
lid 
sid 
Returns:
True if OK, else False

static int openlsd.database.data.LSDDbStorage.delStoragesIfEmpty ( LSDDbAdmin  admin,
long  lid 
) [static]

Del all Storages associated with the lid from the DB if empty

Parameters:
admin 
lid 
Returns:
the number of services deleted

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.getMaxIdxDocument ( LSDDbAdmin  admin  )  [static, private]

Return the Prepare Statement for get Max did of Document in one Legacy/Storage

Parameters:
admin 
Returns:
the LSDDbPrepareStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.getHasDelDocument ( LSDDbAdmin  admin  )  [static, private]

Return the Prepare Statement for get HasDel Document in one Legacy/Storage

Parameters:
admin 
Returns:
the LSDDbPrepareStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.getSizeDocument ( LSDDbAdmin  admin  )  [static, private]

Return the Prepare Statement for get Size from Document in one Legacy/Storage

Parameters:
admin 
Returns:
the LSDDbPrepareStatement

static void openlsd.database.data.LSDDbStorage.checkStorageMT ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
boolean  repair 
) [static]

Check Storage from Legacy with Document in DB with mini threading

Parameters:
admin 
legacy 
repair 

static void openlsd.database.data.LSDDbStorage.checkOneStorage ( LSDDbAdmin  admin,
LSDDbStorage  storage,
LSDDbPreparedStatement  prepstmt1,
LSDDbPreparedStatement  prepstmt2,
LSDDbPreparedStatement  prepstmt3,
LSDDbLegacy  legacy,
FutureTask< Long >[]  tasks,
ExecutorService  executorService,
boolean  repair 
) [static, private]

Check one storage from one LSDDbStorage object

Parameters:
admin 
storage 
prepstmt1 
prepstmt2 
prepstmt3 
legacy 
tasks 
executorService 
repair 

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.getMaxValidFromStorage ( LSDDbAdmin  admin  )  [static, private]

Return the Prepare Statement for get Max valid did of Document in one Legacy/Storage

Parameters:
admin 
Returns:
the LSDDbPrepareStatement

static LSDDbPreparedStatement openlsd.database.data.LSDDbStorage.deleteInvalidFromStorage ( LSDDbAdmin  admin  )  [static, private]

Return the Prepare Statement for delete invalid did of Document in one Legacy/Storage

Parameters:
admin 
Returns:
the LSDDbPrepareStatement

static void openlsd.database.data.LSDDbStorage.purgeStorageMT ( LSDDbAdmin  admin,
LSDDbLegacy  legacy,
boolean  repair,
int  nbthread 
) [static]

Purge Storage from Legacy of empty Documents in DB with multithreading by storage

Parameters:
admin 
legacy 
repair 
nbthread 

static FutureTask<Long> openlsd.database.data.LSDDbStorage.purgeOneStorage ( LSDDbAdmin  admin,
LSDDbStorage  storage,
LSDDbLegacy  legacy,
ExecutorService  executorService,
boolean  repair 
) [static, private]

Purge one storage from one LSDDbStorage object of unused invalid Documents

Parameters:
admin 
storage 
legacy 
executorService 
repair 
Returns:
the FutureTask on the given storage

static boolean openlsd.database.data.LSDDbStorage.alterIndex ( LSDDbAdmin  admin  )  [static]

Alter rebuild all index associated with this Table

Parameters:
admin 
Returns:
True if ok

String openlsd.database.data.LSDDbStorage.toString (  ) 

Object to String

Returns:
the string that displays this object
See also:
java.lang.Object.toString()


Member Data Documentation

Legacy Id

Storage Id

Current size of the Legacy

Next available Document (Following Document Available)

Has this Storage some Deleted Document

final String openlsd.database.data.LSDDbStorage.table = " lsdstorage " [static]

information for DB manipulation: Table name

Initial value:

        {"LID","SID","SIZESTO","FDA","HASDEL"}
DB field names

DB field rank

DB field rank

DB field rank

DB field rank

DB field rank

Initial value:

 
        " "+fields[rlid]+","+fields[rsid]+","+fields[rsize]+
        ","+fields[rfda]+","+fields[rhasdel]+" "
DB field for select

final String openlsd.database.data.LSDDbStorage.insertfields [static, private]

Initial value:

        " ("+allfields+") "
DB field for insert

Initial value:

 "PK_STORAGE"+
        " IDX_STO_LID"+" IDX_STO_LIDSIDSIZE"
Index in Table LSDDbStorage alter index "LSD"."PK_STORAGE" rebuild; alter index "LSD"."IDX_STO_LID" rebuild; alter index "LSD"."IDX_STO_LIDSIDSIZE" rebuild;


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