/[storm]/storm/org/nongnu/storm/pointers/PointerIndex.java
ViewVC logotype

Diff of /storm/org/nongnu/storm/pointers/PointerIndex.java

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

revision 1.1 by benja, Fri May 9 15:23:11 2003 UTC revision 1.2 by benja, Fri May 9 15:52:47 2003 UTC
# Line 33  import java.io.*; Line 33  import java.io.*;
33  import java.security.*;  import java.security.*;
34    
35  public class PointerIndex {  public class PointerIndex {
36        public static boolean dbg = true;
37        private static void p(String s) { System.out.println("PointerIndex:: "+s); }
38    
39      public static final String uri =      public static final String uri =
40          "http://fenfire.org/2003/05/pointer-index-0.1";          "http://fenfire.org/2003/05/pointer-index-0.1";
41    
# Line 43  public class PointerIndex { Line 46  public class PointerIndex {
46    
47      public BlockId get(PointerId id)      public BlockId get(PointerId id)
48          throws IOException, GeneralSecurityException {          throws IOException, GeneralSecurityException {
49            if(dbg) p("Get: "+id);
50    
51          Collector c = db.get(id.toString()).block();          Collector c = db.get(id.toString()).block();
52          long maxstamp = 0;          long maxstamp = 0;
53          BlockId result = null;          BlockId result = null;
54          for(Iterator i=c.iterator(); i.hasNext();) {          for(Iterator i=c.iterator(); i.hasNext();) {
55              IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();              IndexedPool.Mapping m = (IndexedPool.Mapping)i.next();
56                if(dbg) p("Process: "+m.block+" "+m.value);
57    
58              long timestamp;              long timestamp;
59              try {              try {
60                  timestamp = Long.parseLong(m.value);                  timestamp = Long.parseLong(m.value);
# Line 97  public class PointerIndex { Line 104  public class PointerIndex {
104          BlockOutputStream bos = pool.getBlockOutputStream("text/plain");          BlockOutputStream bos = pool.getBlockOutputStream("text/plain");
105          String header =          String header =
106              PointerBlock.COOKIE + "\n" +              PointerBlock.COOKIE + "\n" +
107              Base32.encode(signature);              Base32.encode(signature) + "\n";
108          bos.write(header.getBytes("US-ASCII"));          bos.write(header.getBytes("US-ASCII"));
109          bos.write(data.getBytes("US-ASCII"));          bos.write(data.getBytes("US-ASCII"));
110          bos.close();          bos.close();
# Line 109  public class PointerIndex { Line 116  public class PointerIndex {
116              try {              try {
117                  p = new PointerBlock(block);                  p = new PointerBlock(block);
118              } catch(Throwable _) {              } catch(Throwable _) {
119                    if(dbg) _.printStackTrace();
120                  return Collections.EMPTY_SET;                  return Collections.EMPTY_SET;
121              }              }
122    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

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