Interface IMappingStrategy
- 
- All Known Subinterfaces:
- IMappingStrategy2
 
 public interface IMappingStrategyThe mapping strategy acts as a connection between the DBStore and the database management (and OR-mapping) classes. TheDBStoreuses methods of this interface to create and lookup mappings (or mappers, as they could also be named as such) and to get properties and informations about the mappings used. The mapping classes (e.g., instances of IClassMapping and IListMapping) also use this class as a central point of information and as a resource of common functionalities.- Since:
- 2.0
- Author:
- Eike Stepper, Stefan Winkler
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Interface Description static interfaceIMappingStrategy.PropsContains symbolic constants that specifiy valid keys ofmapping strategy properties.
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringPROP_COLUMN_TYPE_MODIFIERDeprecated.As of 4.4 useIMappingStrategy.Props.COLUMN_TYPE_MODIFIER.static java.lang.StringPROP_FORCE_NAMES_WITH_IDDeprecated.As of 4.4 useIMappingStrategy.Props.FORCE_NAMES_WITH_ID.static java.lang.StringPROP_MAX_FIELD_NAME_LENGTHDeprecated.As of 4.4 useIMappingStrategy.Props.MAX_FIELD_NAME_LENGTH.static java.lang.StringPROP_MAX_TABLE_NAME_LENGTHDeprecated.As of 4.4 useIMappingStrategy.Props.MAX_TABLE_NAME_LENGTH.static java.lang.StringPROP_OBJECT_TYPE_CACHE_SIZEDeprecated.As of 4.4 useIMappingStrategy.Props.OBJECT_TYPE_CACHE_SIZE.static java.lang.StringPROP_QUALIFIED_NAMESDeprecated.As of 4.4 useIMappingStrategy.Props.QUALIFIED_NAMES.static java.lang.StringPROP_TABLE_NAME_PREFIXDeprecated.As of 4.4 useIMappingStrategy.Props.TABLE_NAME_PREFIX.
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description IListMappingcreateListMapping(org.eclipse.emf.ecore.EClass containingClass, org.eclipse.emf.ecore.EStructuralFeature feature)Factory for value mappings of multi-valued-attributes.voidcreateMapping(java.sql.Connection connection, InternalCDOPackageUnit[] packageUnits, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)Create and initialize the mapping infrastructure for the given packages.ITypeMappingcreateValueMapping(org.eclipse.emf.ecore.EStructuralFeature feature)Factory for value mappings of single-valued attributes.IClassMappinggetClassMapping(org.eclipse.emf.ecore.EClass eClass)Look up an existing class mapping for the given class.java.util.Map<org.eclipse.emf.ecore.EClass,IClassMapping>getClassMappings()Returns all class mappings of this strategy.java.util.Map<org.eclipse.emf.ecore.EClass,IClassMapping>getClassMappings(boolean createOnDemand)Returns all class mappings of this strategy.java.lang.StringgetFieldName(org.eclipse.emf.ecore.EStructuralFeature feature)Create a suitable column name which can be used to map the given element.java.lang.StringgetListJoin(java.lang.String attrTable, java.lang.String listTable)java.util.Map<java.lang.String,java.lang.String>getProperties()Returns the configuration properties of this mapping strategy.IDBStoregetStore()java.lang.StringgetTableName(org.eclipse.emf.ecore.EClass containingClass, org.eclipse.emf.ecore.EStructuralFeature feature)Create a suitable table name which can be used to map the given element.java.lang.StringgetTableName(org.eclipse.emf.ecore.ENamedElement element)Create a suitable table name which can be used to map the given element.voidhandleRevisions(IDBStoreAccessor accessor, org.eclipse.emf.ecore.EClass eClass, CDOBranch branch, long timeStamp, boolean exactTime, CDORevisionHandler handler)Passes all revisions of the store to thehandlerif all of the following conditions are met: TheeClassparameter isnullor equal torevision.getEClass().booleanhasAuditSupport()Query if this mapping supports audits.booleanhasBranchingSupport()Query if this mapping supports branches.booleanhasDeltaSupport()Query if this mapping supports revision deltas.voidqueryResources(IDBStoreAccessor accessor, IStoreAccessor.QueryResourcesContext context)Executes a resource query.voidqueryXRefs(IDBStoreAccessor accessor, IStoreAccessor.QueryXRefsContext context)Executes a cross reference query.voidrawExport(IDBStoreAccessor accessor, CDODataOutput out, int lastReplicatedBranchID, int lastBranchID, long lastReplicatedCommitTime, long lastCommitTime)voidrawImport(IDBStoreAccessor accessor, CDODataInput in, long fromCommitTime, long toCommitTime, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)java.util.Set<CDOID>readChangeSet(IDBStoreAccessor accessor, org.eclipse.net4j.util.om.monitor.OMMonitor monitor, CDOChangeSetSegment[] segments)Returns a set of CDOIDs that have at least one revision in any of the passed branches and time ranges.org.eclipse.net4j.util.collection.CloseableIterator<CDOID>readObjectIDs(IDBStoreAccessor accessor)Get an iterator over all instances of objects in the store.CDOClassifierRefreadObjectType(IDBStoreAccessor accessor, CDOID id)Read the type (i.e.voidremoveMapping(java.sql.Connection connection, InternalCDOPackageUnit[] packageUnits)Remove the mapping infrastructure for the given packages.voidrepairAfterCrash(org.eclipse.net4j.db.IDBAdapter dbAdapter, java.sql.Connection connection)Return the maximum object id used in the store.voidsetProperties(java.util.Map<java.lang.String,java.lang.String> properties)Set configuration properties for this mapping strategy.voidsetStore(IDBStore dbStore)Set the store to which this MappingStrategy instance belongs.
 
- 
- 
- 
Field Detail- 
PROP_MAX_TABLE_NAME_LENGTH@Deprecated static final java.lang.String PROP_MAX_TABLE_NAME_LENGTH Deprecated.As of 4.4 useIMappingStrategy.Props.MAX_TABLE_NAME_LENGTH.Name of the integer property that configures the maximum length for table names. A value of zero indicates the value of thedb adapterto be used.- See Also:
- Constant Field Values
 
 - 
PROP_MAX_FIELD_NAME_LENGTH@Deprecated static final java.lang.String PROP_MAX_FIELD_NAME_LENGTH Deprecated.As of 4.4 useIMappingStrategy.Props.MAX_FIELD_NAME_LENGTH.Name of the integer property that configures the maximum length for column names. A value of zero indicates the value of thedb adapterto be used.- See Also:
- Constant Field Values
 
 - 
PROP_TABLE_NAME_PREFIX@Deprecated static final java.lang.String PROP_TABLE_NAME_PREFIX Deprecated.As of 4.4 useIMappingStrategy.Props.TABLE_NAME_PREFIX.Name of the String property that specifies a common prefix for table names.- See Also:
- Constant Field Values
 
 - 
PROP_QUALIFIED_NAMES@Deprecated static final java.lang.String PROP_QUALIFIED_NAMES Deprecated.As of 4.4 useIMappingStrategy.Props.QUALIFIED_NAMES.Name of the boolean property that configures whether the table names are made of simple class names or of qualified class names.- See Also:
- Constant Field Values
 
 - 
PROP_FORCE_NAMES_WITH_ID@Deprecated static final java.lang.String PROP_FORCE_NAMES_WITH_ID Deprecated.As of 4.4 useIMappingStrategy.Props.FORCE_NAMES_WITH_ID.Name of the boolean property that configures whether table names and column names are always suffixed with the internal DBID or only in cases where generated names violate the naming constraints of the underlying backend.- See Also:
- Constant Field Values
 
 - 
PROP_OBJECT_TYPE_CACHE_SIZE@Deprecated static final java.lang.String PROP_OBJECT_TYPE_CACHE_SIZE Deprecated.As of 4.4 useIMappingStrategy.Props.OBJECT_TYPE_CACHE_SIZE.Name of the integer property that configures the size of the object type in-memory cache. Possible configuration values are:- 0 (zero). Don't use memory caching.
- >0. Use memory caching with the cache size given.
 - Since:
- 4.0
- See Also:
- Constant Field Values
 
 - 
PROP_COLUMN_TYPE_MODIFIER@Deprecated static final java.lang.String PROP_COLUMN_TYPE_MODIFIER Deprecated.As of 4.4 useIMappingStrategy.Props.COLUMN_TYPE_MODIFIER.Name of a String property that specifies the name of acolumn type modifier.- Since:
- 4.2
- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
getStoreIDBStore getStore() - Returns:
- the store, this MappingStrategy instance belongs to.
 
 - 
setStorevoid setStore(IDBStore dbStore) Set the store to which this MappingStrategy instance belongs. Should only be called by theDBStore, and only once to initialize the connection betweenDBStoreand mapping strategy.- Parameters:
- dbStore- the DBStore instance to which this MappingStrategy instance belongs.
 
 - 
createValueMappingITypeMapping createValueMapping(org.eclipse.emf.ecore.EStructuralFeature feature) Factory for value mappings of single-valued attributes.- Parameters:
- feature- the feature for which a mapping should be created. It must hold- feature.isMany() == false.
- Returns:
- the mapping created.
 
 - 
createListMappingIListMapping createListMapping(org.eclipse.emf.ecore.EClass containingClass, org.eclipse.emf.ecore.EStructuralFeature feature) Factory for value mappings of multi-valued-attributes.- Parameters:
- containingClass- the class containing the feature.
- feature- the feature for which a mapping should be created. It must hold- feature.isMany() == true.
 
 - 
getTableNamejava.lang.String getTableName(org.eclipse.emf.ecore.ENamedElement element) Create a suitable table name which can be used to map the given element. Should only be called by mapping classes.- Parameters:
- element- the element for which the name should be created. It must hold:- element instanceof EClass || element instanceof EPackage.
- Returns:
- the created table name. It is guaranteed that the table name is compatible with the chosen database.
 
 - 
getTableNamejava.lang.String getTableName(org.eclipse.emf.ecore.EClass containingClass, org.eclipse.emf.ecore.EStructuralFeature feature)Create a suitable table name which can be used to map the given element. Should only be called by mapping classes. Should only be called by mapping classes.- Parameters:
- containingClass- the class containeng the feature.
- feature- the feature for which the table name should be created.
- Returns:
- the created table name. It is guaranteed that the table name is compatible with the chosen database.
 
 - 
getFieldNamejava.lang.String getFieldName(org.eclipse.emf.ecore.EStructuralFeature feature) Create a suitable column name which can be used to map the given element. Should only be called by mapping classes.- Parameters:
- feature- the feature for which the column name should be created.
- Returns:
- the created column name. It is guaranteed that the name is compatible with the chosen database.
 
 - 
createMappingvoid createMapping(java.sql.Connection connection, InternalCDOPackageUnit[] packageUnits, org.eclipse.net4j.util.om.monitor.OMMonitor monitor)Create and initialize the mapping infrastructure for the given packages. Should be called from the DBStore or the DBStoreAccessor.- Parameters:
- connection- the connection to use.
- packageUnits- the packages whose elements should be mapped.
- monitor- the monitor to report progress.
 
 - 
removeMappingvoid removeMapping(java.sql.Connection connection, InternalCDOPackageUnit[] packageUnits)Remove the mapping infrastructure for the given packages. Should be called from the DBStore or the DBStoreAccessor.- Parameters:
- connection- the connection to use.
- packageUnits- the packages for which the mappings should be removed
- Since:
- 4.0
 
 - 
getClassMappingIClassMapping getClassMapping(org.eclipse.emf.ecore.EClass eClass) Look up an existing class mapping for the given class. Before this method is called, the class mapping must have been initialized by callingcreateMapping(Connection, InternalCDOPackageUnit[], OMMonitor)on its containing package.- Parameters:
- eClass- the class to look up.
- Returns:
- the class mapping.
 
 - 
getClassMappingsjava.util.Map<org.eclipse.emf.ecore.EClass,IClassMapping> getClassMappings() Returns all class mappings of this strategy.- Since:
- 4.0
 
 - 
getClassMappingsjava.util.Map<org.eclipse.emf.ecore.EClass,IClassMapping> getClassMappings(boolean createOnDemand) Returns all class mappings of this strategy.- Since:
- 4.0
 
 - 
hasDeltaSupportboolean hasDeltaSupport() Query if this mapping supports revision deltas.
 If this method returnstrue, it is guaranteed that all class mappings returned bygetClassMapping(EClass)implementIClassMappingDeltaSupport.- Returns:
- trueif revision deltas are supported,- falseelse.
 
 - 
hasAuditSupportboolean hasAuditSupport() Query if this mapping supports audits.
 If this method returnstrue, it is guaranteed that all class mappings returned bygetClassMapping(EClass)implementIClassMappingAuditSupport.- Returns:
- trueif audits are supported,- falseelse.
 
 - 
hasBranchingSupportboolean hasBranchingSupport() Query if this mapping supports branches.- Returns:
- trueif branches are supported,- falseelse.
- Since:
- 3.0
 
 - 
queryResourcesvoid queryResources(IDBStoreAccessor accessor, IStoreAccessor.QueryResourcesContext context) Executes a resource query.- Parameters:
- accessor- the accessor to use.
- context- the context from which the query parameters are read and to which the result is written.
 
 - 
queryXRefsvoid queryXRefs(IDBStoreAccessor accessor, IStoreAccessor.QueryXRefsContext context) Executes a cross reference query.- Parameters:
- accessor- the accessor to use.
- context- the context from which the query parameters are read and to which the result is written.
- Since:
- 3.0
 
 - 
readObjectTypeCDOClassifierRef readObjectType(IDBStoreAccessor accessor, CDOID id) Read the type (i.e. class) of the object referred to by a given ID.- Parameters:
- accessor- the accessor to use to look up the type.
- id- the ID of the object for which the type is to be determined.
- Returns:
- the type of the object.
 
 - 
readObjectIDsorg.eclipse.net4j.util.collection.CloseableIterator<CDOID> readObjectIDs(IDBStoreAccessor accessor) Get an iterator over all instances of objects in the store.- Parameters:
- accessor- the accessor to use.
- Returns:
- the iterator.
 
 - 
repairAfterCrashvoid repairAfterCrash(org.eclipse.net4j.db.IDBAdapter dbAdapter, java.sql.Connection connection)Return the maximum object id used in the store. This is used by the DBStore if a previous crash is discovered during the startup process. Should only be called by the DBStore and only during startup.- Parameters:
- dbAdapter- the dbAdapter to use to access the database
- connection- the connection to use to access the database
- Since:
- 4.0
 
 - 
getPropertiesjava.util.Map<java.lang.String,java.lang.String> getProperties() Returns the configuration properties of this mapping strategy.- Since:
- 4.0
 
 - 
setPropertiesvoid setProperties(java.util.Map<java.lang.String,java.lang.String> properties) Set configuration properties for this mapping strategy. Should only be called by the factory creating the mapping strategy instance.- Parameters:
- properties- the configuration properties to set.
 
 - 
handleRevisionsvoid handleRevisions(IDBStoreAccessor accessor, org.eclipse.emf.ecore.EClass eClass, CDOBranch branch, long timeStamp, boolean exactTime, CDORevisionHandler handler) Passes all revisions of the store to thehandlerif all of the following conditions are met:- The eClassparameter isnullor equal torevision.getEClass().
- The branchparameter isnullor equal torevision.getBranch().
- The timeStampparameter isCDOBranchPoint.UNSPECIFIED_DATEor equal torevision.getTimeStamp().
 - Since:
- 4.0
 
- The 
 - 
readChangeSetjava.util.Set<CDOID> readChangeSet(IDBStoreAccessor accessor, org.eclipse.net4j.util.om.monitor.OMMonitor monitor, CDOChangeSetSegment[] segments) Returns a set of CDOIDs that have at least one revision in any of the passed branches and time ranges. DetachedCDORevisions must also be considered!- Since:
- 4.0
- See Also:
- IStoreAccessor.readChangeSet(OMMonitor, CDOChangeSetSegment...)
 
 - 
rawExportvoid rawExport(IDBStoreAccessor accessor, CDODataOutput out, int lastReplicatedBranchID, int lastBranchID, long lastReplicatedCommitTime, long lastCommitTime) throws java.io.IOException - Throws:
- java.io.IOException
- Since:
- 3.0
 
 - 
rawImportvoid rawImport(IDBStoreAccessor accessor, CDODataInput in, long fromCommitTime, long toCommitTime, org.eclipse.net4j.util.om.monitor.OMMonitor monitor) throws java.io.IOException - Throws:
- java.io.IOException
- Since:
- 4.0
 
 - 
getListJoinjava.lang.String getListJoin(java.lang.String attrTable, java.lang.String listTable)- Since:
- 4.0
 
 
- 
 
-