Xindice API
version 1.2m1

org.apache.xindice.core.meta.inline
Class InlineMetaService

java.lang.Object
  extended byorg.apache.xindice.core.meta.inline.InlineMetaService

public class InlineMetaService
extends Object

If the documents in a collection have headers, the Collection object holds an instance of this class. All services the collection needs for working with inline metadata are provided by this class.

Version:
$Revision: 571950 $, $Date: 2007-09-02 06:53:17 -0400 (Sun, 02 Sep 2007) $

Nested Class Summary
static class InlineMetaService.DatabaseEntry
          Utility class for returning an InlineMetaMap and Value from readDatabaseEntry(Value).
 
Field Summary
static Class currentMapClass
          The InlineMetaMap class associated with the current header version.
static InlineMetaWriter currentWriter
          The writer corresponding to the current header version.
static InlineMetaReader[] readerByVersion
          The known readers.
 
Constructor Summary
InlineMetaService()
           
 
Method Summary
 Value createValue(InlineMetaMap map, byte[] data, int offset, int length)
          Create a Value object containing the appropriate header and data.
 InlineMetaMap getEmptyMap()
          Get an InlineMetaMap instance corresponding to the current header version.
 boolean haveReaderForVersion(int version)
          Returns true if a reader is available for the specified version.
 InlineMetaService.DatabaseEntry readDatabaseEntry(Value rawValue)
          Given a Value object from the database, disassemble it into its component metadata and entry data components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

readerByVersion

public static final InlineMetaReader[] readerByVersion
The known readers. All readers for header versions up to and including the current version must be present in this array.


currentWriter

public static final InlineMetaWriter currentWriter
The writer corresponding to the current header version.


currentMapClass

public static final Class currentMapClass
The InlineMetaMap class associated with the current header version. When the Collection fills in an InlineMetaMap object prior to a store, it is working with this class.

Constructor Detail

InlineMetaService

public InlineMetaService()
Method Detail

getEmptyMap

public InlineMetaMap getEmptyMap()
Get an InlineMetaMap instance corresponding to the current header version. Used by Collection to inform the InlineMeta code of the metadata values for the entry being stored.

Returns:
InlineMetaMap instance

createValue

public Value createValue(InlineMetaMap map,
                         byte[] data,
                         int offset,
                         int length)
                  throws InlineMetaException
Create a Value object containing the appropriate header and data. This utility method takes the metadata and the data for the entry to be stored in the database and creates a Value object containing both, ready to store.

Parameters:
map - containing metadata
data - containing entry to be stored in database
offset - in the data to the beginning of the entry
length - of the entry
Returns:
Value object containing the header + entry, ready to store
Throws:
InlineMetaException - if the metadata is incomplete

haveReaderForVersion

public boolean haveReaderForVersion(int version)
Returns true if a reader is available for the specified version.

Parameters:
version - of the header
Returns:
true if a reader is available for the given version

readDatabaseEntry

public InlineMetaService.DatabaseEntry readDatabaseEntry(Value rawValue)
                                                  throws InlineMetaException
Given a Value object from the database, disassemble it into its component metadata and entry data components.

Parameters:
rawValue - containing raw header + entry data from the backing store
Returns:
DatabaseEntry containing metadata in an InlineMetaMap and entry data in a Value.
Throws:
InlineMetaException - if missing the reader for the header, or if the header is corrupted.

Xindice API
version 1.2m1

Copyright (c) 1999-2007 The Apache Software Foundation. All Rights Reserved.