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.

    Thomas Gundersen
    • Constructor Detail

      • DocumentTypeManager

        public DocumentTypeManager()
    • 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
        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
        the appropriate DataType instance
      • register

        public void register​(DataType type)
        Register a data type of any sort, including document types.
        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.
        docType - The document type to register.
        the previously registered type, or null if none was registered
      • getDocumentType

        public DocumentType getDocumentType​(DataTypeName name)
        Gets a registered document.
        name - the document name of the type
        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
        name - the type name of the document type
        returns the document type having this name, or null if none
      • createDocument

        public final Document createDocument​( buf)
      • getDataTypes

        public java.util.Collection<DataType> getDataTypes()
        Returns a read only view of the registered data types
        collection of types
      • getDocumentTypes

        public java.util.Map<DataTypeName,​DocumentType> getDocumentTypes()
        A read only view of the registered document types
        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()