org.alfresco.repo.dictionary
Class DictionaryDAOImpl

java.lang.Object
  extended by org.alfresco.repo.dictionary.DictionaryDAOImpl
All Implemented Interfaces:
DictionaryDAO

public class DictionaryDAOImpl
extends java.lang.Object
implements DictionaryDAO

Default implementation of the Dictionary.


Nested Class Summary
 class DictionaryDAOImpl.DictionaryRegistry
           
 
Constructor Summary
DictionaryDAOImpl(NamespaceDAO namespaceDAO)
          Construct
 
Method Summary
 void destroy()
          Destroy the Dictionary & Namespaces
 java.util.List diffModel(M2Model model)
          Return diffs between input model and model in the Dictionary.
 TypeDefinition getAnonymousType(QName type, java.util.Collection aspects)
          Construct an anonymous type that combines a primary type definition and and one or more aspects
 AspectDefinition getAspect(QName aspectName)
          Gets the specified aspect
 java.util.Collection getAspects(QName modelName)
           
 AssociationDefinition getAssociation(QName assocName)
          Gets the specified association
 java.util.Collection getAssociations(QName modelName)
           
 ClassDefinition getClass(QName className)
          Gets the specified class
 CompiledModel getCompiledModel(QName modelName)
           
 ConstraintDefinition getConstraint(QName constraintQName)
          Gets the specified property constraint
 java.util.Collection getConstraints(QName modelName)
           
 java.util.Collection getConstraints(QName modelName, boolean referenceableDefsOnly)
           
 DataTypeDefinition getDataType(java.lang.Class javaClass)
          Gets the data type for the specified Java Class
 DataTypeDefinition getDataType(QName typeName)
          Gets the specified data type
 java.util.Collection getDataTypes(QName modelName)
           
 java.lang.String getDefaultAnalyserResourceBundleName()
           
 ModelDefinition getModel(QName name)
           
 java.util.Collection getModels()
           
 java.util.Collection getNamespaces(QName modelName)
           
 java.util.Collection getProperties(QName modelName)
           
 java.util.Collection getProperties(QName modelName, QName dataType)
          Get all properties for the model and that are of the given data type.
 java.util.Collection getPropertiesOfDataType(QName dataType)
          Get all properties for all models of the given data type.
 PropertyDefinition getProperty(QName propertyName)
          Gets the specified property
 java.lang.ClassLoader getResourceClassLoader()
           
 java.util.Collection getSubAspects(QName superAspect, boolean follow)
           
 java.util.Collection getSubTypes(QName superType, boolean follow)
           
 TypeDefinition getType(QName typeName)
          Gets the specified type
 java.util.Collection getTypes(QName modelName)
           
 void init()
          Initialise the Dictionary & Namespaces
 boolean isModelInherited(QName modelName)
           
 QName putModel(M2Model model)
          Adds a model to the dictionary.
 QName putModelIgnoringConstraints(M2Model model)
          Adds a model to the dictionary.
 QName putModelImpl(M2Model model, boolean enableConstraintClassLoading)
           
 void register(DictionaryListener dictionaryListener)
          Register with the Dictionary
 void removeModel(QName modelName)
          Removes a model from the dictionary.
 void reset()
          Reset the Dictionary & Namespaces
 void setDefaultAnalyserResourceBundleName(java.lang.String defaultAnalyserResourceBundleName)
           
 void setDictionaryRegistryCache(SimpleCache dictionaryRegistryCache)
           
 void setResourceClassLoader(java.lang.ClassLoader resourceClassLoader)
           
 void setTenantService(TenantService tenantService)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictionaryDAOImpl

public DictionaryDAOImpl(NamespaceDAO namespaceDAO)
Construct

Parameters:
namespaceDAO - namespace data access
Method Detail

setTenantService

public void setTenantService(TenantService tenantService)

setDictionaryRegistryCache

public void setDictionaryRegistryCache(SimpleCache dictionaryRegistryCache)

getDefaultAnalyserResourceBundleName

public java.lang.String getDefaultAnalyserResourceBundleName()
Specified by:
getDefaultAnalyserResourceBundleName in interface DictionaryDAO
Returns:

setDefaultAnalyserResourceBundleName

public void setDefaultAnalyserResourceBundleName(java.lang.String defaultAnalyserResourceBundleName)

register

public void register(DictionaryListener dictionaryListener)
Register with the Dictionary

Specified by:
register in interface DictionaryDAO

init

public void init()
Initialise the Dictionary & Namespaces

Specified by:
init in interface DictionaryDAO

destroy

public void destroy()
Destroy the Dictionary & Namespaces

Specified by:
destroy in interface DictionaryDAO

reset

public void reset()
Reset the Dictionary & Namespaces

Specified by:
reset in interface DictionaryDAO

putModel

public QName putModel(M2Model model)
Description copied from interface: DictionaryDAO
Adds a model to the dictionary. The model is compiled and validated.

Specified by:
putModel in interface DictionaryDAO
Parameters:
model - the model to add
Returns:
QName name of model

putModelIgnoringConstraints

public QName putModelIgnoringConstraints(M2Model model)
Description copied from interface: DictionaryDAO
Adds a model to the dictionary. The model is compiled and validated. Constraints are not loaded. This method should only be used to load models where the enforcement of constraints is never required. For example, SOLR read only use of the index where contraints are not required and thier definitions may not be available.

Specified by:
putModelIgnoringConstraints in interface DictionaryDAO
Parameters:
model - the model to add
Returns:
QName name of model

putModelImpl

public QName putModelImpl(M2Model model,
                          boolean enableConstraintClassLoading)

removeModel

public void removeModel(QName modelName)
Description copied from interface: DictionaryDAO
Removes a model from the dictionary. The types and aspect in the model will no longer be available.

Specified by:
removeModel in interface DictionaryDAO
Parameters:
modelName - the qname of the model to remove
See Also:
DictionaryDAO.removeModel(org.alfresco.service.namespace.QName)

getCompiledModel

public CompiledModel getCompiledModel(QName modelName)
Parameters:
modelName - the model name
Returns:
the compiled model of the given name

getDataType

public DataTypeDefinition getDataType(QName typeName)
Gets the specified data type

Parameters:
typeName - name of the data type
Returns:
data type definition

getDataType

public DataTypeDefinition getDataType(java.lang.Class javaClass)
Gets the data type for the specified Java Class

Parameters:
javaClass - the java class
Returns:
the data type definition (or null, if mapping is not available)

getDataTypes

public java.util.Collection getDataTypes(QName modelName)
Specified by:
getDataTypes in interface DictionaryDAO
Parameters:
modelName - the model to retrieve property types for
Returns:
the property types of the model

getType

public TypeDefinition getType(QName typeName)
Gets the specified type

Parameters:
typeName - name of the type
Returns:
type definition

getSubTypes

public java.util.Collection getSubTypes(QName superType,
                                        boolean follow)
Specified by:
getSubTypes in interface DictionaryDAO
follow - true => follow up the super-class hierarchy, false => immediate sub types only
Returns:

getAspect

public AspectDefinition getAspect(QName aspectName)
Gets the specified aspect

Parameters:
aspectName - name of the aspect
Returns:
aspect definition

getSubAspects

public java.util.Collection getSubAspects(QName superAspect,
                                          boolean follow)
Specified by:
getSubAspects in interface DictionaryDAO
follow - true => follow up the super-class hierarchy, false => immediate sub aspects only
Returns:

getClass

public ClassDefinition getClass(QName className)
Gets the specified class

Parameters:
className - name of the class
Returns:
class definition

getProperty

public PropertyDefinition getProperty(QName propertyName)
Gets the specified property

Parameters:
propertyName - name of the property
Returns:
property definition

getConstraint

public ConstraintDefinition getConstraint(QName constraintQName)
Gets the specified property constraint

Parameters:
constraintQName - the qualified name of the property constraint
Returns:

getAssociation

public AssociationDefinition getAssociation(QName assocName)
Gets the specified association

Parameters:
assocName - name of the association
Returns:
association definition

getAssociations

public java.util.Collection getAssociations(QName modelName)
Specified by:
getAssociations in interface DictionaryDAO
Parameters:
modelName - the model to retrieve associations for
Returns:
the associations of the model

getModels

public java.util.Collection getModels()
Specified by:
getModels in interface DictionaryDAO
Returns:
the models known by the dictionary

isModelInherited

public boolean isModelInherited(QName modelName)
Specified by:
isModelInherited in interface DictionaryDAO

getModel

public ModelDefinition getModel(QName name)
Specified by:
getModel in interface DictionaryDAO
Parameters:
name - the model to retrieve
Returns:
the named model definition

getTypes

public java.util.Collection getTypes(QName modelName)
Specified by:
getTypes in interface DictionaryDAO
Parameters:
modelName - the model to retrieve types for
Returns:
the types of the model

getAspects

public java.util.Collection getAspects(QName modelName)
Specified by:
getAspects in interface DictionaryDAO
Parameters:
modelName - the model to retrieve aspects for
Returns:
the aspects of the model

getAnonymousType

public TypeDefinition getAnonymousType(QName type,
                                       java.util.Collection aspects)
Description copied from interface: DictionaryDAO
Construct an anonymous type that combines a primary type definition and and one or more aspects

Specified by:
getAnonymousType in interface DictionaryDAO
Parameters:
type - the primary type
aspects - the aspects to combine
Returns:
the anonymous type definition

getProperties

public java.util.Collection getProperties(QName modelName)
Specified by:
getProperties in interface DictionaryDAO
Parameters:
modelName - the model for which to get properties for
Returns:
the properties of the model

getProperties

public java.util.Collection getProperties(QName modelName,
                                          QName dataType)
Description copied from interface: DictionaryDAO
Get all properties for the model and that are of the given data type. If dataType is null then the all properties will be returned.

Specified by:
getProperties in interface DictionaryDAO
Parameters:
modelName - the name of the model
dataType - null to get all properties
Returns:
the properties associated with the model

getPropertiesOfDataType

public java.util.Collection getPropertiesOfDataType(QName dataType)
Description copied from interface: DictionaryDAO
Get all properties for all models of the given data type.

Specified by:
getPropertiesOfDataType in interface DictionaryDAO
Returns:

getNamespaces

public java.util.Collection getNamespaces(QName modelName)
Specified by:
getNamespaces in interface DictionaryDAO
Returns:
the namespaces of the model

getConstraints

public java.util.Collection getConstraints(QName modelName)
Specified by:
getConstraints in interface DictionaryDAO
Parameters:
modelName - the model to retrieve constraint defs (including property constaint refs)
Returns:
the constraints of the model

getConstraints

public java.util.Collection getConstraints(QName modelName,
                                           boolean referenceableDefsOnly)
Specified by:
getConstraints in interface DictionaryDAO
Parameters:
modelName - the model to retrieve constraint defs (optionally only referenceable constraints)
Returns:
the constraints of the model

diffModel

public java.util.List diffModel(M2Model model)
Return diffs between input model and model in the Dictionary. If the input model does not exist in the Dictionary then no diffs will be returned.

Specified by:
diffModel in interface DictionaryDAO
Parameters:
model -
Returns:
model diffs (if any)

getResourceClassLoader

public java.lang.ClassLoader getResourceClassLoader()
Specified by:
getResourceClassLoader in interface DictionaryDAO
Returns:

setResourceClassLoader

public void setResourceClassLoader(java.lang.ClassLoader resourceClassLoader)
Specified by:
setResourceClassLoader in interface DictionaryDAO


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.