/[gzz]/gzz/lava/gzz/storm/impl/AbstractPool.java
ViewVC logotype

Diff of /gzz/lava/gzz/storm/impl/AbstractPool.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11 by benja, Mon Jan 13 23:47:17 2003 UTC revision 1.12 by benja, Tue Jan 14 00:14:51 2003 UTC
# Line 33  public abstract class AbstractPool imple Line 33  public abstract class AbstractPool imple
33    
34      protected Set indexTypes;      protected Set indexTypes;
35    
     /**  
      *  <code>null</code> until initializeIndices() has been called  
      *  for the first time.  
      */  
36      protected Map indices = null;      protected Map indices = null;
37    
38      /** Get a DB implementation associated with      /** Get a DB implementation associated with
# Line 50  public abstract class AbstractPool imple Line 46  public abstract class AbstractPool imple
46    
47      public AbstractPool(Set indexTypes) throws IOException {      public AbstractPool(Set indexTypes) throws IOException {
48          this.indexTypes = indexTypes;          this.indexTypes = indexTypes;
49            initializeIndices();
50      }      }
51    
52      protected final void initializeIndices() throws IOException {      /** Initialize the <code>indices</code> map.
53         *  Conceptually, this is part of the constructor,
54         *  but it calls <code>getDB()</code>, which
55         *  may require subclasses to be fully initialized
56         *  before it is called. This <em>is</em> called in
57         *  this class's constructor, but a subclass may
58         *  provide an empty implementation and call
59         *  <code>super.initializeIndices()</code>
60         *  in its own constructor after it is fully initialized.
61         *  Rather roundabout, but more elegant than
62         *  hacking our way around the problem.
63         */
64        protected void initializeIndices() throws IOException {
65          if(this.indices != null) return;          if(this.indices != null) return;
66    
67          Map indices = new HashMap();          Map indices = new HashMap();
# Line 67  public abstract class AbstractPool imple Line 76  public abstract class AbstractPool imple
76          this.indices = Collections.unmodifiableMap(indices);          this.indices = Collections.unmodifiableMap(indices);
77      }      }
78    
79      public Map getIndices() throws IOException {      public Map getIndices() { return indices; }
         initializeIndices();  
         return indices;  
     }  
80    
81      public Object getIndex(String indexTypeURI) throws IOException {      public Object getIndex(String indexTypeURI) {
82          return getIndices().get(indexTypeURI);          return getIndices().get(indexTypeURI);
83      }      }
84    

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26