public class DirectWriteBlueprintsStore extends AbstractDirectWriteStore<BlueprintsPersistenceBackend>
DirectWriteStore that translates model-level operations to Blueprints calls.
This class implements the PersistentStore interface that defines a set of operations to implement in order to
allow EMF persistence delegation. If this store is used, every method call and property access on PersistentEObject is forwarded to this class, that takes care of the database serialization and deserialization
using its embedded BlueprintsPersistenceBackend.
This store can be used as a base store that can be complemented by plugging decorator stores on top of it (see AbstractPersistentStoreDecorator subclasses) to provide additional features such as caching or logging.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
CONTAINER
The label used to define container
Edges. |
protected static String |
CONTAINING_FEATURE
The property key used to define the opposite containing feature in container
Edges. |
protected static String |
CONTENTS
The label used to link root vertex to top-level elements.
|
protected static String |
POSITION
The property key used to define the index of an edge.
|
protected static String |
SEPARATOR
The string used as a separator between values of multi-valued attributes.
|
protected static String |
SIZE_LITERAL
The property key used to define the number of edges with a specific label.
|
backendNO_INDEX| Constructor and Description |
|---|
DirectWriteBlueprintsStore(Resource.Internal resource,
BlueprintsPersistenceBackend backend)
Constructs a new
DirectWriteBlueprintsStore between the given resource and the
backend. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAttribute(PersistentEObject object,
EAttribute attribute,
int index,
Object value)
Adds the
value at the index in the content of the attribute of the object. |
protected void |
addReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Adds the
value at the index in the content of the reference of the object. |
protected void |
clearAttribute(PersistentEObject object,
EAttribute attribute)
Removes all values form the content of the
attribute of the object. |
protected void |
clearReference(PersistentEObject object,
EReference reference)
Removes all values form the content of the
reference of the object. |
protected boolean |
containsAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns whether the content of the
attribute of the object contains the given value. |
protected boolean |
containsReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns whether the content of the
reference of the object contains the given value. |
EObject |
eObject(Id id)
Search in the database the
Vertex corresponding to the given id and reifies it. |
EList<EObject> |
getAllInstances(EClass eClass,
boolean strict)
Computes efficiently
allInstances operation by using underlying graph facilities. |
protected Object |
getAttribute(PersistentEObject object,
EAttribute attribute,
int index)
Returns the value at the
index in the content of the attribute of the object. |
InternalEObject |
getContainer(InternalEObject internalObject)
Returns the object's
container. |
EStructuralFeature |
getContainingFeature(InternalEObject internalObject)
Returns the object's
containing feature. |
protected Object |
getReference(PersistentEObject object,
EReference reference,
int index)
Returns the value at the
index in the content of the reference of the object. |
protected Integer |
getSize(Vertex vertex,
EStructuralFeature feature)
Finds the number of elements contained in the given
feature. |
protected int |
indexOfAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns the first index of the given
value in the content of the attribute of the object. |
protected int |
indexOfReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns the first index of the given
value in the content of the reference of the object. |
protected boolean |
isSetAttribute(PersistentEObject object,
EAttribute attribute)
Returns whether the
attribute of the object is considered set. |
protected boolean |
isSetReference(PersistentEObject object,
EReference reference)
Returns whether the
reference of the object is considered set. |
protected int |
lastIndexOfAttribute(PersistentEObject object,
EAttribute attribute,
Object value)
Returns the last index of the given
value in the content of the attribute of the object. |
protected int |
lastIndexOfReference(PersistentEObject object,
EReference reference,
PersistentEObject value)
Returns the last index of the given
value in the content of the reference of the object. |
protected InternalEObject |
reifyVertex(Vertex vertex)
Creates an
InternalEObject from the given vertex. |
protected InternalEObject |
reifyVertex(Vertex vertex,
EClass eClass)
|
protected Object |
removeAttribute(PersistentEObject object,
EAttribute attribute,
int index)
Removes the value at the
index in the content of the attribute of the object. |
protected Object |
removeReference(PersistentEObject object,
EReference reference,
int index)
Removes the value at the
index in the content of the reference of the object. |
protected Object |
setAttribute(PersistentEObject object,
EAttribute attribute,
int index,
Object value)
Sets the value at the
index in the content of the attribute of the object. |
protected Object |
setReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Sets the value at the
index in the content of the reference of the object. |
int |
size(InternalEObject internalObject,
EStructuralFeature feature)
Returns the number of values in the
content of the object's feature. |
protected void |
unsetAttribute(PersistentEObject object,
EAttribute attribute)
Unsets the
attribute of the object. |
protected void |
unsetReference(PersistentEObject object,
EReference reference)
Unsets the
reference of the object. |
protected static final String SEPARATOR
protected static final String POSITION
protected static final String CONTAINER
Edges.protected static final String CONTENTS
protected static final String CONTAINING_FEATURE
Edges.protected static final String SIZE_LITERAL
public DirectWriteBlueprintsStore(Resource.Internal resource, BlueprintsPersistenceBackend backend)
DirectWriteBlueprintsStore between the given resource and the
backend.resource - the resource to persist and accessbackend - the persistence back-end used to store the modelprotected Object getAttribute(PersistentEObject object, EAttribute attribute, int index)
AbstractDirectWriteStoreindex in the content of the attribute of the object.getAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - an attribute of the objectindex - an index within the content or PersistentStore.NO_INDEXAbstractDirectWriteStore.get(InternalEObject, EStructuralFeature, int)protected Object getReference(PersistentEObject object, EReference reference, int index)
AbstractDirectWriteStoreindex in the content of the reference of the object.getReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a reference of the objectindex - an index within the content or PersistentStore.NO_INDEXAbstractDirectWriteStore.get(InternalEObject, EStructuralFeature, int)protected Object setAttribute(PersistentEObject object, EAttribute attribute, int index, Object value)
AbstractDirectWriteStoreindex in the content of the attribute of the object.setAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - an attribute of the objectindex - an index within the content or PersistentStore.NO_INDEXvalue - the new valueAbstractDirectWriteStore.set(InternalEObject, EStructuralFeature, int, Object)protected Object setReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
AbstractDirectWriteStoreindex in the content of the reference of the object.setReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a reference of the objectindex - an index within the content or PersistentStore.NO_INDEXvalue - the new valueAbstractDirectWriteStore.set(InternalEObject, EStructuralFeature, int, Object)protected boolean isSetAttribute(PersistentEObject object, EAttribute attribute)
AbstractDirectWriteStoreattribute of the object is considered set.isSetAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - an attribute of the objecttrue if the attribute is considered setAbstractDirectWriteStore.isSet(InternalEObject, EStructuralFeature)protected boolean isSetReference(PersistentEObject object, EReference reference)
AbstractDirectWriteStorereference of the object is considered set.isSetReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a reference of the objecttrue if the reference is considered setAbstractDirectWriteStore.isSet(InternalEObject, EStructuralFeature)protected void unsetAttribute(PersistentEObject object, EAttribute attribute)
AbstractDirectWriteStoreattribute of the object.unsetAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - an attribute of the objectAbstractDirectWriteStore.unset(InternalEObject, EStructuralFeature)protected void unsetReference(PersistentEObject object, EReference reference)
AbstractDirectWriteStorereference of the object.unsetReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a reference of the objectAbstractDirectWriteStore.unset(InternalEObject, EStructuralFeature)protected boolean containsAttribute(PersistentEObject object, EAttribute attribute, Object value)
AbstractDirectWriteStoreattribute of the object contains the given value.containsAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectvalue - the value to look fortrue if the attribute contains the given valueAbstractDirectWriteStore.contains(InternalEObject, EStructuralFeature, Object)protected boolean containsReference(PersistentEObject object, EReference reference, PersistentEObject value)
AbstractDirectWriteStorereference of the object contains the given value.containsReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectvalue - the value to look fortrue if the reference contains the given valueAbstractDirectWriteStore.contains(InternalEObject, EStructuralFeature, Object)protected int indexOfAttribute(PersistentEObject object, EAttribute attribute, Object value)
AbstractDirectWriteStorevalue in the content of the attribute of the object.indexOfAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectvalue - the value to look forPersistentStore.NO_INDEX if it is not foundAbstractDirectWriteStore.indexOf(InternalEObject, EStructuralFeature, Object)protected int indexOfReference(PersistentEObject object, EReference reference, PersistentEObject value)
AbstractDirectWriteStorevalue in the content of the reference of the object.indexOfReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectvalue - the value to look forPersistentStore.NO_INDEX if it is not foundAbstractDirectWriteStore.indexOf(InternalEObject, EStructuralFeature, Object)protected int lastIndexOfAttribute(PersistentEObject object, EAttribute attribute, Object value)
AbstractDirectWriteStorevalue in the content of the attribute of the object.lastIndexOfAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectvalue - the value to look forPersistentStore.NO_INDEX if it is not foundAbstractDirectWriteStore.lastIndexOf(InternalEObject, EStructuralFeature, Object)protected int lastIndexOfReference(PersistentEObject object, EReference reference, PersistentEObject value)
AbstractDirectWriteStorevalue in the content of the reference of the object.lastIndexOfReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectvalue - the value to look forPersistentStore.NO_INDEX if it is notAbstractDirectWriteStore.lastIndexOf(InternalEObject, EStructuralFeature, Object)protected void addAttribute(PersistentEObject object, EAttribute attribute, int index, Object value)
AbstractDirectWriteStorevalue at the index in the content of the attribute of the object.addAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectindex - an index within the contentvalue - the value to addAbstractDirectWriteStore.add(InternalEObject, EStructuralFeature, int, Object)protected void addReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
AbstractDirectWriteStorevalue at the index in the content of the reference of the object.addReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectindex - an index within the contentvalue - the value to addAbstractDirectWriteStore.add(InternalEObject, EStructuralFeature, int, Object)protected Object removeAttribute(PersistentEObject object, EAttribute attribute, int index)
AbstractDirectWriteStoreindex in the content of the attribute of the object.removeAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectindex - the index within the content of the value to removeAbstractDirectWriteStore.remove(InternalEObject, EStructuralFeature, int)protected Object removeReference(PersistentEObject object, EReference reference, int index)
AbstractDirectWriteStoreindex in the content of the reference of the object.removeReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectindex - the index within the content of the value to removeAbstractDirectWriteStore.remove(InternalEObject, EStructuralFeature, int)protected void clearAttribute(PersistentEObject object, EAttribute attribute)
AbstractDirectWriteStoreattribute of the object.clearAttribute in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectattribute - a many-valued attribute of the objectAbstractDirectWriteStore.clear(InternalEObject, EStructuralFeature)protected void clearReference(PersistentEObject object, EReference reference)
AbstractDirectWriteStorereference of the object.clearReference in class AbstractDirectWriteStore<BlueprintsPersistenceBackend>object - the objectreference - a many-valued reference of the objectAbstractDirectWriteStore.clear(InternalEObject, EStructuralFeature)public int size(InternalEObject internalObject, EStructuralFeature feature)
org.eclipse.emf.ecore.InternalEObject.EStorecontent of the object's feature.internalObject - the object in question.feature - a many-valued feature of the object.public InternalEObject getContainer(InternalEObject internalObject)
org.eclipse.emf.ecore.InternalEObject.EStorecontainer.EObject.eContainer()public EStructuralFeature getContainingFeature(InternalEObject internalObject)
org.eclipse.emf.ecore.InternalEObject.EStorecontaining feature.EObject.eContainingFeature()protected Integer getSize(Vertex vertex, EStructuralFeature feature)
feature.vertex - the input Vertex of the featurefeature - the EStructuralFeature describing the feature to accessfeature if it is multi-valued, 0 otherwiseprotected InternalEObject reifyVertex(Vertex vertex)
InternalEObject from the given vertex.vertex - the Vertex to reifyInternalEObject built from the provided VertexreifyVertex(Vertex, EClass)protected InternalEObject reifyVertex(Vertex vertex, EClass eClass)
InternalEObject from the given vertex, and sets its EClass with the given
EClass.
This method speeds-up the reification for objects with a known EClass by avoiding unnecessary database
accesses.
vertex - the Vertex to reifyeClass - the EClass representing the type of the element to createInternalEObject build from the provided Vertexpublic EObject eObject(Id id)
Vertex corresponding to the given id and reifies it.public EList<EObject> getAllInstances(EClass eClass, boolean strict)
allInstances operation by using underlying graph facilities. This method uses
database indices to avoid costly traversal of the entire model.eClass - the EClass to get the instances ofstrict - set to true if the method should look for instances of eClass only, set to false if the method should also return elements that are subclasses of eClassEList containing all the EObjects that are instances of the given EClassCopyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.