public class Store extends java.lang.Object implements StoreConstants
| Modifier and Type | Field and Description | 
|---|---|
| static boolean | DEFAULT_HANDLER_FLAG | 
| static java.lang.String | REVISION | 
| java.lang.Object | storeAccessLock | 
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, MAP_ASSIGN, MAP_CHARS_TO_ESCAPE, MAP_CLASS_SEPARATOR, MAP_FLAG, NAMESPACE, SH_SUFFIX, STORING_STATE, UPDATE_OP| Constructor and Description | 
|---|
| Store(java.lang.String logFilename)Create a new Store which does not support precompiled store
 handlers nor in-memory parsing. | 
| Store(java.lang.String logFilename,
     boolean areHandlersEnabled)Create a new Store which does not support precompiled store handlers. | 
| Store(java.lang.String logFilename,
     boolean areHandlersEnabled,
     java.lang.String urid,
     boolean useNIO)Create a new Store | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addClassTag(java.lang.String tag,
           java.lang.Class<?> clazz)Binds a tag name with a Storable class. | 
| void | addExtraDeleteAttribute(java.lang.String attName)Adds an attribute which will be stored when a storable is deleted. | 
| void | addStoreListener(StoreListener listener,
                boolean repeat) | 
| void | addStoreListener(StoreListener listener,
                java.lang.Class<?> clazz,
                boolean repeat) | 
| void | appendAndProcessSuffix(java.util.List<? extends LogEntry> logEntryList)Appends the given LogEntries in the store.xml file and process each of them. | 
| void | appendMilestone(java.util.Map<java.lang.String,java.lang.String> map)Appends a milestone in the store. | 
| void | appendMilestone(java.lang.String text)Appends a milestone in the store. | 
| void | appendSync(java.util.Date date)Appends a sync tag in the store. | 
| boolean | backupStore(java.io.File backupFile)Backup the store. | 
| void | close()Close all Store resources when ending. | 
| void | create(Storable storable)Create a storable, set storable id to stamp value. | 
| void | create(Storable storable,
      boolean overrideId)Create a storable, if overrideId is false and storable have an id then do not override id. | 
| void | delete(Storable storable)Delete a storable (even if references remain on it). | 
| void | delete(Storable storable,
      boolean force)Delete a storable. | 
| int | generateDelta(java.io.OutputStream out,
             Stamp startStamp,
             boolean includeStart)Ouput in a given stream all the log operations having a stamp greater that the given one. | 
| void | generateLogFromMemory(java.lang.String backupFilename)Cleans the log. | 
| java.lang.Class<?> | getClassFromTag(java.lang.String tag)Returns the class binded with a specified tag name
 If the class was not registered the class associated  to the name is returned | 
| int | getCreationLineNumber(java.lang.String id)Returns the line number in the store file of the creation. | 
| java.util.TreeSet<? extends Storable> | getDeletedSet(java.lang.Class<?> clazz)Get the latest version of the deleted Storable for a given class. | 
| java.util.Set<java.lang.String> | getExtraDeleteAttributeSet()Returns the list of attributes stored when a storable is deleted. | 
| LoadReport | getLoadReport()Return the load report | 
| LogCleaner | getLogCleaner()Returns the LogCleaner. | 
| java.lang.String | getLogFilename()Return the name of the log file. | 
| java.util.List<InnerLogEntry> | getMilestoneList()Returns the list of milestones. | 
| Stamp | getProgressStamp()Return the greatest stamp of this urid | 
| Stamp | getProgressStamp(java.lang.String urid)Return the greatest stamp of the given urid | 
| StampTable | getProgressTable()Return the progressTable | 
| int | getSize()Return the size of the store. | 
| Stamp | getStamp()Return a new stamp. | 
| int | getStampLineNumber(Stamp stamp)Returns the line number in the store file of the given stamp. | 
| int | getState()Return the current state of the store (see StoreConstants). | 
| Storable | getStorable(java.lang.String id)Return the storable given its id | 
| java.util.Map<java.lang.Class<?>,java.util.Set<StoreListener>> | getStoreClassListeners(boolean repeat) | 
| java.util.Set<StoreListener> | getStoreListeners(boolean repeat) | 
| SyncManager | getSyncManager()Return the SyncManager | 
| java.lang.String | getTagFromClass(java.lang.Class<?> clazz)Returns the tag name binded with a specified class | 
| java.lang.String | getUrid() | 
| java.util.List<? extends Storable> | getVersionList(Storable storable)Get all the version of a given Storable | 
| java.util.List<? extends Storable> | getVersionList(java.lang.String id)Get all the version of a given Storable ID | 
| boolean | isReferrenced(Storable storable) | 
| boolean | isRegistered(Storable storable) | 
| boolean | isRegistered(java.lang.String id) | 
| java.util.Iterator<Storable> | iterator()Return an iterator on the storables registered in the swizzler | 
| void | load()Load and process the log | 
| void | load(boolean processStorable,
    boolean processInner)Load and process the log | 
| void | parseLog(LogManagerHandler handler)Parse the store with the given handler | 
| boolean | parseLog(LogManagerHandler handler,
        int startLine)Parse the store with the given handler from the given line number | 
| void | parseLog(LogManagerHandler handler,
        Stamp stamp)Parse the store with the given handler from the given stamp | 
| void | printMemoryToLog(java.io.OutputStream out)Prints a cleaned version of the log. | 
| void | processInnerLogEntry(InnerLogEntry logEntry) | 
| void | processLogEntry(LogEntry logEntry) | 
| void | processStorableLogEntry(StorableLogEntry sle) | 
| void | removeStoreListener(StoreListener listener) | 
| void | removeStoreListener(StoreListener listener,
                   java.lang.Class<?> clazz) | 
| void | replaceSuffix(java.util.TreeSet<StorableLogEntry> newSuffix,
             LogEntry startLogEntry,
             boolean includeStart) | 
| void | setClassLoader(java.lang.ClassLoader classLoader)Set the classLoader | 
| void | setReplaceSuffixLimit(int replaceSuffixLimit)A store suffix replacement starting before the limit will be rejected. | 
| void | setUrid(java.lang.String urid)Set the current urid value | 
| void | update(Storable storable,
      java.util.Map<java.lang.String,java.lang.String> attributes)Update a storable. | 
| void | update(Storable storable,
      Storable updated)Update a storable. | 
| void | update(java.lang.String id,
      java.util.Map<java.lang.String,java.lang.String> attributes)Update a storable. | 
| void | update(java.lang.String id,
      Storable updated)Update a storable. | 
| void | updateStamp(Stamp stamp)Update the current stamp value (and the progress table) | 
| void | updateStamp(Stamp stamp,
           boolean updatePT)Update the current stamp value | 
| boolean | verifyLastStampIndex()Verify if the last (highest) stamp is correctly indexed. | 
| boolean | verifyStampLineMap()Verify if the stamps are correctly indexed. | 
public static final java.lang.String REVISION
public static final boolean DEFAULT_HANDLER_FLAG
public java.lang.Object storeAccessLock
public Store(java.lang.String logFilename)
      throws java.io.IOException
logFilename - the name of the file which contains the logjava.io.IOException - if an error occurspublic Store(java.lang.String logFilename,
             boolean areHandlersEnabled)
      throws java.io.IOException
logFilename - the name of the file which contains the logareHandlersEnabled - specify if the precompiled store handlers are supported.java.io.IOException - if an error occurspublic Store(java.lang.String logFilename,
             boolean areHandlersEnabled,
             java.lang.String urid,
             boolean useNIO)
      throws java.io.IOException
logFilename - the name of the file which contains the logareHandlersEnabled - specify if the precompiled store handlers are supported.urid - the URIDuseNIO - specify if the NIO must be used (faster store access)java.io.IOException - if an error occurspublic void addExtraDeleteAttribute(java.lang.String attName)
attName - the attribute namepublic java.util.Set<java.lang.String> getExtraDeleteAttributeSet()
public void setClassLoader(java.lang.ClassLoader classLoader)
classLoader - the classLoader to usepublic void addClassTag(java.lang.String tag,
                        java.lang.Class<?> clazz)
tag - the nam of the tagclazz - the classpublic java.lang.String getTagFromClass(java.lang.Class<?> clazz)
clazz - the classpublic java.lang.Class<?> getClassFromTag(java.lang.String tag)
                                   throws java.lang.ClassNotFoundException
tag - the tag namejava.lang.ClassNotFoundException - if an error occurspublic Storable getStorable(java.lang.String id)
id - the storable idpublic boolean isReferrenced(Storable storable)
storable - the storable to checkpublic boolean isRegistered(Storable storable)
storable - the storable to checkpublic boolean isRegistered(java.lang.String id)
id - the storable idpublic java.util.List<? extends Storable> getVersionList(Storable storable)
storable - the storablepublic java.util.List<? extends Storable> getVersionList(java.lang.String id)
id - the ID of storablepublic java.util.TreeSet<? extends Storable> getDeletedSet(java.lang.Class<?> clazz)
clazz - the searched classpublic int generateDelta(java.io.OutputStream out,
                         Stamp startStamp,
                         boolean includeStart)
                  throws LogException
out - the outputstream to use to output the operationsstartStamp - the stamp to start the copyincludeStart - true if the start stamp must be includedLogException - if an error occurspublic void parseLog(LogManagerHandler handler) throws LogException
handler - the handler used to parse the storeLogException - if an error occurspublic void parseLog(LogManagerHandler handler, Stamp stamp) throws LogException
handler - the handler used to parse the storestamp - the stamp to start the parsingLogException - if an error occurspublic boolean parseLog(LogManagerHandler handler, int startLine)
handler - the handler used to parse the storestartLine - the line number to start the parsingpublic void replaceSuffix(java.util.TreeSet<StorableLogEntry> newSuffix, LogEntry startLogEntry, boolean includeStart) throws java.io.IOException
newSuffix - The new suffixstartLogEntry - the start logEntryincludeStart - true if the startLogEntry must be includedjava.io.IOException - if an error occursLogManager.replaceSuffix(java.util.TreeSet,com.jalios.jstore.LogEntry,boolean,boolean)public void appendAndProcessSuffix(java.util.List<? extends LogEntry> logEntryList) throws java.io.IOException
logEntryList - the list of logEntry. It assumes the logEntries are sorted according their stampsjava.io.IOException - if an error occurspublic java.util.Iterator<Storable> iterator()
public int getSize()
public int getState()
public java.lang.String getUrid()
StampManager.getUrid()public void setUrid(java.lang.String urid)
urid - the URIDStampManager.setUrid(String)public void updateStamp(Stamp stamp)
stamp - the stamp to be addedupdateStamp(Stamp, boolean)public void updateStamp(Stamp stamp, boolean updatePT)
stamp - the stamp to be addedupdatePT - if true use this stamp to update the progress tableStampManager.update(com.jalios.jstore.Stamp,boolean)public Stamp getStamp()
StampManager.getStamp()public StampTable getProgressTable()
StampManager.getProgressTable()public Stamp getProgressStamp()
StampManager.getProgressStamp(String)public Stamp getProgressStamp(java.lang.String urid)
urid - the uridStampManager.getProgressStamp(String)public SyncManager getSyncManager()
public void load()
          throws LogException
LogException - if an error occurspublic void load(boolean processStorable,
                 boolean processInner)
          throws LogException
processStorable - if true the storable operations are processed. If false only the stamps information are processed.processInner - if true the storable operations are processed. If false only the stamps information are processed.LogException - if an error occurspublic void processLogEntry(LogEntry logEntry)
public void processInnerLogEntry(InnerLogEntry logEntry)
public void processStorableLogEntry(StorableLogEntry sle)
public void create(Storable storable) throws java.io.IOException
storable - the storable to create.java.io.IOException - if an error occurspublic void create(Storable storable, boolean overrideId) throws java.io.IOException
storable - the storableoverrideId - if overrideId is false and storable have an id then do not override idjava.io.IOException - if an error occurspublic void update(java.lang.String id,
                   java.util.Map<java.lang.String,java.lang.String> attributes)
            throws java.io.IOException
id - the id of the storable to updateattributes - the map that contains the new attributes valuesjava.io.IOException - if an error occurspublic void update(Storable storable, java.util.Map<java.lang.String,java.lang.String> attributes) throws java.io.IOException
storable - the storable to updateattributes - the map that contains the new attributes valuesjava.io.IOException - if an error occurspublic void update(java.lang.String id,
                   Storable updated)
            throws java.io.IOException,
                   NoUpdateException
storable and updated.id - the id of the storable to updateupdated - the updated storablejava.io.IOException - if an error occursNoUpdateException - if an error occurspublic void update(Storable storable, Storable updated) throws java.io.IOException, NoUpdateException
storable and updated.storable - the storable to updateupdated - the updated storablejava.io.IOException - if an error occursNoUpdateException - on error, for example when given objects are same instancepublic void delete(Storable storable) throws java.io.IOException
storable - the storable to deletejava.io.IOException - if an error occurspublic void delete(Storable storable, boolean force) throws java.io.IOException
storable - the storable to deleteforce - if true the referenced storable attributes are
 deletedjava.io.IOException - if an error occurspublic java.util.List<InnerLogEntry> getMilestoneList()
public void appendMilestone(java.lang.String text)
                     throws java.io.IOException
text - the text of the milestone.java.io.IOException - if an error occurspublic void appendMilestone(java.util.Map<java.lang.String,java.lang.String> map)
                     throws java.io.IOException
map - the map of attributes.java.io.IOException - if an error occurspublic void appendSync(java.util.Date date)
                throws java.io.IOException
date - the date of the sync.java.io.IOException - if an error occurspublic void generateLogFromMemory(java.lang.String backupFilename)
                           throws java.io.IOException
printCleanedLog method. If a backup filename is provided (i.e. not null), the current log file is copy into before to
 be cleaned.backupFilename - the name of the file to backup the current logjava.io.IOException - if an error occurspublic void printMemoryToLog(java.io.OutputStream out)
                      throws java.lang.Exception
out - the OutputStream in which to print the cleaned logjava.lang.Exception - if an error occurspublic LogCleaner getLogCleaner()
public java.lang.String getLogFilename()
public LoadReport getLoadReport()
public int getStampLineNumber(Stamp stamp)
stamp - the stamp to get the line numberpublic boolean verifyStampLineMap()
public boolean verifyLastStampIndex()
public int getCreationLineNumber(java.lang.String id)
id - the id of the storablepublic boolean backupStore(java.io.File backupFile)
backupFile - the backup file.LogManager.backupStore(File)public void setReplaceSuffixLimit(int replaceSuffixLimit)
replaceSuffixLimit - the limit (in number of lines).public java.util.Set<StoreListener> getStoreListeners(boolean repeat)
public java.util.Map<java.lang.Class<?>,java.util.Set<StoreListener>> getStoreClassListeners(boolean repeat)
public void addStoreListener(StoreListener listener, boolean repeat)
public void addStoreListener(StoreListener listener, java.lang.Class<?> clazz, boolean repeat)
public void removeStoreListener(StoreListener listener)
public void removeStoreListener(StoreListener listener, java.lang.Class<?> clazz)
public void close()
Copyright © 2001-2019 Jalios SA. All Rights Reserved.