use of org.apache.jackrabbit.oak.json.JsonDeserializer in project jackrabbit-oak by apache.
the class IndexDefinitionUpdater method getIndexDefnStates.
private static Map<String, NodeState> getIndexDefnStates(String json) throws IOException {
Base64BlobSerializer blobHandler = new Base64BlobSerializer();
Map<String, NodeState> indexDefns = Maps.newHashMap();
JsopReader reader = new JsopTokenizer(json);
reader.read('{');
if (!reader.matches('}')) {
do {
String indexPath = reader.readString();
if (!indexPath.startsWith("/")) {
String msg = String.format("Invalid format of index definitions. The key name [%s] should " + "be index path ", indexPath);
throw new IllegalArgumentException(msg);
}
reader.read(':');
if (reader.matches('{')) {
JsonDeserializer deserializer = new JsonDeserializer(blobHandler);
NodeState idxState = deserializer.deserialize(reader);
indexDefns.put(indexPath, idxState);
}
} while (reader.matches(','));
reader.read('}');
}
return indexDefns;
}
Aggregations