openlsm.autoimport.LSMImport Class Reference

Inheritance diagram for openlsm.autoimport.LSMImport:

Inheritance graph
[legend]
Collaboration diagram for openlsm.autoimport.LSMImport:

Collaboration graph
[legend]

List of all members.


Detailed Description

Class to import files into DB and LSD for OpenLSM
Author:
Frederic Bregier LGPL

Public Member Functions

boolean initRegisterFile ()

Static Public Member Functions

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

 LSMImport (LSDLoadConfig llc)
 LSMImport (LSDDbAdmin admin)
int initializeArgs (String[] args, int curargs)
boolean getIndexFromString (String line)
boolean initOptions (String[]args, int curargs)
boolean initConnection ()
boolean prepareImportQueue ()
boolean finalizeAfterImport ()
boolean finishAfterAutoImport ()
boolean finalizeConnection ()
int privateInitializeArgs (String[] args, int curargs)
boolean initOneFileOption (int curargs, String[]args)
boolean initOptionsAuto (String[]args, int curargs)
boolean joinConnection ()
boolean errorFromPrepareImportQueue ()
boolean finalizeAfterAutoImport ()
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

openlsm.autoimport.LSMImport.LSMImport ( LSDLoadConfig  llc  )  [protected]

Create a LSMImport from args

Parameters:
llc 

openlsm.autoimport.LSMImport.LSMImport ( LSDDbAdmin  admin  )  [protected]

Create a LSMImport from args

Parameters:
admin 


Member Function Documentation

static void openlsm.autoimport.LSMImport.main ( String[]  args  )  [static]

Run auto 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
-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) (MANDATORY since OpenLSM suppose only one Legacy by import)
-idip set the idip of the target OpenLSD Server (should be either Protected or Compressed ports id)
As third group of args:
-source sourcefile (containing a list of "file lid idb" where lid is not there if -samelid is set)

int openlsm.autoimport.commonimport.LSMImportAbstract.initializeArgs ( String[]  args,
int  curargs 
) [protected, inherited]

Get arguments

Parameters:
args 
curargs 
Returns:
the next current rank

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.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 from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.initOptions ( String[]  args,
int  curargs 
) [protected, inherited]

Finalize Init options from args

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

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.initConnection (  )  [protected, inherited]

InitConnection. Must be followed later on by joinConnection()

Returns:
True if OK, else False

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.prepareImportQueue (  )  [protected, inherited]

Prepare the Import Queue

Returns:
True if OK, else False

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.finalizeAfterImport (  )  [protected, inherited]

Finalize status and object after import and close LSD connections

Returns:
True if OK, else False

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.finishAfterAutoImport (  )  [protected, inherited]

Finalize status and object after import for AutoImport

Returns:
True if OK, else False

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

boolean openlsm.autoimport.commonimport.LSMImportAbstract.finalizeConnection (  )  [protected, inherited]

Finalize connection (database)

Returns:
True if OK, else False

Reimplemented from openlsd.appli.autoimport.commonimport.LSDImportAbstract.

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.

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.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.finalizeAfterAutoImport (  )  [protected, inherited]

Finalize and close LSD connections for AutoImport

Returns:
True if OK, else False

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

LoadConfig from file

Does this Import using the same Legacy for all files

If Same Legacy, which Legacy Id

LSDDbLegacy openlsd.appli.autoimport.commonimport.LSDImportAbstract.sameLegacy = null [protected, inherited]

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

LSDBusiness openlsd.appli.autoimport.commonimport.LSDImportAbstract.lsdb = null [protected, inherited]

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

LSDClientDelete openlsd.appli.autoimport.commonimport.LSDImportAbstract.lcd = null [protected, inherited]

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

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

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: