org.apache.directory.server.core.changelog
Class DefaultChangeLog

java.lang.Object
  extended by org.apache.directory.server.core.changelog.DefaultChangeLog
All Implemented Interfaces:
ChangeLog

public class DefaultChangeLog
extends java.lang.Object
implements ChangeLog

The default ChangeLog service implementation.

Version:
$Rev$, $Date$
Author:
Apache Directory Project
'XBean'

Constructor Summary
DefaultChangeLog()
           
 
Method Summary
 void destroy()
           
 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)
           
 boolean isEnabled()
          Checks whether or not the change log has been enabled to track changes.
 boolean isExposeChangeLog()
           
 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.shared.ldap.ldif.LdifEntry forward, org.apache.directory.shared.ldap.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.shared.ldap.ldif.LdifEntry forward, java.util.List<org.apache.directory.shared.ldap.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)
           
 void setEnabled(boolean enabled)
           
 void setExposeChangeLog(boolean exposeChangeLog)
          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()
           
 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultChangeLog

public DefaultChangeLog()
Method Detail

getChangeLogStore

public ChangeLogStore getChangeLogStore()
Specified by:
getChangeLogStore in interface ChangeLog

setChangeLogStore

public void setChangeLogStore(ChangeLogStore store)
Specified by:
setChangeLogStore in interface ChangeLog

getCurrentRevision

public long getCurrentRevision()
                        throws java.lang.Exception
Description copied from interface: ChangeLog
Gets the current revision for the server.

Specified by:
getCurrentRevision in interface ChangeLog
Returns:
the current revision
Throws:
java.lang.Exception - if there is a problem accessing this information

log

public ChangeLogEvent log(LdapPrincipal principal,
                          org.apache.directory.shared.ldap.ldif.LdifEntry forward,
                          org.apache.directory.shared.ldap.ldif.LdifEntry reverse)
                   throws java.lang.Exception
Records a change as a forward LDIF, a reverse change to revert the change and the authorized principal triggering the revertable change event.

Specified by:
log in interface ChangeLog
Parameters:
principal - the authorized LDAP principal triggering the change
forward - LDIF of the change going to the next state
reverse - LDIF (anti-operation): the change required to revert this change
Returns:
the new revision reached after having applied the forward LDIF
Throws:
java.lang.Exception - if there are problems logging the change

log

public ChangeLogEvent log(LdapPrincipal principal,
                          org.apache.directory.shared.ldap.ldif.LdifEntry forward,
                          java.util.List<org.apache.directory.shared.ldap.ldif.LdifEntry> reverses)
                   throws java.lang.Exception
Records a change as a forward LDIF, some reverse changes to revert the change and the authorized principal triggering the revertable change event.

Specified by:
log in interface ChangeLog
Parameters:
principal - the authorized LDAP principal triggering the change
forward - LDIF of the change going to the next state
reverses - LDIF (anti-operation): the changes required to revert this change
Returns:
the new revision reached after having applied the forward LDIF
Throws:
java.lang.Exception - if there are problems logging the change

isLogSearchSupported

public boolean isLogSearchSupported()
Description copied from interface: ChangeLog
Returns whether or not this ChangeLogService supports searching for changes.

Specified by:
isLogSearchSupported in interface ChangeLog
Returns:
true if log searching is supported, false otherwise

isTagSearchSupported

public boolean isTagSearchSupported()
Description copied from interface: ChangeLog
Returns whether or not this ChangeLogService supports searching for snapshot tags.

Specified by:
isTagSearchSupported in interface ChangeLog
Returns:
true if snapshot tag searching is supported, false otherwise

isTagStorageSupported

public boolean isTagStorageSupported()
Description copied from interface: ChangeLog
Returns whether or not this ChangeLogService stores snapshot tags.

Specified by:
isTagStorageSupported in interface ChangeLog
Returns:
true if this ChangeLogService supports tag storage, false otherwise

getChangeLogSearchEngine

public ChangeLogSearchEngine getChangeLogSearchEngine()
Description copied from interface: ChangeLog
Gets the change log query engine which would be used to ask questions about what changed, when, how and by whom. It may not be supported by all implementations. Some implementations may simply log changes without direct access to those changes from within the server.

Specified by:
getChangeLogSearchEngine in interface ChangeLog
Returns:
the change log query engine

getTagSearchEngine

public TagSearchEngine getTagSearchEngine()
Description copied from interface: ChangeLog
Gets the tag search engine used to query the snapshots taken. If this ChangeLogService does not support a taggable and searchable store then an UnsupportedOperationException will result.

Specified by:
getTagSearchEngine in interface ChangeLog
Returns:
the snapshot query engine for this store

tag

public Tag tag(long revision,
               java.lang.String description)
        throws java.lang.Exception
Description copied from interface: ChangeLog
Creates a tag for a snapshot of the server in a specific state at a revision. If the ChangeLog has a TaggableChangeLogStore then the tag is stored. If it does not then it's up to callers to track this tag since it will not be stored by this service.

Specified by:
tag in interface ChangeLog
Parameters:
revision - the revision to tag the snapshot
description - some information about what the snapshot tag represents
Returns:
the Tag associated with the revision
Throws:
java.lang.Exception - if there is a problem taking a tag
java.lang.IllegalArgumentException - if the revision is out of range (less than 0 and greater than the current revision)

tag

public Tag tag(long revision)
        throws java.lang.Exception
Description copied from interface: ChangeLog
Creates a tag for a snapshot of the server in a specific state at a revision. If the ChangeLog has a TaggableChangeLogStore then the tag is stored. If it does not then it's up to callers to track this tag since it will not be stored by this service.

Specified by:
tag in interface ChangeLog
Parameters:
revision - the revision to tag the snapshot
Returns:
the Tag associated with the revision
Throws:
java.lang.Exception - if there is a problem taking a tag
java.lang.IllegalArgumentException - if the revision is out of range (less than 0 and greater than the current revision)

tag

public Tag tag(java.lang.String description)
        throws java.lang.Exception
Description copied from interface: ChangeLog
Creates a snapshot of the server at the current revision.

Specified by:
tag in interface ChangeLog
Parameters:
description - some information about what the snapshot tag represents
Returns:
the revision at which the tag is created
Throws:
java.lang.Exception - if there is a problem taking a tag

tag

public Tag tag()
        throws java.lang.Exception
Description copied from interface: ChangeLog
Creates a snapshot of the server at the current revision.

Specified by:
tag in interface ChangeLog
Returns:
the revision at which the tag is created
Throws:
java.lang.Exception - if there is a problem taking a tag

setEnabled

public void setEnabled(boolean enabled)
Specified by:
setEnabled in interface ChangeLog

isEnabled

public boolean isEnabled()
Description copied from interface: ChangeLog
Checks whether or not the change log has been enabled to track changes.

Specified by:
isEnabled in interface ChangeLog
Returns:
true if the change log is tracking changes, false otherwise

getLatest

public Tag getLatest()
              throws java.lang.Exception
Specified by:
getLatest in interface ChangeLog
Throws:
java.lang.Exception

init

public void init(DirectoryService service)
          throws java.lang.Exception
Specified by:
init in interface ChangeLog
Throws:
java.lang.Exception

sync

public void sync()
          throws java.lang.Exception
Specified by:
sync in interface ChangeLog
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Specified by:
destroy in interface ChangeLog
Throws:
java.lang.Exception

isExposeChangeLog

public boolean isExposeChangeLog()
Specified by:
isExposeChangeLog in interface ChangeLog
See Also:
ChangeLog.isExposeChangeLog()

setExposeChangeLog

public void setExposeChangeLog(boolean exposeChangeLog)
Description copied from interface: ChangeLog
Exposes the contents of ChangeLog to clients if set to true. Default setting is false.

Specified by:
setExposeChangeLog in interface ChangeLog
Parameters:
exposeChangeLog - true to expose the contents, false to not expose.
See Also:
ChangeLog.setExposeChangeLog(boolean)

setPartitionSuffix

public void setPartitionSuffix(java.lang.String suffix)
Description copied from interface: ChangeLog
The prefix of the partition. Default value is ou=changelog.

Specified by:
setPartitionSuffix in interface ChangeLog
Parameters:
suffix - suffix value to be set for the changelog partition
See Also:
ChangeLog.setPartitionSuffix(String)

setRevisionsContainerName

public void setRevisionsContainerName(java.lang.String revContainerName)
Description copied from interface: ChangeLog
The name of the revisions container under the partition. Default value is ou=revisions

Specified by:
setRevisionsContainerName in interface ChangeLog
Parameters:
revContainerName - the name of the revisions container
See Also:
ChangeLog.setRevisionsContainerName(String)

setTagsContainerName

public void setTagsContainerName(java.lang.String tagContainerName)
Description copied from interface: ChangeLog
The name of the tags container under the partition. Default value is ou=tags

Specified by:
setTagsContainerName in interface ChangeLog
Parameters:
tagContainerName - the name of the revisions container
See Also:
ChangeLog.setTagsContainerName(String)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2009 Apache Software Foundation. All Rights Reserved.