public class SchemaManagerImpl extends Object implements SchemaManager
Holds basic types (String, Integer, etc.), schemas, document types and facets.
| Modifier and Type | Field and Description |
|---|---|
protected List<TypeConfiguration> |
allConfigurations
All the registered configurations (prefetch).
|
protected List<DocumentTypeDescriptor> |
allDocumentTypes
All the registered document types.
|
protected List<FacetDescriptor> |
allFacets
All the registered facets.
|
protected boolean |
allowVersionWriteForDublinCore
Effective allowVersionWriteForDublinCore flag.
|
protected List<ProxiesDescriptor> |
allProxies
All the registered proxy descriptors.
|
protected List<SchemaBindingDescriptor> |
allSchemas
All the registered schemas.
|
static boolean |
CLEAR_COMPLEX_PROP_BEFORE_SET_DEFAULT
Default used for clearComplexPropertyBeforeSet if there is no XML configuration found.
|
protected boolean |
clearComplexPropertyBeforeSet
Effective clearComplexPropertyBeforeSet flag.
|
protected Map<String,Map<String,String>> |
deprecatedProperties |
protected boolean |
dirty
Whether there have been changes to the registered schemas, facets or document types that require recomputation of
the effective ones.
|
protected Map<String,DocumentTypeImpl> |
documentTypes
Effective document types.
|
protected Map<String,Set<String>> |
documentTypesExtending |
protected Map<String,Set<String>> |
documentTypesForFacet |
protected Map<String,CompositeType> |
facets
Effective facets.
|
protected Set<String> |
noPerDocumentQueryFacets |
protected PrefetchInfo |
prefetchInfo
Effective prefetch info.
|
protected Map<String,Schema> |
prefixToSchema |
protected Set<String> |
proxySchemaNames
Effective proxy schema names.
|
protected List<Schema> |
proxySchemas
Effective proxy schemas.
|
protected List<Runnable> |
recomputeCallbacks |
protected Map<String,Map<String,String>> |
removedProperties |
protected Map<String,Schema> |
schemas
Effective schemas.
|
static String |
SCHEMAS_DIR_NAME |
protected Map<String,Type> |
types
Basic type registry.
|
protected Map<String,Schema> |
uriToSchema |
| Constructor and Description |
|---|
SchemaManagerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkDirty()
Checks if something has to be recomputed if a dynamic register/unregister happened.
|
protected void |
clearSchemaDir() |
protected void |
copySchema(SchemaBindingDescriptor sd) |
protected void |
executeRecomputeCallbacks() |
void |
flushPendingsRegistration() |
Set<String> |
getAllowedSubTypes(String typeName)
Returns the types of the children that can be created inside a given
type type. |
boolean |
getAllowVersionWriteForDublinCore()
Whether we allow to write the dublincore schema on a version.
|
boolean |
getClearComplexPropertyBeforeSet()
Whether or not to ignore any previous values when setting complex properties.
|
PropertyDeprecationHandler |
getDeprecatedProperties() |
DocumentType |
getDocumentType(String name)
Gets a document type.
|
DocumentTypeDescriptor |
getDocumentTypeDescriptor(String name) |
Set<String> |
getDocumentTypeNamesExtending(String docTypeName)
Return the names of all document types extending the given one, which is included.
|
Set<String> |
getDocumentTypeNamesForFacet(String facet)
Returns the names of all document types that have given facet.
|
DocumentType[] |
getDocumentTypes()
Gets the list of document types.
|
int |
getDocumentTypesCount() |
CompositeType |
getFacet(String name)
Gets a facet.
|
FacetDescriptor |
getFacetDescriptor(String name) |
CompositeType[] |
getFacets()
Gets the list of facets.
|
Field |
getField(Field parent,
String subFieldName)
Returns the field with given parent field and sub name, or null if not found.
|
protected Field |
getField(Field parent,
String subFieldName,
boolean finalCall) |
Field |
getField(String xpath)
Returns the field with given xpath, or null if not found.
|
Set<String> |
getNoPerDocumentQueryFacets()
Finds which facets are configured as no-per-instance-query.
|
List<Schema> |
getProxySchemas(String docType)
Gets the schemas on a proxy for a document of the given type.
|
PropertyDeprecationHandler |
getRemovedProperties() |
Schema |
getSchema(String name)
Gets a schema.
|
Schema |
getSchemaFromPrefix(String schemaPrefix) |
Schema |
getSchemaFromURI(String schemaURI) |
Schema[] |
getSchemas()
Gets the list of schemas.
|
File |
getSchemasDir() |
protected Type |
getType(String name) |
protected Collection<Type> |
getTypes() |
boolean |
hasSuperType(String docType,
String superType)
Returns true if
docType is or extends superType, false otherwise. |
boolean |
isProxySchema(String schema,
String docType)
Checks if a schema is on a proxy for a document of the given type.
|
protected void |
loadSchema(SchemaBindingDescriptor sd) |
protected DocumentTypeDescriptor |
mergeDocumentTypeDescriptors(DocumentTypeDescriptor src,
DocumentTypeDescriptor dst) |
protected void |
recompute()
Recomputes effective registries for schemas, facets and document types.
|
protected void |
recomputeConfiguration() |
protected DocumentType |
recomputeDocumentType(String name,
DocumentTypeDescriptor dtd,
DocumentType parent) |
protected DocumentType |
recomputeDocumentType(String name,
Set<String> stack,
Map<String,DocumentTypeDescriptor> dtds) |
protected void |
recomputeDocumentTypes() |
void |
recomputeDynamicFacets() |
protected void |
recomputeFacet(FacetDescriptor fd) |
protected void |
recomputeFacets() |
protected void |
recomputeProxies() |
protected void |
recomputeSchemas() |
protected void |
registerBuiltinTypes() |
void |
registerConfiguration(TypeConfiguration config) |
void |
registerDocumentType(DocumentTypeDescriptor dtd) |
protected void |
registerDocumentType(DocumentTypeImpl docType) |
void |
registerFacet(FacetDescriptor fd) |
protected CompositeType |
registerFacet(String name,
Set<String> schemaNames) |
void |
registerPropertyDeprecation(PropertyDeprecationDescriptor descriptor) |
void |
registerProxies(ProxiesDescriptor pd) |
void |
registerRecomputeCallback(Runnable callback) |
protected void |
registerSchema(Schema schema) |
void |
registerSchema(SchemaBindingDescriptor sd) |
protected void |
registerType(Type type) |
protected Field |
resolveSubField(ListType listType,
String subName,
boolean fallbackOnSubElement) |
void |
unregisterConfiguration(TypeConfiguration config) |
void |
unregisterDocumentType(DocumentTypeDescriptor dtd) |
void |
unregisterFacet(FacetDescriptor fd) |
void |
unregisterPropertyDeprecation(PropertyDeprecationDescriptor descriptor) |
void |
unregisterProxies(ProxiesDescriptor pd) |
void |
unregisterRecomputeCallback(Runnable callback) |
void |
unregisterSchema(SchemaBindingDescriptor sd) |
protected volatile boolean dirty
protected List<TypeConfiguration> allConfigurations
protected List<SchemaBindingDescriptor> allSchemas
protected List<FacetDescriptor> allFacets
protected List<DocumentTypeDescriptor> allDocumentTypes
protected List<ProxiesDescriptor> allProxies
protected PrefetchInfo prefetchInfo
protected boolean clearComplexPropertyBeforeSet
protected boolean allowVersionWriteForDublinCore
protected final Map<String,Schema> uriToSchema
protected final Map<String,Schema> prefixToSchema
protected Map<String,CompositeType> facets
protected Set<String> noPerDocumentQueryFacets
protected Map<String,DocumentTypeImpl> documentTypes
protected Map<String,Set<String>> documentTypesExtending
protected Map<String,Set<String>> documentTypesForFacet
protected List<Schema> proxySchemas
protected Set<String> proxySchemaNames
public static final String SCHEMAS_DIR_NAME
public static final boolean CLEAR_COMPLEX_PROP_BEFORE_SET_DEFAULT
protected List<Runnable> recomputeCallbacks
public SchemaManagerImpl()
protected void clearSchemaDir()
public File getSchemasDir()
protected void registerBuiltinTypes()
protected void registerType(Type type)
protected Collection<Type> getTypes()
public void registerConfiguration(TypeConfiguration config)
public void unregisterConfiguration(TypeConfiguration config)
public void registerSchema(SchemaBindingDescriptor sd)
public void unregisterSchema(SchemaBindingDescriptor sd)
public void registerFacet(FacetDescriptor fd)
public void unregisterFacet(FacetDescriptor fd)
public void registerDocumentType(DocumentTypeDescriptor dtd)
public void unregisterDocumentType(DocumentTypeDescriptor dtd)
public DocumentTypeDescriptor getDocumentTypeDescriptor(String name)
public FacetDescriptor getFacetDescriptor(String name)
public void recomputeDynamicFacets()
public void registerProxies(ProxiesDescriptor pd)
public void unregisterProxies(ProxiesDescriptor pd)
public void checkDirty()
protected void recompute()
protected void recomputeConfiguration()
protected void recomputeSchemas()
protected void copySchema(SchemaBindingDescriptor sd) throws IOException
IOExceptionprotected void loadSchema(SchemaBindingDescriptor sd) throws IOException, SAXException, TypeException
IOExceptionSAXExceptionTypeExceptionprotected void registerSchema(Schema schema)
public Schema[] getSchemas()
TypeProvidergetSchemas in interface TypeProviderpublic Schema getSchema(String name)
TypeProvidergetSchema in interface TypeProviderpublic Schema getSchemaFromPrefix(String schemaPrefix)
getSchemaFromPrefix in interface SchemaManagerpublic Schema getSchemaFromURI(String schemaURI)
getSchemaFromURI in interface SchemaManagerprotected void recomputeFacets()
protected void recomputeFacet(FacetDescriptor fd)
protected CompositeType registerFacet(String name, Set<String> schemaNames)
public CompositeType[] getFacets()
TypeProvidergetFacets in interface TypeProviderpublic CompositeType getFacet(String name)
TypeProvidergetFacet in interface TypeProviderpublic Set<String> getNoPerDocumentQueryFacets()
TypeProvidergetNoPerDocumentQueryFacets in interface TypeProviderprotected void recomputeDocumentTypes()
protected DocumentTypeDescriptor mergeDocumentTypeDescriptors(DocumentTypeDescriptor src, DocumentTypeDescriptor dst)
protected DocumentType recomputeDocumentType(String name, Set<String> stack, Map<String,DocumentTypeDescriptor> dtds)
protected DocumentType recomputeDocumentType(String name, DocumentTypeDescriptor dtd, DocumentType parent)
protected void registerDocumentType(DocumentTypeImpl docType)
public DocumentType getDocumentType(String name)
TypeProvidergetDocumentType in interface TypeProviderpublic Set<String> getDocumentTypeNamesForFacet(String facet)
SchemaManagergetDocumentTypeNamesForFacet in interface SchemaManagerpublic Set<String> getDocumentTypeNamesExtending(String docTypeName)
SchemaManagergetDocumentTypeNamesExtending in interface SchemaManagerpublic DocumentType[] getDocumentTypes()
TypeProvidergetDocumentTypes in interface TypeProviderpublic int getDocumentTypesCount()
getDocumentTypesCount in interface SchemaManagerpublic boolean hasSuperType(String docType, String superType)
SchemaManagerdocType is or extends superType, false otherwise.hasSuperType in interface SchemaManagerpublic Set<String> getAllowedSubTypes(String typeName)
SchemaManagertype type.getAllowedSubTypes in interface SchemaManagerprotected void recomputeProxies()
public List<Schema> getProxySchemas(String docType)
TypeProvidergetProxySchemas in interface TypeProviderpublic boolean isProxySchema(String schema, String docType)
TypeProviderisProxySchema in interface TypeProviderpublic Field getField(String xpath)
SchemaManagergetField in interface SchemaManagerpublic Field getField(Field parent, String subFieldName)
SchemaManagergetField in interface SchemaManagerprotected Field resolveSubField(ListType listType, String subName, boolean fallbackOnSubElement)
public void flushPendingsRegistration()
public void registerRecomputeCallback(Runnable callback)
public void unregisterRecomputeCallback(Runnable callback)
protected void executeRecomputeCallbacks()
public void registerPropertyDeprecation(PropertyDeprecationDescriptor descriptor)
public void unregisterPropertyDeprecation(PropertyDeprecationDescriptor descriptor)
public PropertyDeprecationHandler getDeprecatedProperties()
getDeprecatedProperties in interface SchemaManagerpublic PropertyDeprecationHandler getRemovedProperties()
getRemovedProperties in interface SchemaManagerpublic boolean getClearComplexPropertyBeforeSet()
SchemaManagergetClearComplexPropertyBeforeSet in interface SchemaManagertrue if setting a complex property ignores any previous valuespublic boolean getAllowVersionWriteForDublinCore()
SchemaManagergetAllowVersionWriteForDublinCore in interface SchemaManagertrue if write to the dublincore schema of a version is allowedCopyright © 2019 Nuxeo. All rights reserved.