Skip to content

Commit

Permalink
full reformat of the code and Javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
yvrng committed Jan 16, 2017
1 parent 5a50b80 commit 5c95dc1
Show file tree
Hide file tree
Showing 18 changed files with 78 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
* This class extends {@link MinimalEStoreEObjectImpl} that delegates {@link EStructuralFeature} accesses
* to an underlying {@link EStore} that interacts with the database used to store the model.
* <p>
* {@link DefaultPersistentEObject}s is backend-agnostic, and is as an EMF-level element wrapper in all
* {@link DefaultPersistentEObject}s is backend-agnostic, and is as an EMF-level element wrapper in all
* existing database implementations.
*/
public class DefaultPersistentEObject extends MinimalEStoreEObjectImpl implements PersistentEObject {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
/**
* The default implementation of a {@link PersistentResource} that contains {@link PersistentEObject}.
* <p>
* {@link DefaultPersistentResource}s is backend-agnostic and only delegates model element operations
* to its internal {@link PersistentStore} which is reponsible of database access.
* {@link DefaultPersistentResource}s is backend-agnostic and only delegates model element operations
* to its internal {@link PersistentStore} which is responsible of database access.
*/
public class DefaultPersistentResource extends ResourceImpl implements PersistentResource {

Expand Down Expand Up @@ -312,19 +312,19 @@ public DummyRootEObject(Resource.Internal resource) {
private static class PersistenceBackendShutdownHook extends Thread {

/**
* The backend to stop when the application will exit
* The back-end to stop when the application will exit.
*/
private final PersistenceBackend backend;

/**
* The {@link URI} of the resource used by the {@code backend}
* The {@link URI} of the resource used by the {@code backend}.
*/
private final URI uri;

/**
* Creates a new {@code PersistenceBackendShutdownHook} with the given {@code backend}.
*
* @param backend the backend to stop when the application will exit
* @param backend the back-end to stop when the application will exit
* @param uri the {@link URI} of the resource used by the {@code backend}
*/
private PersistenceBackendShutdownHook(PersistenceBackend backend, URI uri) {
Expand All @@ -335,7 +335,7 @@ private PersistenceBackendShutdownHook(PersistenceBackend backend, URI uri) {
/**
* Adds a shutdown hook on the given {@code backend}. It will be stopped when the application will exit.
*
* @param backend the backend to stop when the application will exit
* @param backend the back-end to stop when the application will exit
* @param uri the {@link URI} of the resource used by the {@code backend}
*/
public static void closeOnExit(PersistenceBackend backend, URI uri) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.InternalEObject.EStore;
import org.eclipse.emf.ecore.resource.Resource;

import java.io.Closeable;

/**
* Extends the {@link Resource} interface by providing efficient model-level operations that
* are not accessible using the standard EMF API. For example, {@code getAllInstances} is a
* utility method that computes efficiently all the instances of a given type by delegating the
* are not accessible using the standard EMF API. For example, {@code getAllInstances} is a
* utility method that computes efficiently all the instances of a given type by delegating the
* operation to the underlying database, that can benefits of its internal optimizations and indices.
*/
public interface PersistentResource extends Resource, Resource.Internal, Closeable {
Expand All @@ -32,10 +31,11 @@ public interface PersistentResource extends Resource, Resource.Internal, Closeab
void close();

/**
* Returns the {@link EStore} used to store the model.
*
* @return the {@link EStore} used to store the model
* @return the {@link EStore}
*/
InternalEObject.EStore eStore();
EStore eStore();

/**
* Computes the set of instances of the given {@link EClass} (including its sub-types).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ public abstract class AbstractPersistenceBackendFactoryTest extends AbstractUnit

private static final String INNER_BACKEND_FIELDNAME = "backend";

private static <F> F getField(Object object, String fieldName, Class<?> in, Class<F> out) {
if (!in.isInstance(object)) {
throw new IllegalArgumentException();
}

try {
Field storeField = in.getDeclaredField(fieldName);
storeField.setAccessible(true);
return out.cast(storeField.get(object));
}
catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}

protected PersistentStore getInnerStore(InternalEObject.EStore store) {
return getField(store, INNER_STORE_FIELDNAME, AbstractPersistentStoreDecorator.class, PersistentStore.class);
}
Expand All @@ -42,19 +57,4 @@ protected PersistenceBackend getInnerBackend(InternalEObject.EStore store) {

return innerBackend;
}

private static <F> F getField(Object object, String fieldName, Class<?> in, Class<F> out) {
if (!in.isInstance(object)) {
throw new IllegalArgumentException();
}

try {
Field storeField = in.getDeclaredField(fieldName);
storeField.setAccessible(true);
return out.cast(storeField.get(object));
}
catch (NoSuchFieldException | IllegalAccessException e) {
throw new RuntimeException(e);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public void copyBackend(PersistenceBackend from, PersistenceBackend to) {
* @return the created configuration
*
* @throws InvalidDataStoreException if the configuration cannot be created in the {@code directory}, or if some
* {@code options} are missing or invalid.
* {@code options} are missing or invalid.
*/
private PropertiesConfiguration getOrCreateBlueprintsConfiguration(File directory, Map<?, ?> options) throws InvalidDataStoreException {
PropertiesConfiguration configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

package fr.inria.atlanmod.neoemf.data.blueprints.option;

import com.tinkerpop.blueprints.Vertex;

import fr.inria.atlanmod.neoemf.data.blueprints.store.DirectWriteBlueprintsCacheManyStore;
import fr.inria.atlanmod.neoemf.data.blueprints.store.DirectWriteBlueprintsStore;
import fr.inria.atlanmod.neoemf.data.store.AutocommitStoreDecorator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@

/**
* Provides utility configuration classes that are dynamically called to setup Blueprints databases.
*
* @note The classes in this package have to be overriden for each backend implementation that has to
* perform some startup configuration.
*
* @note The classes in this package have to be overriden for each back-end implementation that has to perform some
* startup configuration.
*/

package fr.inria.atlanmod.neoemf.data.blueprints.configuration;
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
*/

/**
* Provides Blueprints' specific readers and writers used in the {@code io} module to save and persist models from external sources.
* Provides Blueprints' specific readers and writers used in the {@code io} module to save and persist models from
* external sources.
* <p>
* Providing efficient model import and export is tightly coupled to the database and the data representation. In order to provide this
* feature, a backend module should contain an I/O specific package that overrides {@link fr.inria.atlanmod.neoemf.io.persistence.AbstractPersistenceHandler}.
*
* Providing efficient model import and export is tightly coupled to the database and the data representation. In order
* to provide this feature, a back-end module should contain an I/O specific package that overrides {@link
* fr.inria.atlanmod.neoemf.io.persistence.AbstractPersistenceHandler}.
*
* @see fr.inria.atlanmod.neoemf.io.persistence.AbstractPersistenceHandler
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@

/**
* Provides utility classes to define specific behaviors of Blueprints data persistence.
*
* @note Options defined using the classes inside this package are usable for each Blueprints
* implementation. For backend-specific configuration refers to the corresponding package in the
* backend plugin.
*
* @note Options defined using the classes inside this package are usable for each Blueprints implementation. For
* backend-specific configuration refers to the corresponding package in the backend plugin.
*/

package fr.inria.atlanmod.neoemf.data.blueprints.option;
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@

/**
* Provides utility classes to define specific behaviors of Neo4j data persistence.
*
* @note Options defined using the classes inside this package are only usable with Neo4j as the concrete
* implementation of the Blueprints API. Neo4j specific options can be combined with Blueprints generic
* options.
*
*
* @note Options defined using the classes inside this package are only usable with Neo4j as the concrete implementation
* of the Blueprints API. Neo4j specific options can be combined with Blueprints generic options.
* @see fr.inria.atlanmod.neoemf.data.blueprints.option.BlueprintsOptionsBuilder
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
* Mock {@link PersistenceBackend} implementation for HBase to fit core architecture.
* <p>
* This class does not access HBase database, but is here to fit the requirement of the
* core architecture. For historical reasons the real access to the HBase Table
* core architecture. For historical reasons the real access to the HBase Table
* is done in {@link DirectWriteHBaseStore} and {@link ReadOnlyHBaseStore}.
* <p>
* Moving HBase access to this class to fit NeoEMF backend architecture is planned in
* Moving HBase access to this class to fit NeoEMF back-end architecture is planned in
* a future release.
*
*
* @see DirectWriteHBaseStore
* @see ReadOnlyHBaseStore
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
/**
* A factory that creates instances of {@link HBasePersistenceBackend}.
* <p>
* This class only creates persistent databases that can be configured using
* This class only creates persistent databases that can be configured using
* {@link PersistentResource#save(Map)} and {@link PersistentResource#load(Map)}
* options maps.
* <p>
* Note that transient backends can be instantiated using this factory, but they will
* Note that transient back-ends can be instantiated using this factory, but they will
* be handed as persistent ones. This is a limitation that will be solved in next releases.
* To avoid any consistency issue we recommend every HBase resource right after their creation,
* ensuring the resource is using a persistent backend.
*
* ensuring the resource is using a persistent back-end.
*
* @see PersistentResource
* @see HBasePersistenceBackend
* @see HBaseOptionsBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,14 @@
* An {@link AbstractDirectWriteStore} that translates model-level operations to HBase operations.
* <p>
* This class implements the {@link 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 {@link PersistentEObject}
* is forwarded to this class, that takes care of the serialization/deserialization from/to HBase.
* <p>
* @note For historical purposes this class does not use a {@link HBasePersistenceBackend}, instead,
* it accesses HBase directly using the low-level database API.
* allow EMF persistence delegation. If this store is used, every method call and property access on {@link
* PersistentEObject} is forwarded to this class, that takes care of the serialization/deserialization from/to HBase.
*
* @note For historical purposes this class does not use a {@link HBasePersistenceBackend}, instead, it accesses HBase
* directly using the low-level database API.
* <p>
* 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.
*
* 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 PersistentEObject
* @see HBasePersistenceBackend
* @see AbstractDirectWriteStore
Expand Down Expand Up @@ -172,7 +171,7 @@ public DirectWriteHBaseStore(Resource.Internal resource) throws IOException {
*
* @param connection the connection to the HBase server
* @param tableName the name of the table to access on the server
* @param admin the administrator client of the HBase server
* @param admin the administrator client of the HBase server
*
* @return the created HBase table containing the columns and column families to store the model
*
Expand All @@ -194,12 +193,13 @@ protected Table initTable(Connection connection, TableName tableName, Admin admi

/**
* A specific implementation of {@link EStore#add(InternalEObject, EStructuralFeature, int, Object)} that takes
* benefit of the HBase facilities to append an element in a multi-valued {@link EReference} without deserializing
* benefit of the HBase facilities to append an element in a multi-valued {@link EReference} without de-serializing
* the entire collection.
*
* @param object the source element
* @param reference the multi-valued {@link EReference}
* @param atEnd {@code true} to append {@code referencedObject} at the end of the collection, {@code false} to put it at the beginning (if the persisted collection is empty)
* @param reference the multi-valued {@link EReference}
* @param atEnd {@code true} to append {@code referencedObject} at the end of the collection, {@code
* false} to put it at the beginning (if the persisted collection is empty)
* @param referencedObject the {@link PersistentEObject} to append
*
* @throws IOException if the HBase database cannot be found
Expand Down Expand Up @@ -316,7 +316,7 @@ protected void updateContainment(PersistentEObject object, EReference reference,
}

/**
* Computes {@code object}'s metaclass informations and persists them in the database.
* Computes {@code object}'s metaclass information and persists them in the database.
*
* @param object the {@link PersistentEObject} to persist the metaclass of
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
* A {@link DirectWriteHBaseStore} that only allows read operations on the underlying database.
* <p>
* Read-only configuration allows to access model element faster, without checking value consistency
* between database calls. This store reimplements all the mutators and throws an
* between database calls. This store re-implements all the mutators and throws an
* {@link UnsupportedOperationException} when they are called, preventing resource corruption.
* <p>
* * This store can be used as a base store that can be complemented by plugging decorator stores on top of it
* * 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.
*
*/
public class ReadOnlyHBaseStore extends DirectWriteHBaseStore {

/**
* In-memory cache that holds persisted model elements identifiers mapped to the {@link FeatureKey} used to access them.
* In-memory cache that holds persisted model elements identifiers mapped to the {@link FeatureKey} used to access
* them.
*/
private final Cache<FeatureKey, Object> objectsCache;

Expand All @@ -70,16 +70,17 @@ public ReadOnlyHBaseStore(Resource.Internal resource) throws IOException {

/**
* Checks that the provided {@code tableName} corresponds to an existing HBase table and opens it.
* <p>
*
* @note Read-only mode is only available for existing databases.
*
* @param connection the connection to the HBase server
* @param tableName the name of the table to access on the server
* @param admin the administrator client of the HBase server
* @param admin the administrator client of the HBase server
*
* @return the opened HBase table
*
* @throws IOException if the HBase server cannot be found or if {@code tableName} does not reference an existing table
* @throws IOException if the HBase server cannot be found or if {@code tableName} does not reference an existing
* table
*/
@Override
protected Table initTable(Connection connection, TableName tableName, Admin admin) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
*/

/**
* Provides utility classes to create HBase specific URIs, serialize and deserialize HBase records, and
* Provides utility classes to create HBase specific URIs, serialize and deserialize HBase records, and
* manage HBase resource life-cycle.
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public void storeContainer(Id id, ContainerInfo container) {
*
* @param id the {@link Id} of the element
*
* @return a {@link ClassInfo} descriptor containing element's metaclass informations ({@link EClass}, metamodel
* @return a {@link ClassInfo} descriptor containing element's metaclass information ({@link EClass}, meta-model
* name, and {@code nsURI})
*/
public ClassInfo metaclassFor(Id id) {
Expand All @@ -228,8 +228,8 @@ public ClassInfo metaclassFor(Id id) {
* Stores metaclass ({@link EClass}) information for the element with the given {@link Id}.
*
* @param id the {@link Id} of the element
* @param metaclass the {@link ClassInfo} descriptor containing element's metaclass informations ({@link EClass},
* metamodel name, and {@code nsURI})
* @param metaclass the {@link ClassInfo} descriptor containing element's metaclass information ({@link EClass},
* meta-model name, and {@code nsURI})
*/
public void storeMetaclass(Id id, ClassInfo metaclass) {
instanceOfMap.put(id, metaclass);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public MapDbOptionsBuilder directWrite() {
}

/**
* Adds the {@code direct-write-with-lists} feature in the created options.
* Adds the {@code direct-write-with-lists} feature in the created options.
*
* @return this builder (for chaining)
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@

public class LazyAdapterFactoryContentProvider extends AdapterFactoryContentProvider implements
ILazyTreeContentProvider, INotifyChangedListener, ITreeContentProvider,
IPropertySourceProvider {
IPropertySourceProvider
{

public LazyAdapterFactoryContentProvider(AdapterFactory adapterFactory) {
super(adapterFactory);
Expand Down

0 comments on commit 5c95dc1

Please sign in to comment.