Skip to content

Commit

Permalink
Class rename.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerson Sunyé committed Jan 29, 2017
1 parent dbf8852 commit 3d0644d
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public Resource createResource(File file, ResourceSet resourceSet) throws Except
@Override
public Map<String, Object> getOptions() {
return BerkeleyDbOptionsBuilder.newBuilder()
.directWrite()
.directWriteIndices()
.autocommit()
.asMap();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import fr.inria.atlanmod.neoemf.annotations.Experimental;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.CachedMapStore;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteCachedMapStore;
import org.eclipse.emf.ecore.resource.Resource;

/**
* ???
*/
@Experimental
public class DirectWriteBerkeleyDbCacheManyStore extends CachedMapStore<MapBackend> {
public class DirectWriteBerkeleyDbCacheManyStore extends DirectWriteCachedMapStore<MapBackend> {

/**
* Constructs a new {@code DirectWriteBerkeleyDbCacheManyStore} between the given {@code resource} and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import fr.inria.atlanmod.neoemf.annotations.Experimental;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.MapStoreWithIndices;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteMapStoreWithIndices;
import org.eclipse.emf.ecore.resource.Resource;

/**
* ???
*/
@Experimental
public class DirectWriteBerkeleyDbIndicesStore extends MapStoreWithIndices<MapBackend> {
public class DirectWriteBerkeleyDbIndicesStore extends DirectWriteMapStoreWithIndices<MapBackend> {

/**
* Constructs a new {@code DirectWriteBerkeleyDbIndicesStore} between the given {@code resource} and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import fr.inria.atlanmod.neoemf.annotations.Experimental;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.MapStoreWithLists;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteMapStoreWithLists;
import org.eclipse.emf.ecore.resource.Resource;

/**
* ???
*/
@Experimental
public class DirectWriteBerkeleyDbListsStore extends MapStoreWithLists<MapBackend> {
public class DirectWriteBerkeleyDbListsStore extends DirectWriteMapStoreWithLists<MapBackend> {

/**
* Constructs a new {@code DirectWriteBerkeleyDbListsStore} between the given {@code resource} and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@

import fr.inria.atlanmod.neoemf.annotations.Experimental;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.MapStore;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteMapStore;
import org.eclipse.emf.ecore.resource.Resource;

/**
* ???
*/
@Experimental
public class DirectWriteBerkeleyDbStore extends MapStore<MapBackend> {
public class DirectWriteBerkeleyDbStore extends DirectWriteMapStore<MapBackend> {

/**
* Constructs a new {@code DirectWriteBerkeleyDbStore} between the given {@code resource} and the {@code backend}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@
import fr.inria.atlanmod.neoemf.annotations.VisibleForTesting;
import fr.inria.atlanmod.neoemf.core.Id;
import fr.inria.atlanmod.neoemf.data.PersistenceBackend;
import fr.inria.atlanmod.neoemf.data.store.DirectWriteStore;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteMapStore;
import fr.inria.atlanmod.neoemf.data.structure.ClassInfo;
import fr.inria.atlanmod.neoemf.data.structure.ContainerInfo;
import fr.inria.atlanmod.neoemf.data.structure.FeatureKey;
import fr.inria.atlanmod.neoemf.data.structure.MultivaluedFeatureKey;
import fr.inria.atlanmod.neoemf.data.map.core.store.MapStore;
import org.eclipse.emf.ecore.EClass;

import java.util.Collection;
Expand All @@ -29,9 +28,9 @@
* An adapter on top of a map-based database that provides specific methods for communicating with the database that it uses.
* Each {@code MapBackend} manage one single instance of a database.
* <p>
* It does not provide model-level translation; these functions are handled by {@link MapStore}s.
* It does not provide model-level translation; these functions are handled by {@link DirectWriteMapStore}s.
*
* @see MapStore
* @see DirectWriteMapStore
*/
public interface MapBackend extends PersistenceBackend {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import static java.util.Objects.isNull;

/**
* A {@link MapStore} that uses an internal cache to store persisted {@link Object}s that are part
* A {@link DirectWriteMapStore} that uses an internal cache to store persisted {@link Object}s that are part
* of multi-valued {@link EReference}s to speed-up their access.
* <p>
* Using a cache avoids multiple {@link java.util.List} deserialization to retrieve the same element, which can be an important
Expand All @@ -36,12 +36,12 @@
* This store can be used as a base store that can be complemented by plugging decorator stores on top of it (see {@link
* fr.inria.atlanmod.neoemf.data.store.AbstractPersistentStoreDecorator} subclasses) to provide additional features such as caching or logging.
*
* @see MapStore
* @see DirectWriteMapStore
* @see MapBackend
*
* @see fr.inria.atlanmod.neoemf.data.store.AbstractPersistentStoreDecorator
*/
public class CachedMapStore<P extends MapBackend> extends MapStore<P> {
public class DirectWriteCachedMapStore<P extends MapBackend> extends DirectWriteMapStore<P> {

/**
* In-memory cache that holds ???, identified by the associated {@link FeatureKey}.
Expand All @@ -50,12 +50,12 @@ public class CachedMapStore<P extends MapBackend> extends MapStore<P> {
.maximumSize(DEFAULT_CACHE_SIZE).build();;

/**
* Constructs a new {@code MapStore} between the given {@code resource} and the {@code backend}.
* Constructs a new {@code DirectWriteMapStore} between the given {@code resource} and the {@code backend}.
*
* @param resource the resource to persist and access
* @param backend the persistence back-end used to store the model
*/
public CachedMapStore(Resource.Internal resource, P backend) {
public DirectWriteCachedMapStore(Resource.Internal resource, P backend) {
super(resource, backend);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
*
* @param <P> the type of the supported {@link PersistenceBackend}
*/
public abstract class MapStore<P extends MapBackend> extends AbstractDirectWriteStore<P> {
public abstract class DirectWriteMapStore<P extends MapBackend> extends AbstractDirectWriteStore<P> {

/**
* The default cache size (10 000).
Expand All @@ -63,12 +63,12 @@ public abstract class MapStore<P extends MapBackend> extends AbstractDirectWrite
.maximumSize(DEFAULT_CACHE_SIZE).build();

/**
* Constructs a new {@code MapStore} between the given {@code resource} and the {@code backend}.
* Constructs a new {@code DirectWriteMapStore} between the given {@code resource} and the {@code backend}.
*
* @param resource the resource to persist and access
* @param backend the persistence back-end used to store the model
*/
public MapStore(Resource.Internal resource, P backend) {
public DirectWriteMapStore(Resource.Internal resource, P backend) {
super(resource, backend);
}

Expand All @@ -92,7 +92,7 @@ public void unset(InternalEObject internalObject, EStructuralFeature feature) {

@Override
public boolean contains(InternalEObject internalObject, EStructuralFeature feature, Object value) {
NeoLogger.debug("MapStore::contains({1}, {2})", new Object[] {
NeoLogger.debug("DirectWriteMapStore::contains({1}, {2})", new Object[] {
feature.getName(), value});
checkNotNull(internalObject);
checkNotNull(feature);
Expand Down Expand Up @@ -249,7 +249,7 @@ public int indexOf(InternalEObject internalObject, EStructuralFeature feature, O

int index;
PersistentEObject object = PersistentEObject.from(internalObject);
NeoLogger.debug("MapStore::indexOf({})");
NeoLogger.debug("DirectWriteMapStore::indexOf({})");

Object[] array = (Object[]) getFromMap(object, feature);
if (isNull(array)) {
Expand Down Expand Up @@ -541,7 +541,7 @@ private class PersistentEObjectCacheLoader implements Function<Id, PersistentEOb
@Override
public PersistentEObject apply(Id id) {
PersistentEObject object;
EClass eClass = MapStore.this.resolveInstanceOf(id);
EClass eClass = DirectWriteMapStore.this.resolveInstanceOf(id);
if (nonNull(eClass)) {
EObject eObject;
if (Objects.equals(eClass.getEPackage().getClass(), EPackageImpl.class)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@

import java.util.Collection;
import java.util.Collections;
import java.util.Map;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;

/**
* A {@link MapStore} that persists {@link Collection} indices instead of serialized arrays.
* A {@link DirectWriteMapStore} that persists {@link Collection} indices instead of serialized arrays.
* <p>
* Indices are persisted with dedicated {@link FeatureKey}s containing the index of the element to
* store. Using this approach avoid to deserialize entire {@link Collection}s to retrieve a single
Expand All @@ -48,18 +47,18 @@
* This store can be used as a base store that can be complemented by plugging decorator stores on top of it
* (see {@link AbstractPersistentStoreDecorator} subclasses) to provide additional features such as caching or logging.
*
* @see MapStore
* @see DirectWriteMapStore
* @see MapBackend
* @see AbstractPersistentStoreDecorator
*/
public class MapStoreWithIndices<P extends MapBackend> extends MapStore<P> {
public class DirectWriteMapStoreWithIndices<P extends MapBackend> extends DirectWriteMapStore<P> {
/**
* Constructs a new {@code MapStore} between the given {@code resource} and the {@code backend}.
* Constructs a new {@code DirectWriteMapStore} between the given {@code resource} and the {@code backend}.
*
* @param resource the resource to persist and access
* @param backend the persistence back-end used to store the model
*/
public MapStoreWithIndices(Resource.Internal resource, P backend) {
public DirectWriteMapStoreWithIndices(Resource.Internal resource, P backend) {
super(resource, backend);
}

Expand Down Expand Up @@ -117,15 +116,15 @@ public Object remove(InternalEObject internalObject, EStructuralFeature feature,

@Override
public int indexOf(InternalEObject internalObject, EStructuralFeature feature, Object value) {
NeoLogger.debug("MapStoreWithIndices::indexOf({1}, {2})", new Object[] {
NeoLogger.debug("DirectWriteMapStoreWithIndices::indexOf({1}, {2})", new Object[] {
feature.getName(), value});

return ArrayUtils.indexOf(toArray(internalObject, feature), value);
}

@Override
public int lastIndexOf(InternalEObject internalObject, EStructuralFeature feature, Object value) {
NeoLogger.debug("MapStoreWithIndices::lastIndexOf({1}, {2})", new Object[] {
NeoLogger.debug("DirectWriteMapStoreWithIndices::lastIndexOf({1}, {2})", new Object[] {
feature.getName(), value});

return indexOf(internalObject, feature, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import static java.util.Objects.isNull;

/**
* A {@link MapStore} that uses Java {@link List}s instead of arrays to persist multi-valued
* A {@link DirectWriteMapStore} that uses Java {@link List}s instead of arrays to persist multi-valued
* {@link EAttribute}s and {@link EReference}s.
* <p>
* Using a {@link List}-based implementation allows to benefit from the rich Java {@link Collection} API, with the cost
Expand All @@ -47,11 +47,11 @@
* This store can be used as a base store that can be complemented by plugging decorator stores on top of it
* (see {@link AbstractPersistentStoreDecorator} subclasses) to provide additional features such as caching or logging.
*
* @see MapStore
* @see DirectWriteMapStore
* @see MapBackend
* @see AbstractPersistentStoreDecorator
*/
public class MapStoreWithLists<P extends MapBackend> extends MapStore<P> {
public class DirectWriteMapStoreWithLists<P extends MapBackend> extends DirectWriteMapStore<P> {
/**
* In-memory cache that holds multi-valued {@link EStructuralFeature}s wrapped in a {@link List}, identified by
* their associated {@link FeatureKey}.
Expand All @@ -60,12 +60,12 @@ public class MapStoreWithLists<P extends MapBackend> extends MapStore<P> {
.maximumSize(DEFAULT_CACHE_SIZE).build();

/**
* Constructs a new {@code MapStore} between the given {@code resource} and the {@code backend}.
* Constructs a new {@code DirectWriteMapStore} between the given {@code resource} and the {@code backend}.
*
* @param resource the resource to persist and access
* @param backend the persistence back-end used to store the model
*/
public MapStoreWithLists(Resource.Internal resource, P backend) {
public DirectWriteMapStoreWithLists(Resource.Internal resource, P backend) {
super(resource, backend);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,18 @@

package fr.inria.atlanmod.neoemf.data.mapdb.store;

import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;

import fr.inria.atlanmod.neoemf.core.PersistentEObject;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.CachedMapStore;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteCachedMapStore;
import fr.inria.atlanmod.neoemf.data.mapdb.MapDbPersistenceBackend;
import fr.inria.atlanmod.neoemf.data.store.AbstractPersistentStoreDecorator;
import fr.inria.atlanmod.neoemf.data.structure.FeatureKey;

import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.resource.Resource;

import java.util.Collection;
import java.util.List;

import static com.google.common.base.Preconditions.checkPositionIndex;
import static java.util.Objects.isNull;

/**
* A {@link DirectWriteMapDbStore} that uses an internal cache to store persisted {@link Object}s that are part
Expand All @@ -47,7 +39,7 @@
* @see MapDbPersistenceBackend
* @see AbstractPersistentStoreDecorator
*/
public class DirectWriteMapDbCacheManyStore extends CachedMapStore<MapBackend> {
public class DirectWriteMapDbCacheManyStore extends DirectWriteCachedMapStore<MapBackend> {

/**
* Constructs a new {@code DirectWriteMapDbCacheManyStore} between the given {@code resource} and the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,18 @@

package fr.inria.atlanmod.neoemf.data.mapdb.store;

import fr.inria.atlanmod.neoemf.core.Id;
import fr.inria.atlanmod.neoemf.core.PersistentEObject;
import fr.inria.atlanmod.neoemf.data.map.core.MapBackend;
import fr.inria.atlanmod.neoemf.data.map.core.store.MapStoreWithIndices;
import fr.inria.atlanmod.neoemf.data.map.core.store.DirectWriteMapStoreWithIndices;
import fr.inria.atlanmod.neoemf.data.mapdb.MapDbPersistenceBackend;
import fr.inria.atlanmod.neoemf.data.store.AbstractPersistentStoreDecorator;
import fr.inria.atlanmod.neoemf.data.structure.FeatureKey;
import fr.inria.atlanmod.neoemf.data.structure.MultivaluedFeatureKey;

import org.apache.commons.lang3.ArrayUtils;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.resource.Resource;

import java.util.Collection;
import java.util.Collections;

import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;

/**
* A {@link DirectWriteMapDbStore} that persists {@link Collection} indices instead of serialized arrays.
* <p>
Expand All @@ -51,7 +41,7 @@
* @see MapDbPersistenceBackend
* @see AbstractPersistentStoreDecorator
*/
public class DirectWriteMapDbIndicesStore extends MapStoreWithIndices<MapBackend> {
public class DirectWriteMapDbIndicesStore extends DirectWriteMapStoreWithIndices<MapBackend> {

/**
* Constructs a new {@code DirectWriteMapDbIndicesStore} between the given {@code resource} and the
Expand Down
Loading

0 comments on commit 3d0644d

Please sign in to comment.