avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcus Crafter <craft...@fztig938.bank.dresdner.net>
Subject Re: [PROPOSAL] Simple proposal to add "clear" functionality to Store components
Date Wed, 14 Aug 2002 15:35:00 GMT
Applied. Thanks mate.

Cheers,

Marcus

On Wed, Aug 14, 2002 at 11:43:33AM +0200, Michael Melhem wrote:
> Hi all
> 
> I have attached a patch to this mail regarding this proposal
> 
> Marcus,
> How are you mate? :-)
> 
> I couldnt see any obvious way to avoid iterating over remove with
> FileSystemStore/PersistentStore
> 
> Regards,
> Michael Melhem
> 
> On Tue, 13 Aug 2002, Michael Melhem wrote:
> 
> > Hi all,
> >
> > Re: org.apache.excalibur.store.Store
> >
> > I have a simple proposal to add a "Clear()" method to the Store
> > components.
> >
> > That would give store components the ability to rid themselves of any
> > information they are holding. That is, an ability to clear the store of
> > all the entries it currently holds!
> >
> > Does anyone see any issues with this? If not I will submit a
> > patch to implement this proposal.
> >
> > Regards,
> > Michael Melhem
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>
> >
> >

Content-Description: patch diff file
> ? clear.diff
> Index: src/java/org/apache/excalibur/store/Store.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-avalon-excalibur/store/src/java/org/apache/excalibur/store/Store.java,v
> retrieving revision 1.3
> diff -u -r1.3 Store.java
> --- src/java/org/apache/excalibur/store/Store.java	14 Jul 2002 01:28:01 -0000	1.3
> +++ src/java/org/apache/excalibur/store/Store.java	14 Aug 2002 09:09:10 -0000
> @@ -65,6 +65,11 @@
>      void remove( Object key );
>  
>      /**
> +     * Clear the Store of all data it holds 
> +     */
> +    void clear();
> +
> +    /**
>       * Indicates if the given key is associated to a contained object.
>       */
>      boolean containsKey( Object key );
> Index: src/java/org/apache/excalibur/store/impl/AbstractFilesystemStore.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-avalon-excalibur/store/src/java/org/apache/excalibur/store/impl/AbstractFilesystemStore.java,v
> retrieving revision 1.3
> diff -u -r1.3 AbstractFilesystemStore.java
> --- src/java/org/apache/excalibur/store/impl/AbstractFilesystemStore.java	13 Jun 2002
17:24:52 -0000	1.3
> +++ src/java/org/apache/excalibur/store/impl/AbstractFilesystemStore.java	14 Aug 2002
09:09:11 -0000
> @@ -161,6 +161,20 @@
>      }
>  
>      /**
> +     * Clear the Store of all elements 
> +     */
> +    public synchronized void clear() {
> +                Enumeration enum = this.keys();
> +                while (enum.hasMoreElements()) {
> +                    Object key = enum.nextElement();
> +                    if (key == null) {
> +                        continue;
> +                    }
> +                        this.remove(key);
> +                 }
> +    }
> +
> +    /**
>       * Indicates if the given key is associated to a contained object.
>       */
>      public synchronized boolean containsKey(final Object key) {
> Index: src/java/org/apache/excalibur/store/impl/MRUMemoryStore.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-avalon-excalibur/store/src/java/org/apache/excalibur/store/impl/MRUMemoryStore.java,v
> retrieving revision 1.5
> diff -u -r1.5 MRUMemoryStore.java
> --- src/java/org/apache/excalibur/store/impl/MRUMemoryStore.java	10 Jul 2002 09:40:17
-0000	1.5
> +++ src/java/org/apache/excalibur/store/impl/MRUMemoryStore.java	14 Aug 2002 09:09:11
-0000
> @@ -222,6 +222,20 @@
>      }
>  
>      /**
> +     * Clear the Store of all elements 
> +     */
> +    public synchronized void clear() {
> +                Enumeration enum = this.cache.keys();
> +                while (enum.hasMoreElements()) {
> +                    Object key = enum.nextElement();
> +                    if (key == null) {
> +                        continue;
> +                    }
> +                        this.remove(key);
> +                 }
> +    }
> +
> +    /**
>       * Indicates if the given key is associated to a contained object.
>       *
>       * @param key The key of the object
> Index: src/java/org/apache/excalibur/store/impl/MemoryStore.java
> ===================================================================
> RCS file: /home/cvspublic/jakarta-avalon-excalibur/store/src/java/org/apache/excalibur/store/impl/MemoryStore.java,v
> retrieving revision 1.1
> diff -u -r1.1 MemoryStore.java
> --- src/java/org/apache/excalibur/store/impl/MemoryStore.java	2 May 2002 08:55:39 -0000
1.1
> +++ src/java/org/apache/excalibur/store/impl/MemoryStore.java	14 Aug 2002 09:09:11 -0000
> @@ -68,6 +68,13 @@
>          table.remove(key);
>      }
>  
> +    /**
> +     * Clear the Store of all elements 
> +     */
> +    public synchronized void clear() {
> +        table.clear();
> +    }
> +
>      public synchronized void free() {}
>  
>      /**

> --
> To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>

-- 
        .....
     ,,$$$$$$$$$,      Marcus Crafter
    ;$'      '$$$$:    Computer Systems Engineer
    $:         $$$$:   ManageSoft GmbH
     $       o_)$$$:   82-84 Mainzer Landstrasse
     ;$,    _/\ &&:'   60327 Frankfurt Germany
       '     /( &&&
           \_&&&&'
          &&&&.
    &&&&&&&:

--
To unsubscribe, e-mail:   <mailto:avalon-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@jakarta.apache.org>


Mime
View raw message