if ( createDs == null )
{
final DirectoryService directoryService = getDirectoryService();
if ( directoryService != null && directoryService.getChangeLog().isEnabled() )
{
return new Statement()
{
@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" );
}
}
}
};
}
else
{
LOG.trace( "no @CreateDS and no outer @CreateDS on: {}", description );
return base;
}
}
else
{
return new Statement()
{
@Override
public void evaluate() throws Throwable
{
LOG.trace( "Creating directory service" );