API Overview API Index Package Overview Direct link to this page
JavaOnTracks 0.1.2
  net.jot.persistance. JOTFSIndexManager View Javadoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74

/*
------------------------------------
JavaOnTracks          Thibaut Colar
tcolar-jot AT colar DOT net
Artistic Licence 2.0
http://www.javaontracks.net
------------------------------------
 */
package net.jot.persistance;

/**
 * Manager for an FSDB index
 * @deprecated 
 * @author tcolar
 */
public class JOTFSIndexManager {
        /**
	private static Hashtable indexes=new Hashtable();
		
	
	public static Hashtable getIndexes()
	{
		return indexes;
	}

       
	public static JOTFSIndex getIndex(JOTModelMapping mapping) throws Exception
	{
		String name=mapping.getTableName();
		JOTLogger.log(JOTLogger.CAT_DB,JOTLogger.DEBUG_LEVEL,JOTFSIndexManager.class,"GetIndex model name:"+name);
		JOTFSIndex index=(JOTFSIndex)indexes.get(name);
		if(index==null)
		{
			// we need to load the index from the file.
			synchronized(JOTFSIndexManager.class)
			{
				if(index==null)
				{
					index=new JOTFSIndex();
					JOTFSQueryImpl impl=(JOTFSQueryImpl)JOTQueryManager.getImplementation(mapping.getQueryClassName());
					RandomAccessFile indexFile=impl.getIndexFile(mapping);
					indexFile.seek(0);
					index.setFile(indexFile);
					while(indexFile.getFilePointer()<indexFile.length())
					{
						long indexPos=indexFile.getFilePointer();
						long id=indexFile.readLong();
						long value=indexFile.readLong();
						if(id > 0)
						{
							index.setIndexIndexOffset(id,indexPos);
							//TODO: + make use of the metadata to see if data changed, maybe verify that the dataId is matching the dataId in the data file and if not, rebuild the index
							index.setDataOffset(id, value);
						}
					}
					indexes.put(name,index);
				}
			}
		}	
		return index;
	}

	public static void destroy()
	{
		Enumeration e=indexes.elements();
		while(e.hasMoreElements())
		{
			JOTFSIndex index=(JOTFSIndex)e.nextElement();
			if(index!=null)
				index.closeFile();
		}
	}
*/
}

Generated By: JavaOnTracks Doclet 0.1.5     ©Thibaut Colar