public class HistoryServiceImpl extends java.lang.Object implements HistoryService
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DATA_DIRECTORY
The data directory.
|
static java.lang.String |
DATA_FILE
The data file.
|
CACHE_ENABLED_PROPERTY, DATE_FORMAT
Constructor and Description |
---|
HistoryServiceImpl(org.osgi.framework.BundleContext bundleContext)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
History |
createHistory(HistoryID id,
HistoryRecordStructure recordStructure)
Creates a new history for this ID.
|
protected javax.xml.parsers.DocumentBuilder |
getDocumentBuilder() |
java.util.List<HistoryID> |
getExistingHistories(java.lang.String[] rawid)
Enumerates existing histories.
|
java.util.Iterator<HistoryID> |
getExistingIDs()
Returns the IDs of all existing histories.
|
protected org.jitsi.service.fileaccess.FileAccessService |
getFileAccessService() |
History |
getHistory(HistoryID id)
Returns the history associated with this ID.
|
protected boolean |
isCacheEnabled()
Returns whether caching of readed documents is enabled or desibled.
|
boolean |
isHistoryCreated(HistoryID id)
Checks whether a history is created and stored.
|
boolean |
isHistoryExisting(HistoryID id)
Tests if a history with the given ID exists and is loaded.
|
void |
moveHistory(HistoryID oldId,
HistoryID newId)
Moves the content of oldId history to the content of the newId.
|
protected org.w3c.dom.Document |
parse(java.io.ByteArrayInputStream in)
Parse documents.
|
protected org.w3c.dom.Document |
parse(java.io.File file)
Parse documents.
|
void |
purgeLocallyCachedHistories()
Clears locally(in memory) cached histories.
|
void |
purgeLocallyStoredHistory(HistoryID id)
Permamently removes local stored History
|
public static final java.lang.String DATA_DIRECTORY
public static final java.lang.String DATA_FILE
public HistoryServiceImpl(org.osgi.framework.BundleContext bundleContext) throws java.lang.Exception
bundleContext
- OSGi bundle contextjava.lang.Exception
- if something went wrong during initializationpublic java.util.Iterator<HistoryID> getExistingIDs()
HistoryService
getExistingIDs
in interface HistoryService
public boolean isHistoryExisting(HistoryID id)
HistoryService
isHistoryExisting
in interface HistoryService
id
- The ID to test.public History getHistory(HistoryID id) throws java.lang.IllegalArgumentException
HistoryService
getHistory
in interface HistoryService
id
- The ID of the history.java.lang.IllegalArgumentException
- Thrown if there is no such history.public History createHistory(HistoryID id, HistoryRecordStructure recordStructure) throws java.lang.IllegalArgumentException, java.io.IOException
HistoryService
createHistory
in interface HistoryService
id
- The ID of the history to be created.recordStructure
- The structure of the data.java.lang.IllegalArgumentException
- Thrown if such history already exists.java.io.IOException
- Thrown if the history could not be created due to a IO error.protected org.jitsi.service.fileaccess.FileAccessService getFileAccessService()
protected javax.xml.parsers.DocumentBuilder getDocumentBuilder()
protected org.w3c.dom.Document parse(java.io.File file) throws org.xml.sax.SAXException, java.io.IOException
file
- File the file to parseorg.xml.sax.SAXException
- exceptionjava.io.IOException
- exceptionprotected org.w3c.dom.Document parse(java.io.ByteArrayInputStream in) throws org.xml.sax.SAXException, java.io.IOException
in
- ByteArrayInputStream the stream to parseorg.xml.sax.SAXException
- exceptionjava.io.IOException
- exceptionprotected boolean isCacheEnabled()
public void purgeLocallyStoredHistory(HistoryID id) throws java.io.IOException
purgeLocallyStoredHistory
in interface HistoryService
id
- HistoryIDjava.io.IOException
public void purgeLocallyCachedHistories()
purgeLocallyCachedHistories
in interface HistoryService
public void moveHistory(HistoryID oldId, HistoryID newId) throws java.io.IOException
moveHistory
in interface HistoryService
oldId
- old and existing historynewId
- the place where content of oldId will be movedjava.io.IOException
- problem moving to newIdpublic boolean isHistoryCreated(HistoryID id)
isHistoryCreated
in interface HistoryService
id
- the history to checkpublic java.util.List<HistoryID> getExistingHistories(java.lang.String[] rawid) throws java.lang.IllegalArgumentException
getExistingHistories
in interface HistoryService
rawid
- the start of the HistoryID of all the histories that will be
returned.java.lang.IllegalArgumentException
- if the rawid contains ids
which are missing in current history.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.