public interface IMappingStrategy
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.Modifier and Type | Interface and Description |
---|---|
static interface |
IMappingStrategy.Props
Contains symbolic constants that specifiy valid keys of
mapping strategy properties . |
Modifier and Type | Field and Description |
---|---|
static String |
PROP_COLUMN_TYPE_MODIFIER
Deprecated.
As of 4.4 use
IMappingStrategy.Props.COLUMN_TYPE_MODIFIER . |
static String |
PROP_FORCE_NAMES_WITH_ID
Deprecated.
As of 4.4 use
IMappingStrategy.Props.FORCE_NAMES_WITH_ID . |
static String |
PROP_MAX_FIELD_NAME_LENGTH
Deprecated.
As of 4.4 use
IMappingStrategy.Props.MAX_FIELD_NAME_LENGTH . |
static String |
PROP_MAX_TABLE_NAME_LENGTH
Deprecated.
As of 4.4 use
IMappingStrategy.Props.MAX_TABLE_NAME_LENGTH . |
static String |
PROP_OBJECT_TYPE_CACHE_SIZE
Deprecated.
As of 4.4 use
IMappingStrategy.Props.OBJECT_TYPE_CACHE_SIZE . |
static String |
PROP_QUALIFIED_NAMES
Deprecated.
As of 4.4 use
IMappingStrategy.Props.QUALIFIED_NAMES . |
static String |
PROP_TABLE_NAME_PREFIX
Deprecated.
As of 4.4 use
IMappingStrategy.Props.TABLE_NAME_PREFIX . |
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
@Deprecated static final String PROP_MAX_TABLE_NAME_LENGTH
IMappingStrategy.Props.MAX_TABLE_NAME_LENGTH
.db adapter
to be used.@Deprecated static final String PROP_MAX_FIELD_NAME_LENGTH
IMappingStrategy.Props.MAX_FIELD_NAME_LENGTH
.db adapter
to be used.@Deprecated static final String PROP_TABLE_NAME_PREFIX
IMappingStrategy.Props.TABLE_NAME_PREFIX
.@Deprecated static final String PROP_QUALIFIED_NAMES
IMappingStrategy.Props.QUALIFIED_NAMES
.@Deprecated static final String PROP_FORCE_NAMES_WITH_ID
IMappingStrategy.Props.FORCE_NAMES_WITH_ID
.@Deprecated static final String PROP_OBJECT_TYPE_CACHE_SIZE
IMappingStrategy.Props.OBJECT_TYPE_CACHE_SIZE
.@Deprecated static final String PROP_COLUMN_TYPE_MODIFIER
IMappingStrategy.Props.COLUMN_TYPE_MODIFIER
.column type modifier
.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
Copyright (c) 2014 Eike Stepper (Berlin, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html