|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||
MapRepository class and its supporting classes provide a default implementation of the connector
classes for connectors that support the transient or persistent mapping of a UUID to a standard
representation of a node.
See:
Description

| Interface Summary | |
|---|---|
| MapNode | |
| MapRepositorySource | An extension of the RepositorySource class that provides a cache policy and a
repository context. |
| MapRepositoryTransaction | A transaction returned by the MapRepository.startTransaction(boolean). |
| MapWorkspace | The MapWorkspace defines the required methods for workspaces in a map repository. |
| Class Summary | |
|---|---|
| AbstractMapWorkspace | A default implementation of MapWorkspace that only requires the user to implement some simple, map-like operations. |
| DefaultMapNode | |
| LockBasedTransaction | A MapRepositoryTransaction based upon a Lock. |
| MapRepository | A default implementation of a map-based repository. |
| MapRepositoryConnection | A connection to a MapRepository. |
| MapRequestProcessor | The default implementation of the RequestProcessor for map repositories. |
The MapRepository class and its supporting classes provide a default implementation of the connector
classes for connectors that support the transient or persistent mapping of a UUID to a standard
representation of a node.
To implement a connector based on this framework, one must create an implementation of the repository source,
an implementation of the repository itself, and an implementation of the workspace.
The repository source implementation contains properties for the repository configuration and caching policies. A key
method in the MapRepositorySource implementation if the RepositorySource.getConnection() method,
which should generally be implemented using the default connection implementation.
if (repository == null) {
repository = new InMemoryRepository(name, rootNodeUuid, defaultWorkspaceName);
}
return new MapRepositoryConnection(this, repository);
The repository implementation is only required to provide an implementation of the MapRepository.createWorkspace(org.modeshape.graph.ExecutionContext, String)
method that returns the appropriate workspace implementation for the connector. However, all constructors for the repository must
call MapRepository.initialize() after the constructor has completed its initialization, as demonstrated below:
public InMemoryRepository( String sourceName,
UUID rootNodeUuid,
String defaultWorkspaceName ) {
initialize();
}
Finally, the workspace implementation must be created. Implementors should consider extending the AbstractMapWorkspace class, which provides reasonable default implementations (assuming that the backing map provides O(1) lookups - a sine qua non for maps) for almost
this class imposes a requirement that its AbstractMapWorkspace.initialize() method also be called at the end of each constructor, like so:
public Workspace( MapRepository repository,
String name ) {
super(repository, name);
initialize();
}
InMemoryRepositorySource
|
||||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||||