public class ReadOnlyHBaseStore extends DirectWriteHBaseStore
DirectWriteHBaseStore
that only allows read operations on the underlying database.
Read-only configuration allows to access model element faster, without checking value consistency
between database calls. This store re-implements all the mutators and throws an
UnsupportedOperationException
when they are called, preventing resource corruption.
* 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.
DEFAULT_CACHE_SIZE, PROPERTY_FAMILY, table
backend
NO_INDEX
Constructor and Description |
---|
ReadOnlyHBaseStore(Resource.Internal resource)
Constructs a new
ReadOnlyHBaseStore on the given resource . |
Modifier and Type | Method and Description |
---|---|
void |
add(InternalEObject internalObject,
EStructuralFeature feature,
int index,
Object value)
Adds the value at the index in the
content of the object's feature. |
void |
clear(InternalEObject internalObject,
EStructuralFeature feature)
Removes all values form the
content of the object's feature |
protected Object |
getFromTable(PersistentEObject object,
EStructuralFeature feature)
|
protected Table |
initTable(Connection connection,
TableName tableName,
Admin admin)
Checks that the provided
tableName corresponds to an existing HBase table and opens it. |
Object |
move(InternalEObject internalObject,
EStructuralFeature feature,
int targetIndex,
int sourceIndex)
Moves the value at the source index in the
content of the object's feature
to the target index. |
Object |
remove(InternalEObject internalObject,
EStructuralFeature feature,
int index)
Removes the value at the index in the
content of the object's feature. |
Object |
set(InternalEObject internalObject,
EStructuralFeature feature,
int index,
Object value)
Sets the value at the index in the
content of the object's feature. |
void |
unset(InternalEObject internalObject,
EStructuralFeature feature)
Unsets the feature of the object.
|
protected void |
updateContainment(PersistentEObject object,
EReference reference,
PersistentEObject referencedObject)
Add
referencedObject in the reference containment list of object . |
protected void |
updateInstanceOf(PersistentEObject object)
Computes
object 's metaclass information and persists them in the database. |
addAttribute, addReference, contains, eObject, getAttribute, getContainer, getContainingFeature, getReference, indexOf, isSet, lastIndexOf, removeAttribute, removeReference, save, setAttribute, setReference, size
clearAttribute, clearReference, containsAttribute, containsReference, create, get, hashCode, indexOfAttribute, indexOfReference, isEmpty, isSetAttribute, isSetReference, lastIndexOfAttribute, lastIndexOfReference, parseProperty, resource, serializeToProperty, toArray, toArray, unsetAttribute, unsetReference
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllInstances
public ReadOnlyHBaseStore(Resource.Internal resource) throws IOException
ReadOnlyHBaseStore
on the given resource
.resource
- the resource to persist and accessIOException
- if the HBase server cannot be foundprotected Table initTable(Connection connection, TableName tableName, Admin admin) throws IOException
tableName
corresponds to an existing HBase table and opens it.
Read-only mode is only available for existing databases.
initTable
in class DirectWriteHBaseStore
connection
- the connection to the HBase servertableName
- the name of the table to access on the serveradmin
- the administrator client of the HBase serverIOException
- if the HBase server cannot be found or if tableName
does not reference an existing
tableprotected void updateContainment(PersistentEObject object, EReference reference, PersistentEObject referencedObject)
DirectWriteHBaseStore
referencedObject
in the reference
containment list of object
. Inverse container
feature between referencedObject
and object
is also updated.updateContainment
in class DirectWriteHBaseStore
object
- the container elementreference
- the containment EReference
referencedObject
- the element to add to object
's containment listUnsupportedOperationException
- operation not supported in read-only modeprotected void updateInstanceOf(PersistentEObject object)
DirectWriteHBaseStore
object
's metaclass information and persists them in the database.updateInstanceOf
in class DirectWriteHBaseStore
object
- the PersistentEObject
to persist the metaclass ofUnsupportedOperationException
- operation not supported in read-only modeprotected Object getFromTable(PersistentEObject object, EStructuralFeature feature)
getFromTable
in class DirectWriteHBaseStore
object
- the source elementfeature
- the EStructuralFeature
to get the value offeature
. It can be a String
for single-valued EStructuralFeature
s or a String
[] for many-valued EStructuralFeature
spublic void unset(InternalEObject internalObject, EStructuralFeature feature)
AbstractDirectWriteStore
By default, calls the associated methods depending on the type of the feature
.
unset
in interface InternalEObject.EStore
unset
in class DirectWriteHBaseStore
internalObject
- the object in question.feature
- a feature of the object.UnsupportedOperationException
- operation not supported in read-only modeAbstractDirectWriteStore.unsetAttribute(PersistentEObject, EAttribute)
,
AbstractDirectWriteStore.unsetReference(PersistentEObject, EReference)
public void clear(InternalEObject internalObject, EStructuralFeature feature)
AbstractDirectWriteStore
content
of the object's feature
By default, calls the associated methods depending on the type of the feature
.
clear
in interface InternalEObject.EStore
clear
in class DirectWriteHBaseStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.UnsupportedOperationException
- operation not supported in read-only modeAbstractDirectWriteStore.clearAttribute(PersistentEObject, EAttribute)
,
AbstractDirectWriteStore.clearReference(PersistentEObject, EReference)
public Object set(InternalEObject internalObject, EStructuralFeature feature, int index, Object value)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
set
in interface InternalEObject.EStore
set
in class AbstractDirectWriteStore<HBasePersistenceBackend>
internalObject
- the object in question.feature
- a feature of the object.index
- an index within the content or InternalEObject.EStore.NO_INDEX
.value
- the new value.UnsupportedOperationException
- operation not supported in read-only modeAbstractDirectWriteStore.setAttribute(PersistentEObject, EAttribute, int, Object)
,
AbstractDirectWriteStore.setReference(PersistentEObject, EReference, int, PersistentEObject)
public void add(InternalEObject internalObject, EStructuralFeature feature, int index, Object value)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
add
in interface InternalEObject.EStore
add
in class AbstractDirectWriteStore<HBasePersistenceBackend>
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- an index within the content.value
- the value to add.UnsupportedOperationException
- operation not supported in read-only modeAbstractDirectWriteStore.addAttribute(PersistentEObject, EAttribute, int, Object)
,
AbstractDirectWriteStore.addReference(PersistentEObject, EReference, int, PersistentEObject)
public Object remove(InternalEObject internalObject, EStructuralFeature feature, int index)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
remove
in interface InternalEObject.EStore
remove
in class AbstractDirectWriteStore<HBasePersistenceBackend>
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- the index within the feature's content of the value to remove.UnsupportedOperationException
- operation not supported in read-only modeAbstractDirectWriteStore.removeAttribute(PersistentEObject, EAttribute, int)
,
AbstractDirectWriteStore.removeReference(PersistentEObject, EReference, int)
public Object move(InternalEObject internalObject, EStructuralFeature feature, int targetIndex, int sourceIndex)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature
to the target index.move
in interface InternalEObject.EStore
move
in class AbstractDirectWriteStore<HBasePersistenceBackend>
internalObject
- the object in question.feature
- a many-valued
feature of the object.targetIndex
- the index within the feature's content to which to move the value.sourceIndex
- the index within the feature's content of the value to move.UnsupportedOperationException
- operation not supported in read-only modeCopyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.