|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opensubsystems.core.util.FileCommitUtils
public class FileCommitUtils
Class used for safe file manipulation. It simulates database transaction for file operations such as copy, move, replace or delete. The client should prepare any new or modified file to temporary location. Then the client should call prepareToCommit() method which will prepare the file fot the safe manipulation. After everything is ready, commit() method should be called, otherwise rollback() method should by called.
| Field Summary | |
|---|---|
static java.lang.String |
FILE_PATH_READY_TO_BE_REPLACED
Constant for ready to replace directory name |
static java.lang.String |
FILE_PATH_READY_TO_COPY
Constant for ready to copy directory name |
static java.lang.String |
FILE_PATH_READY_TO_DELETE
Constant for ready to delete directory name |
static java.lang.String |
FILE_PATH_READY_TO_MOVE
Constant for ready to move directory name |
static java.lang.String |
FILE_PATH_READY_TO_REPLACE
Constant for ready to replace directory name |
static java.lang.String |
FILECOMMIT_RETRY_COUNT
Configuration setting for how many times to retry file commit or rollback operations in case of error before the commit or rollback of file manipulation operation is aborted. |
static int |
FILECOMMIT_RETRY_COUNT_DEFAULT
Default value for configuration setting how many times to retry file commit operations in case or error before we give up. |
static int |
LIST_IDENTIFICATOR_COPY
Constant for sender list identificator: copy |
static int |
LIST_IDENTIFICATOR_DELETE
Constant for sender list identificator: replace |
static int |
LIST_IDENTIFICATOR_MOVE
Constant for sender list identificator: replace |
static int |
LIST_IDENTIFICATOR_REPLACE
Constant for sender list identificator: replace |
static int |
LIST_IDENTIFICATOR_TO_BE_REPLACED
Constant for sender list identificator: to be replaced |
protected boolean |
m_bMovedFilesDeleteForRollback
Flag signaling if moved files will be deleted from ready_to_move directory during rollback process. |
protected java.lang.Integer |
m_iReturnCode
Error returning code |
protected int |
m_iStatus
Current status of the utils (prepare commit, commit or rollback). |
protected java.util.List |
m_lstCopyFromFiles
List of file names and path names that will be copied FROM (sources) |
protected java.util.List |
m_lstCopyToFiles
List of file names and path names that will be copied TO (destinations) |
protected java.util.List |
m_lstDeleteFiles
List of file names and path names that will be deleted |
protected java.util.List |
m_lstMoveFromFiles
List of file names and path names that will be moved FROM (sources) |
protected java.util.List |
m_lstMoveToFiles
List of file names and path names that will be moved TO (destinations) |
protected java.util.List |
m_lstReadyToBeReplacedFrom
List of files that are ready to be replaced FROM (sources). |
protected java.util.List |
m_lstReadyToBeReplacedTo
List of files that are ready to be replaced TO (destinations). |
protected java.util.List |
m_lstReadyToCopyFrom
List of files that are ready to copy FROM (sources). |
protected java.util.List |
m_lstReadyToCopyTo
List of files that are ready to copy TO (destinations). |
protected java.util.List |
m_lstReadyToDeleteFrom
List of files that are ready to delete FROM (sources). |
protected java.util.List |
m_lstReadyToDeleteTo
List of files that are ready to delete TO (destinations). |
protected java.util.List |
m_lstReadyToMoveFrom
List of files that are ready to move FROM (sources). |
protected java.util.List |
m_lstReadyToMoveTo
List of files that are ready to move TO (destinations). |
protected java.util.List |
m_lstReadyToReplaceFrom
List of files that are ready to replace FROM (sources). |
protected java.util.List |
m_lstReadyToReplaceTo
List of files that are ready to replace TO (destinations). |
protected java.util.List |
m_lstReplaceFromFiles
List of file names and path names that will be replaced FROM (sources) |
protected java.util.List |
m_lstReplaceToFiles
List of file names and path names that will be replaced TO (destinations) |
protected static int |
RC_DB_ERR
Return code for DB exception status |
static java.lang.Integer |
RC_DB_ERR_OBJ
Object code for for DB exception status |
protected static int |
RC_FILE_ERR
Return code for file exception status |
static java.lang.Integer |
RC_FILE_ERR_OBJ
Object code for for file exception status |
static int |
RC_OK
Return code for successfull status |
static java.lang.Integer |
RC_OK_OBJ
Object code for for successfull status |
protected static int |
s_iFileCommitRetryCount
How many times to retry file commit operations in case or error before we give up. |
static int |
SENDER_COMMIT
Constant for sender identificator: commit |
static int |
SENDER_ROLLBACK
Constant for sender identificator: rollback |
static int |
SLEEP_TIME
Constant for sleeping time duration |
static int |
STATUS_COMMIT
Constant for status: commit |
static int |
STATUS_INITIAL
Constant for initial status: no action yet |
static int |
STATUS_PREPARE_TO_COMMIT
Constant for status: prepare to commit |
static int |
STATUS_ROLLBACK
Constant for status: rollback |
| Constructor Summary | |
|---|---|
FileCommitUtils()
Empty constructor |
|
FileCommitUtils(java.lang.Integer iReturnCode,
java.util.List lstCopyFromFiles,
java.util.List lstCopyToFiles,
java.util.List lstMoveFromFiles,
java.util.List lstMoveToFiles,
java.util.List lstReplaceFromFiles,
java.util.List lstReplaceToFiles,
java.util.List lstDeleteFiles,
boolean bMovedFilesDeleteForRollback)
Full constructor |
|
| Method Summary | |
|---|---|
void |
commit()
Method will commit files. |
int |
getStatus()
|
void |
prepareToCommit()
Method will prepare files to commit. |
void |
rollback()
Method to rollback files. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FILECOMMIT_RETRY_COUNT
public static final int FILECOMMIT_RETRY_COUNT_DEFAULT
public static final int SLEEP_TIME
public static final java.lang.String FILE_PATH_READY_TO_COPY
public static final java.lang.String FILE_PATH_READY_TO_MOVE
public static final java.lang.String FILE_PATH_READY_TO_REPLACE
public static final java.lang.String FILE_PATH_READY_TO_BE_REPLACED
public static final java.lang.String FILE_PATH_READY_TO_DELETE
public static final int RC_OK
public static final java.lang.Integer RC_OK_OBJ
protected static final int RC_DB_ERR
public static final java.lang.Integer RC_DB_ERR_OBJ
protected static final int RC_FILE_ERR
public static final java.lang.Integer RC_FILE_ERR_OBJ
public static final int STATUS_INITIAL
public static final int STATUS_PREPARE_TO_COMMIT
public static final int STATUS_COMMIT
public static final int STATUS_ROLLBACK
public static final int LIST_IDENTIFICATOR_COPY
public static final int LIST_IDENTIFICATOR_REPLACE
public static final int LIST_IDENTIFICATOR_TO_BE_REPLACED
public static final int LIST_IDENTIFICATOR_MOVE
public static final int LIST_IDENTIFICATOR_DELETE
public static final int SENDER_COMMIT
public static final int SENDER_ROLLBACK
protected java.lang.Integer m_iReturnCode
protected java.util.List m_lstCopyFromFiles
protected java.util.List m_lstCopyToFiles
protected java.util.List m_lstMoveFromFiles
protected java.util.List m_lstMoveToFiles
protected java.util.List m_lstReplaceFromFiles
protected java.util.List m_lstReplaceToFiles
protected java.util.List m_lstDeleteFiles
protected int m_iStatus
protected boolean m_bMovedFilesDeleteForRollback
protected java.util.List m_lstReadyToCopyFrom
protected java.util.List m_lstReadyToCopyTo
protected java.util.List m_lstReadyToMoveFrom
protected java.util.List m_lstReadyToMoveTo
protected java.util.List m_lstReadyToBeReplacedFrom
protected java.util.List m_lstReadyToBeReplacedTo
protected java.util.List m_lstReadyToReplaceFrom
protected java.util.List m_lstReadyToReplaceTo
protected java.util.List m_lstReadyToDeleteFrom
protected java.util.List m_lstReadyToDeleteTo
protected static int s_iFileCommitRetryCount
| Constructor Detail |
|---|
public FileCommitUtils()
public FileCommitUtils(java.lang.Integer iReturnCode,
java.util.List lstCopyFromFiles,
java.util.List lstCopyToFiles,
java.util.List lstMoveFromFiles,
java.util.List lstMoveToFiles,
java.util.List lstReplaceFromFiles,
java.util.List lstReplaceToFiles,
java.util.List lstDeleteFiles,
boolean bMovedFilesDeleteForRollback)
iReturnCode - - error returning codelstCopyFromFiles - - list of file and path names that will be copied FROM (sources)lstCopyToFiles - - list of file and path names that will be copied TO (destination)lstMoveFromFiles - - list of file and path names that will be moved FROM (sources)lstMoveToFiles - - list of file and path names that will be moved TO (destination)lstReplaceFromFiles - - list of file and path names that will be replaced FROM (sources)lstReplaceToFiles - list of file and path names that will be replaced TO (destinations)lstDeleteFiles - - list of file and path names that will be deletedbMovedFilesDeleteForRollback - - flag signaling if moved files will be deleted from
ready_to_move directory during rollback process.
This flag will be TRUE if there will be moved files
from temporary directory to the repository. If error
will occured, there is not important move files back
from ready_to_move directory to the temporary one.| Method Detail |
|---|
public void prepareToCommit()
throws java.io.IOException
java.io.IOException - - error occured during file moving
public void commit()
throws OSSException
OSSException - - error occured during files commiting
public void rollback()
throws OSSException
OSSException - - error occured during files commitingpublic int getStatus()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||