public class SegmentParser extends Object
SegmentParser serves as a base class for parsing segments.
This base class provides means for parsing segments into their various
kinds of record. Descendants typically parametrise its behaviour by
overriding the on...() methods as needed. By default those
methods just initiate the traversal of the same named record.
A typical usage for e.g. printing out the sizes of all templates would look as follows:
new TestParser() {
protected void onTemplate(RecordId parentId, RecordId templateId) {
TemplateInfo templateInfo = parseTemplate(parentId, templateId);
System.out.println(templateInfo.size);
}
}.parseNode(null, nodeId);
| Modifier and Type | Class and Description |
|---|---|
static class |
SegmentParser.BlobInfo
Return type of
parseBlob(RecordId). |
static class |
SegmentParser.BlobType
Type of blobs (and strings)
|
static class |
SegmentParser.ListBucketInfo
Return type of
parseListBucket(RecordId, int, int, int). |
static class |
SegmentParser.ListInfo
Return type of
parseList(RecordId, RecordId, int) . |
static class |
SegmentParser.MapInfo
Result type of
parseMap(RecordId, RecordId, MapRecord). |
static class |
SegmentParser.NodeInfo
Result type of
parseNode(RecordId). |
static class |
SegmentParser.PropertyInfo
Result type of
parseProperty(RecordId, RecordId, PropertyTemplate). |
static class |
SegmentParser.TemplateInfo
Result type of
parseTemplate(RecordId). |
static class |
SegmentParser.ValueInfo
Result type of
parseValue(RecordId, RecordId, Type). |
| Constructor and Description |
|---|
SegmentParser() |
protected void onNode(RecordId parentId, RecordId nodeId)
parseNode(RecordId) upon encountering
a child node.parentId - id of the parent nodenodeId - if of the child nodeprotected void onTemplate(RecordId parentId, RecordId templateId)
parseNode(RecordId) upon encountering
a templateparentId - id of the node being parsedtemplateId - id of the templateprotected void onMap(RecordId parentId, RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
parseNode(RecordId),
parseMapDiff(RecordId, MapRecord) and
parseMapBranch(RecordId, MapRecord) upon encountering a map.parentId - the id of the parent of the mapmapId - the id of the mapmap - the mapprotected void onMapDiff(RecordId parentId, RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
parseMap(RecordId, RecordId, MapRecord) upon encountering
a map diff.parentId - the id of the parent mapmapId - the id of the mapmap - the mapprotected void onMapLeaf(RecordId parentId, RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
parseMap(RecordId, RecordId, MapRecord) upon encountering
a map leaf.parentId - the id of the parent mapmapId - the id of the mapmap - the mapprotected void onMapBranch(RecordId parentId, RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
parseMap(RecordId, RecordId, MapRecord) upon encountering
a map branch.parentId - the id of the parent mapmapId - the id of the mapmap - the mapprotected void onProperty(RecordId parentId, RecordId propertyId, org.apache.jackrabbit.oak.plugins.segment.PropertyTemplate template)
parseNode(RecordId) upon encountering
a property.parentId - the id of the parent nodepropertyId - the id of the propertytemplate - the property templateprotected void onValue(RecordId parentId, RecordId valueId, org.apache.jackrabbit.oak.api.Type<?> type)
parseProperty(RecordId, RecordId, PropertyTemplate) upon
encountering a value.parentId - the id the value's parentvalueId - the id of the valuetype - the type of the valueprotected void onBlob(RecordId parentId, RecordId blobId)
parseValue(RecordId, RecordId, Type) upon encountering a blob.parentId - the id of the blob's parentblobId - the id of the blobprotected void onString(RecordId parentId, RecordId stringId)
parseTemplate(RecordId),
parseMapLeaf(RecordId, MapRecord) and
parseValue(RecordId, RecordId, Type) upon encountering a string.parentId - the id of the string's parentstringId - the id of the stringprotected void onList(RecordId parentId, RecordId listId, int count)
parseNode(RecordId),
parseProperty(RecordId, RecordId, PropertyTemplate),
parseTemplate(RecordId),
parseBlob(RecordId) and
parseString(RecordId) upon encountering a list.parentId - the id of the list's parentlistId - the id of the listcount - the number of elements in the listprotected void onListBucket(RecordId parentId, RecordId listId, int index, int count, int capacity)
parseList(RecordId, RecordId, int) and
parseListBucket(RecordId, int, int, int) upon encountering a list
bucket.parentId - the id of the list's parentlistId - the id of the listindex - the index into the bucketcount - the number of items in the bucketcapacity - the capacity of the bucketpublic SegmentParser.NodeInfo parseNode(RecordId nodeId)
nodeId - public SegmentParser.TemplateInfo parseTemplate(RecordId templateId)
templateId - public SegmentParser.MapInfo parseMap(RecordId parentId, RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
parentId - parent of this map or null if nonemapId - map - public SegmentParser.MapInfo parseMapDiff(RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
mapId - map - public SegmentParser.MapInfo parseMapLeaf(RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
mapId - map - public SegmentParser.MapInfo parseMapBranch(RecordId mapId, org.apache.jackrabbit.oak.plugins.segment.MapRecord map)
mapId - map - public SegmentParser.PropertyInfo parseProperty(RecordId parentId, RecordId propertyId, org.apache.jackrabbit.oak.plugins.segment.PropertyTemplate template)
parentId - propertyId - template - public SegmentParser.ValueInfo parseValue(RecordId parentId, RecordId valueId, org.apache.jackrabbit.oak.api.Type<?> type)
parentId - parent of the value record, null if nonevalueId - type - public SegmentParser.BlobInfo parseBlob(RecordId blobId)
blobId - public SegmentParser.BlobInfo parseString(RecordId stringId)
stringId - public SegmentParser.ListInfo parseList(RecordId parentId, RecordId listId, int count)
parentId - parent of the list, null if nonelistId - count - public SegmentParser.ListBucketInfo parseListBucket(RecordId listId, int index, int count, int capacity)
listId - index - index of the first item to parsecount - number of items to parsecapacity - total number of itemsCopyright © 2012-2018 The Apache Software Foundation. All Rights Reserved.