commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From froehl...@apache.org
Subject cvs commit: jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore JispFilesystemStore.java
Date Sat, 12 Jan 2002 17:25:01 GMT
froehlich    02/01/12 09:25:01

  Modified:    simplestore/src/java/org/apache/commons/simplestore
                        JispFilesystemStore.java
  Log:
  added wrapper method for the keys
  
  Revision  Changes    Path
  1.2       +17 -6     jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/JispFilesystemStore.java
  
  Index: JispFilesystemStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/simplestore/src/java/org/apache/commons/simplestore/JispFilesystemStore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JispFilesystemStore.java	12 Jan 2002 16:55:43 -0000	1.1
  +++ JispFilesystemStore.java	12 Jan 2002 17:25:01 -0000	1.2
  @@ -11,6 +11,7 @@
   import com.coyotegulch.jisp.BTreeIndex;
   import com.coyotegulch.jisp.IndexedObjectDatabase;
   import com.coyotegulch.jisp.KeyNotFound;
  +import com.coyotegulch.jisp.KeyObject;
   
   import java.io.File;
   import java.io.IOException;
  @@ -138,7 +139,7 @@
           Object readObj = null;
   
           try {
  -            readObj = mDatabase.read(new JispStringKey(key.toString()), mIndex);
  +            readObj = mDatabase.read(this.wrapKeyObject(key), mIndex);
           } catch (Exception e) {
               e.printStackTrace();
           }
  @@ -180,8 +181,8 @@
           throws IOException {
           if (value instanceof Serializable) {
               try {
  -                JispStringKey[] keyArray = new JispStringKey[1];
  -                keyArray[0] = new JispStringKey(key.toString());
  +                KeyObject[] keyArray = new KeyObject[1];
  +                keyArray[0] = this.wrapKeyObject(key);
                   mDatabase.write(keyArray, (Serializable) value);
               } catch (Exception e) {
                   e.printStackTrace();
  @@ -217,8 +218,8 @@
        */
       public void remove(Object key) {
           try {
  -            JispStringKey[] keyArray = new JispStringKey[1];
  -            keyArray[0] = new JispStringKey(key.toString());
  +            KeyObject[] keyArray = new KeyObject[1];
  +            keyArray[0] = this.wrapKeyObject(key);
               mDatabase.remove(keyArray);
           } catch (KeyNotFound ignore) {
           } catch (Exception e) {
  @@ -236,7 +237,7 @@
           long res = -1;
   
           try {
  -            res = mIndex.findKey(new JispStringKey(key.toString()));
  +            res = mIndex.findKey(this.wrapKeyObject(key));
           } catch (KeyNotFound ignore) {
           } catch (Exception e) {
               e.printStackTrace();
  @@ -257,6 +258,16 @@
       public Enumeration keys() {
           //TODO: Implementation
           return null;
  +    }
  +
  +    private KeyObject wrapKeyObject(Object key) {
  +
  +        if(key instanceof String) {
  +            return new JispStringKey(key.toString());
  +        } else {
  +            //TODO: Implementation
  +            return null;
  +        }
       }
   }
   
  
  
  

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


Mime
View raw message