org.jboss.dna.connector.store.jpa.model.simple
Class SimpleJpaRepository

java.lang.Object
  extended by org.jboss.dna.graph.connector.map.MapRepository
      extended by org.jboss.dna.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 DNA server.


Constructor Summary
SimpleJpaRepository(String sourceName, UUID rootNodeUuid, javax.persistence.EntityManager entityManager, ExecutionContext context, boolean compressData, boolean creatingWorkspacesAllowed, long minimumSizeOfLargeValuesInBytes)
           
SimpleJpaRepository(String sourceName, UUID rootNodeUuid, String defaultWorkspaceName, String[] predefinedWorkspaceNames, javax.persistence.EntityManager entityManager, ExecutionContext context, boolean compressData, boolean creatingWorkspacesAllowed, long minimumSizeOfLargeValuesInBytes)
           
 
Method Summary
 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.jboss.dna.graph.connector.map.MapRepository
createWorkspace, createWorkspace, destroyWorkspace, getRootNodeUuid, getSourceName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)

SimpleJpaRepository

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

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)


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