Package com.jalios.jstore
Class LogManager
- java.lang.Object
-
- com.jalios.jstore.LogManager
-
- All Implemented Interfaces:
StoreConstants
public class LogManager extends java.lang.Object implements StoreConstants
This class manages the log file- Author:
- Olivier Dedieu
-
-
Field Summary
-
Fields inherited from interface com.jalios.jstore.StoreConstants
ARRAY_FLAG, CLEANING_STATE, COLLECTION_FLAG, CREATE_OP, DELETE_OP, IDLE_STATE, INNER_LOGS, INNER_MILESTONE, INNER_PREFIX, INNER_SYNC, ITEM_ESCAPE_CHAR, ITEM_SEPARATOR, LOADING_STATE, LOG_DIR_LOG_PREFIX, LOG_DIR_LOG_WORK, MAP_ASSIGN, MAP_CHARS_TO_ESCAPE, MAP_CLASS_SEPARATOR, MAP_FLAG, NAMESPACE, SH_SUFFIX, STORING_STATE, UPDATE_OP
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
backupStore(java.io.File backupFile)
Backup the store.java.io.File
getLatestLogPrefixFile()
long
getLineNumberInLogWork(long globalLineNumber)
LoadReport
getLoadReport()
java.io.File
getLogDirectory()
java.io.File
getLogFile()
java.util.List<java.io.File>
getLogFileList()
java.lang.String
getLogFilename()
Return the name of the log file.java.io.File
getLogWorkFile()
long
getLogWorkStartLine()
long
getPrefixLineCount()
boolean
isLogDirectory()
long
moveOperations(Stamp stamp, long expectedLineCount)
Move the operations of store-work.xml to the most recent store-prefix-n.xml.void
refreshLogDirectory()
void
refreshLogFile()
void
replaceSuffix(java.util.TreeSet<StorableLogEntry> newSuffix, LogEntry startLogEntry, boolean includeStart, boolean useIndex)
Replace the existing suffix of the store (starting at startLogEntry) with a new one represented by newSuffix.static java.lang.String
searchStamp(java.lang.String line)
Search the stamp in a line of the store.void
setReplaceSuffixLimit(int replaceSuffixLimit)
A store suffix replacement starting before the limit will be rejected.boolean
stampExists(Stamp stamp)
boolean
verifyLastStampIndex()
Returns true if the last (highest) stamp is correctly indexed.boolean
verifyStampLineMap()
Verify if the all the stamps are correctly indexed.
-
-
-
Method Detail
-
refreshLogDirectory
public void refreshLogDirectory() throws LogException
- Throws:
LogException
-
refreshLogFile
public void refreshLogFile() throws LogException
- Throws:
LogException
-
getLogFilename
public java.lang.String getLogFilename()
Return the name of the log file.- Returns:
- the name of the log file
-
isLogDirectory
public boolean isLogDirectory()
-
getLogDirectory
public java.io.File getLogDirectory()
-
getLogFileList
public java.util.List<java.io.File> getLogFileList()
-
getLogWorkFile
public java.io.File getLogWorkFile()
-
getLatestLogPrefixFile
public java.io.File getLatestLogPrefixFile()
-
getLogFile
public java.io.File getLogFile()
-
getPrefixLineCount
public long getPrefixLineCount()
-
getLoadReport
public LoadReport getLoadReport()
-
replaceSuffix
public void replaceSuffix(java.util.TreeSet<StorableLogEntry> newSuffix, LogEntry startLogEntry, boolean includeStart, boolean useIndex) throws java.io.IOException
Replace the existing suffix of the store (starting at startLogEntry) with a new one represented by newSuffix.- Parameters:
newSuffix
- the new suffixstartLogEntry
- the position of the suffix to replaceincludeStart
- if true start the suffix remplacement at startLogEntry ; otherwise just after startLogEntryuseIndex
- should use indexed log access- Throws:
java.io.IOException
- if I/O exception occurs or a LogExpcetion if some conditions are not respected (eg: too deep replacement, new store is smaller than the common prefix)- Since:
- jcms-4.1.0
-
getLineNumberInLogWork
public long getLineNumberInLogWork(long globalLineNumber) throws java.io.IOException
- Throws:
java.io.IOException
-
verifyLastStampIndex
public boolean verifyLastStampIndex()
Returns true if the last (highest) stamp is correctly indexed.- Returns:
- true if the last (highest) stamp is correctly indexed.
- Since:
- jcms-5.0.5
-
verifyStampLineMap
public boolean verifyStampLineMap()
Verify if the all the stamps are correctly indexed. Prints the first bad indexed stamp in the store.- Returns:
- true if all the stamps are correctly indexed.
- Since:
- jcms-5.0.5
-
searchStamp
public static java.lang.String searchStamp(java.lang.String line)
Search the stamp in a line of the store.- Parameters:
line
- a line of the store- Returns:
- the stamp or null if no stamp is in the line
-
backupStore
public boolean backupStore(java.io.File backupFile)
Backup the store.- Parameters:
backupFile
- the backup file.- Returns:
- true if the store has been successfully backuped.
- Since:
- jcms-5.7.0
-
setReplaceSuffixLimit
public void setReplaceSuffixLimit(int replaceSuffixLimit)
A store suffix replacement starting before the limit will be rejected.- Parameters:
replaceSuffixLimit
- the limit (in number of lines).- Since:
- jcms-5.7.4
-
stampExists
public boolean stampExists(Stamp stamp)
-
moveOperations
public long moveOperations(Stamp stamp, long expectedLineCount)
Move the operations of store-work.xml to the most recent store-prefix-n.xml. This method is dedicated for logDir.- Parameters:
stamp
- move all the operations before this stamps, and also the operation with this stamp.expectedLineCount
- the exepected line count to move- Returns:
- the number of lines moved (-1 if an error occured)
- Since:
- jcms-10.0.8
-
getLogWorkStartLine
public long getLogWorkStartLine()
-
-