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 SimpleModel

    java.lang.Object
      org.modeshape.connector.store.jpa.Model
          org.modeshape.connector.store.jpa.model.simple.SimpleModel

    public class SimpleModel

extends Model

Database model that stores each node (transparently) and its properties (opaquely) in a single row. Large property values are stored separately and can be shared between nodes.

The set of tables used in this model includes:

- Namespaces - the set of namespace URIs used in paths, property names, and property values.
- Nodes - each node along with its name, seralized properties, parent, UUID, and position within its parent. This approach makes it possible to efficiently work with nodes containing large numbers of children, where adding and removing child nodes is largely independent of the number of children. Also, working with properties is also completely independent of the number of child nodes.
- Large values - property values larger than a certain size will be broken out into this table, where they are tracked by their SHA-1 hash and shared by all properties that have that same value. The values are stored in a binary (and optionally compressed) form.
- ReferenceChanges - the references from one node to another
- Subgraph - a working area for efficiently computing the space of a subgraph; see below
- Change log - a record of the changes that have been made to the repository. This is used to distribute change events across multiple distributed processes, and to allow a recently-connected client to identify the set of changes that have been made since a particular time or date. Changes are serialized into a binary, compressed format.
- Options - the parameters for this store's configuration (common to all models)

### Subgraph queries

This database model contains two tables that are used in an efficient mechanism to find all of the nodes in the subgraph below a certain node. This process starts by creating a record for the subgraph query, and then proceeds by executing a join to find all the children of the top-level node, and inserting them into the database (in a working area associated with the subgraph query). Then, another join finds all the children of those children and inserts them into the same working area. This continues until the maximum depth has been reached, or until there are no more children (whichever comes first). All of the nodes in the subgraph are then represented by records in the working area, and can be used to quickly and efficient work with the subgraph nodes. When finished, the mechanism deletes the records in the working area associated with the subgraph query.

This subgraph query mechanism is extremely efficient, performing one join/insert statement per level of the subgraph, and is completely independent of the number of nodes in the subgraph. For example, consider a subgraph of node A, where A has 10 children, and each child contains 10 children, and each grandchild contains 10 children. This subgraph has a total of 1111 nodes (1 root + 10 children + 10*10 grandchildren + 10*10*10 great-grandchildren). Finding the nodes in this subgraph would normally require 1 query per node (in other words, 1111 queries). But with this subgraph query mechanism, all of the nodes in the subgraph can be found with 1 insert plus 4 additional join/inserts.

This mechanism has the added benefit that the set of nodes in the subgraph are kept in a working area in the database, meaning they don't have to be pulled into memory.

Subgraph queries are used to efficiently process a number of different requests, including `ReadBranchRequest`, `DeleteBranchRequest`, `MoveBranchRequest`, and `CopyBranchRequest`. Processing each of these kinds of requests requires knowledge of the subgraph, and in fact all but the `ReadBranchRequest` need to know the complete subgraph.

Constructor Summary
`SimpleModel()`

Method Summary
`RepositoryConnection` | `createConnection(JpaSource source)`
`Class<?>[]` | `getEntityClasses()` Return the entity classes that will be used by JPA to store information in the database.

Methods inherited from class org.modeshape.connector.store.jpa.Model
`equals, getDescription, getDescription, getName, hashCode, toString`

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

Constructor Detail

### SimpleModel

    public SimpleModel()

Method Detail

### getEntityClasses

    public Class<?>[] getEntityClasses()

  Description copied from class: `Model`
  Return the entity classes that will be used by JPA to store information in the database.

  Specified by:
    `getEntityClasses` in class `Model`
  Returns:
    an array of the classes that will be used by this model; never null

### createConnection

    public RepositoryConnection createConnection(JpaSource source)

  Specified by:
    `createConnection` in class `Model`

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.