Default constructor, called from Open#open. @param meta meta data @throws IOException I/O Exception
(final MetaData meta)
| 63 | * @throws IOException I/O Exception |
| 64 | */ |
| 65 | public DiskData(final MetaData meta) throws IOException { |
| 66 | super(meta); |
| 67 | |
| 68 | try(DataInput in = new DataInput(meta.dbFile(DATAINF))) { |
| 69 | meta.read(in); |
| 70 | while(true) { |
| 71 | final String k = string(in.readToken()); |
| 72 | if(k.isEmpty()) break; |
| 73 | switch(k) { |
| 74 | case DBTAGS -> elemNames = new Names(in, meta); |
| 75 | case DBATTS -> attrNames = new Names(in, meta); |
| 76 | case DBPATH -> paths = new PathIndex(this, in); |
| 77 | case DBNS -> nspaces = new Namespaces(in); |
| 78 | case DBDOCS -> resources.read(in); |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | // open data and indexes |
| 84 | init(); |
| 85 | if(meta.updindex) { |
| 86 | idmap = new IdPreMap(meta.dbFile(DATAIDP)); |
| 87 | if(meta.textindex) textIndex = new UpdatableDiskValues(this, IndexType.TEXT); |
| 88 | if(meta.attrindex) attrIndex = new UpdatableDiskValues(this, IndexType.ATTRIBUTE); |
| 89 | if(meta.tokenindex) tokenIndex = new UpdatableDiskValues(this, IndexType.TOKEN); |
| 90 | } else { |
| 91 | if(meta.textindex) textIndex = new DiskValues(this, IndexType.TEXT); |
| 92 | if(meta.attrindex) attrIndex = new DiskValues(this, IndexType.ATTRIBUTE); |
| 93 | if(meta.tokenindex) tokenIndex = new DiskValues(this, IndexType.TOKEN); |
| 94 | } |
| 95 | if(meta.ftindex) ftIndex = new FTIndex(this); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Internal database constructor, called from {@link DiskBuilder#build}. |