Class SegmentParser
java.lang.Object
org.apache.jackrabbit.oak.segment.SegmentParser
- Direct Known Subclasses:
- RecordUsageAnalyser
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);
 - 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classReturn type ofparseBlob(RecordId).static enumType of blobs (and strings)static classReturn type ofparseListBucket(RecordId, int, int, int).static classReturn type ofparseList(RecordId, RecordId, int).static classResult type ofparseMap(RecordId, RecordId, MapRecord).static classResult type ofparseNode(RecordId).static classResult type ofparseProperty(RecordId, RecordId, PropertyTemplate).static classResult type ofparseTemplate(RecordId).static classResult type ofparseValue(RecordId, RecordId, Type).
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidCallback called byparseValue(RecordId, RecordId, Type)upon encountering a blob.protected voidCallback called byparseNode(RecordId),parseProperty(RecordId, RecordId, PropertyTemplate),parseTemplate(RecordId),parseBlob(RecordId)andparseString(RecordId)upon encountering a list.protected voidonListBucket(RecordId parentId, RecordId listId, int index, int count, int capacity) Callback called byparseList(RecordId, RecordId, int)andparseListBucket(RecordId, int, int, int)upon encountering a list bucket.protected voidCallback called byparseNode(RecordId),parseMapDiff(RecordId, MapRecord)andparseMapBranch(RecordId, MapRecord)upon encountering a map.protected voidonMapBranch(RecordId parentId, RecordId mapId, MapRecord map) Callback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map branch.protected voidCallback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map diff.protected voidCallback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map leaf.protected voidCallback called byparseNode(RecordId)upon encountering a child node.protected voidonProperty(RecordId parentId, RecordId propertyId, PropertyTemplate template) Callback called byparseNode(RecordId)upon encountering a property.protected voidCallback called byparseTemplate(RecordId),parseMapLeaf(RecordId, MapRecord)andparseValue(RecordId, RecordId, Type)upon encountering a string.protected voidonTemplate(RecordId parentId, RecordId templateId) Callback called byparseNode(RecordId)upon encountering a templateprotected voidCallback called byparseProperty(RecordId, RecordId, PropertyTemplate)upon encountering a value.Parse a blob recordParse a list recordparseListBucket(RecordId listId, int index, int count, int capacity) Parse item of list bucketsParse a map recordparseMapBranch(RecordId mapId, MapRecord map) Parse a map branch recordparseMapDiff(RecordId mapId, MapRecord map) Parse a map diff recordparseMapLeaf(RecordId mapId, MapRecord map) Parse a map leaf recordParse a node recordparseProperty(RecordId parentId, RecordId propertyId, PropertyTemplate template) Parse a propertyparseString(RecordId stringId) Parse a string recordparseTemplate(RecordId templateId) Parse a template recordparseValue(RecordId parentId, RecordId valueId, Type<?> type) Parse a value record
- 
Constructor Details- 
SegmentParser
 
- 
- 
Method Details- 
onNodeCallback called byparseNode(RecordId)upon encountering a child node.- Parameters:
- parentId- id of the parent node
- nodeId- if of the child node
 
- 
onTemplateCallback called byparseNode(RecordId)upon encountering a template- Parameters:
- parentId- id of the node being parsed
- templateId- id of the template
 
- 
onMapCallback called byparseNode(RecordId),parseMapDiff(RecordId, MapRecord)andparseMapBranch(RecordId, MapRecord)upon encountering a map.- Parameters:
- parentId- the id of the parent of the map
- mapId- the id of the map
- map- the map
 
- 
onMapDiffCallback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map diff.- Parameters:
- parentId- the id of the parent map
- mapId- the id of the map
- map- the map
 
- 
onMapLeafCallback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map leaf.- Parameters:
- parentId- the id of the parent map
- mapId- the id of the map
- map- the map
 
- 
onMapBranchCallback called byparseMap(RecordId, RecordId, MapRecord)upon encountering a map branch.- Parameters:
- parentId- the id of the parent map
- mapId- the id of the map
- map- the map
 
- 
onPropertyCallback called byparseNode(RecordId)upon encountering a property.- Parameters:
- parentId- the id of the parent node
- propertyId- the id of the property
- template- the property template
 
- 
onValueCallback called byparseProperty(RecordId, RecordId, PropertyTemplate)upon encountering a value.- Parameters:
- parentId- the id the value's parent
- valueId- the id of the value
- type- the type of the value
 
- 
onBlobCallback called byparseValue(RecordId, RecordId, Type)upon encountering a blob.- Parameters:
- parentId- the id of the blob's parent
- blobId- the id of the blob
 
- 
onStringCallback called byparseTemplate(RecordId),parseMapLeaf(RecordId, MapRecord)andparseValue(RecordId, RecordId, Type)upon encountering a string.- Parameters:
- parentId- the id of the string's parent
- stringId- the id of the string
 
- 
onListCallback called byparseNode(RecordId),parseProperty(RecordId, RecordId, PropertyTemplate),parseTemplate(RecordId),parseBlob(RecordId)andparseString(RecordId)upon encountering a list.- Parameters:
- parentId- the id of the list's parent
- listId- the id of the list
- count- the number of elements in the list
 
- 
onListBucketCallback called byparseList(RecordId, RecordId, int)andparseListBucket(RecordId, int, int, int)upon encountering a list bucket.- Parameters:
- parentId- the id of the list's parent
- listId- the id of the list
- index- the index into the bucket
- count- the number of items in the bucket
- capacity- the capacity of the bucket
 
- 
parseNodeParse a node record- Parameters:
- nodeId-
- Returns:
 
- 
parseTemplateParse a template record- Parameters:
- templateId-
- Returns:
 
- 
parseMapParse a map record- Parameters:
- parentId- parent of this map or- nullif none
- mapId-
- map-
- Returns:
 
- 
parseMapDiffParse a map diff record- Parameters:
- mapId-
- map-
- Returns:
 
- 
parseMapLeafParse a map leaf record- Parameters:
- mapId-
- map-
- Returns:
 
- 
parseMapBranchParse a map branch record- Parameters:
- mapId-
- map-
- Returns:
 
- 
parsePropertypublic SegmentParser.PropertyInfo parseProperty(RecordId parentId, RecordId propertyId, PropertyTemplate template) Parse a property- Parameters:
- parentId-
- propertyId-
- template-
- Returns:
 
- 
parseValueParse a value record- Parameters:
- parentId- parent of the value record,- nullif none
- valueId-
- type-
- Returns:
 
- 
parseBlobParse a blob record- Parameters:
- blobId-
- Returns:
 
- 
parseStringParse a string record- Parameters:
- stringId-
- Returns:
 
- 
parseListParse a list record- Parameters:
- parentId- parent of the list,- nullif none
- listId-
- count-
- Returns:
 
- 
parseListBucketpublic SegmentParser.ListBucketInfo parseListBucket(RecordId listId, int index, int count, int capacity) Parse item of list buckets- Parameters:
- listId-
- index- index of the first item to parse
- count- number of items to parse
- capacity- total number of items
- Returns:
 
 
-