Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.connector.store.jpa.model.simple
Class SimpleJpaRepository

    java.lang.Object
      org.modeshape.graph.connector.map.MapRepository
          org.modeshape.connector.store.jpa.model.simple.SimpleJpaRepository

    public class SimpleJpaRepository

extends MapRepository

Implementation of `MapRepository` for the `Simple JPA connector model`. This class exposes a map of workspace names to `workspaces` and each workspace provides a logical mapping of node UUIDs to `nodes`. The `JpaNode` class functions as an adapter between the `persistent entity for nodes` and the `map repository interface for nodes`.

This class differs slightly from the other `MapRepository` implementations in that it exists only within the lifetime of a single `EntityManager` (which itself is opened and closed within the lifetime of a single `SimpleJpaConnection`. The other map repository implementations all outlive any particular connection and generally survive for the lifetime of the ModeShape server.

Nested Class Summary
`protected class` | `SimpleJpaRepository.JpaNode` Adapter between the `persistent entity for nodes` and the `map repository interface for nodes`.
`protected class` | `SimpleJpaRepository.LargeValueSerializer`
`protected class` | `SimpleJpaRepository.Workspace` This class provides a logical mapping of UUIDs to `nodes` within a named workspace.

Field Summary
`protected boolean` | `compressData`
`protected ExecutionContext` | `context`
`protected boolean` | `creatingWorkspacesAllowed`
`protected String` | `dialect`
`protected javax.persistence.EntityManager` | `entityManager`
`protected long` | `minimumSizeOfLargeValuesInBytes`
`protected NameFactory` | `nameFactory`
`protected Namespaces` | `namespaceEntities`
`protected PathFactory` | `pathFactory`
`protected Workspaces` | `workspaceEntities`

Fields inherited from class org.modeshape.graph.connector.map.MapRepository
`rootNodeUuid`

Constructor Summary
`SimpleJpaRepository(String sourceName, UUID rootNodeUuid, javax.persistence.EntityManager entityManager, ExecutionContext context, boolean compressData, boolean creatingWorkspacesAllowed, long minimumSizeOfLargeValuesInBytes, String dialect)`
`SimpleJpaRepository(String sourceName, UUID rootNodeUuid, String defaultWorkspaceName, String[] predefinedWorkspaceNames, javax.persistence.EntityManager entityManager, ExecutionContext context, boolean compressData, boolean creatingWorkspacesAllowed, long minimumSizeOfLargeValuesInBytes, String dialect)`

Method Summary
`protected boolean` | `collectGarbage()` Collect and remove all records that are no longer needed in the database.
`protected MapWorkspace` | `createWorkspace(ExecutionContext context, String name)` Creates a new workspace with the given name containing only a root node.
`MapWorkspace` | `getWorkspace(String name)` Returns the workspace with the given name
`Set<String>` | `getWorkspaceNames()` Returns a list of the names of the currently created workspaces
`MapRepositoryTransaction` | `startTransaction(boolean readonly)` Begin a transaction, hinting whether the transaction will be used only to read the content.

Methods inherited from class org.modeshape.graph.connector.map.MapRepository
`createWorkspace, createWorkspace, destroyWorkspace, getDefaultWorkspaceName, getRootNodeUuid, getSourceName, initialize`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### entityManager

    protected final javax.persistence.EntityManager entityManager

### workspaceEntities

    protected final Workspaces workspaceEntities

### namespaceEntities

    protected final Namespaces namespaceEntities

### context

    protected final ExecutionContext context

### pathFactory

    protected final PathFactory pathFactory

### nameFactory

    protected final NameFactory nameFactory

### compressData

    protected final boolean compressData

### creatingWorkspacesAllowed

    protected final boolean creatingWorkspacesAllowed

### minimumSizeOfLargeValuesInBytes

    protected final long minimumSizeOfLargeValuesInBytes

### dialect

    protected final String dialect

Constructor Detail

### SimpleJpaRepository

    public SimpleJpaRepository(String sourceName,
                               UUID rootNodeUuid,
                               String defaultWorkspaceName,
                               String[] predefinedWorkspaceNames,
                               javax.persistence.EntityManager entityManager,
                               ExecutionContext context,
                               boolean compressData,
                               boolean creatingWorkspacesAllowed,
                               long minimumSizeOfLargeValuesInBytes,
                               String dialect)

### SimpleJpaRepository

    public SimpleJpaRepository(String sourceName,
                               UUID rootNodeUuid,
                               javax.persistence.EntityManager entityManager,
                               ExecutionContext context,
                               boolean compressData,
                               boolean creatingWorkspacesAllowed,
                               long minimumSizeOfLargeValuesInBytes,
                               String dialect)

Method Detail

### createWorkspace

    protected MapWorkspace createWorkspace(ExecutionContext context,
                                           String name)

  Description copied from class: `MapRepository`
  Creates a new workspace with the given name containing only a root node.

  This method does NOT automatically add the newly created workspace to the `workspace map` or check to see if a workspace already exists in this repository with the same name.

  Specified by:
    `createWorkspace` in class `MapRepository`
  Parameters:
    `context` - the context in which the workspace is to be created
    `name` - the name of the workspace
  Returns:
    the newly created workspace; may not be null

### getWorkspace

    public MapWorkspace getWorkspace(String name)

  Description copied from class: `MapRepository`
  Returns the workspace with the given name

  Overrides:
    `getWorkspace` in class `MapRepository`
  Parameters:
    `name` - the name of the workspace to return
  Returns:
    the workspace with the given name; may be null if no workspace with the given name exists

### getWorkspaceNames

    public Set<String> getWorkspaceNames()

  Description copied from class: `MapRepository`
  Returns a list of the names of the currently created workspaces

  Overrides:
    `getWorkspaceNames` in class `MapRepository`
  Returns:
    a list of the names of the currently created workspaces

### startTransaction

    public MapRepositoryTransaction startTransaction(boolean readonly)

  Begin a transaction, hinting whether the transaction will be used only to read the content. If this is called, then the transaction must be either `committed` or `rolled back`.

  Specified by:
    `startTransaction` in class `MapRepository`
  Parameters:
    `readonly` - true if the transaction will not modify any content, or false if changes are to be made
  Returns:
    the transaction; never null
  See Also:
    `MapRepository.startTransaction(boolean)`

### collectGarbage

    protected boolean collectGarbage()

  Collect and remove all records that are no longer needed in the database.

  Returns:
    true if all unused records could be deleted, or false if some unused records still remain (because removing them all would have been too time consuming or costly).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.