private long getCurrentRevision( DirectoryService dirService ) throws Exception { if ( ( dirService != null ) && ( dirService.getChangeLog().isEnabled() ) ) { long revision = dirService.getChangeLog().getCurrentRevision(); LOG.debug( "Create revision {}", revision ); return revision; } return 0; }
private void revert( DirectoryService dirService, long revision ) throws Exception { if ( dirService == null ) { return; } ChangeLog cl = dirService.getChangeLog(); if ( cl.isEnabled() && ( revision < cl.getCurrentRevision() ) ) { LOG.debug( "Revert revision {}", revision ); dirService.revert( revision ); } }
public long revert() throws LdapException { if ( changeLog == null || !changeLog.isEnabled() ) { throw new IllegalStateException( I18n.err( I18n.ERR_310 ) ); } Tag latest = changeLog.getLatest(); if ( null != latest ) { if ( latest.getRevision() < changeLog.getCurrentRevision() ) { return revert( latest.getRevision() ); } else { LOG.info( "Ignoring request to revert without changes since the latest tag." ); return changeLog.getCurrentRevision(); } } throw new IllegalStateException( I18n.err( I18n.ERR_311 ) ); }
@Override public void evaluate() throws Throwable { Tag tag = directoryService.getChangeLog().tag(); DSAnnotationProcessor.applyLdifs( description, directoryService ); LOG.debug( "Tagged change log: {}", tag ); try { base.evaluate(); } finally { if ( directoryService.getChangeLog().getCurrentRevision() > tag.getRevision() ) { LOG.debug( "Reverting to tag: {}", tag ); directoryService.revert( tag.getRevision() ); } else { LOG.debug( "No changes made, nothing to revert" ); } } } };
return changeLog.getCurrentRevision();