Index: dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java =================================================================== --- dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java (revision 1406) +++ dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java (working copy) @@ -370,7 +370,7 @@ * * @throws Exception if an error occurs */ - public void failsFromDna466TestShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception { + public void testShouldNotCloneIfItWouldViolateTypeSemantics() throws Exception { session = helper.getSuperuserSession("otherWorkspace"); assertThat(session.getWorkspace().getName(), is("otherWorkspace")); @@ -432,5 +432,4 @@ } } - } Index: docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml =================================================================== --- docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml (revision 1406) +++ docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml (working copy) @@ -56,9 +56,9 @@ The name of the repository source, which is used by the &RepositoryService; when obtaining a &RepositoryConnection; by name. - supportsUpdates + supportsUpdates (Basic Model Only) Determines whether the content in the database is can be updated ("true"), or if the content may only be read ("false"). - The default value is "true". + The default value is "true". This property is ignored by the Simple Model (q.v., the model property below) rootNodeUuid @@ -104,7 +104,7 @@ driverClassloaderName - The name of the class loader or classpath that should be used to load the JDBC driver class. + The name of the class loader or classpath that should be used to load the JDBC driver class. This is not required if the DataSource is found in JNDI. @@ -173,11 +173,12 @@ - referentialIntegrityEnforced + referentialIntegrityEnforced (Basic Model Only) An advanced boolean property that dictates whether the database's referential integrity should be enabled, or false if this checking is not to be used. While referential integrity does help to ensure the consistency of the records, it does add work to update - operations and can impact performance. + operations and can impact performance. The Simple Model (q.v., the "model" property below) ignores this property and does not support + this feature. The default value is "true". @@ -202,8 +203,13 @@ model - An advanced property that dictates the type of storage schema that is used. Currently, the only supported value is "Basic", - which is also the default. + An advanced property that dictates the type of storage schema that is used. Currently, the only supported values are "Basic" and "Simple". + The Basic model supports a read-only mode (q.v., the "supportsUpdates" property) and database-level + enforcement of referential integrity (q.v., the "referentialIntegrityEnforced" property above), but does not fully support all JCR functions. + As a result, the Simple model is now the default model, but DNA repositories that were created under the Basic model will continue to use + the "Basic" model regardless of the value of this property. Repositories can be converted from the Basic model to the Simple model by exporting + them to an XML file as a system view through the JCR interface and then importing them into a new repository created with the model property set + to "Simple". @@ -278,11 +284,11 @@ Running this executable will create two files in the output directory (or the current directory if no output directory was specified): create.dna-jpa-connector.ddl and drop.dna-jpa-connector.ddl. The former contains the DDL to create or replace the tables, - foreign keys, indices, and sequences needed by the JPA connector and the latter containts the DDL to drop any tables, foreign keys, indices, and + foreign keys, indices, and sequences needed by the JPA connector and the latter contains the DDL to drop any tables, foreign keys, indices, and sequences needed by the JPA connector. - + Basic Model This database schema model stores node properties as opaque records and children as transparent records. @@ -293,6 +299,11 @@ + Workspaces - the set of workspaces and their names. + + + + Namespaces - the set of namespace URIs used in paths, property names, and property values. @@ -326,13 +337,6 @@ Subgraph - a working area for efficiently computing the space of a subgraph; see below - Options - the parameters for this store's configuration (common to all models) @@ -350,7 +354,7 @@ 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, + 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 @@ -367,6 +371,64 @@ requests requires knowledge of the subgraph, and in fact all but the &ReadBranchRequest; need to know the complete subgraph. - + + + Simple Model + + This database schema model stores node properties as opaque records in the same row as transparent values like the node's namespace, local name, + and same-name-sibling index. Large property values are stored separately. It is a small evolution of the design from the Basic model. + + + The set of tables used in this model includes: + + + + Workspaces - the set of workspaces and their names. + + + + + Namespaces - the set of namespace URIs used in paths, property names, and property values. + + + + + Nodes - the nodes in the repository, where each node and its properties are represented by a single record. 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. Since the primary consumer of DNA graph information is the JCR layer, and the JCR layer always + retrieves the nodes' properties for retrieved nodes, the properties have been moved in-row with the nodes. Properties are still store + in an opaque, serialized (and optionally compressed) form. + + + + + Large values - property values larger than a certain size will be broken out into this table, where they are tracked by + their SHA-1 has and shared by all properties that have that same value. The values are stored in a binary (and optionally + compressed) form. This is equivalent to the Basic model's approach for storing large values. + + + + + Subgraph - a working area for efficiently computing the space of a subgraph; see below + + + + + Options - the parameters for this store's configuration (common to all models) + + + + + + Just like the Basic model, this model contains two tables that are used in an efficient mechanism to find all of the nodes in the subgraph below + a certain node. The subgraph tables work so similarly in the Simple model that the description from the Basic model still applies. + + + In the Simple model, subgraph queries are used to efficiently process a number of different requests, including &ReadBranchRequest; + and &DeleteBranchRequest;. 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. + + Index: docs/reference/src/main/docbook/en-US/custom.dtd =================================================================== --- docs/reference/src/main/docbook/en-US/custom.dtd (revision 1406) +++ docs/reference/src/main/docbook/en-US/custom.dtd (working copy) @@ -60,6 +60,7 @@ BigDecimal"> Calendar"> Date"> +EntityManagerFactory"> @@ -139,6 +140,8 @@ RemovePropertyRequest"> CreateNodeRequest"> CopyBranchRequest"> +ReadBranchRequest"> +MoveBranchRequest"> DeleteBranchRequest"> InvalidRequestException"> InvalidWorkspaceException"> Index: extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java =================================================================== --- extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java (revision 1406) +++ extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java (working copy) @@ -79,7 +79,7 @@ private static final Model[] ALL_ARRAY = new Model[] {BASIC, SIMPLE}; private static final List MODIFIABLE_MODELS = new ArrayList(Arrays.asList(ALL_ARRAY)); public static final Collection ALL = Collections.unmodifiableCollection(MODIFIABLE_MODELS); - public static final Model DEFAULT = BASIC; + public static final Model DEFAULT = SIMPLE; public static boolean addModel( Model model ) { CheckArg.isNotNull(model, "modelName"); Index: extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java =================================================================== --- extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java (revision 1407) +++ extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java (working copy) @@ -25,14 +25,10 @@ import org.jboss.dna.common.statistic.Stopwatch; import org.jboss.dna.connector.store.jpa.JpaSource; -import org.jboss.dna.graph.ExecutionContext; +import org.jboss.dna.connector.store.jpa.TestEnvironment; import org.jboss.dna.graph.Graph; -import org.jboss.dna.graph.Subgraph; -import org.jboss.dna.graph.connector.RepositoryConnectionFactory; -import org.jboss.dna.graph.connector.RepositoryContext; import org.jboss.dna.graph.connector.RepositorySource; import org.jboss.dna.graph.connector.test.ReadableConnectorTest; -import org.jboss.dna.graph.observe.Observer; public class SimpleJpaConnectorReadableTest extends ReadableConnectorTest { @@ -44,40 +40,12 @@ @Override protected RepositorySource setUpSource() { // Set the connection properties using the environment defined in the POM files ... - JpaSource source = new JpaSource(); - + JpaSource source = TestEnvironment.configureJpaSource("Test Repository", this); source.setModel(JpaSource.Models.SIMPLE.getName()); - source.setName("SimpleJpaSource"); - source.setDialect("org.hibernate.dialect.HSQLDialect"); - source.setDriverClassName("org.hsqldb.jdbcDriver"); - source.setUsername("sa"); - source.setPassword(""); - source.setUrl("jdbc:hsqldb:mem:test"); - source.setShowSql(false); - source.setAutoGenerateSchema("create"); - source.initialize(new RepositoryContext() { + // Override the inherited properties ... + source.setCompressData(true); - private final ExecutionContext context = new ExecutionContext(); - - public Subgraph getConfiguration( int depth ) { - return null; - } - - public ExecutionContext getExecutionContext() { - return context; - } - - public Observer getObserver() { - return null; - } - - public RepositoryConnectionFactory getRepositoryConnectionFactory() { - return null; - } - - }); - return source; } Index: extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java =================================================================== --- extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java (revision 1407) +++ extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java (working copy) @@ -24,14 +24,10 @@ package org.jboss.dna.connector.store.jpa.model.simple; import org.jboss.dna.connector.store.jpa.JpaSource; -import org.jboss.dna.graph.ExecutionContext; +import org.jboss.dna.connector.store.jpa.TestEnvironment; import org.jboss.dna.graph.Graph; -import org.jboss.dna.graph.Subgraph; -import org.jboss.dna.graph.connector.RepositoryConnectionFactory; -import org.jboss.dna.graph.connector.RepositoryContext; import org.jboss.dna.graph.connector.RepositorySource; import org.jboss.dna.graph.connector.test.WritableConnectorTest; -import org.jboss.dna.graph.observe.Observer; public class SimpleJpaConnectorWritableTest extends WritableConnectorTest { @@ -43,41 +39,12 @@ @Override protected RepositorySource setUpSource() { // Set the connection properties using the environment defined in the POM files ... - JpaSource source = new JpaSource(); - + JpaSource source = TestEnvironment.configureJpaSource("Test Repository", this); source.setModel(JpaSource.Models.SIMPLE.getName()); - source.setName("SimpleJpaSource"); - source.setDialect("org.hibernate.dialect.HSQLDialect"); - source.setDriverClassName("org.hsqldb.jdbcDriver"); - source.setUsername("sa"); - source.setPassword(""); - source.setUrl("jdbc:hsqldb:mem:test"); - source.setShowSql(false); - source.setAutoGenerateSchema("create"); - source.setReferentialIntegrityEnforced(false); - source.initialize(new RepositoryContext() { + // Override the inherited properties ... + source.setCompressData(true); - private final ExecutionContext context = new ExecutionContext(); - - public Subgraph getConfiguration( int depth ) { - return null; - } - - public ExecutionContext getExecutionContext() { - return context; - } - - public Observer getObserver() { - return null; - } - - public RepositoryConnectionFactory getRepositoryConnectionFactory() { - return null; - } - - }); - return source; } Index: extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java =================================================================== --- extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java (revision 1407) +++ extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java (working copy) @@ -49,7 +49,7 @@ source.setDriverClassName("org.hsqldb.jdbcDriver"); source.setUsername("sa"); source.setPassword(""); - source.setUrl("jdbc:hsqldb:."); + source.setUrl("jdbc:hsqldb:mem:."); source.setShowSql(true); source.setAutoGenerateSchema("create"); Index: extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java =================================================================== --- extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java (revision 1406) +++ extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java (working copy) @@ -42,6 +42,7 @@ // Set the connection properties to be an in-memory HSQL database ... JpaSource source = new JpaSource(); source.setName(sourceName); + source.setModel(JpaSource.Models.BASIC.getName()); source.setDialect(properties.getProperty("jpaSource.dialect")); source.setDriverClassName(properties.getProperty("jpaSource.driverClassName")); source.setUsername(properties.getProperty("jpaSource.username"));