Class 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 Detail

      • DocumentTypeManager

        public DocumentTypeManager()
      • DocumentTypeManager

        @Inject
        public DocumentTypeManager​(com.yahoo.document.config.DocumentmanagerConfig config)
    • Method Detail

      • 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 manager
        detailedType - 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)
      • 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.
      • shutdown

        public void shutdown()