/** * {@inheritDoc} */ @Override public void sync() throws LdapException { if ( enabled ) { store.sync(); } }
/** * {@inheritDoc} */ @Override public void destroy() throws LdapException { if ( enabled ) { store.destroy(); } storeInitialized = false; }
/** * {@inheritDoc} */ @Override public long getCurrentRevision() throws LdapException { synchronized ( store ) { return store.getCurrentRevision(); } }
/** * Read the configuration for the ChangeLog system * * @param changeLogBean The Bean containing the ChangeLog configuration * @return The instantiated ChangeLog element */ public static ChangeLog createChangeLog( ChangeLogBean changeLogBean ) { if ( ( changeLogBean == null ) || changeLogBean.isDisabled() ) { return null; } ChangeLog changeLog = new DefaultChangeLog(); changeLog.setEnabled( changeLogBean.isEnabled() ); changeLog.setExposed( changeLogBean.isChangeLogExposed() ); return changeLog; }
/** * {@inheritDoc} */ @Override public boolean equals( Object other ) { if ( other instanceof Tag ) { Tag ot = ( Tag ) other; if ( description != null && ot.getDescription() != null ) { return revision == ot.getRevision() && description.equals( ot.getDescription() ); } else if ( description == null && ot.getDescription() == null ) { return revision == ot.getRevision(); } } return false; }
/** * {@inheritDoc} */ @Override public Tag tag( String description ) { if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) ) { return latest; } latest = new Tag( currentRevision, description ); tags.put( currentRevision, latest ); return latest; }
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; }
/** * {@inheritDoc} */ @Override public Tag tag( long revision, String description ) throws Exception { if ( revision < 0 ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_239 ) ); } if ( revision > store.getCurrentRevision() ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_240 ) ); } if ( store instanceof TaggableChangeLogStore ) { latest = ( ( TaggableChangeLogStore ) store ).tag( revision ); return latest; } latest = new Tag( revision, description ); return latest; }
/** * {@inheritDoc} */ @Override public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, LdifEntry reverse ) { currentRevision++; ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(), principal, forward, reverse ); events.add( event ); return event; }
/** * {@inheritDoc} */ @Override public Tag tag( long revision, String descrition ) { if ( tags.containsKey( revision ) ) { return tags.get( revision ); } latest = new Tag( revision, descrition ); tags.put( revision, latest ); return latest; }
/** * {@inheritDoc} */ @Override public Tag getLatest() throws LdapException { if ( latest != null ) { return latest; } if ( store instanceof TaggableChangeLogStore ) { latest = ( ( TaggableChangeLogStore ) store ).getLatest(); return latest; } return null; }
public synchronized void sync() throws Exception { if ( !started ) { return; } this.changeLog.sync(); this.partitionNexus.sync(); }
/** * {@inheritDoc} */ @Override public ChangeLogSearchEngine getChangeLogSearchEngine() { if ( isLogSearchSupported() ) { return ( ( SearchableChangeLogStore ) store ).getChangeLogSearchEngine(); } throw new UnsupportedOperationException( I18n.err( I18n.ERR_237 ) ); }
/** * {@inheritDoc} */ @Override public TagSearchEngine getTagSearchEngine() { if ( isTagSearchSupported() ) { return ( ( TaggableSearchableChangeLogStore ) store ).getTagSearchEngine(); } throw new UnsupportedOperationException( I18n.err( I18n.ERR_238 ) ); }
/** * {@inheritDoc} */ @Override public Tag tag() { if ( ( latest != null ) && ( latest.getRevision() == currentRevision ) ) { return latest; } latest = new Tag( currentRevision, null ); tags.put( currentRevision, latest ); return latest; }
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 ); } }
/** * {@inheritDoc} */ @Override public Tag tag() throws Exception { return tag( store.getCurrentRevision(), null ); }
/** * {@inheritDoc} */ @Override public ChangeLogEvent log( LdapPrincipal principal, LdifEntry forward, List<LdifEntry> reverses ) { currentRevision++; ChangeLogEvent event = new ChangeLogEvent( currentRevision, DateUtils.getGeneralizedTime(), principal, forward, reverses ); events.add( event ); return event; }
/** * {@inheritDoc} */ @Override public Tag tag( long revision ) { if ( tags.containsKey( revision ) ) { return tags.get( revision ); } latest = new Tag( revision, null ); tags.put( revision, latest ); return latest; }
/** * {@inheritDoc} */ @Override public Tag tag( String description ) throws Exception { return tag( store.getCurrentRevision(), description ); }