/** * {@inheritDoc} */ public String forwardLookup( PartitionTxn partitionTxn, K attrVal ) throws LdapException { return forward.get( partitionTxn, attrVal ); }
Object value = get( key );
/** * @see Index#reverseLookup(java.math.BigInteger) */ public Object reverseLookup( BigInteger id ) throws NamingException { return reverse.get( id ); }
/** * Gets the Attributes of an entry from this MasterTable. * * @param id the BigInteger id of the entry to retrieve. * @return the Attributes of the entry with operational attributes and all. * @throws NamingException if there is a read error on the underlying Db. */ public Attributes get( BigInteger id ) throws NamingException { return ( Attributes ) super.get( id ); }
/** * {@inheritDoc} */ public K reverseLookup( PartitionTxn partitionTxn, String id ) throws LdapException { if ( withReverse ) { return reverse.get( partitionTxn, id ); } else { return null; } }
/** * Gets a persistant property stored in the admin table of this MasterTable. * * @param property the key of the property to get the value of * @return the value of the property * @throws NamingException when the underlying admin table cannot be read */ public String getProperty( String property ) throws NamingException { synchronized ( adminTbl ) { return ( String ) adminTbl.get( property ); } }
/** * @see Index#forwardLookup(java.lang.Object) */ public BigInteger forwardLookup( Object attrVal ) throws NamingException { return ( BigInteger ) forward.get( getNormalized( attrVal ) ); }
/** * 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() ); } }
/** * 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; }
K key = reverse.get( partitionTxn, entryId );