public class DefaultChangeLog extends java.lang.Object implements ChangeLog
| Modifier and Type | Field and Description |
|---|---|
private static java.lang.String |
DEFAULT_PARTITION_SUFFIX |
private static java.lang.String |
DEFAULT_REV_CONTAINER_NAME |
private static java.lang.String |
DEFAULT_TAG_CONTAINER_NAME |
private boolean |
enabled
Tells if the service is activated or not
|
private boolean |
exposed
A flag used to tell if the changeLog system is visible by the clients
|
private Tag |
latest
The latest tag set
|
private static org.slf4j.Logger |
LOG
The class logger
|
private java.lang.String |
partitionSuffix |
private java.lang.String |
revContainerName |
private ChangeLogStore |
store
The default store is a InMemory store.
|
private boolean |
storeInitialized
A volatile flag used to avoid store switching when in use
|
private java.lang.String |
tagContainerName |
| Constructor and Description |
|---|
DefaultChangeLog() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the changeLog
|
ChangeLogSearchEngine |
getChangeLogSearchEngine()
Gets the change log query engine which would be used to ask questions
about what changed, when, how and by whom.
|
ChangeLogStore |
getChangeLogStore() |
long |
getCurrentRevision()
Gets the current revision for the server.
|
Tag |
getLatest() |
TagSearchEngine |
getTagSearchEngine()
Gets the tag search engine used to query the snapshots taken.
|
void |
init(DirectoryService service)
Initialize the ChangeLog system.
|
boolean |
isEnabled()
Checks whether or not the change log has been enabled to track changes.
|
boolean |
isExposed() |
boolean |
isLogSearchSupported()
Returns whether or not this ChangeLogService supports searching for changes.
|
boolean |
isTagSearchSupported()
Returns whether or not this ChangeLogService supports searching for snapshot tags.
|
boolean |
isTagStorageSupported()
Returns whether or not this ChangeLogService stores snapshot tags.
|
ChangeLogEvent |
log(LdapPrincipal principal,
org.apache.directory.api.ldap.model.ldif.LdifEntry forward,
org.apache.directory.api.ldap.model.ldif.LdifEntry reverse)
Records a change as a forward LDIF, a reverse change to revert the change and
the authorized principal triggering the revertable change event.
|
ChangeLogEvent |
log(LdapPrincipal principal,
org.apache.directory.api.ldap.model.ldif.LdifEntry forward,
java.util.List<org.apache.directory.api.ldap.model.ldif.LdifEntry> reverses)
Records a change as a forward LDIF, some reverse changes to revert the change and
the authorized principal triggering the revertable change event.
|
void |
setChangeLogStore(ChangeLogStore store)
Set the underlying storage
|
void |
setEnabled(boolean enabled)
Enable or disable the ChangeLog service
|
void |
setExposed(boolean exposed)
Exposes the contents of ChangeLog to clients if set to true.
|
void |
setPartitionSuffix(java.lang.String suffix)
The prefix of the partition.
|
void |
setRevisionsContainerName(java.lang.String revContainerName)
The name of the revisions container under the partition.
|
void |
setTagsContainerName(java.lang.String tagContainerName)
The name of the tags container under the partition.
|
void |
sync()
Flush the changes to disk
|
Tag |
tag()
Creates a snapshot of the server at the current revision.
|
Tag |
tag(long revision)
Creates a tag for a snapshot of the server in a specific state at a revision.
|
Tag |
tag(long revision,
java.lang.String description)
Creates a tag for a snapshot of the server in a specific state at a revision.
|
Tag |
tag(java.lang.String description)
Creates a snapshot of the server at the current revision.
|
java.lang.String |
toString() |
private static final org.slf4j.Logger LOG
private boolean enabled
private Tag latest
private ChangeLogStore store
private volatile boolean storeInitialized
private boolean exposed
private static final java.lang.String DEFAULT_PARTITION_SUFFIX
private static final java.lang.String DEFAULT_REV_CONTAINER_NAME
private static final java.lang.String DEFAULT_TAG_CONTAINER_NAME
private java.lang.String partitionSuffix
private java.lang.String revContainerName
private java.lang.String tagContainerName
public ChangeLogStore getChangeLogStore()
getChangeLogStore in interface ChangeLogpublic void setChangeLogStore(ChangeLogStore store)
setChangeLogStore in interface ChangeLogstore - The storagepublic long getCurrentRevision()
throws org.apache.directory.api.ldap.model.exception.LdapException
getCurrentRevision in interface ChangeLogorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic ChangeLogEvent log(LdapPrincipal principal, org.apache.directory.api.ldap.model.ldif.LdifEntry forward, org.apache.directory.api.ldap.model.ldif.LdifEntry reverse) throws org.apache.directory.api.ldap.model.exception.LdapException
log in interface ChangeLogprincipal - the authorized LDAP principal triggering the changeforward - LDIF of the change going to the next statereverse - LDIF (anti-operation): the change required to revert this changeorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic ChangeLogEvent log(LdapPrincipal principal, org.apache.directory.api.ldap.model.ldif.LdifEntry forward, java.util.List<org.apache.directory.api.ldap.model.ldif.LdifEntry> reverses) throws org.apache.directory.api.ldap.model.exception.LdapException
log in interface ChangeLogprincipal - the authorized LDAP principal triggering the changeforward - LDIF of the change going to the next statereverses - LDIF (anti-operation): the changes required to revert this changeorg.apache.directory.api.ldap.model.exception.LdapExceptionpublic boolean isLogSearchSupported()
isLogSearchSupported in interface ChangeLogpublic boolean isTagSearchSupported()
isTagSearchSupported in interface ChangeLogpublic boolean isTagStorageSupported()
isTagStorageSupported in interface ChangeLogpublic ChangeLogSearchEngine getChangeLogSearchEngine()
getChangeLogSearchEngine in interface ChangeLogpublic TagSearchEngine getTagSearchEngine()
getTagSearchEngine in interface ChangeLogpublic Tag tag(long revision, java.lang.String description) throws java.lang.Exception
tag in interface ChangeLogrevision - the revision to tag the snapshotdescription - some information about what the snapshot tag representsjava.lang.Exception - if there is a problem taking a tagjava.lang.IllegalArgumentException - if the revision is out of range (less than 0
and greater than the current revision)public Tag tag(long revision) throws java.lang.Exception
tag in interface ChangeLogrevision - the revision to tag the snapshotjava.lang.Exception - if there is a problem taking a tagjava.lang.IllegalArgumentException - if the revision is out of range (less than 0
and greater than the current revision)public Tag tag(java.lang.String description) throws java.lang.Exception
public Tag tag() throws java.lang.Exception
public void setEnabled(boolean enabled)
setEnabled in interface ChangeLogenabled - true to enable the service, flase to disable itpublic boolean isEnabled()
public Tag getLatest() throws org.apache.directory.api.ldap.model.exception.LdapException
public void init(DirectoryService service) throws java.lang.Exception
public void sync()
throws java.lang.Exception
public void destroy()
throws java.lang.Exception
public boolean isExposed()
public void setExposed(boolean exposed)
setExposed in interface ChangeLogexposed - true to expose the contents, false to not expose.public void setPartitionSuffix(java.lang.String suffix)
setPartitionSuffix in interface ChangeLogsuffix - suffix value to be set for the changelog partitionpublic void setRevisionsContainerName(java.lang.String revContainerName)
setRevisionsContainerName in interface ChangeLogrevContainerName - the name of the revisions containerpublic void setTagsContainerName(java.lang.String tagContainerName)
setTagsContainerName in interface ChangeLogtagContainerName - the name of the revisions containerpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()