openlsd.web.appli.LSDWebImport Class Reference

Inheritance diagram for openlsd.web.appli.LSDWebImport:

Inheritance graph
[legend]
Collaboration diagram for openlsd.web.appli.LSDWebImport:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class to import files into DB and LSD from Web from localized Tomcat service with LSD Server
Author:
Frederic Bregier LGPL

Public Member Functions

 LSDWebImport (LSDDbAdmin admin)
int putFileFromWebLocal (ArrayList< String > erreurs, long legacy, LSDDbIpPort userOrComp, LSDDbIpPort prot, LSDBusiness lsdb, File file)
boolean initRegisterFile ()

Static Public Member Functions

static int putFileFromWeb (ArrayList< String > erreurs, LSDDbAdmin admin, long legacy, LSDDbIpPort userOrComp, LSDDbIpPort prot, LSDBusiness lsdb, File file)
static void main (String[] args)
static void registerFalseFile (LSDExtQueueMember member, String message)
static void registerFalseFile (String filename, String message)
static void registerTrueFile (LSDExtQueueMember member, boolean createOKFile)

Public Attributes

long targetIdip = LSDConstants.invalide_idx

Static Public Attributes

static final String extOK = ".ok"
static final String extKO = ".ko"

Protected Member Functions

int privateInitializeArgs (String[] args, int curargs)
int initializeArgs (String[] args, int curargs)
boolean getIndexFromString (String line)
boolean initOptions (String[]args, int curargs)
boolean initOneFileOption (int curargs, String[]args)
boolean initOptionsAuto (String[]args, int curargs)
boolean initConnection ()
boolean prepareImportQueue ()
boolean joinConnection ()
boolean errorFromPrepareImportQueue ()
boolean finalizeAfterImport ()
boolean finishAfterAutoImport ()
boolean finalizeAfterAutoImport ()
boolean finalizeConnection ()
void finalizeRegisterFile ()
boolean getClientPutInfo (LSDDbLegacy legacy, boolean compressedClient, boolean keepalived)
boolean getClientPutInfoFromIpPort (LSDDbLegacy legacy, LSDDbIpPort ipportUser1, LSDDbIpPort ipportProt1, boolean keepalived)
LSDDbLegacy getLegacy (long lid)
LSDDbIpPort getIpPortC (LSDDbLegacy legacy)
LSDDbIpPort getIpPortP (LSDDbLegacy legacy)

Protected Attributes

LSDDbAdmin admin = null
LSDLoadConfig llc = null
boolean isSameLid = false
long sameLid = LSDConstants.invalide_idx
LSDDbLegacy sameLegacy = null
boolean todelete = true
int option = -1
String file0 = null
long lid0 = LSDConstants.invalide_idx
LSDBusiness lsdb = null
LSDExtClientInfo lci = null
LSDClientPut lcp = null
LSDClientDelete lcd = null
String passwd = null
String dir1 = null
String ext1 = null
String source2 = null
boolean blockmode = false
ConcurrentLinkedQueue
< LSDExtQueueMember
todoQueue = null
ConcurrentLinkedQueue
< LSDExtQueueMembers > 
todoQueueB = null
ConcurrentLinkedQueue
< LSDExtQueueMember
doneQueue = null
int nbFile = 1
int nbthread = 1
String extidb = null
boolean sameDbConnMyltithread = false
boolean async = false
boolean isCompressed = false
LSDClientPut[] lcps = null
LSDDbAdmin[] dbconns = null
File[] listFiles = null
LinkedList< String > listline = null
ConcurrentLinkedQueue
< LSDExtQueueMember >[] 
todoQueues = null
ConcurrentLinkedQueue
< LSDExtQueueMembers >[] 
todoQueuesB = null
ConcurrentLinkedQueue
< LSDExtQueueMember
todoQueueLocal = null
ConcurrentLinkedQueue
< LSDExtQueueMembers > 
todoQueueBLocal = null
LinkedList< String > errorList = null
String extStop = null
String filename2Out = null

Static Protected Attributes

static long KO = 0
static boolean istesting = false
static Date date_debut = null
static boolean use2Out = false
static FileWriter fileOK = null
static FileWriter fileKO = null
static long countKO = 0
static long countOK = 0

Constructor & Destructor Documentation

openlsd.web.appli.LSDWebImport.LSDWebImport ( LSDDbAdmin  admin  ) 

Create a LSDCheck from args

Parameters:
admin 


Member Function Documentation

static int openlsd.web.appli.LSDWebImport.putFileFromWeb ( ArrayList< String >  erreurs,
LSDDbAdmin  admin,
long  legacy,
LSDDbIpPort  userOrComp,
LSDDbIpPort  prot,
LSDBusiness  lsdb,
File  file 
) [static]

Put a file from the web (File from multipart-data)

Parameters:
erreurs is an arrayList of Strings that will contains litteral of errors if any
admin 
legacy 
userOrComp User (not compressed) or Compressed LSD Server entry
prot Protected LSD Server entry
lsdb 
file 
Returns:
0 if OK, else > 0 means an error occurs (1:no Legacy found in DB, 2:no connection to OpenLSD Server, 3:document was not inserted)

int openlsd.web.appli.LSDWebImport.putFileFromWebLocal ( ArrayList< String >  erreurs,
long  legacy,
LSDDbIpPort  userOrComp,
LSDDbIpPort  prot,
LSDBusiness  lsdb,
File  file 
)

Put a file from the web (File from multipart-data)

Parameters:
erreurs is an arrayList of Strings that will contains litteral of errors if any
legacy 
userOrComp User (not compressed) or Compressed LSD Server entry
prot Protected LSD Server entry
lsdb 
file 
Returns:
0 if OK, else > 0 means an error occurs (1:no Legacy found in DB, 2:no connection to OpenLSD Server, 3:document was not inserted)

static void openlsd.appli.autoimport.LSDImport.main ( String[]  args  )  [static, inherited]

Run 1 file local import

Parameters:
args with the config filename as first arg. As second group of args:
-testing set the import as testing mode for simple test where idmetier get the curdate added: not for use in production
-nbthread nbthread (set the number of threads)
-async set the connection mode to OpenLSD Server as asynchrone (first launch connection, then do other stuff, then join the connection
-dbconn set that each thread will have its own db connexion, less efficient solution but less database connection
-nodelete set no delete file after import but save one file with same name and extension=".ok" or ".ko" according to the import status. Only one option can be set between -delete and -nodelete.
-delete (default option) delete file when correctly imported or save one file with the same name and extension=".ko". Only one option can be set between -delete and -nodelete.
-2out set the out status to 2 files in the import source directory, one ".ok", another one ".ko" according to the import status
-compressed set the connection mode to OpenLSD Server as using a compressed mode (useful only in Net mode where files can be compressed)
-samelid lid
where it specifies that it will be the same lid for all files (optimization) (by default, if not specified, not the same lid)
As third group of args where one only of those can be set:
-dir directory extension (each file has one file with same name and the extension containing "lid idb")
-file file lid idb
-source sourcefile (containing a list of "file lid idb" where lid is not there if -samelid is set)

int openlsd.appli.autoimport.commonimport.LSDImportAbstract.privateInitializeArgs ( String[]  args,
int  curargs 
) [protected, inherited]

Function to override for specific initialization values

Parameters:
args 
curargs 
Returns:
the next current rank

Reimplemented in openlsd.appli.autoimport.LSDAutoImport, and openlsd.appli.autoimport.LSDAutoImportBlock.

int openlsd.appli.autoimport.commonimport.LSDImportAbstract.initializeArgs ( String[]  args,
int  curargs 
) [protected, inherited]

Get arguments

Parameters:
args 
curargs 
Returns:
the next current rank

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.getIndexFromString ( String  line  )  [protected, inherited]

Get file, lid and idb from the String line where a blank character is a separator. Should be override to explicitly specify how to use the correct business implementation.

Parameters:
line 
Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.initOptions ( String[]  args,
int  curargs 
) [protected, inherited]

Finalize Init options from args

Parameters:
args 
curargs 
Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.initOneFileOption ( int  curargs,
String[]  args 
) [protected, inherited]

Init one File option form args and current position (must be override)

Parameters:
curargs 
args 
Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.initRegisterFile (  )  [inherited]

Create OK and KO files

Returns:
True if OK else False

static void openlsd.appli.autoimport.commonimport.LSDImportAbstract.registerFalseFile ( LSDExtQueueMember  member,
String  message 
) [static, inherited]

Register a File as member as False import

Parameters:
member 
message 

static void openlsd.appli.autoimport.commonimport.LSDImportAbstract.registerFalseFile ( String  filename,
String  message 
) [static, inherited]

Register a File as filename as False import

Parameters:
filename 
message 

static void openlsd.appli.autoimport.commonimport.LSDImportAbstract.registerTrueFile ( LSDExtQueueMember  member,
boolean  createOKFile 
) [static, inherited]

Register a File as True import

Parameters:
member 
createOKFile 

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.initOptionsAuto ( String[]  args,
int  curargs 
) [protected, inherited]

Finalize Init options from args for AutoImport

Parameters:
args 
curargs 
Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.initConnection (  )  [protected, inherited]

InitConnection. Must be followed later on by joinConnection()

Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.prepareImportQueue (  )  [protected, inherited]

Prepare the Import Queue

Returns:
True if OK, else False

Reimplemented in openlsd.server.autoimport.commonimport.LSDServerImportAbstract, and openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.joinConnection (  )  [protected, inherited]

Finalize connection if they are pending

Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.errorFromPrepareImportQueue (  )  [protected, inherited]

Set the error status from prepareImportQueue

Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.finalizeAfterImport (  )  [protected, inherited]

Finalize status and object after import and close LSD connections

Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.finishAfterAutoImport (  )  [protected, inherited]

Finalize status and object after import for AutoImport

Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.finalizeAfterAutoImport (  )  [protected, inherited]

Finalize and close LSD connections for AutoImport

Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.finalizeConnection (  )  [protected, inherited]

Finalize connection (database)

Returns:
True if OK, else False

Reimplemented in openlsm.autoimport.commonimport.LSMImportAbstract.

void openlsd.appli.autoimport.commonimport.LSDImportAbstract.finalizeRegisterFile (  )  [protected, inherited]

Finalize registered files for OK and KO

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.getClientPutInfo ( LSDDbLegacy  legacy,
boolean  compressedClient,
boolean  keepalived 
) [protected, inherited]

Get a LSDClientPut and LSDClientInfo and LSDClientDelete for the Legacy and using the extension of PutSessionHandler and InfoSessionHandler.

Parameters:
legacy 
compressedClient 
keepalived 
Returns:
True if OK, else False

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.getClientPutInfoFromIpPort ( LSDDbLegacy  legacy,
LSDDbIpPort  ipportUser1,
LSDDbIpPort  ipportProt1,
boolean  keepalived 
) [protected, inherited]

Get a LSDClientPut and LSDClientInfo and LSDClientDelete for the Legacy and using the extension of PutSessionHandler and InfoSessionHandler.

Parameters:
legacy 
ipportUser1 
ipportProt1 
keepalived 
Returns:
True if OK, else False

LSDDbLegacy openlsd.appli.autoimport.commonimport.LSDImportAbstract.getLegacy ( long  lid  )  [protected, inherited]

Get the Legacy corresponding to the Legacy lid

Parameters:
lid 
Returns:
the LSDDBLegacy or null if an error occurs.

LSDDbIpPort openlsd.appli.autoimport.commonimport.LSDImportAbstract.getIpPortC ( LSDDbLegacy  legacy  )  [protected, inherited]

Get the IpPort correspondig to the Legacy for Compress

Parameters:
legacy 
Returns:
The LSDDbIpPort or null if an error occurs.

LSDDbIpPort openlsd.appli.autoimport.commonimport.LSDImportAbstract.getIpPortP ( LSDDbLegacy  legacy  )  [protected, inherited]

Get the IpPort correspondig to the Legacy for Protected

Parameters:
legacy 
Returns:
The LSDDbIpPort or null if an error occurs.


Member Data Documentation

DB Admin object

LSDLoadConfig openlsd.appli.autoimport.commonimport.LSDImportAbstract.llc = null [protected, inherited]

LoadConfig from file

Does this Import using the same Legacy for all files

If Same Legacy, which Legacy Id

If Same Legacy, which Legacy Object

Does the file after successful import should be deleted

Which mode: 0 = file lid idb, 1 = dir extension, 2 = sourcefile

Mode 0: the file

Mode 0: the Legacy Id

Mode 0: the ID Business

LSDExtClientInfo openlsd.appli.autoimport.commonimport.LSDImportAbstract.lci = null [protected, inherited]

Info Client

LSDClientPut openlsd.appli.autoimport.commonimport.LSDImportAbstract.lcp = null [protected, inherited]

Put Client

Delete Client

Password for Delete Client

Mode 1: Directory

Mode 1: Extension

Mode 2: Source filename

Mode block

ConcurrentLinkedQueue<LSDExtQueueMember> openlsd.appli.autoimport.commonimport.LSDImportAbstract.todoQueue = null [protected, inherited]

Queue of files to import in non block mode

ConcurrentLinkedQueue<LSDExtQueueMembers> openlsd.appli.autoimport.commonimport.LSDImportAbstract.todoQueueB = null [protected, inherited]

Queue of files to import in block mode

ConcurrentLinkedQueue<LSDExtQueueMember> openlsd.appli.autoimport.commonimport.LSDImportAbstract.doneQueue = null [protected, inherited]

Queue of imported files

Number of Files

long openlsd.appli.autoimport.commonimport.LSDImportAbstract.KO = 0 [static, protected, inherited]

Number of KO files

Number of threads

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.istesting = false [static, protected, inherited]

test only

test only

Date openlsd.appli.autoimport.commonimport.LSDImportAbstract.date_debut = null [static, protected, inherited]

test only

Is DB Conn using thread shared connection

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.async = false [protected, inherited]

Should the connection done as async (join with a future)

Using compression

LSDClientPut [] openlsd.appli.autoimport.commonimport.LSDImportAbstract.lcps = null [protected, inherited]

Client connections

Database connections

List of files from -dir option

LinkedList<String> openlsd.appli.autoimport.commonimport.LSDImportAbstract.listline = null [protected, inherited]

List of line from -source option

ConcurrentLinkedQueue<LSDExtQueueMember> [] openlsd.appli.autoimport.commonimport.LSDImportAbstract.todoQueues = null [protected, inherited]

todo Queues for non block mode

ConcurrentLinkedQueue<LSDExtQueueMembers> [] openlsd.appli.autoimport.commonimport.LSDImportAbstract.todoQueuesB = null [protected, inherited]

todo Queues for block mode

todo local Queue for non block mode

ConcurrentLinkedQueue<LSDExtQueueMembers> openlsd.appli.autoimport.commonimport.LSDImportAbstract.todoQueueBLocal = null [protected, inherited]

todo local Queue for block mode

LinkedList<String> openlsd.appli.autoimport.commonimport.LSDImportAbstract.errorList = null [protected, inherited]

List of files in error from init part

File that stops the process when it exists for AutoImport

boolean openlsd.appli.autoimport.commonimport.LSDImportAbstract.use2Out = false [static, protected, inherited]

Should we use two files as exit (OK and KO) or one KO by file

Basename for 2out files

FileWriter openlsd.appli.autoimport.commonimport.LSDImportAbstract.fileOK = null [static, protected, inherited]

FileWriter for OK status if use2Out is true

FileWriter openlsd.appli.autoimport.commonimport.LSDImportAbstract.fileKO = null [static, protected, inherited]

FileWriter for KO status if use2Out is true

long openlsd.appli.autoimport.commonimport.LSDImportAbstract.countKO = 0 [static, protected, inherited]

Number of KO files

long openlsd.appli.autoimport.commonimport.LSDImportAbstract.countOK = 0 [static, protected, inherited]

Number of OK files

Target if any by default (implies the use of -samelid option) (ML Support)

final String openlsd.appli.autoimport.commonimport.LSDImportAbstract.extOK = ".ok" [static, inherited]

Extension for OK files

final String openlsd.appli.autoimport.commonimport.LSDImportAbstract.extKO = ".ko" [static, inherited]

Extension for KO files


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