You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Alex Karasulu <ak...@apache.org> on 2011/06/24 10:00:50 UTC

Re: svn commit: r1138906 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ xdbm-partition/src/main/java/org/apache/d

Can you explain why you did this? Sounds like a code reduction cleanup
but if you can elaborate a bit more that would be great.

Thanks,
Alex

On Thu, Jun 23, 2011 at 5:43 PM,  <el...@apache.org> wrote:
> Author: elecharny
> Date: Thu Jun 23 14:43:12 2011
> New Revision: 1138906
>
> URL: http://svn.apache.org/viewvc?rev=1138906&view=rev
> Log:
> Removed methods from the inherited classes when those methods are already defined in their parent.
>
> Modified:
>    directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
>    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
>    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java
>    directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
>
> Modified: directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java?rev=1138906&r1=1138905&r2=1138906&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java (original)
> +++ directory/apacheds/trunk/jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/JdbmMasterTable.java Thu Jun 23 14:43:12 2011
> @@ -142,45 +142,6 @@ public class JdbmMasterTable<E> extends
>         }
>     }
>
> -    /**
> -     * Gets the ServerEntry from this MasterTable.
> -     *
> -     * @param id the Long id of the entry to retrieve.
> -     * @return the ServerEntry with operational attributes and all.
> -     * @throws Exception if there is a read error on the underlying Db.
> -     */
> -    public E get( Long id ) throws Exception
> -    {
> -        return super.get( id );
> -    }
> -
> -
> -    /**
> -     * Puts the ServerEntry into this master table at an index
> -     * specified by id.  Used both to create new entries and update existing
> -     * ones.
> -     *
> -     * @param entry the ServerEntry w/ operational attributes
> -     * @param id    the Long id of the entry to put
> -     * @throws Exception if there is a write error on the underlying Db.
> -     */
> -    public void put( Long id, E entry ) throws Exception
> -    {
> -        super.put( id, entry );
> -    }
> -
> -
> -    /**
> -     * Deletes a ServerEntry from the master table at an index specified by id.
> -     *
> -     * @param id the Long id of the entry to delete
> -     * @throws Exception if there is a write error on the underlying Db
> -     */
> -    public void delete( Long id ) throws Exception
> -    {
> -        super.remove( id );
> -    }
> -
>
>     /**
>      * Get's the next value from this SequenceBDb.  This has the side-effect of
>
> Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java?rev=1138906&r1=1138905&r2=1138906&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java (original)
> +++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/AbstractStore.java Thu Jun 23 14:43:12 2011
> @@ -1139,7 +1139,7 @@ public abstract class AbstractStore<E, I
>             }
>         }
>
> -        master.delete( id );
> +        master.remove( id );
>
>         // if this is a context entry reset the master table counter
>         if ( id.equals( getDefaultId() ) )
>
> Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java?rev=1138906&r1=1138905&r2=1138906&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java (original)
> +++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/MasterTable.java Thu Jun 23 14:43:12 2011
> @@ -35,36 +35,6 @@ public interface MasterTable<ID, E> exte
>
>
>     /**
> -     * Gets an entry from this MasterTable.
> -     *
> -     * @param id the id of the entry to retrieve.
> -     * @return the entry with all user and operational attributes.
> -     * @throws Exception if there is a read error on the underlying Db.
> -     */
> -    E get( ID id ) throws Exception;
> -
> -
> -    /**
> -     * Puts an entry into this MasterTable with a specified unique id.  Used
> -     * both to create new entries and update existing ones.
> -     *
> -     * @param entry the entry to add
> -     * @param id unique identifier of the entry to put
> -     * @throws Exception if there is a write error on the underlying Db.
> -     */
> -    void put( ID id, E entry ) throws Exception;
> -
> -
> -    /**
> -     * Deletes a entry from this MasterTable at an index specified by id.
> -     *
> -     * @param id unique identifier of the entry to delete
> -     * @throws Exception if there is a write error on the underlying Db
> -     */
> -    void delete( ID id ) throws Exception;
> -
> -
> -    /**
>      * Gets the next value from the sequence of this MasterTable.  This has
>      * the side-effect of incrementing the sequence values permanently.
>      *
>
> Modified: directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java
> URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java?rev=1138906&r1=1138905&r2=1138906&view=diff
> ==============================================================================
> --- directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java (original)
> +++ directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/impl/avl/AvlMasterTable.java Thu Jun 23 14:43:12 2011
> @@ -21,7 +21,6 @@ package org.apache.directory.server.xdbm
>
>
>  import java.util.Comparator;
> -import java.util.Properties;
>  import java.util.concurrent.atomic.AtomicLong;
>
>  import org.apache.directory.server.xdbm.MasterTable;
> @@ -35,7 +34,6 @@ import org.apache.directory.server.xdbm.
>  */
>  public class AvlMasterTable<E> extends AvlTable<Long, E> implements MasterTable<Long, E>
>  {
> -    private Properties props = new Properties();
>     private AtomicLong counter = new AtomicLong( 0 );
>
>
> @@ -45,13 +43,10 @@ public class AvlMasterTable<E> extends A
>         super( name, keyComparator, valComparator, dupsEnabled );
>     }
>
> -
> -    public void delete( Long id ) throws Exception
> -    {
> -        super.remove( id );
> -    }
> -
>
> +    /**
> +     * {@inheritDoc}
> +     */
>     public Long getNextId( E entry ) throws Exception
>     {
>         return counter.incrementAndGet();
>
>
>

Re: svn commit: r1138906 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ xdbm-partition/src/main/java/org/apache/d

Posted by Alex Karasulu <ak...@apache.org>.
Great thanks for the clarification. Finally this stuff is getting some
polishing after years of rust.

Thanks,
Alex

On Fri, Jun 24, 2011 at 11:05 AM, Emmanuel Lecharny <el...@gmail.com> wrote:
> On 6/24/11 10:00 AM, Alex Karasulu wrote:
>>
>> Can you explain why you did this? Sounds like a code reduction cleanup
>> but if you can elaborate a bit more that would be great.
>
> Sure ! Those methods are already declared in their parent class, so no need
> to declare them in the inherited class, when their body just do
> super.<sameMethod>(<sameParams>).
>
> It's basically removal of duplicated code.
>
> I also renamed the delete() method to remove(), to be consistent in the
> naming : why should we used remove or delete to do the exact same thing?
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>

Re: svn commit: r1138906 - in /directory/apacheds/trunk: jdbm-partition/src/main/java/org/apache/directory/server/core/partition/impl/btree/jdbm/ xdbm-partition/src/main/java/org/apache/directory/server/xdbm/ xdbm-partition/src/main/java/org/apache/d

Posted by Emmanuel Lecharny <el...@gmail.com>.
On 6/24/11 10:00 AM, Alex Karasulu wrote:
> Can you explain why you did this? Sounds like a code reduction cleanup
> but if you can elaborate a bit more that would be great.

Sure ! Those methods are already declared in their parent class, so no 
need to declare them in the inherited class, when their body just do 
super.<sameMethod>(<sameParams>).

It's basically removal of duplicated code.

I also renamed the delete() method to remove(), to be consistent in the 
naming : why should we used remove or delete to do the exact same thing?

-- 
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com