Creates a database information string. @param meta meta data @param bold header bold header flag @param index add index information @return info string
(final MetaData meta, final boolean bold, final boolean index)
| 44 | * @return info string |
| 45 | */ |
| 46 | public static String db(final MetaData meta, final boolean bold, final boolean index) { |
| 47 | final TokenBuilder tb = new TokenBuilder(); |
| 48 | final String header = (bold ? new TokenBuilder().bold().add('%').norm().toString() : "%") + NL; |
| 49 | tb.addExt(header, DB_PROPS); |
| 50 | info(tb, MetaProp.NAME, meta); |
| 51 | info(tb, MetaProp.SIZE.name(), Performance.formatHuman(meta.dbSize())); |
| 52 | info(tb, MetaProp.NODES, meta); |
| 53 | info(tb, MetaProp.DOCUMENTS, meta); |
| 54 | info(tb, MetaProp.BINARIES, meta); |
| 55 | info(tb, MetaProp.VALUES, meta); |
| 56 | info(tb, MetaProp.TIMESTAMP, meta); |
| 57 | info(tb, MetaProp.UPTODATE, meta); |
| 58 | if(meta.corrupt) tb.add(' ' + DB_CORRUPT + NL); |
| 59 | |
| 60 | tb.add(NL).addExt(header, RES_PROPS); |
| 61 | info(tb, MetaProp.INPUTPATH, meta); |
| 62 | info(tb, MetaProp.INPUTSIZE.name(), Performance.formatHuman(meta.inputsize)); |
| 63 | info(tb, MetaProp.INPUTDATE, meta); |
| 64 | |
| 65 | if(index) { |
| 66 | tb.add(NL).addExt(header, INDEXES); |
| 67 | if(meta.oldindex()) { |
| 68 | tb.add(' ' + H_INDEX_FORMAT + NL); |
| 69 | } else { |
| 70 | for(final MetaProp prop : MetaProp.values()) { |
| 71 | if(prop.index) info(tb, prop, meta); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | return tb.toString(); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void build(final CmdBuilder cb) { |