Author: bcarothers
Date: 2009-12-05 18:21:03 -0500 (Sat, 05 Dec 2009)
New Revision: 1408
Modified:
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
trunk/docs/reference/src/main/docbook/en-US/custom.dtd
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
Log:
DNA-577
Applied patch that changes the default setting in JpaSource and updates the reference
guide. I changed the sub-sections to be of style <sect1> instead of <sect2> to
be compliant with the DTD for the enclosing <chapter> tag. This cleans up an error
in the Eclipse Docbook editor.
The patch also re-adds a test that was overridden a few months ago when DNA-466 was still
open and cleans up some of the existing connector-level tests for the simple model.
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java 2009-12-05 02:53:36 UTC
(rev 1407)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/DnaTckTest.java 2009-12-05 23:21:03 UTC
(rev 1408)
@@ -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 @@
}
}
-
}
Modified: trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml
===================================================================
---
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/docs/reference/src/main/docbook/en-US/content/connectors/jdbc_storage.xml 2009-12-05
23:21:03 UTC (rev 1408)
@@ -56,9 +56,9 @@
<entry>The name of the repository source, which is used by the
&RepositoryService; when obtaining a &RepositoryConnection; by
name.</entry>
</row>
<row>
- <entry>supportsUpdates</entry>
+ <entry>supportsUpdates (Basic Model Only)</entry>
<entry>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".</entry>
+ The default value is "true". This property is ignored by the Simple
Model (q.v., the model property below)</entry>
</row>
<row>
<entry>rootNodeUuid</entry>
@@ -104,7 +104,7 @@
<row>
<entry>driverClassloaderName</entry>
<entry>
- The name of the <link linkend="class_loader_factory">class loader
or classpath</link> that should be used to load the JDBC driver class.
+ The name of the <!-- link linkend="class_loader_factory" -->class
loader or classpath<!-- /link --> that should be used to load the JDBC driver
class.
This is not required if the DataSource is found in JNDI.
</entry>
</row>
@@ -173,11 +173,12 @@
</entry>
</row>
<row>
- <entry>referentialIntegrityEnforced</entry>
+ <entry>referentialIntegrityEnforced (Basic Model Only)</entry>
<entry>
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".
</entry>
</row>
@@ -202,8 +203,13 @@
<row>
<entry>model</entry>
<entry>
- 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".
</entry>
</row>
<row>
@@ -278,11 +284,11 @@
<para>
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.
</para>
- <sect2>
+ <sect1>
<title>Basic Model</title>
<para>
This database schema model stores node properties as opaque records and children as
transparent records.
@@ -293,6 +299,11 @@
<itemizedlist>
<listitem>
<para>
+ Workspaces - the set of workspaces and their names.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
Namespaces - the set of namespace URIs used in paths, property names, and property
values.
</para>
</listitem>
@@ -326,13 +337,6 @@
Subgraph - a working area for efficiently computing the space of a subgraph; see
below
</para>
</listitem>
- <!--listitem>
- <para>
- 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.
- </para>
- </listitem-->
<listitem>
<para>
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.
</para>
<para>
- This subgraph query mechanism is extremely efficient, performing one join/insert
statement <i>per level of the subgraph</i>,
+ This subgraph query mechanism is extremely efficient, performing one join/insert
statement <emphasis>per level of the subgraph</emphasis>,
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.
</para>
- </sect2>
+ </sect1>
+ <sect1>
+ <title>Simple Model</title>
+ <para>
+ 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.
+ </para>
+ <para>
+ The set of tables used in this model includes:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Workspaces - the set of workspaces and their names.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Namespaces - the set of namespace URIs used in paths, property names, and property
values.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 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.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 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.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Subgraph - a working area for efficiently computing the space of a subgraph; see
below
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Options - the parameters for this store's configuration (common to all
models)
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ 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.
+ </para>
+ <para>
+ 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.
+ </para>
+ </sect1>
</chapter>
Modified: trunk/docs/reference/src/main/docbook/en-US/custom.dtd
===================================================================
--- trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-05 02:53:36 UTC (rev
1407)
+++ trunk/docs/reference/src/main/docbook/en-US/custom.dtd 2009-12-05 23:21:03 UTC (rev
1408)
@@ -60,6 +60,7 @@
<!ENTITY BigDecimal "<ulink
url='&Java;java/math/BigDecimal.html'><classname>BigDecimal</classname></ulink>">
<!ENTITY Calendar "<ulink
url='&Java;java/util/Calendar.html'><classname>Calendar</classname></ulink>">
<!ENTITY Date "<ulink
url='&Java;java/util/Date.html'><classname>Date</classname></ulink>">
+<!ENTITY EntityManagerFactory "<ulink
url='&Java;javax/persistence/EntityManagerFactory.html'><classname>EntityManagerFactory</classname></ulink>">
<!-- Types in JCR API -->
@@ -139,6 +140,8 @@
<!ENTITY RemovePropertyRequest "<ulink
url='&API;graph/request/RemovePropertyRequest.html'><classname>RemovePropertyRequest</classname></ulink>">
<!ENTITY CreateNodeRequest "<ulink
url='&API;graph/request/CreateNodeRequest.html'><classname>CreateNodeRequest</classname></ulink>">
<!ENTITY CopyBranchRequest "<ulink
url='&API;graph/request/CopyBranchRequest.html'><classname>CopyBranchRequest</classname></ulink>">
+<!ENTITY ReadBranchRequest "<ulink
url='&API;graph/request/ReadBranchRequest.html'><classname>ReadBranchRequest</classname></ulink>">
+<!ENTITY MoveBranchRequest "<ulink
url='&API;graph/request/MoveBranchRequest.html'><classname>MoveBranchRequest</classname></ulink>">
<!ENTITY DeleteBranchRequest "<ulink
url='&API;graph/request/DeleteBranchRequest.html'><classname>DeleteBranchRequest</classname></ulink>">
<!ENTITY InvalidRequestException "<ulink
url='&API;graph/request/InvalidRequestException.html'><classname>InvalidRequestException</classname></ulink>">
<!ENTITY InvalidWorkspaceException "<ulink
url='&API;graph/request/InvalidWorkspaceException.html'><classname>InvalidWorkspaceException</classname></ulink>">
Modified:
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/extensions/dna-connector-store-jpa/src/main/java/org/jboss/dna/connector/store/jpa/JpaSource.java 2009-12-05
23:21:03 UTC (rev 1408)
@@ -79,7 +79,7 @@
private static final Model[] ALL_ARRAY = new Model[] {BASIC, SIMPLE};
private static final List<Model> MODIFIABLE_MODELS = new
ArrayList<Model>(Arrays.asList(ALL_ARRAY));
public static final Collection<Model> 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");
Modified:
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/TestEnvironment.java 2009-12-05
23:21:03 UTC (rev 1408)
@@ -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"));
Modified:
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorReadableTest.java 2009-12-05
23:21:03 UTC (rev 1408)
@@ -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;
}
Modified:
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaConnectorWritableTest.java 2009-12-05
23:21:03 UTC (rev 1408)
@@ -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;
}
Modified:
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java
===================================================================
---
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-05
02:53:36 UTC (rev 1407)
+++
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/model/simple/SimpleJpaSourceTest.java 2009-12-05
23:21:03 UTC (rev 1408)
@@ -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");