return put( key, value );
/** * Sets a persistant property stored in the admin table of this MasterTable. * * @param property the key of the property to set the value of * @param value the value of the property * @throws NamingException when the underlying admin table cannot be writen */ public void setProperty( String property, String value ) throws NamingException { synchronized ( adminTbl ) { adminTbl.put( property, value ); } } }
/** * Puts the Attributes of an entry into this master table at an index * specified by id. Used both to create new entries and update existing * ones. * * @param entry the Attributes of entry w/ operational attributes * @param id the BigInteger id of the entry to put * @return the Attributes of the entry put * @throws NamingException if there is a write error on the underlying Db. */ public Attributes put( Attributes entry, BigInteger id ) throws NamingException { return ( Attributes ) super.put( id, entry ); }
/** * @see org.apache.directory.server.core.partition.impl.btree.Index#add( * javax.naming.directory.Attribute, java.math.BigInteger) */ public synchronized void add( Attribute attr, BigInteger id ) throws NamingException { // Can efficiently batch add to the reverse table NamingEnumeration values = attr.getAll(); reverse.put( id, values ); // Have no choice but to add each value individually to forward table values = attr.getAll(); while ( values.hasMore() ) { forward.put( values.next(), id ); } }
/** * Get's the next value from this SequenceBDb. This has the side-effect of * changing the current sequence values perminantly in memory and on disk. * Master table sequence begins at BigInteger.ONE. The BigInteger.ZERO is * used for the fictitious parent of the suffix root entry. * * @return the current value incremented by one. * @throws NamingException if the admin table storing sequences cannot be * read and writen to. */ public BigInteger getNextId() throws NamingException { BigInteger lastVal = null; BigInteger nextVal = null; synchronized ( adminTbl ) { lastVal = new BigInteger( ( String ) adminTbl.get( SEQPROP_KEY ) ); if ( null == lastVal ) { adminTbl.put( SEQPROP_KEY, BigInteger.ONE.toString() ); return BigInteger.ONE; } else { nextVal = lastVal.add( BigInteger.ONE ); adminTbl.put( SEQPROP_KEY, nextVal.toString() ); } } return nextVal; }
/** * Get's the current id value from this master database's sequence without * affecting the seq. * * @return the current value. * @throws NamingException if the admin table storing sequences cannot be * read. */ public BigInteger getCurrentId() throws NamingException { BigInteger id = null; synchronized ( adminTbl ) { id = new BigInteger( ( String ) adminTbl.get( SEQPROP_KEY ) ); if ( null == id ) { adminTbl.put( SEQPROP_KEY, BigInteger.ZERO.toString() ); id = BigInteger.ZERO; } } return id; }
/** * Creates the master entry table using a Berkeley Db for the backing store. * * @param recMan the jdbm record manager * @throws NamingException if there is an error opening the Db file. */ public JdbmMasterTable(RecordManager recMan) throws NamingException { super( DBF, recMan, BIG_INTEGER_COMPARATOR ); adminTbl = new JdbmTable( "admin", recMan, STRING_COMPARATOR ); String seqValue = ( String ) adminTbl.get( SEQPROP_KEY ); if ( null == seqValue ) { adminTbl.put( SEQPROP_KEY, BigInteger.ZERO.toString() ); } }
/** * Stores the given message in the queue * * @param message The message to store */ public synchronized void log( ReplicaEventMessage message ) { try { LOG.debug( "logging entry with Dn {} with the event {}", message.getEntry().getDn(), message.getChangeType() ); PROVIDER_LOG.debug( "logging entry with Dn {} with the event {}", message.getEntry().getDn(), message.getChangeType() ); String entryCsn = message.getEntry().get( SchemaConstants.ENTRY_CSN_AT ).getString(); journal.put( partitionTxn, entryCsn, message ); } catch ( Exception e ) { LOG.warn( "Failed to insert the entry into syncrepl log", e ); PROVIDER_LOG.error( "Failed to insert the entry into syncrepl log", e ); } }