|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The mapping strategy acts as a connection between the DBStore and the database management (and OR-mapping) classes.
The DBStore
uses 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.
Field Summary | |
---|---|
static String |
PROP_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. |
static String |
PROP_MAX_FIELD_NAME_LENGTH
Name of the integer property that configures the maximum length for column names. |
static String |
PROP_MAX_TABLE_NAME_LENGTH
Name of the integer property that configures the maximum length for table names. |
static String |
PROP_OBJECT_TYPE_CACHE_SIZE
Name of the integer property that configures the size of the object type in-memory cache. |
static String |
PROP_QUALIFIED_NAMES
Name of the boolean property that configures whether the table names are made of simple class names or of qualified class names. |
static String |
PROP_TABLE_NAME_PREFIX
Name of the String property that specifies a common prefix for table names. |
Method Summary | |
---|---|
IListMapping |
createListMapping(EClass containingClass,
EStructuralFeature feature)
Factory for value mappings of multi-valued-attributes. |
void |
createMapping(Connection connection,
InternalCDOPackageUnit[] packageUnits,
OMMonitor monitor)
Create and initialize the mapping infrastructure for the given packages. |
ITypeMapping |
createValueMapping(EStructuralFeature feature)
Factory for value mappings of single-valued attributes. |
IClassMapping |
getClassMapping(EClass eClass)
Look up an existing class mapping for the given class. |
Map<EClass,IClassMapping> |
getClassMappings()
Returns all class mappings of this strategy. |
Map<EClass,IClassMapping> |
getClassMappings(boolean createOnDemand)
Returns all class mappings of this strategy. |
String |
getFieldName(EStructuralFeature feature)
Create a suitable column name which can be used to map the given element. |
String |
getListJoin(String attrTable,
String listTable)
|
Map<String,String> |
getProperties()
Returns the configuration properties of this mapping strategy. |
IDBStore |
getStore()
|
String |
getTableName(EClass containingClass,
EStructuralFeature feature)
Create a suitable table name which can be used to map the given element. |
String |
getTableName(ENamedElement element)
Create a suitable table name which can be used to map the given element. |
void |
handleRevisions(IDBStoreAccessor accessor,
EClass eClass,
CDOBranch branch,
long timeStamp,
boolean exactTime,
CDORevisionHandler handler)
Passes all revisions of the store to the handler if all of the following
conditions are met:
The eClass parameter is null or equal to revision.getEClass() . |
boolean |
hasAuditSupport()
Query if this mapping supports audits. |
boolean |
hasBranchingSupport()
Query if this mapping supports branches. |
boolean |
hasDeltaSupport()
Query if this mapping supports revision deltas. |
void |
queryResources(IDBStoreAccessor accessor,
IStoreAccessor.QueryResourcesContext context)
Executes a resource query. |
void |
queryXRefs(IDBStoreAccessor accessor,
IStoreAccessor.QueryXRefsContext context)
Executes a cross reference query. |
void |
rawExport(IDBStoreAccessor accessor,
CDODataOutput out,
int lastReplicatedBranchID,
int lastBranchID,
long lastReplicatedCommitTime,
long lastCommitTime)
|
void |
rawImport(IDBStoreAccessor accessor,
CDODataInput in,
long fromCommitTime,
long toCommitTime,
OMMonitor monitor)
|
Set<CDOID> |
readChangeSet(IDBStoreAccessor accessor,
OMMonitor monitor,
CDOChangeSetSegment[] segments)
Returns a set of CDOIDs that have at least one revision in any of the passed branches and time ranges. |
CloseableIterator<CDOID> |
readObjectIDs(IDBStoreAccessor accessor)
Get an iterator over all instances of objects in the store. |
CDOClassifierRef |
readObjectType(IDBStoreAccessor accessor,
CDOID id)
Read the type (i.e. class) of the object referred to by a given ID. |
void |
removeMapping(Connection connection,
InternalCDOPackageUnit[] packageUnits)
Remove the mapping infrastructure for the given packages. |
void |
repairAfterCrash(IDBAdapter dbAdapter,
Connection connection)
Return the maximum object id used in the store. |
void |
setProperties(Map<String,String> properties)
Set configuration properties for this mapping strategy. |
void |
setStore(IDBStore dbStore)
Set the store to which this MappingStrategy instance belongs. |
Field Detail |
---|
static final String PROP_MAX_TABLE_NAME_LENGTH
db adapter
to be used.
static final String PROP_MAX_FIELD_NAME_LENGTH
db adapter
to be used.
static final String PROP_TABLE_NAME_PREFIX
static final String PROP_QUALIFIED_NAMES
static final String PROP_FORCE_NAMES_WITH_ID
static final String PROP_OBJECT_TYPE_CACHE_SIZE
Method Detail |
---|
IDBStore getStore()
void setStore(IDBStore dbStore)
DBStore
, and
only once to initialize the connection between DBStore
and mapping strategy.
dbStore
- the DBStore instance to which this MappingStrategy instance belongs.ITypeMapping createValueMapping(EStructuralFeature feature)
feature
- the feature for which a mapping should be created. It must hold feature.isMany() == false
.
IListMapping createListMapping(EClass containingClass, EStructuralFeature feature)
containingClass
- the class containing the feature.feature
- the feature for which a mapping should be created. It must hold feature.isMany() == true
.String getTableName(ENamedElement element)
element
- the element for which the name should be created. It must hold:
element instanceof EClass || element instanceof EPackage
.
String getTableName(EClass containingClass, EStructuralFeature feature)
containingClass
- the class containeng the feature.feature
- the feature for which the table name should be created.
String getFieldName(EStructuralFeature feature)
feature
- the feature for which the column name should be created.
void createMapping(Connection connection, InternalCDOPackageUnit[] packageUnits, OMMonitor monitor)
connection
- the connection to use.packageUnits
- the packages whose elements should be mapped.monitor
- the monitor to report progress.void removeMapping(Connection connection, InternalCDOPackageUnit[] packageUnits)
connection
- the connection to use.packageUnits
- the packages for which the mappings should be removedIClassMapping getClassMapping(EClass eClass)
createMapping(Connection, InternalCDOPackageUnit[], OMMonitor)
on its
containing package.
eClass
- the class to look up.
Map<EClass,IClassMapping> getClassMappings()
Map<EClass,IClassMapping> getClassMappings(boolean createOnDemand)
boolean hasDeltaSupport()
true
, it is guaranteed that all class mappings returned by
getClassMapping(EClass)
implement IClassMappingDeltaSupport
.
true
if revision deltas are supported, false
else.boolean hasAuditSupport()
true
, it is guaranteed that all class mappings returned by
getClassMapping(EClass)
implement IClassMappingAuditSupport
.
true
if audits are supported, false
else.boolean hasBranchingSupport()
true
if branches are supported, false
else.void queryResources(IDBStoreAccessor accessor, IStoreAccessor.QueryResourcesContext context)
accessor
- the accessor to use.context
- the context from which the query parameters are read and to which the result is written.void queryXRefs(IDBStoreAccessor accessor, IStoreAccessor.QueryXRefsContext context)
accessor
- the accessor to use.context
- the context from which the query parameters are read and to which the result is written.CDOClassifierRef readObjectType(IDBStoreAccessor accessor, CDOID id)
accessor
- the accessor to use to look up the type.id
- the ID of the object for which the type is to be determined.
CloseableIterator<CDOID> readObjectIDs(IDBStoreAccessor accessor)
accessor
- the accessor to use.
void repairAfterCrash(IDBAdapter dbAdapter, Connection connection)
dbAdapter
- the dbAdapter to use to access the databaseconnection
- the connection to use to access the databaseMap<String,String> getProperties()
void setProperties(Map<String,String> properties)
properties
- the configuration properties to set.void handleRevisions(IDBStoreAccessor accessor, EClass eClass, CDOBranch branch, long timeStamp, boolean exactTime, CDORevisionHandler handler)
handler
if all of the following
conditions are met:
eClass
parameter is null
or equal to revision.getEClass()
.
branch
parameter is null
or equal to revision.getBranch()
.
timeStamp
parameter is CDOBranchPoint.UNSPECIFIED_DATE
or equal to
revision.getTimeStamp()
.
Set<CDOID> readChangeSet(IDBStoreAccessor accessor, OMMonitor monitor, CDOChangeSetSegment[] segments)
IStoreAccessor.readChangeSet(OMMonitor, CDOChangeSetSegment...)
void rawExport(IDBStoreAccessor accessor, CDODataOutput out, int lastReplicatedBranchID, int lastBranchID, long lastReplicatedCommitTime, long lastCommitTime) throws IOException
IOException
void rawImport(IDBStoreAccessor accessor, CDODataInput in, long fromCommitTime, long toCommitTime, OMMonitor monitor) throws IOException
IOException
String getListJoin(String attrTable, String listTable)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |