Package com.yahoo.document
Class DocumentTypeManager
- java.lang.Object
-
- com.yahoo.document.DocumentTypeManager
-
public class DocumentTypeManager extends java.lang.Object
The DocumentTypeManager keeps track of the document types registered in the Vespa common repository.The DocumentTypeManager is also responsible for registering a FieldValue factory for each data type a field can have. The Document object uses this factory to serialize and deserialize the various datatypes. The factory could also be used to expand the functionality of various datatypes, for instance displaying the data type in human-readable form or as XML.
- Author:
- Thomas Gundersen
-
-
Constructor Summary
Constructors Constructor Description DocumentTypeManager()
DocumentTypeManager(com.yahoo.document.config.DocumentmanagerConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
assign(DocumentTypeManager other)
void
clear()
Clears the DocumentTypeManager.DocumentTypeManager
configure(java.lang.String configId)
Document
createDocument(DocumentDeserializer data)
Document
createDocument(com.yahoo.io.GrowableByteBuffer buf)
java.util.Iterator<DocumentType>
documentTypeIterator()
AnnotationTypeRegistry
getAnnotationTypeRegistry()
DataType
getDataType(int code)
DataType
getDataType(int code, java.lang.String detailedType)
Return a data type instanceDataType
getDataType(java.lang.String name)
java.util.Collection<DataType>
getDataTypes()
Returns a read only view of the registered data typesDocumentType
getDocumentType(DataTypeName name)
Gets a registered document.DocumentType
getDocumentType(java.lang.String name)
Returns a registered document typejava.util.Map<DataTypeName,DocumentType>
getDocumentTypes()
A read only view of the registered document typesboolean
hasDataType(int code)
boolean
hasDataType(java.lang.String name)
void
register(DataType type)
Register a data type of any sort, including document types.DocumentType
registerDocumentType(DocumentType docType)
Registers a document type.void
shutdown()
-
-
-
Method Detail
-
assign
public void assign(DocumentTypeManager other)
-
configure
public DocumentTypeManager configure(java.lang.String configId)
-
hasDataType
public boolean hasDataType(java.lang.String name)
-
hasDataType
public boolean hasDataType(int code)
-
getDataType
public DataType getDataType(java.lang.String name)
-
getDataType
public DataType getDataType(int code)
-
getDataType
public DataType getDataType(int code, java.lang.String detailedType)
Return a data type instance- Parameters:
code
- the code of the data type to return, which must be either built in or present in this managerdetailedType
- detailed type information, or the empty string if none- Returns:
- the appropriate DataType instance
-
register
public void register(DataType type)
Register a data type of any sort, including document types.- Parameters:
type
- The datatype to register TODO Give unique ids to document types
-
registerDocumentType
public DocumentType registerDocumentType(DocumentType docType)
Registers a document type. Typically called by someone importing the document types from the common Vespa repository.- Parameters:
docType
- The document type to register.- Returns:
- the previously registered type, or null if none was registered
-
getDocumentType
public DocumentType getDocumentType(DataTypeName name)
Gets a registered document.- Parameters:
name
- the document name of the type- Returns:
- returns the document type found, or null if there is no type with this name
-
getDocumentType
public DocumentType getDocumentType(java.lang.String name)
Returns a registered document type- Parameters:
name
- the type name of the document type- Returns:
- returns the document type having this name, or null if none
-
createDocument
public final Document createDocument(com.yahoo.io.GrowableByteBuffer buf)
-
createDocument
public Document createDocument(DocumentDeserializer data)
-
getDataTypes
public java.util.Collection<DataType> getDataTypes()
Returns a read only view of the registered data types- Returns:
- collection of types
-
getDocumentTypes
public java.util.Map<DataTypeName,DocumentType> getDocumentTypes()
A read only view of the registered document types- Returns:
- map of types
-
documentTypeIterator
public java.util.Iterator<DocumentType> documentTypeIterator()
-
clear
public void clear()
Clears the DocumentTypeManager. After this operation, only the default document type and data types are available.
-
getAnnotationTypeRegistry
public AnnotationTypeRegistry getAnnotationTypeRegistry()
-
shutdown
public void shutdown()
-
-