Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.schema
Class SchemaManagerImpl

java.lang.Object
  extended by org.nuxeo.ecm.core.schema.SchemaManagerImpl
All Implemented Interfaces:
SchemaManager, TypeProvider

public class SchemaManagerImpl
extends Object
implements SchemaManager

Schema Manager implementation.

Holds basic types (String, Integer, etc.), schemas, document types and facets.


Constructor Summary
SchemaManagerImpl()
           
 
Method Summary
 void clear()
          Unregisters all types.
 DocumentType getDocumentType(String name)
          Gets a document type.
 Set<String> getDocumentTypeNamesExtending(String docTypeName)
          Implementation details: there is a cache on each server for this Assumes that types never change in the lifespan of this server process and that the Core server has finished loading its types.
 Set<String> getDocumentTypeNamesForFacet(String facet)
          Same remarks as in getDocumentTypeNamesExtending(java.lang.String).
 DocumentType[] getDocumentTypes()
          Gets the list of document types.
 int getDocumentTypesCount()
           
 CompositeType getFacet(String name)
          Gets a facet.
 CompositeType[] getFacets()
          Gets the list of facets.
 Field getField(String prefixedName)
          Gets the field given a prefixed name.
 TypeHelper getHelper(String schema, String type)
           
 PrefetchInfo getPrefetchInfo()
           
 Schema getSchema(String name)
          Gets a schema.
 File getSchemaDirectory()
           
 File getSchemaFile(String name)
           
 Schema getSchemaFromPrefix(String schemaPrefix)
           
 Schema getSchemaFromURI(String schemaURI)
           
 Schema[] getSchemas()
          Gets the list of schemas.
 int getSchemasCount()
           
 Type getType(String name)
          Gets a property type.
 Type getType(String schema, String name)
          Low level generic type lookup.
 Type[] getTypes()
          Gets the list of property types.
 Type[] getTypes(String schema)
          Gets the types defined by the given schema.
 int getTypesCount()
           
 String getXmlSchemaDefinition(String name)
          Get the schema definition.
 void importTypes(TypeProvider provider)
          Initializes initial types using a remote provider if any was specified.
 void registerDocumentType(DocumentType docType)
           
 void registerDocumentType(DocumentTypeDescriptor dtd)
           
 void registerFacet(CompositeType facet)
           
 void registerFacet(FacetDescriptor fd)
           
 void registerHelper(String schema, String type, TypeHelper helper)
           
 void registerSchema(Schema schema)
           
 void registerType(Type type)
           
 URL resolveSchemaLocation(String location)
           
 void setPrefetchInfo(PrefetchInfo prefetchInfo)
           
 void setSchemaDirectory(File dir)
           
 DocumentType unregisterDocumentType(String name)
           
 CompositeType unregisterFacet(String name)
           
 void unregisterHelper(String schema, String type)
           
 Schema unregisterSchema(String name)
           
 Type unregisterType(String name)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaManagerImpl

public SchemaManagerImpl()
                  throws Exception
Throws:
Exception
Method Detail

importTypes

public void importTypes(TypeProvider provider)
Initializes initial types using a remote provider if any was specified.

Should be called when a provider is registered.


getType

public Type getType(String schema,
                    String name)
Description copied from interface: TypeProvider
Low level generic type lookup.

Specified by:
getType in interface TypeProvider

registerType

public void registerType(Type type)
Specified by:
registerType in interface SchemaManager

unregisterType

public Type unregisterType(String name)
Specified by:
unregisterType in interface SchemaManager

getType

public Type getType(String name)
Description copied from interface: TypeProvider
Gets a property type.

Specified by:
getType in interface TypeProvider

getTypes

public Type[] getTypes()
Description copied from interface: TypeProvider
Gets the list of property types.

Specified by:
getTypes in interface TypeProvider

getTypes

public Type[] getTypes(String schema)
Description copied from interface: SchemaManager
Gets the types defined by the given schema.

Specified by:
getTypes in interface SchemaManager
Returns:

getTypesCount

public int getTypesCount()
Specified by:
getTypesCount in interface SchemaManager

registerSchema

public void registerSchema(Schema schema)
Specified by:
registerSchema in interface SchemaManager

unregisterSchema

public Schema unregisterSchema(String name)
Specified by:
unregisterSchema in interface SchemaManager

getSchema

public Schema getSchema(String name)
Description copied from interface: TypeProvider
Gets a schema.

Specified by:
getSchema in interface TypeProvider

getSchemaFromPrefix

public Schema getSchemaFromPrefix(String schemaPrefix)
Specified by:
getSchemaFromPrefix in interface SchemaManager

getSchemaFromURI

public Schema getSchemaFromURI(String schemaURI)
Specified by:
getSchemaFromURI in interface SchemaManager

getField

public Field getField(String prefixedName)
Description copied from interface: SchemaManager
Gets the field given a prefixed name.

Specified by:
getField in interface SchemaManager
Returns:
the field or null if none

getSchemas

public Schema[] getSchemas()
Description copied from interface: TypeProvider
Gets the list of schemas.

Specified by:
getSchemas in interface TypeProvider

getSchemasCount

public int getSchemasCount()
Specified by:
getSchemasCount in interface SchemaManager

setPrefetchInfo

public void setPrefetchInfo(PrefetchInfo prefetchInfo)

getPrefetchInfo

public PrefetchInfo getPrefetchInfo()

registerDocumentType

public void registerDocumentType(DocumentType docType)
Specified by:
registerDocumentType in interface SchemaManager

registerDocumentType

public void registerDocumentType(DocumentTypeDescriptor dtd)

unregisterDocumentType

public DocumentType unregisterDocumentType(String name)
Specified by:
unregisterDocumentType in interface SchemaManager

getDocumentType

public DocumentType getDocumentType(String name)
Description copied from interface: TypeProvider
Gets a document type.

Specified by:
getDocumentType in interface TypeProvider

getDocumentTypes

public DocumentType[] getDocumentTypes()
Description copied from interface: TypeProvider
Gets the list of document types.

Specified by:
getDocumentTypes in interface TypeProvider

getDocumentTypesCount

public int getDocumentTypesCount()
Specified by:
getDocumentTypesCount in interface SchemaManager

registerFacet

public void registerFacet(CompositeType facet)
Specified by:
registerFacet in interface SchemaManager

registerFacet

public void registerFacet(FacetDescriptor fd)

unregisterFacet

public CompositeType unregisterFacet(String name)
Specified by:
unregisterFacet in interface SchemaManager

getFacet

public CompositeType getFacet(String name)
Description copied from interface: TypeProvider
Gets a facet.

Specified by:
getFacet in interface TypeProvider

getFacets

public CompositeType[] getFacets()
Description copied from interface: TypeProvider
Gets the list of facets.

Specified by:
getFacets in interface TypeProvider

clear

public void clear()
Description copied from interface: SchemaManager
Unregisters all types. Useful for testing.

Specified by:
clear in interface SchemaManager

setSchemaDirectory

public void setSchemaDirectory(File dir)

getSchemaDirectory

public File getSchemaDirectory()

getSchemaFile

public File getSchemaFile(String name)

resolveSchemaLocation

public URL resolveSchemaLocation(String location)

getDocumentTypeNamesForFacet

public Set<String> getDocumentTypeNamesForFacet(String facet)
Same remarks as in getDocumentTypeNamesExtending(java.lang.String). Tested in nuxeo-core

Specified by:
getDocumentTypeNamesForFacet in interface SchemaManager
Returns:
null or the names as a guaranteed non-empty set.

getDocumentTypeNamesExtending

public Set<String> getDocumentTypeNamesExtending(String docTypeName)
Implementation details: there is a cache on each server for this Assumes that types never change in the lifespan of this server process and that the Core server has finished loading its types.

This is tested in nuxeo-core and SearchBackendTestCase (hence compass plugin).

Specified by:
getDocumentTypeNamesExtending in interface SchemaManager
Returns:
null or the set of names.

getXmlSchemaDefinition

public String getXmlSchemaDefinition(String name)
Description copied from interface: SchemaManager
Get the schema definition.

Specified by:
getXmlSchemaDefinition in interface SchemaManager
Returns:

registerHelper

public void registerHelper(String schema,
                           String type,
                           TypeHelper helper)
Specified by:
registerHelper in interface SchemaManager

unregisterHelper

public void unregisterHelper(String schema,
                             String type)
Specified by:
unregisterHelper in interface SchemaManager

getHelper

public TypeHelper getHelper(String schema,
                            String type)
Specified by:
getHelper in interface SchemaManager

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.