DNA SVN: r1499 - in trunk: utils/dna-jpa-ddl-gen and 1 other directory.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-30 18:45:35 -0500 (Wed, 30 Dec 2009)
New Revision: 1499
Modified:
trunk/extensions/dna-sequencer-text/pom.xml
trunk/utils/dna-jpa-ddl-gen/pom.xml
Log:
Fixed branding in POM project name
Modified: trunk/extensions/dna-sequencer-text/pom.xml
===================================================================
--- trunk/extensions/dna-sequencer-text/pom.xml 2009-12-30 22:08:10 UTC (rev 1498)
+++ trunk/extensions/dna-sequencer-text/pom.xml 2009-12-30 23:45:35 UTC (rev 1499)
@@ -9,7 +9,7 @@
<!-- The groupId and version values are inherited from parent -->
<artifactId>dna-sequencer-text</artifactId>
<packaging>jar</packaging>
- <name>JBoss Text File Sequencer</name>
+ <name>JBoss DNA Text File Sequencer</name>
<description>JBoss DNA Sequencer that processes fixed width and delimited text files</description>
<url>http://labs.jboss.org/dna</url>
<dependencies>
Modified: trunk/utils/dna-jpa-ddl-gen/pom.xml
===================================================================
--- trunk/utils/dna-jpa-ddl-gen/pom.xml 2009-12-30 22:08:10 UTC (rev 1498)
+++ trunk/utils/dna-jpa-ddl-gen/pom.xml 2009-12-30 23:45:35 UTC (rev 1499)
@@ -10,7 +10,7 @@
<!-- The groupId and version values are inherited from parent -->
<artifactId>dna-jpa-ddl-gen</artifactId>
<packaging>jar</packaging>
- <name>JBoss JPA Connector DDL Generator</name>
+ <name>JBoss DNA JPA Connector DDL Generator</name>
<description>
Utility application to generate ddl for JBoss DNA JPA connector
</description>
14 years, 4 months
DNA SVN: r1498 - in trunk/docs: examples/gettingstarted/repositories/src/main/resources and 3 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-30 17:08:10 -0500 (Wed, 30 Dec 2009)
New Revision: 1498
Removed:
trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties
Modified:
trunk/docs/examples/gettingstarted/repositories/pom.xml
trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml
trunk/docs/examples/gettingstarted/repositories/src/main/resources/log4j.properties
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java
trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml
Log:
DNA-464 Add use of file system connector to repositories example
Applied patch that also adds a JPA repository to the example to demonstrate that connector.
Modified: trunk/docs/examples/gettingstarted/repositories/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/pom.xml 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/examples/gettingstarted/repositories/pom.xml 2009-12-30 22:08:10 UTC (rev 1498)
@@ -39,6 +39,16 @@
<artifactId>dna-connector-filesystem</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-store-jpa</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.2</version>
+ </dependency>
<!--
Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for running)
-->
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml 2009-12-30 22:08:10 UTC (rev 1498)
@@ -36,14 +36,37 @@
-->
<dna:source jcr:name="Cars" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource" dna:retryLimit="3" dna:defaultWorkspaceName="workspace1"/>
<!--
- The 'Aircraft' repository is also an in-memory source with a single default workspace.
+ The 'Aircraft' repository is also a JPA source (pointing to an in-memory HSQL database with a single default workspace.
By defining a default workspace, the clients using the Graph API will by default use that workspace,
but can easily say to use other workspaces (or create, clone, or destroy workspaces).
+
+ If you wanted to use a JNDI datasource instead of manually specifying the database login information, you would replace this:
+ dna:driverClassName="org.hsqldb.jdbcDriver"
+ dna:username="sa"
+ dna:password=""
+ dna:url="jdbc:hsqldb:mem:target"
+
+ With this:
+ dna:dataSourceJndiName="your JNDI name"
-->
- <dna:source jcr:name="Aircraft" dna:classname="org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource">
- <!-- Define the name of the workspace used by default. Optional, but convenient. -->
- <defaultWorkspaceName>workspace2</defaultWorkspaceName>
- </dna:source>
+ <dna:source jcr:name="Aircraft" dna:classname="org.jboss.dna.connector.store.jpa.JpaSource"
+ dna:model="Simple"
+ dna:dialect="org.hibernate.dialect.HSQLDialect"
+ dna:driverClassName="org.hsqldb.jdbcDriver"
+ dna:username="sa"
+ dna:password=""
+ dna:url="jdbc:hsqldb:mem:target"
+ dna:maximumConnectionsInPool="1"
+ dna:referentialIntegrityEnforced="true"
+ dna:largeValueSizeInBytes="10000"
+ dna:retryLimit="3"
+ dna:compressData="false"
+ dna:predefinedWorkspaceNames="workspace2"
+ dna:showSql="false"
+ dna:autoGenerateSchema="create"
+ dna:creatingWorkspacesAllowed="true"
+ dna:defaultWorkspaceName="workspace2" />
+
<!--
The 'UFO' repository is a file system source with a single default workspace. The file system connector exposes
files and folders as JCR nodes. It can save JCR nodes too, but only if they have certain primary types.
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/resources/log4j.properties
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/log4j.properties 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/log4j.properties 2009-12-30 22:08:10 UTC (rev 1498)
@@ -8,6 +8,8 @@
log4j.rootLogger=INFO, stdout
# Set up the default logging to be INFO level, then override specific units
+log4j.logger.org.hibernate=WARN
+log4j.logger.com.mchange=WARN
log4j.logger.org.jboss.dna=INFO
log4j.logger.org.jboss.example.dna=INFO
Modified: trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java 2009-12-30 22:08:10 UTC (rev 1498)
@@ -326,7 +326,17 @@
assertThat(client.getNodeInfo("Cars", "/Cars/Sports/Non Existant Car", properties, children), is(false));
}
+ @Ignore
@Test
+ public void shouldNotFreezeIfWrongNodeEntered() throws Throwable {
+ client.startRepositories();
+
+ Map<String, Object[]> properties = new HashMap<String, Object[]>();
+ List<String> children = new ArrayList<String>();
+ client.getNodeInfo("Vehicles", "/Vehicles/foo", properties, children);
+ }
+
+ @Test
public void shouldBeAbleToExecuteTestsRepeatedly() throws Throwable {
for (int i = 0; i != 5; ++i) {
// shouldHaveContentFromConfigurationRepository();
Deleted: trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/examples/gettingstarted/repositories/src/test/resources/log4j.properties 2009-12-30 22:08:10 UTC (rev 1498)
@@ -1,19 +0,0 @@
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %m%n
-
-# Root logger option
-log4j.rootLogger=WARNING, stdout
-
-# Set up the default logging to be INFO level, then override specific units
-log4j.logger.org.jboss.dna=ERROR
-log4j.logger.org.jboss.dna.connector.federation=TRACE
-#log4j.logger.org.jboss.dna.repository.sequencers=TRACE
-#log4j.logger.org.jboss.dna.sequencer=DEBUG
-#log4j.logger.org.jboss.dna.connector=TRACE
-#log4j.logger.org.jboss.dna.spi.connector.RepositoryConnectionPool=TRACE
-#log4j.logger.org.jboss.dna.spi=DEBUG
-#log4j.logger.org.jboss.example.dna=TRACE
-
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml
===================================================================
--- trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml 2009-12-30 20:39:18 UTC (rev 1497)
+++ trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml 2009-12-30 22:08:10 UTC (rev 1498)
@@ -47,7 +47,8 @@
<title>Repositories used in the example client</title>
<graphic align="center" scale="60" fileref="example-repositories.png"/>
</figure>
- The "Cars" and "Airplanes" repositories are in-memory repositories (using the In-Memory repository connector) and the "UFOs" repository is
+ The "Cars" repository is an in-memory repository (using the In-Memory repository connector), the "Aircraft" repository is a JPA repository
+ (although it points to an in-memory HSQL database using the JPA repository connector), and the "UFOs" repository is
a file system repository (using the File System repository connector). The federated "Vehicles" repository
content is federated from the other repositories and cached into the "Cache" repository. This is shown in the following figure:
<figure id="example-federated-repository">
14 years, 4 months
DNA SVN: r1497 - in trunk/docs/gettingstarted/src/main/docbook/en-US/images: example-federated-repository.graffle and 3 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-30 15:39:18 -0500 (Wed, 30 Dec 2009)
New Revision: 1497
Modified:
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/QuickLook/Preview.pdf
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/QuickLook/Thumbnail.tiff
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/data.plist
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.png
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/QuickLook/Preview.pdf
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/QuickLook/Thumbnail.tiff
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/data.plist
trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.png
Log:
DNA-464 Add use of file system connector to repositories example
Updated the example-repositories.png and example-federated-repository.png diagrams with the new UFOs source (using the File System connector) and changing the Aircraft source to use the JPA connector.
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/QuickLook/Preview.pdf
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/QuickLook/Thumbnail.tiff
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/data.plist
===================================================================
--- trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/data.plist 2009-12-30 20:39:00 UTC (rev 1496)
+++ trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.graffle/data.plist 2009-12-30 20:39:18 UTC (rev 1497)
@@ -7,7 +7,7 @@
<key>ApplicationVersion</key>
<array>
<string>com.omnigroup.OmniGraffle</string>
- <string>137.11.0.108132</string>
+ <string>138.12.0.121252</string>
</array>
<key>AutoAdjust</key>
<true/>
@@ -50,7 +50,121 @@
<key>GraphicsList</key>
<array>
<dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>Head</key>
+ <dict>
+ <key>ID</key>
+ <integer>179</integer>
+ </dict>
+ <key>ID</key>
+ <integer>181</integer>
+ <key>Points</key>
+ <array>
+ <string>{256.406, 215.02}</string>
+ <string>{307.651, 260.72}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>TailArrow</key>
+ <string>FilledArrow</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>165</integer>
+ </dict>
+ </dict>
+ <dict>
<key>Bounds</key>
+ <string>{{301.962, 310}, {52, 13}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>Vertical</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica-Bold</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>180</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\b\fs22 \cf0 UFOs}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{307.651, 257}, {40.6226, 43.9593}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>179</integer>
+ <key>ImageID</key>
+ <integer>1</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
<string>{{166.961, 71}, {162, 44}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
@@ -102,7 +216,7 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -156,8 +270,8 @@
<integer>169</integer>
<key>Points</key>
<array>
- <string>{252.614, 215.02}</string>
- <string>{274.135, 255.02}</string>
+ <string>{248.874, 215.02}</string>
+ <string>{247.307, 257}</string>
</array>
<key>Style</key>
<dict>
@@ -187,8 +301,8 @@
<integer>168</integer>
<key>Points</key>
<array>
- <string>{245.4, 215.02}</string>
- <string>{222.529, 255.02}</string>
+ <string>{241.858, 215.02}</string>
+ <string>{190.584, 260.936}</string>
</array>
<key>Style</key>
<dict>
@@ -249,7 +363,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -291,7 +405,7 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{259.961, 308.02}, {52, 13}}</string>
+ <string>{{220.273, 310}, {52, 13}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -332,7 +446,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -344,7 +458,7 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{265.65, 255.02}, {40.6226, 43.9593}}</string>
+ <string>{{225.962, 257}, {40.6226, 43.9593}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -374,7 +488,7 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{183.961, 308.02}, {52, 13}}</string>
+ <string>{{144.273, 310}, {52, 13}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -415,7 +529,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -427,7 +541,7 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{189.65, 255.02}, {40.6226, 43.9593}}</string>
+ <string>{{149.962, 257}, {40.6226, 43.9593}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -511,7 +625,7 @@
<key>MasterSheets</key>
<array/>
<key>ModificationDate</key>
- <string>2009-06-04 22:36:51 -0500</string>
+ <string>2009-12-30 14:26:19 -0600</string>
<key>Modifier</key>
<string>Randall Hauch</string>
<key>NotesVisible</key>
@@ -577,7 +691,7 @@
<key>ExpandedCanvases</key>
<array/>
<key>Frame</key>
- <string>{{314, 187}, {710, 884}}</string>
+ <string>{{157, 197}, {710, 884}}</string>
<key>ListView</key>
<true/>
<key>OutlineWidth</key>
@@ -591,7 +705,7 @@
<key>SidebarWidth</key>
<integer>120</integer>
<key>VisibleRegion</key>
- <string>{{0, 0}, {575, 733}}</string>
+ <string>{{0, 0}, {561, 716}}</string>
<key>Zoom</key>
<real>1</real>
<key>ZoomValues</key>
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-federated-repository.png
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/QuickLook/Preview.pdf
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/QuickLook/Thumbnail.tiff
===================================================================
(Binary files differ)
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/data.plist
===================================================================
--- trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/data.plist 2009-12-30 20:39:00 UTC (rev 1496)
+++ trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.graffle/data.plist 2009-12-30 20:39:18 UTC (rev 1497)
@@ -7,7 +7,7 @@
<key>ApplicationVersion</key>
<array>
<string>com.omnigroup.OmniGraffle</string>
- <string>137.11.0.108132</string>
+ <string>138.12.0.121252</string>
</array>
<key>AutoAdjust</key>
<true/>
@@ -51,7 +51,7 @@
<array>
<dict>
<key>Bounds</key>
- <string>{{293.161, 277}, {62.4553, 13}}</string>
+ <string>{{369.162, 277}, {62.4553, 13}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>FitText</key>
@@ -66,7 +66,7 @@
<real>12</real>
</dict>
<key>ID</key>
- <integer>185</integer>
+ <integer>189</integer>
<key>Shape</key>
<string>Rectangle</string>
<key>Style</key>
@@ -92,7 +92,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -103,7 +103,169 @@
</dict>
</dict>
<dict>
+ <key>Class</key>
+ <string>LineGraphic</string>
+ <key>ID</key>
+ <integer>188</integer>
+ <key>Points</key>
+ <array>
+ <string>{321.209, 159}</string>
+ <string>{404.23, 214}</string>
+ </array>
+ <key>Style</key>
+ <dict>
+ <key>stroke</key>
+ <dict>
+ <key>HeadArrow</key>
+ <string>0</string>
+ <key>TailArrow</key>
+ <string>FilledArrow</string>
+ </dict>
+ </dict>
+ <key>Tail</key>
+ <dict>
+ <key>ID</key>
+ <integer>134</integer>
+ </dict>
+ </dict>
+ <dict>
<key>Bounds</key>
+ <string>{{374.39, 264}, {52, 13}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>Vertical</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica-Bold</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>187</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\b\fs22 \cf0 Vehicles}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{380.079, 214}, {40.6226, 43.9593}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>ID</key>
+ <integer>186</integer>
+ <key>ImageID</key>
+ <integer>1</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
+ <string>{{288, 277}, {71.839, 13}}</string>
+ <key>Class</key>
+ <string>ShapedGraphic</string>
+ <key>FitText</key>
+ <string>Vertical</string>
+ <key>Flow</key>
+ <string>Resize</string>
+ <key>FontInfo</key>
+ <dict>
+ <key>Font</key>
+ <string>Helvetica</string>
+ <key>Size</key>
+ <real>12</real>
+ </dict>
+ <key>ID</key>
+ <integer>190</integer>
+ <key>Shape</key>
+ <string>Rectangle</string>
+ <key>Style</key>
+ <dict>
+ <key>fill</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>shadow</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ <key>stroke</key>
+ <dict>
+ <key>Draws</key>
+ <string>NO</string>
+ </dict>
+ </dict>
+ <key>Text</key>
+ <dict>
+ <key>Pad</key>
+ <integer>0</integer>
+ <key>Text</key>
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
+{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
+{\colortbl;\red255\green255\blue255;}
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
+
+\f0\i\fs22 \cf0 (File System)}</string>
+ <key>VerticalPad</key>
+ <integer>0</integer>
+ </dict>
+ </dict>
+ <dict>
+ <key>Bounds</key>
<string>{{217.161, 277}, {62.4553, 13}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
@@ -145,12 +307,12 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-\f0\i\fs22 \cf0 (In-Memory)}</string>
+\f0\i\fs22 \cf0 (JPA)}</string>
<key>VerticalPad</key>
<integer>0</integer>
</dict>
@@ -198,7 +360,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -215,7 +377,7 @@
<integer>175</integer>
<key>Points</key>
<array>
- <string>{269.926, 159}</string>
+ <string>{298.219, 159}</string>
<string>{323.767, 214}</string>
</array>
<key>Style</key>
@@ -246,8 +408,8 @@
<integer>174</integer>
<key>Points</key>
<array>
- <string>{248.389, 159}</string>
- <string>{248.389, 214}</string>
+ <string>{279.198, 159}</string>
+ <string>{257.191, 214}</string>
</array>
<key>Style</key>
<dict>
@@ -272,7 +434,7 @@
<integer>173</integer>
<key>Points</key>
<array>
- <string>{229.847, 159}</string>
+ <string>{258.382, 159}</string>
<string>{182.078, 215.678}</string>
</array>
<key>Style</key>
@@ -293,7 +455,7 @@
</dict>
<dict>
<key>Bounds</key>
- <string>{{167.389, 115}, {162, 44}}</string>
+ <string>{{207, 115}, {162, 44}}</string>
<key>Class</key>
<string>ShapedGraphic</string>
<key>ID</key>
@@ -344,7 +506,7 @@
<key>Text</key>
<dict>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -396,12 +558,12 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
-\f0\b\fs22 \cf0 Vehicles}</string>
+\f0\b\fs22 \cf0 UFOs}</string>
<key>VerticalPad</key>
<integer>0</integer>
</dict>
@@ -479,7 +641,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -562,7 +724,7 @@
<key>Pad</key>
<integer>0</integer>
<key>Text</key>
- <string>{\rtf1\ansi\ansicpg1252\cocoartf949\cocoasubrtf460
+ <string>{\rtf1\ansi\ansicpg1252\cocoartf1038\cocoasubrtf250
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\qc\pardirnatural
@@ -658,7 +820,7 @@
<key>MasterSheets</key>
<array/>
<key>ModificationDate</key>
- <string>2009-06-04 22:36:27 -0500</string>
+ <string>2009-12-30 14:25:44 -0600</string>
<key>Modifier</key>
<string>Randall Hauch</string>
<key>NotesVisible</key>
@@ -729,7 +891,7 @@
</dict>
</array>
<key>Frame</key>
- <string>{{288, 237}, {710, 884}}</string>
+ <string>{{524, 255}, {710, 884}}</string>
<key>ListView</key>
<true/>
<key>OutlineWidth</key>
@@ -743,7 +905,7 @@
<key>SidebarWidth</key>
<integer>120</integer>
<key>VisibleRegion</key>
- <string>{{0, 0}, {575, 733}}</string>
+ <string>{{0, 0}, {561, 716}}</string>
<key>Zoom</key>
<real>1</real>
<key>ZoomValues</key>
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/images/example-repositories.png
===================================================================
(Binary files differ)
14 years, 4 months
DNA SVN: r1496 - trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-30 15:39:00 -0500 (Wed, 30 Dec 2009)
New Revision: 1496
Modified:
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java
Log:
DNA-606 RepositoryConnectionPool Returns Invalid Connections to the Available Pool
Applied patch that turns on connection validation and modifies the validateConnection(...) method to remove invalid connections from the in-use pool rather than returning them to the available pool.
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java 2009-12-30 20:18:42 UTC (rev 1495)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/RepositoryConnectionPool.java 2009-12-30 20:39:00 UTC (rev 1496)
@@ -142,7 +142,7 @@
/**
* Flag specifying whether a connection should be validated before returning it from the {@link #getConnection()} method.
*/
- private final AtomicBoolean validateConnectionBeforeUse = new AtomicBoolean(false);
+ private final AtomicBoolean validateConnectionBeforeUse = new AtomicBoolean(true);
/**
* The time in nanoseconds that ping should wait before timing out and failing.
@@ -648,7 +648,7 @@
if (runState == TERMINATED) return true;
if (nanos <= 0) return false;
nanos = termination.awaitNanos(nanos);
- //this.logger.trace("---> Done waiting: run state = {0}; condition = {1}, {2} open",runState,termination,poolSize)
+ // this.logger.trace("---> Done waiting: run state = {0}; condition = {1}, {2} open",runState,termination,poolSize)
// ;
}
} finally {
@@ -821,8 +821,15 @@
}
} finally {
if (invalidConnection != null) {
- connection = null;
- returnConnection(invalidConnection);
+ try {
+ mainLock.lock();
+ connection = null;
+ this.poolSize--;
+ this.inUseConnections.remove(connection);
+ // returnConnection(invalidConnection);
+ } finally {
+ mainLock.unlock();
+ }
}
}
return connection;
14 years, 4 months
DNA SVN: r1495 - in trunk: extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem and 2 other directories.
by dna-commits@lists.jboss.org
Author: rhauch
Date: 2009-12-30 15:18:42 -0500 (Wed, 30 Dec 2009)
New Revision: 1495
Modified:
trunk/.gitignore
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java
trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java
trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemSourceTest.java
trunk/utils/dna-jpa-ddl-gen/.classpath
Log:
Corrected several compiler warnings related to JavaDoc and generated-accessors. Also fixed the .classpath file for the DDL generator project.
Modified: trunk/.gitignore
===================================================================
--- trunk/.gitignore 2009-12-30 01:15:22 UTC (rev 1494)
+++ trunk/.gitignore 2009-12-30 20:18:42 UTC (rev 1495)
@@ -64,6 +64,7 @@
/extensions/dna-sequencer-jbpm-jpdl/target
/extensions/dna-sequencer-mp3/target
/extensions/dna-sequencer-msoffice/target
+/extensions/dna-sequencer-text/target
/extensions/dna-sequencer-xml/target
/extensions/dna-sequencer-zip/target
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java 2009-12-30 01:15:22 UTC (rev 1494)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/FileSystemRepository.java 2009-12-30 20:18:42 UTC (rev 1495)
@@ -77,7 +77,7 @@
public class FileSystemRepository extends WritablePathRepository {
private static final String DEFAULT_MIME_TYPE = "application/octet";
- private final FileSystemSource source;
+ protected final FileSystemSource source;
private File repositoryRoot;
public FileSystemRepository( FileSystemSource source ) {
@@ -685,15 +685,15 @@
}
/**
- * Recursively checks if any of the files in the tree rooted at {@code root} would exceed the {@link #maxPathLength
- * maximum path length for the processor} if their paths were {@code delta} characters longer. If any files would exceed
- * this length, a {@link RepositorySourceException} is thrown.
+ * Recursively checks if any of the files in the tree rooted at {@code root} would exceed the
+ * {@link FileSystemSource#getMaxPathLength() maximum path length for the processor} if their paths were {@code delta}
+ * characters longer. If any files would exceed this length, a {@link RepositorySourceException} is thrown.
*
* @param root the root of the tree to check; may be a file or directory but may not be null
* @param delta the change in the length of the path to check. Used to preemptively check whether moving a file or
* directory to a new path would violate path length rules
* @throws RepositorySourceException if any files in the tree rooted at {@code root} would exceed this
- * {@link #maxPathLength the maximum path length for this processor}
+ * {@link FileSystemSource#getMaxPathLength() the maximum path length for this processor}
*/
protected void ensureValidPathLength( File root,
int delta ) {
Modified: trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java 2009-12-30 01:15:22 UTC (rev 1494)
+++ trunk/extensions/dna-connector-filesystem/src/main/java/org/jboss/dna/connector/filesystem/package-info.java 2009-12-30 20:18:42 UTC (rev 1495)
@@ -23,7 +23,7 @@
*/
/**
* The classes that make up the connector that accesses the files and directories on a local file system and exposes them as content in a repository.
- * This connector is based on the {@link WritablePathRepository path repository framework}.
+ * This connector is based on the {@link org.jboss.dna.graph.connector.path.WritablePathRepository path repository framework}.
*/
package org.jboss.dna.connector.filesystem;
Modified: trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemSourceTest.java
===================================================================
--- trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemSourceTest.java 2009-12-30 01:15:22 UTC (rev 1494)
+++ trunk/extensions/dna-connector-filesystem/src/test/java/org/jboss/dna/connector/filesystem/FileSystemSourceTest.java 2009-12-30 20:18:42 UTC (rev 1495)
@@ -71,6 +71,7 @@
public RepositoryConnectionFactory getRepositoryConnectionFactory() {
return new RepositoryConnectionFactory() {
+ @SuppressWarnings( "synthetic-access" )
public RepositoryConnection createConnection( String sourceName ) throws RepositorySourceException {
return source.getConnection();
}
Modified: trunk/utils/dna-jpa-ddl-gen/.classpath
===================================================================
--- trunk/utils/dna-jpa-ddl-gen/.classpath 2009-12-30 01:15:22 UTC (rev 1494)
+++ trunk/utils/dna-jpa-ddl-gen/.classpath 2009-12-30 20:18:42 UTC (rev 1495)
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" path="src/test/java"/>
- <classpathentry kind="src" path="src/main/resources"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
</classpath>
14 years, 4 months
DNA SVN: r1494 - in trunk/docs: examples/gettingstarted/repositories/src/main/assembly and 8 other directories.
by dna-commits@lists.jboss.org
Author: bcarothers
Date: 2009-12-29 20:15:22 -0500 (Tue, 29 Dec 2009)
New Revision: 1494
Added:
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/README.txt
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/zzyzx.txt
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/
trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/frobozz.txt
Modified:
trunk/docs/examples/gettingstarted/repositories/pom.xml
trunk/docs/examples/gettingstarted/repositories/src/main/assembly/basic.xml
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java
trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml
trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java
trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml
Log:
DNA-464 Add use of file system connector to repositories example
Applied a patch that adds a file system connector (for UFOs, which are so strange that they can't be placed in a normal in-memory repository!) and updates the tests and documentation accordingly* The patch also removes the need to manually log in to each repository, something I found seriously annoying and impossible to use without reading either the manual or the source code. I can replace the old code if anyone disagrees with this change.
* - I do not have "graffle" installed, so I did not update any of the images in the Repositories Example chapter of the Getting Started Guide
Modified: trunk/docs/examples/gettingstarted/repositories/pom.xml
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/pom.xml 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/pom.xml 2009-12-30 01:15:22 UTC (rev 1494)
@@ -34,6 +34,11 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.dna</groupId>
+ <artifactId>dna-connector-filesystem</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<!--
Logging (require SLF4J API for compiling, but use Log4J and its SLF4J binding for running)
-->
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/assembly/basic.xml
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/assembly/basic.xml 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/assembly/basic.xml 2009-12-30 01:15:22 UTC (rev 1494)
@@ -24,6 +24,10 @@
<directory>src/main/resources/security/</directory>
<outputDirectory/>
</fileSet>
+ <fileSet>
+ <directory>src/main/resources/ufoSource</directory>
+ <outputDirectory>src/main/resources/ufoSource</outputDirectory>
+ </fileSet>
</fileSets>
<files>
<file>
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/ConsoleInput.java 2009-12-30 01:15:22 UTC (rev 1494)
@@ -34,7 +34,7 @@
import java.util.Map;
import javax.security.auth.callback.CallbackHandler;
import org.jboss.dna.common.util.StringUtil;
-import com.sun.security.auth.callback.TextCallbackHandler;
+import org.jboss.dna.graph.JaasSecurityContext;
/**
* The {@link UserInterface} implementation that uses the console.
@@ -323,7 +323,7 @@
* @see org.jboss.example.dna.repository.UserInterface#getCallbackHandler()
*/
public CallbackHandler getCallbackHandler() {
- return new TextCallbackHandler();
+ return new JaasSecurityContext.UserPasswordCallbackHandler("jsmith", "secret".toCharArray());
}
}
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/java/org/jboss/example/dna/repository/RepositoryClient.java 2009-12-30 01:15:22 UTC (rev 1494)
@@ -40,6 +40,7 @@
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import net.jcip.annotations.Immutable;
+import org.jboss.dna.common.collection.Problem;
import org.jboss.dna.common.text.NoOpEncoder;
import org.jboss.dna.common.util.CheckArg;
import org.jboss.dna.graph.ExecutionContext;
@@ -151,6 +152,13 @@
engine = configuration.build();
engine.start();
+ if (engine.getProblems().hasProblems()) {
+ for (Problem problem : engine.getProblems()) {
+ System.err.println(problem.getMessageString());
+ }
+ throw new RuntimeException("Could not start due to problems");
+ }
+
// For this example, we're using a couple of in-memory repositories (including one for the configuration repository).
// Normally, these would exist already and would simply be accessed. But in this example, we're going to
// populate these repositories here by importing from files. First do the configuration repository ...
Modified: trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/configRepository.xml 2009-12-30 01:15:22 UTC (rev 1494)
@@ -45,6 +45,15 @@
<defaultWorkspaceName>workspace2</defaultWorkspaceName>
</dna:source>
<!--
+ The 'UFO' repository is a file system source with a single default workspace. The file system connector exposes
+ files and folders as JCR nodes. It can save JCR nodes too, but only if they have certain primary types.
+ -->
+ <dna:source jcr:name="UFOs" dna:classname="org.jboss.dna.connector.filesystem.FileSystemSource"
+ dna:workspaceRootPath="./src/main/resources/ufoSource"
+ dna:defaultWorkspaceName="workspace1"
+ dna:creatingWorkspacesAllowed="false"
+ dna:updatesAllowed="true"/>
+ <!--
The 'Vehicles' repository is a federated source that owns none of its own content, but instead
projects (in this case) all of the content from the 'Cars' source as if it appears
under '/Vehicles/Cars', while all the 'Aircraft' content appears under '/Vehicles/Aircraft'.
@@ -64,10 +73,14 @@
<dna:projection jcr:name="Cars projection" dna:source="Cars" dna:workspaceName="workspace1">
<dna:projectionRules>/Vehicles/Cars => /Cars</dna:projectionRules>
</dna:projection>
- <!-- Project the 'Aicraft' content, starting with the '/Aircraft' node. -->
+ <!-- Project the 'Aircraft' content, starting with the '/Aircraft' node. -->
<dna:projection jcr:name="Aircarft projection" dna:source="Aircraft" dna:workspaceName="workspace2">
<dna:projectionRules>/Vehicles/Aircraft => /Aircraft</dna:projectionRules>
</dna:projection>
+ <!-- Project the 'UFO' content, starting with the root node. -->
+ <dna:projection jcr:name="UFO projection" dna:source="UFOs" dna:workspaceName="workspace1">
+ <dna:projectionRules>/Vehicles/UFOs => /</dna:projectionRules>
+ </dna:projection>
<!-- Project the 'System' content. Only needed when this source is accessed through JCR. -->
<!-- dna:projection jcr:name="System projection" dna:source="System" dna:workspaceName="default">
<dna:projectionRules>/jcr:system => /</dna:projectionRules>
@@ -149,6 +162,22 @@
</dna:options>
</dna:repository>
<!--
+ Define a JCR repository that accesses the 'UFO' source directly.
+ This of course is optional, since we could access the same content through 'vehicles'.
+ -->
+ <dna:repository jcr:name="UFOs">
+ <!-- Specify the source that should be used for the repository -->
+ <dna:source>UFOs</dna:source>
+ <!-- Define the options for the JCR repository, using camelcase version of JcrRepository.Option names -->
+ <dna:options jcr:primaryType="dna:options">
+ <jaasLoginConfigName jcr:primaryType="dna:option" dna:value="dna-jcr"/>
+ </dna:options>
+ <!-- Define any custom node types. Importing CND files via JcrConfiguration is equivalent to specifying here. -->
+ <dna:nodeTypes jcr:primaryType="dna:nodeTypes"/>
+ <!-- Define any namespaces for this repository, other than those already defined by JCR or DNA -->
+ <namespaces jcr:primaryType="dna:namespaces" />
+ </dna:repository>
+ <!--
Define a JCR repository that accesses the 'Vehicles' federated source directly,
which is defined in the sources to be a projection of the 'Cars' and 'Vehicles' content.
-->
Added: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/README.txt
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/README.txt (rev 0)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/README.txt 2009-12-30 01:15:22 UTC (rev 1494)
@@ -0,0 +1 @@
+This workspace contains skeletal information on unconfirmed UFOs.
\ No newline at end of file
Property changes on: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/README.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/zzyzx.txt
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/zzyzx.txt (rev 0)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/zzyzx.txt 2009-12-30 01:15:22 UTC (rev 1494)
@@ -0,0 +1,2 @@
+The Zzyzx is the fastest vehicle in the Martian fleet. It has spinning lasers and can drop
+disintegration bombs on unsuspecting targets.
Property changes on: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/martians/zzyzx.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/frobozz.txt
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/frobozz.txt (rev 0)
+++ trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/frobozz.txt 2009-12-30 01:15:22 UTC (rev 1494)
@@ -0,0 +1 @@
+The Venutian Frobozz travels faster than the speed of light and fires a death ray.
\ No newline at end of file
Property changes on: trunk/docs/examples/gettingstarted/repositories/src/main/resources/ufoSource/workspace1/venutians/frobozz.txt
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java
===================================================================
--- trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/examples/gettingstarted/repositories/src/test/java/org/jboss/example/dna/repository/RepositoryClientTest.java 2009-12-30 01:15:22 UTC (rev 1494)
@@ -34,6 +34,7 @@
import java.util.Map;
import javax.security.auth.callback.CallbackHandler;
import org.jboss.dna.graph.JaasSecurityContext;
+import org.jboss.dna.graph.property.Binary;
import org.jboss.security.config.IDTrustConfiguration;
import org.junit.After;
import org.junit.Before;
@@ -94,6 +95,14 @@
assertThat(actualValues, is(values));
}
+ protected String string( Object rawValue ) {
+ if (rawValue instanceof Binary) {
+ return new String(((Binary)rawValue).getBytes());
+ }
+
+ return rawValue.toString();
+ }
+
protected void getNodeInfo( String source,
String path ) throws Throwable {
properties.clear();
@@ -239,6 +248,27 @@
}
@Test
+ public void shouldHaveContentFromUfosRepository() throws Throwable {
+ client.startRepositories();
+
+ getNodeInfo("UFOs", "/");
+ assertThat(children, hasItems("martians", "venutians", "README.txt"));
+ assertThat(properties.containsKey("jcr:primaryType"), is(true));
+
+ getNodeInfo("UFOs", "/martians/zzyzx.txt");
+ assertThat(children, hasItems("jcr:content"));
+ assertThat(properties.containsKey("jcr:primaryType"), is(true));
+
+ getNodeInfo("UFOs", "/martians/zzyzx.txt/jcr:content");
+ assertThat(children.size(), is(0));
+ assertThat(properties.containsKey("jcr:primaryType"), is(true));
+
+ assertThat(string(properties.get("jcr:data")[0]).startsWith("The Zzyzx is the fastest vehicle in the Martian fleet."),
+ is(true));
+
+ }
+
+ @Test
public void shouldHaveContentFromVehiclesRepository() throws Throwable {
client.startRepositories();
@@ -282,6 +312,12 @@
assertProperty("maxSpeed", "30mph");
assertProperty("emptyWeight", "605lb");
assertProperty("crew", "1");
+
+ getNodeInfo("Vehicles", "/Vehicles/UFOs/martians/zzyzx.txt/jcr:content");
+ assertThat(children.size(), is(0));
+ assertThat(properties.containsKey("jcr:primaryType"), is(true));
+ assertThat(string(properties.get("jcr:data")[0]).startsWith("The Zzyzx is the fastest vehicle in the Martian fleet."),
+ is(true));
}
@Test
@@ -296,6 +332,7 @@
// shouldHaveContentFromConfigurationRepository();
shouldHaveContentFromCarsRepository();
shouldHaveContentFromAircraftRepository();
+ shouldHaveContentFromUfosRepository();
shouldHaveContentFromVehiclesRepository();
}
}
Modified: trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml
===================================================================
--- trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml 2009-12-29 22:48:24 UTC (rev 1493)
+++ trunk/docs/gettingstarted/src/main/docbook/en-US/content/repository_example.xml 2009-12-30 01:15:22 UTC (rev 1494)
@@ -38,7 +38,7 @@
</para>
<sect1 id="running_repository_example">
<title>Running the repository example</title>
- <para>The repository example consists of a client application that sets up two DNA repositories (named "Cars" and "Airplanes") and
+ <para>The repository example consists of a client application that sets up three DNA repositories (named "Cars", "Airplanes", and "UFOs") and
a federated repository ("Vehicles") that dynamically federates the information from the other two repositories.
The client application allows you to interactively navigate each of these repositories just as you would navigate the
directory structure on a file system.</para>
@@ -47,10 +47,11 @@
<title>Repositories used in the example client</title>
<graphic align="center" scale="60" fileref="example-repositories.png"/>
</figure>
- Most of the repositories are in-memory repositories (using the In-Memory repository connector), but the federated "Vehicles" repository
+ The "Cars" and "Airplanes" repositories are in-memory repositories (using the In-Memory repository connector) and the "UFOs" repository is
+ a file system repository (using the File System repository connector). The federated "Vehicles" repository
content is federated from the other repositories and cached into the "Cache" repository. This is shown in the following figure:
<figure id="example-federated-repository">
- <title>Vehicles repository content is federated from the Cars, Airplanes and Configuration repositories</title>
+ <title>Vehicles repository content is federated from the Cars, Airplanes, UFOs, and Configuration repositories</title>
<graphic align="center" scale="60" fileref="example-federated-repository.png"/>
</figure>
</para>
@@ -87,10 +88,12 @@
</table>
<note>
<para>
- The first time you access any repository, you will be prompted to log in. This is JAAS at work, and the example application
- should prompt you for a username and password. As configured in the "jaas.conf.xml" and "users.properties" files,
- enter "jsmith" for the username and "secret" for the password. And, yes, the password is shown in cleartext - this
- is a simple example, after all!
+ The first time you access any repository, the application is automatically logging you in to DNA's JAAS-based security
+ system. To make the application easier to use, it always logs in with the "jsmith" as the username and "secret" as the
+ password. This matches what is configured in the "jaas.conf.xml" and "users.properties" files. If you want to confirm
+ that the security feature is working, change the password in target/dna-example-repositories-basic.dir/users.properties to
+ something else and re-run the application. After you select a repository and try to view a directory with 'ls', you
+ will get a LoginException!
</para>
</note>
<para>If you were to select the "Cars" repository and use some of the commands, you should see something similar to:
14 years, 4 months
DNA SVN: r1493 - trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-12-29 17:48:24 -0500 (Tue, 29 Dec 2009)
New Revision: 1493
Added:
trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNRespositoryConnectorWriteableTest.java
Log:
some write svn access (add file/dir, update file)
Added: trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNRespositoryConnectorWriteableTest.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNRespositoryConnectorWriteableTest.java (rev 0)
+++ trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNRespositoryConnectorWriteableTest.java 2009-12-29 22:48:24 UTC (rev 1493)
@@ -0,0 +1,309 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.connector.svn;
+
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.IsNull.notNullValue;
+import static org.junit.Assert.assertThat;
+import java.io.ByteArrayOutputStream;
+import org.jboss.dna.graph.DnaLexicon;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.JcrLexicon;
+import org.jboss.dna.graph.JcrMixLexicon;
+import org.jboss.dna.graph.JcrNtLexicon;
+import org.jboss.dna.graph.connector.RepositorySource;
+import org.jboss.dna.graph.connector.RepositorySourceException;
+import org.jboss.dna.graph.connector.test.AbstractConnectorTest;
+import org.junit.Test;
+import org.tmatesoft.svn.core.SVNNodeKind;
+import org.tmatesoft.svn.core.SVNProperties;
+import org.tmatesoft.svn.core.io.SVNRepository;
+
+/**
+ * @author Serge Pagop
+ */
+public class SVNRespositoryConnectorWriteableTest extends AbstractConnectorTest {
+
+ protected static final String EMPTY_CONTENT = "";
+ protected static final String TEST_CONTENT = "Test content";
+ protected SVNRepository remoteRepos = null;
+ protected String repositoryRootURL;
+ protected SVNNodeKind kind = null;
+ protected SVNProperties fileProperties = null;
+ protected ByteArrayOutputStream baos = null;
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#setUpSource()
+ */
+ @Override
+ protected RepositorySource setUpSource() throws Exception {
+ repositoryRootURL = SVNConnectorTestUtil.createURL("src/test/resources/dummy_svn_repos", "target/copy_of dummy_svn_repos");
+ String[] predefinedWorkspaceNames = new String[] {repositoryRootURL + "trunk", repositoryRootURL + "tags"};
+ SVNRepositorySource source = new SVNRepositorySource();
+ source.setName("Test Repository");
+ source.setUsername("sp");
+ source.setPassword("");
+ source.setRepositoryRootURL(repositoryRootURL);
+ source.setPredefinedWorkspaceNames(predefinedWorkspaceNames);
+ source.setDirectoryForDefaultWorkspace(predefinedWorkspaceNames[0]);
+ source.setCreatingWorkspacesAllowed(Boolean.TRUE);
+ source.setUpdatesAllowed(true);
+
+ remoteRepos = SVNRepositoryUtil.createRepository(repositoryRootURL + "trunk", "sp", "");
+
+ return source;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#initializeContent(org.jboss.dna.graph.Graph)
+ */
+ @Override
+ protected void initializeContent( Graph graph ) throws Exception {
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.jboss.dna.graph.connector.test.AbstractConnectorTest#afterEach()
+ */
+ @Override
+ public void afterEach() throws Exception {
+ remoteRepos = null;
+ super.afterEach();
+ }
+
+ @Test( expected = RepositorySourceException.class )
+ public void shouldNotBeAbleToCreateInvalidTypeForRepository() {
+ graph.create("/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.UNSTRUCTURED).orReplace().and();
+ }
+
+ @Test( expected = RepositorySourceException.class )
+ public void shouldNotBeAbleToSetArbitraryProperties() {
+ graph.create("/testFile").with(JcrLexicon.MIXIN_TYPES, JcrMixLexicon.LOCKABLE).orReplace().and();
+ }
+
+ @Test
+ public void shouldBeAbleToCreateNodeFileWithContentLevel1() throws Exception {
+
+
+ // LEVEL 0
+ graph.create("/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/testFile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
+ TEST_CONTENT.getBytes()).orReplace().and();
+ kind = remoteRepos.checkPath("testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+
+ graph.create("/testFile1").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/testFile1/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
+ TEST_CONTENT.getBytes()).orReplace().and();
+ kind = remoteRepos.checkPath("testFile1", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("testFile1", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+
+ // LEVEL 1
+ graph.create("/root/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/root/testFile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
+ TEST_CONTENT.getBytes()).orReplace().and();
+ kind = remoteRepos.checkPath("root/testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("root/testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+
+ // LEVEL 2
+ graph.create("/root/a/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/root/a/testFile/jcr:content").with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE).and(JcrLexicon.DATA,
+ TEST_CONTENT.getBytes()).orReplace().and();
+ kind = remoteRepos.checkPath("root/a/testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("root/a/testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+ }
+
+
+ @Test
+ public void shouldRespectConflictBehaviorOnCreate() throws Exception {
+ graph.create("/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/testFile/jcr:content")
+ .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+ .and(JcrLexicon.DATA, TEST_CONTENT.getBytes())
+ .orReplace()
+ .and();
+
+ graph.create("/testFile/jcr:content")
+ .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+ .and(JcrLexicon.DATA, "Should not overwrite".getBytes())
+ .ifAbsent()
+ .and();
+
+ kind = remoteRepos.checkPath("testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+ }
+
+ @Test
+ public void shouldBeAbleToCreateFileWithNoContent() throws Exception {
+ graph.create("/testEmptyFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+
+ kind = remoteRepos.checkPath("testEmptyFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("testEmptyFile", -1, fileProperties, baos);
+ assertContents(baos, EMPTY_CONTENT);
+ }
+
+ @Test
+ public void shouldBeAbleToCreateFolder() throws Exception {
+ graph.create("/testFolder").orReplace().and();
+
+ kind = remoteRepos.checkPath("testFolder", -1);
+ assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+
+ graph.create("/root/testFolder").orReplace().and();
+
+ kind = remoteRepos.checkPath("root/testFolder", -1);
+ assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+
+ graph.create("/root/a/testFolder").orReplace().and();
+
+ kind = remoteRepos.checkPath("root/a/testFolder", -1);
+ assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+ }
+
+ @Test
+ public void shouldBeAbleToAddChildrenToFolder() throws Exception {
+ graph.create("/testFolder").orReplace().and();
+
+ kind = remoteRepos.checkPath("testFolder", -1);
+ assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+
+ graph.create("/testFolder/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/testFolder/testFile/jcr:content")
+ .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+ .and(JcrLexicon.DATA, TEST_CONTENT.getBytes())
+ .orReplace()
+ .and();
+
+ kind = remoteRepos.checkPath("testFolder/testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("testFolder/testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+
+ graph.create("/root/testFolder").orReplace().and();
+
+ kind = remoteRepos.checkPath("root/testFolder", -1);
+ assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+
+ graph.create("/root/testFolder/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+ graph.create("/root/testFolder/testFile/jcr:content")
+ .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+ .and(JcrLexicon.DATA, TEST_CONTENT.getBytes())
+ .orReplace()
+ .and();
+
+ kind = remoteRepos.checkPath("root/testFolder/testFile", -1);
+ assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+ fileProperties = new SVNProperties();
+ baos = new ByteArrayOutputStream();
+ remoteRepos.getFile("root/testFolder/testFile", -1, fileProperties, baos);
+ assertContents(baos, TEST_CONTENT);
+ }
+
+// @Test
+// public void shouldBeAbleToCopyFile() throws Exception {
+// graph.create("/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+// graph.create("/testFile/jcr:content")
+// .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+// .and(JcrLexicon.DATA, TEST_CONTENT.getBytes())
+// .orReplace()
+// .and();
+//
+// kind = remoteRepos.checkPath("testFile", -1);
+// assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+// fileProperties = new SVNProperties();
+// baos = new ByteArrayOutputStream();
+// remoteRepos.getFile("testFile", -1, fileProperties, baos);
+// assertContents(baos, TEST_CONTENT);
+//
+// graph.copy("/testFile").to("/copiedFile");
+// kind = remoteRepos.checkPath("copiedFile", -1);
+// assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+// fileProperties = new SVNProperties();
+// baos = new ByteArrayOutputStream();
+// remoteRepos.getFile("copiedFile", -1, fileProperties, baos);
+// assertContents(baos, TEST_CONTENT);
+// }
+//
+// @Test
+// public void shouldBeAbleToCopyFolder() throws Exception {
+// graph.create("/testFolder").orReplace().and();
+// graph.create("/testFolder/testFile").with(JcrLexicon.PRIMARY_TYPE, JcrNtLexicon.FILE).orReplace().and();
+// graph.create("/testFolder/testFile/jcr:content")
+// .with(JcrLexicon.PRIMARY_TYPE, DnaLexicon.RESOURCE)
+// .and(JcrLexicon.DATA, TEST_CONTENT.getBytes())
+// .orReplace()
+// .and();
+//
+// kind = remoteRepos.checkPath("testFolder/testFile", -1);
+// assertThat(kind == SVNNodeKind.FILE, is(Boolean.TRUE));
+// fileProperties = new SVNProperties();
+// baos = new ByteArrayOutputStream();
+// remoteRepos.getFile("testFolder/testFile", -1, fileProperties, baos);
+// assertContents(baos, TEST_CONTENT);
+//
+//
+// graph.copy("/testFolder").to("/copiedFolder");
+// kind = remoteRepos.checkPath("copiedFolder", -1);
+// assertThat(kind == SVNNodeKind.DIR, is(Boolean.TRUE));
+// fileProperties = new SVNProperties();
+// baos = new ByteArrayOutputStream();
+// remoteRepos.getFile("copiedFolder/testFile", -1, fileProperties, baos);
+// assertContents(baos, TEST_CONTENT);
+// }
+
+ protected void assertContents( ByteArrayOutputStream baos,
+ String contents ) {
+ assertThat(baos, notNullValue());
+ assertThat(baos.toString(), is(contents));
+ }
+}
Property changes on: trunk/extensions/dna-connector-svn/src/test/java/org/jboss/dna/connector/svn/SVNRespositoryConnectorWriteableTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
14 years, 4 months
DNA SVN: r1492 - trunk/extensions/dna-connector-svn/src/main/resources/org/jboss/dna/connector/svn.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-12-29 17:47:38 -0500 (Tue, 29 Dec 2009)
New Revision: 1492
Modified:
trunk/extensions/dna-connector-svn/src/main/resources/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.properties
Log:
some write svn access (add file/dir, update file)
Modified: trunk/extensions/dna-connector-svn/src/main/resources/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.properties
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/resources/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.properties 2009-12-29 22:47:12 UTC (rev 1491)
+++ trunk/extensions/dna-connector-svn/src/main/resources/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.properties 2009-12-29 22:47:38 UTC (rev 1492)
@@ -24,6 +24,7 @@
connectorName = SVN Connector
nodeDoesNotExist = This node kind is missing at {0}
+nodeAlreadyExist = This node {0} already exist.
nodeIsActuallyUnknow = This node kind is actually unknown {0}
propertyIsRequired = The {0} property is required but has no value
errorSerializingCachePolicyInSource = Error serializing a {0} instance owned by the {1} SVNRepositorySource
@@ -42,4 +43,16 @@
sameNameSiblingsAreNotAllowed = {0} does not allow same name siblings on nodes: {1}
onlyTheDefaultNamespaceIsAllowed = {0} requires node names use the default namespace: {1}
locationInRequestMustHavePath = {0} requires a path in the request: {1}
-unableToCreateWorkspaces = {0} does not allow creating new workspaces (request was to create "{1}")
\ No newline at end of file
+unableToCreateWorkspaces = {0} does not allow creating new workspaces (request was to create "{1}")
+pathForRequestIsNotCorrect = The path "{0}" for the request is not correct.
+pathForRequestMustStartWithAForwardSlash = The path "{0}" for the request must start with a forward slash.
+unsupportedPrimaryType = Primary type "{3}" for path "{0}" in workspace "{1}" in {2} is not valid for the file system connector. Valid primary types are nt\:file, nt\:folder, nt\:resource, and dna\:resouce.
+invalidPropertyNames = Attempt to set or update invalid property names: {0}
+invalidNameForResource = Invalid node name "{3}" for node at path "{0}" in workspace "{1}" in {2}. The name of nodes with primary type nt:resource or dna:resource must be "jcr:content".
+invalidPathForResource = Invalid parent type for node at path "{0}" in workspace "{1}" in {2}. The parent node for nodes with primary type nt:resource or dna:resource must be of type nt:file.
+missingRequiredProperty = Missing required property "{3}" at path "{0}" in workspace "{1}" in {2}
+
+
+# Writable tests
+couldNotCreateFile =Error reading data in workspace "{1}" "{0}" "{2}" "{3}"
+couldNotReadData= Error reading data in workspace "{1}" "{0}" "{2}" "{3}"
14 years, 4 months
DNA SVN: r1491 - trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-12-29 17:47:12 -0500 (Tue, 29 Dec 2009)
New Revision: 1491
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java
Log:
some write svn access (add file/dir, update file)
Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java 2009-12-29 22:46:45 UTC (rev 1490)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/scm/ScmActionFactory.java 2009-12-29 22:47:12 UTC (rev 1491)
@@ -31,6 +31,11 @@
String file,
byte[] content );
+ public ScmAction mergeFile( String rootPath,
+ String fileName,
+ byte[] oldData,
+ byte[] newData );
+
public ScmAction addDirectory( String root,
String path );
14 years, 4 months
DNA SVN: r1490 - trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn.
by dna-commits@lists.jboss.org
Author: spagop
Date: 2009-12-29 17:46:45 -0500 (Tue, 29 Dec 2009)
New Revision: 1490
Modified:
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java
trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java
Log:
some write svn access (add file/dir, update file)
Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java 2009-12-29 22:46:08 UTC (rev 1489)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryConnectorI18n.java 2009-12-29 22:46:45 UTC (rev 1490)
@@ -53,6 +53,16 @@
public static I18n sameNameSiblingsAreNotAllowed;
public static I18n onlyTheDefaultNamespaceIsAllowed;
public static I18n unableToCreateWorkspaces;
+ public static I18n pathForRequestIsNotCorrect;
+ public static I18n pathForRequestMustStartWithAForwardSlash;
+ public static I18n nodeAlreadyExist;
+ public static I18n unsupportedPrimaryType;
+ public static I18n invalidPropertyNames;
+ public static I18n invalidNameForResource;
+ public static I18n invalidPathForResource;
+ public static I18n missingRequiredProperty;
+ public static I18n couldNotCreateFile;
+ public static I18n couldNotReadData;
static {
try {
@@ -73,4 +83,6 @@
public static Set<String> getLocalizationProblems( Locale locale ) {
return I18n.getLocalizationProblems(SVNRepositoryConnectorI18n.class, locale);
}
+
+
}
Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java 2009-12-29 22:46:08 UTC (rev 1489)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java 2009-12-29 22:46:45 UTC (rev 1490)
@@ -23,30 +23,38 @@
*/
package org.jboss.dna.connector.svn;
-import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import org.jboss.dna.common.i18n.I18n;
import org.jboss.dna.common.util.Logger;
import org.jboss.dna.connector.scm.ScmAction;
import org.jboss.dna.connector.scm.ScmActionFactory;
+import org.jboss.dna.connector.svn.mgnt.AddDirectory;
+import org.jboss.dna.connector.svn.mgnt.AddFile;
+import org.jboss.dna.connector.svn.mgnt.MergeFile;
+import org.jboss.dna.graph.DnaIntLexicon;
import org.jboss.dna.graph.DnaLexicon;
import org.jboss.dna.graph.ExecutionContext;
import org.jboss.dna.graph.JcrLexicon;
import org.jboss.dna.graph.JcrNtLexicon;
import org.jboss.dna.graph.Location;
+import org.jboss.dna.graph.NodeConflictBehavior;
import org.jboss.dna.graph.connector.RepositorySourceException;
import org.jboss.dna.graph.property.Binary;
import org.jboss.dna.graph.property.BinaryFactory;
import org.jboss.dna.graph.property.DateTimeFactory;
import org.jboss.dna.graph.property.Name;
import org.jboss.dna.graph.property.NameFactory;
+import org.jboss.dna.graph.property.NamespaceRegistry;
import org.jboss.dna.graph.property.Path;
import org.jboss.dna.graph.property.PathFactory;
import org.jboss.dna.graph.property.PathNotFoundException;
@@ -79,9 +87,7 @@
import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.SVNProperties;
import org.tmatesoft.svn.core.SVNProperty;
-import org.tmatesoft.svn.core.io.ISVNEditor;
import org.tmatesoft.svn.core.io.SVNRepository;
-import org.tmatesoft.svn.core.io.diff.SVNDeltaGenerator;
/**
* The {@link RequestProcessor} implementation for the file subversion repository connector. This is the class that does the bulk
@@ -93,6 +99,31 @@
private static final String DEFAULT_MIME_TYPE = "application/octet-stream";
+ /**
+ * Only certain properties are tolerated when writing content (dna:resource or jcr:resource) nodes. These properties are
+ * implicitly stored (primary type, data) or silently ignored (encoded, mimetype, last modified). The silently ignored
+ * properties must be accepted to stay compatible with the JCR specification.
+ */
+ private final Set<Name> ALLOWABLE_PROPERTIES_FOR_CONTENT = Collections.unmodifiableSet(new HashSet<Name>(
+ Arrays.asList(new Name[] {
+ JcrLexicon.PRIMARY_TYPE,
+ JcrLexicon.DATA,
+ JcrLexicon.ENCODED,
+ JcrLexicon.MIMETYPE,
+ JcrLexicon.LAST_MODIFIED,
+ JcrLexicon.UUID,
+ DnaIntLexicon.NODE_DEFINITON})));
+ /**
+ * Only certain properties are tolerated when writing files (nt:file) or folders (nt:folder) nodes. These properties are
+ * implicitly stored in the file or folder (primary type, created).
+ */
+ private final Set<Name> ALLOWABLE_PROPERTIES_FOR_FILE_OR_FOLDER = Collections.unmodifiableSet(new HashSet<Name>(
+ Arrays.asList(new Name[] {
+ JcrLexicon.PRIMARY_TYPE,
+ JcrLexicon.CREATED,
+ JcrLexicon.UUID,
+ DnaIntLexicon.NODE_DEFINITON})));
+
private final String defaultNamespaceUri;
private final boolean updatesAllowed;
private SVNRepository defaultWorkspace;
@@ -321,10 +352,291 @@
*/
@Override
public void process( CreateNodeRequest request ) {
- updatesAllowed(request);
+ logger.trace(request.toString());
+ if (!updatesAllowed(request)) return;
+
+ // continue
+ Path parentPath = getPathFor(request.under(), request);
+ if (parentPath == null) return;
+
+ // svn connector does not support same name sibling
+ sameNameSiblingIsNotSupported(parentPath, request);
+
+ SVNRepository workspaceRoot = getWorkspaceDirectory(request.inWorkspace());
+ assert workspaceRoot != null;
+
+ SVNNodeKind parent = getSVNNodeKindFor(workspaceRoot, parentPath, request.under(), request.inWorkspace(), request);
+ if (parent == null) {
+ return;
+ }
+
+ NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
+ // New name to commit into the svn repos workspace
+ String newName = request.named().getString(registry);
+
+ // Collect all the properties of the node in a hash map
+ Map<Name, Property> properties = new HashMap<Name, Property>(request.properties().size());
+ for (Property property : request.properties()) {
+ properties.put(property.getName(), property);
+ }
+
+ Property primaryTypeProp = properties.get(JcrLexicon.PRIMARY_TYPE);
+ Name primaryType = primaryTypeProp == null ? null : nameFactory().create(primaryTypeProp.getFirstValue());
+
+ Path newPath = pathFactory().create(parentPath, request.named());
+ Location actualLocation = Location.create(newPath);
+
+ String newChildPath = null;
+
+ // File
+ if (JcrNtLexicon.FILE.equals(primaryType)) {
+ ensureValidProperties(request.properties(), ALLOWABLE_PROPERTIES_FOR_FILE_OR_FOLDER);
+ // Parent node already exist
+ boolean skipWrite = false;
+
+ if (request.under().getPath().isRoot()) {
+
+ if (!accessData.getRepositoryRootUrl().equals(request.inWorkspace())) {
+ newChildPath = newName;
+ } else {
+ newChildPath = "/" + newName;
+ }
+ } else {
+
+ newChildPath = getPathAsString(request.under().getPath()) + "/" + newName;
+
+ if (!accessData.getRepositoryRootUrl().equals(request.inWorkspace())) {
+ newChildPath = newChildPath.substring(1);
+ }
+ }
+
+ // check if the new name already exist
+ if (SVNRepositoryUtil.exists(workspaceRoot, newChildPath)) {
+ if (request.conflictBehavior().equals(NodeConflictBehavior.APPEND)) {
+ I18n msg = SVNRepositoryConnectorI18n.sameNameSiblingsAreNotAllowed;
+ throw new InvalidRequestException(msg.text(this.getSourceName(), newName));
+ } else if (request.conflictBehavior().equals(NodeConflictBehavior.DO_NOT_REPLACE)) {
+ skipWrite = true;
+ }
+ }
+ // Don't try to write if the node conflict behavior is DO_NOT_REPLACE
+ if (!skipWrite) {
+ // create a new, empty file
+ if (newChildPath != null) {
+ try {
+ String rootPath = null;
+ if (request.under().getPath().isRoot()) {
+ rootPath = "";
+ } else {
+ rootPath = getPathAsString(request.under().getPath());
+ }
+ newFile(rootPath, newName, "".getBytes(), null, request.inWorkspace(), this.defaultWorkspace);
+ } catch (SVNException e) {
+ I18n msg = SVNRepositoryConnectorI18n.couldNotCreateFile;
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName(),
+ e.getMessage()), e));
+ return;
+ }
+ }
+ }
+ } else if (JcrNtLexicon.RESOURCE.equals(primaryType) || DnaLexicon.RESOURCE.equals(primaryType)) { // Resource
+ ensureValidProperties(request.properties(), ALLOWABLE_PROPERTIES_FOR_CONTENT);
+ if (request.under().getPath().isRoot()) {
+ newChildPath = getPathAsString(parentPath);
+ if (!accessData.getRepositoryRootUrl().equals(request.inWorkspace())) {
+ newChildPath = getPathAsString(parentPath).substring(1);
+ }
+ } else {
+ newChildPath = getPathAsString(parentPath);
+ if (!accessData.getRepositoryRootUrl().equals(request.inWorkspace())) {
+ newChildPath = newChildPath.substring(1);
+ }
+ }
+
+ if (!JcrLexicon.CONTENT.equals(request.named())) {
+ I18n msg = SVNRepositoryConnectorI18n.invalidNameForResource;
+ String nodeName = request.named().getString(registry);
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName(),
+ nodeName)));
+ return;
+ }
+
+ if (parent != SVNNodeKind.FILE) {
+ I18n msg = SVNRepositoryConnectorI18n.invalidPathForResource;
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName())));
+ return;
+ }
+
+ boolean skipWrite = false;
+ if (parent != SVNNodeKind.NONE || parent != SVNNodeKind.UNKNOWN) {
+ if (request.conflictBehavior().equals(NodeConflictBehavior.APPEND)) {
+ I18n msg = SVNRepositoryConnectorI18n.sameNameSiblingsAreNotAllowed;
+ throw new InvalidRequestException(msg.text(this.getSourceName(), newName));
+ } else if (request.conflictBehavior().equals(NodeConflictBehavior.DO_NOT_REPLACE)) {
+ // TODO check if the file already has content
+ skipWrite = true;
+ }
+ }
+
+ if (!skipWrite) {
+ Property dataProperty = properties.get(JcrLexicon.DATA);
+ if (dataProperty == null) {
+ I18n msg = SVNRepositoryConnectorI18n.missingRequiredProperty;
+ String dataPropName = JcrLexicon.DATA.getString(registry);
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName(),
+ dataPropName)));
+ return;
+ }
+
+ BinaryFactory binaryFactory = getExecutionContext().getValueFactories().getBinaryFactory();
+ Binary binary = binaryFactory.create(properties.get(JcrLexicon.DATA).getFirstValue());
+ // get old data
+ ByteArrayOutputStream contents = new ByteArrayOutputStream();
+ SVNProperties svnProperties = new SVNProperties();
+ try {
+ workspaceRoot.getFile(newChildPath, -1, svnProperties, contents);
+ byte[] oldData = contents.toByteArray();
+ // modify the empty old data with the new resource
+ if (oldData != null) {
+ String rootPath = null;
+ String fileName = null;
+
+ Path p = request.under().getPath();
+ rootPath = getPathAsString(p.getAncestor(1));
+ fileName = p.getLastSegment().getString(registry);
+
+ if (request.under().getPath().isRoot()) {
+ rootPath = "";
+ }
+
+ modifyFile(rootPath,
+ fileName,
+ oldData,
+ binary.getBytes(),
+ null,
+ request.inWorkspace(),
+ this.defaultWorkspace);
+ }
+ } catch (SVNException e) {
+ I18n msg = SVNRepositoryConnectorI18n.couldNotReadData;
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName(),
+ e.getMessage()), e));
+ return;
+ }
+ }
+
+ } else if (JcrNtLexicon.FOLDER.equals(primaryType) || primaryType == null) { // Folder
+ ensureValidProperties(request.properties(), ALLOWABLE_PROPERTIES_FOR_FILE_OR_FOLDER);
+ try {
+ String rootDirPath = getPathAsString(request.under().getPath());
+ mkdir(rootDirPath, newName, null, request.inWorkspace(), workspaceRoot);
+ } catch (SVNException e) {
+ I18n msg = SVNRepositoryConnectorI18n.couldNotCreateFile;
+ request.setError(new RepositorySourceException(getSourceName(),
+ msg.text(getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName(),
+ e.getMessage()), e));
+ return;
+ }
+ } else {
+ I18n msg = SVNRepositoryConnectorI18n.unsupportedPrimaryType;
+ request.setError(new RepositorySourceException(getSourceName(), msg.text(primaryType.getString(registry),
+ getPathAsString(request.under().getPath()),
+ request.inWorkspace(),
+ getSourceName())));
+ return;
+ }
+
+ request.setActualLocationOfNode(actualLocation);
}
/**
+ * @param workspaceRoot
+ * @param path
+ * @param location
+ * @param inWorkspace
+ * @param request
+ * @return a svn node kind
+ */
+ protected SVNNodeKind getSVNNodeKindFor( SVNRepository workspaceRoot,
+ Path path,
+ Location location,
+ String inWorkspace,
+ Request request ) {
+ assert path != null;
+ assert location != null;
+ assert request != null;
+
+ SVNNodeKind rootNode = SVNRepositoryUtil.checkThePath(workspaceRoot, "", -1, getSourceName());
+
+ if (rootNode != SVNNodeKind.DIR) return null;
+
+ if (path.isRoot()) {
+ return rootNode;
+ }
+
+ // See if the path is a "jcr:content" node ...
+ if (path.getLastSegment().getName().equals(JcrLexicon.CONTENT)) {
+ // We only want to use the parent path to find the actual file ...
+ path = path.getParent();
+ }
+ SVNNodeKind kind = rootNode;
+ for (Path.Segment segment : path) {
+ if (segment.getIndex() > 1) {
+ I18n msg = SVNRepositoryConnectorI18n.sameNameSiblingsAreNotAllowed;
+ throw new RepositorySourceException(getSourceName(), msg.text(getSourceName(), request));
+ }
+ }
+
+ String currentPath = getPathAsString(path);
+ if (!this.accessData.getRepositoryRootUrl().equals(inWorkspace)) {
+ if (currentPath.startsWith("/")) {
+ currentPath = currentPath.substring(1);
+ }
+ }
+ kind = SVNRepositoryUtil.checkThePath(workspaceRoot, currentPath, -1, getSourceName());
+
+ if (kind != null) {
+ if (kind == SVNNodeKind.NONE || kind == SVNNodeKind.UNKNOWN) {
+ // Unable to complete the path, so prepare the exception by determining the lowest path that exists ...
+ request.setError(new RepositorySourceException(getSourceName(), " Node kind with path " + currentPath
+ + " is missing or actually unknown"));
+ return null;
+ }
+ }
+
+ assert kind != null;
+ return kind;
+ }
+
+ private void sameNameSiblingIsNotSupported( Path path,
+ CreateNodeRequest request ) {
+ for (Path.Segment segment : path) {
+ // Verify the segment is valid ...
+ if (segment.getIndex() > 1) {
+ I18n msg = SVNRepositoryConnectorI18n.sameNameSiblingsAreNotAllowed;
+ throw new RepositorySourceException(getSourceName(), msg.text(getSourceName(), request));
+ }
+ }
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.jboss.dna.graph.request.processor.RequestProcessor#process(org.jboss.dna.graph.request.UpdatePropertiesRequest)
@@ -681,44 +993,6 @@
}
/**
- * Open the directories where change has to be made.
- *
- * @param editor - abstract editor.
- * @param rootPath - the pa to open.
- * @throws SVNException when a error occur.
- */
- protected static void openDirectories( ISVNEditor editor,
- String rootPath ) throws SVNException {
- assert rootPath != null;
- int pos = rootPath.indexOf('/', 0);
- while (pos != -1) {
- String dir = rootPath.substring(0, pos);
- editor.openDir(dir, -1);
- pos = rootPath.indexOf('/', pos + 1);
- }
- String dir = rootPath.substring(0, rootPath.length());
- editor.openDir(dir, -1);
- }
-
- /**
- * Close the directories where change was made.
- *
- * @param editor - the abstract editor.
- * @param path - the directories to open.
- * @throws SVNException when a error occur.
- */
- protected static void closeDirectories( ISVNEditor editor,
- String path ) throws SVNException {
- int length = path.length() - 1;
- int pos = path.lastIndexOf('/', length);
- editor.closeDir();
- while (pos != -1) {
- editor.closeDir();
- pos = path.lastIndexOf('/', pos - 1);
- }
- }
-
- /**
* Get the last revision.
*
* @param repos
@@ -736,123 +1010,159 @@
}
/**
- * Add directory in a repository
+ * Create a directory .
*
- * @param repository - the repository.
- * @param root - the root path has to exist.
- * @param child - new path to be added.
- * @param message - information about the change action.
- * @throws SVNException when a error occur.
+ * @param rootDirPath - the root directory where the created directory will reside
+ * @param childDirPath - the name of the created directory.
+ * @param comment - comment for the creation.
+ * @param inWorkspace
+ * @param currentRepository
+ * @throws SVNException - if during the creation, there is an error.
*/
- protected void addDirEntry( SVNRepository repository,
- String root,
- String child,
- String message ) throws SVNException {
- assert root.trim().length() != 0;
- SVNNodeKind rootKind = repository.checkPath(root, -1);
- if (rootKind == SVNNodeKind.UNKNOWN) {
+ private void mkdir( String rootDirPath,
+ String childDirPath,
+ String comment,
+ String inWorkspace,
+ SVNRepository currentRepository ) throws SVNException {
+
+ String tempParentPath = rootDirPath;
+ if (!this.accessData.getRepositoryRootUrl().equals(inWorkspace)) {
+ if (!tempParentPath.equals("/") && tempParentPath.startsWith("/")) {
+ tempParentPath = tempParentPath.substring(1);
+ } else if (tempParentPath.equals("/")) {
+ tempParentPath = "";
+ }
+ }
+ String checkPath = tempParentPath.length() == 0 ? childDirPath : tempParentPath + "/" + childDirPath;
+ SVNNodeKind nodeKind = null;
+ try {
+ nodeKind = currentRepository.checkPath(checkPath, -1);
+ } catch (SVNException e) {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
- "path with name '{0}' is unknown in the repository",
- root);
+ "May be a Connecting problem to the repository or a user's authentication failure: {0}",
+ e.getMessage());
throw new SVNException(err);
- } else if (rootKind == SVNNodeKind.NONE) {
+ }
+
+ if (nodeKind != null && nodeKind == SVNNodeKind.NONE) {
+ ScmAction addNodeAction = addDirectory(rootDirPath, childDirPath);
+ SVNActionExecutor executor = new SVNActionExecutor(currentRepository);
+ comment = comment == null ? "Create a new file " + childDirPath : comment;
+ executor.execute(addNodeAction, comment);
+ } else {
SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
- "path with name '{0}' is missing in the repository",
- root);
+ "Node with name '{0}' can't be created",
+ childDirPath);
throw new SVNException(err);
- } else if (rootKind == SVNNodeKind.FILE) {
- SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
- "path with name '{0}' is a file, you need a directory",
- root);
- throw new SVNException(err);
- } else if (rootKind == SVNNodeKind.DIR) {
- ISVNEditor editor = repository.getCommitEditor(message, null, true, null);
- if (root.length() == 1 && root.charAt(0) == '/') {
- addProcess(repository, editor, root, "", child);
- } else {
- String rootPath = root.substring(1);
- addProcess(repository, editor, rootPath, null, child);
- }
}
}
- private void addProcess( SVNRepository repos,
- ISVNEditor editor,
- String rootPath,
- String editedRoot,
- String childSegmentName ) throws SVNException {
- openDirectories(editor, editedRoot);
- // test if so a directory does not exist.
- SVNNodeKind childKind = repos.checkPath(childSegmentName, -1);
- if (childKind == SVNNodeKind.NONE) {
- editor.addDir(childSegmentName, null, -1);
- closeDirectories(editor, childSegmentName);
- if (editedRoot != null) {
- closeDirectories(editor, editedRoot);
- } else {
- closeDirectories(editor, rootPath);
- }
+ /**
+ * Create a file.
+ *
+ * @param rootDirPath
+ * @param childFilePath
+ * @param content
+ * @param comment
+ * @param inWorkspace
+ * @param currentRepository
+ * @throws SVNException
+ */
+ public void newFile( String rootDirPath,
+ String childFilePath,
+ byte[] content,
+ String comment,
+ String inWorkspace,
+ SVNRepository currentRepository ) throws SVNException {
- } else {
- closeDirectories(editor, childSegmentName);
- if (editedRoot != null) {
- closeDirectories(editor, editedRoot);
- } else {
- closeDirectories(editor, rootPath);
+ String tempParentPath = rootDirPath;
+ if (!this.accessData.getRepositoryRootUrl().equals(inWorkspace)) {
+ if (!tempParentPath.equals("/") && tempParentPath.startsWith("/")) {
+ tempParentPath = tempParentPath.substring(1);
}
}
- }
+ String checkPath = tempParentPath + "/" + childFilePath;
+ SVNNodeKind nodeKind = null;
+ try {
+ nodeKind = currentRepository.checkPath(checkPath, -1);
+ } catch (SVNException e) {
+ SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
+ "May be a Connecting problem to the repository or a user's authentication failure: {0}",
+ e.getMessage());
+ throw new SVNException(err);
+ }
- /**
- * Create a directory .
- *
- * @param repos
- * @param root - the root directory where the created directory will reside
- * @param childName - the name of the created directory.
- * @param message - comment for the creation.
- * @throws SVNException - if during the creation, there is an error.
- */
- @SuppressWarnings( "unused" )
- private void mkdir( SVNRepository repos,
- String root,
- String childName,
- String message ) throws SVNException {
- SVNNodeKind childKind = repos.checkPath(childName, -1);
- if (childKind == SVNNodeKind.NONE) {
- ScmAction addNodeAction = addDirectory(root, childName);
- SVNActionExecutor executor = new SVNActionExecutor(repos);
- executor.execute(addNodeAction, message);
+ if (nodeKind != null && nodeKind == SVNNodeKind.NONE) {
+ ScmAction addFileNodeAction = addFile(rootDirPath, childFilePath, content);
+ SVNActionExecutor executor = new SVNActionExecutor(currentRepository);
+ comment = comment == null ? "Create a new file " + childFilePath : comment;
+ executor.execute(addFileNodeAction, comment);
} else {
- SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "Item with name '{0}' can't be created", childName);
+ SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
+ "Item with name '{0}' can't be created (already exist)",
+ childFilePath);
throw new SVNException(err);
}
}
/**
- * Create a file.
+ * Modify a file
*
- * @param path
- * @param file
- * @param content
- * @param message
+ * @param rootPath
+ * @param fileName
+ * @param oldData
+ * @param newData
+ * @param comment
+ * @param inWorkspace
+ * @param currentRepository
* @throws SVNException
*/
- @SuppressWarnings( "unused" )
- private void newFile( String path,
- String file,
- byte[] content,
- String message ) throws SVNException {
- SVNNodeKind childKind = defaultWorkspace.checkPath(file, -1);
- if (childKind == SVNNodeKind.NONE) {
- ScmAction addFileNodeAction = addFile(path, file, content);
- SVNActionExecutor executor = new SVNActionExecutor(defaultWorkspace);
- executor.execute(addFileNodeAction, message);
- } else {
- SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN,
- "Item with name '{0}' can't be created (already exist)",
- file);
+ private void modifyFile( String rootPath,
+ String fileName,
+ byte[] oldData,
+ byte[] newData,
+ String comment,
+ String inWorkspace,
+ SVNRepository currentRepository ) throws SVNException {
+ assert rootPath != null;
+ assert fileName != null;
+ assert oldData != null;
+ assert inWorkspace != null;
+ assert currentRepository != null;
+
+ try {
+
+ if (!this.accessData.getRepositoryRootUrl().equals(inWorkspace)) {
+ if (rootPath.equals("/")) {
+ rootPath = "";
+ } else {
+ rootPath = rootPath.substring(1) + "/";
+ }
+ } else {
+ if (!rootPath.equals("/")) {
+ rootPath = rootPath + "/";
+ }
+ }
+ String path = rootPath + fileName;
+
+ SVNNodeKind nodeKind = currentRepository.checkPath(path, -1);
+ if (nodeKind == SVNNodeKind.NONE || nodeKind == SVNNodeKind.UNKNOWN) {
+ SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_NOT_FOUND,
+ "Item with name '{0}' can't be found",
+ path);
+ throw new SVNException(err);
+ }
+
+ ScmAction modifyFileAction = mergeFile(rootPath, fileName, oldData, newData);
+ SVNActionExecutor executor = new SVNActionExecutor(currentRepository);
+ comment = comment == null ? "modify the " + fileName : comment;
+ executor.execute(modifyFileAction, comment);
+
+ } catch (SVNException e) {
+ SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNKNOWN, "This error is appeared: '{0}'", e.getMessage());
throw new SVNException(err);
}
+
}
/**
@@ -879,6 +1189,18 @@
/**
* {@inheritDoc}
*
+ * @see org.jboss.dna.connector.scm.ScmActionFactory#mergeFile(java.lang.String, java.lang.String, byte[], byte[])
+ */
+ public ScmAction mergeFile( String rootPath,
+ String fileName,
+ byte[] oldData,
+ byte[] newData ) {
+ return new MergeFile(rootPath, fileName, oldData, newData);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
* @see org.jboss.dna.connector.scm.ScmActionFactory#copyDirectory(java.lang.String, java.lang.String, long)
*/
public ScmAction copyDirectory( String path,
@@ -906,66 +1228,6 @@
return null;
}
- /**
- * root should be the last, previously created, parent folder. Each directory in the path will be created.
- */
- public static class AddDirectory implements ScmAction {
- private String root;
- private String path;
-
- public AddDirectory( String root,
- String path ) {
- this.root = root;
- this.path = path;
- }
-
- public void applyAction( Object context ) throws SVNException {
-
- ISVNEditor editor = (ISVNEditor)context;
-
- openDirectories(editor, this.root);
- String[] paths = this.path.split("/");
- String newPath = this.root;
- for (int i = 0, length = paths.length; i < length; i++) {
- newPath = (newPath.length() != 0) ? newPath + "/" + paths[i] : paths[i];
-
- editor.addDir(newPath, null, -1);
- }
-
- closeDirectories(editor, path);
- closeDirectories(editor, this.root);
- }
- }
-
- public static class AddFile implements ScmAction {
- private String path;
- private String file;
- private byte[] content;
-
- public AddFile( String path,
- String file,
- byte[] content ) {
- this.path = path;
- this.file = file;
- this.content = content;
- }
-
- public void applyAction( Object context ) throws Exception {
- ISVNEditor editor = (ISVNEditor)context;
- openDirectories(editor, path);
-
- editor.addFile(path + "/" + file, null, -1);
- editor.applyTextDelta(path + "/" + file, null);
- SVNDeltaGenerator deltaGenerator = new SVNDeltaGenerator();
- String checksum = deltaGenerator.sendDelta(path + "/" + file, new ByteArrayInputStream(this.content), editor, true);
- editor.closeFile(path + "/" + file, checksum);
-
- closeDirectories(editor, path);
-
- }
-
- }
-
@SuppressWarnings( "unused" )
private byte[] getContent( Object[] objs ) {
byte[] content = null;
@@ -995,11 +1257,6 @@
I18n msg = SVNRepositoryConnectorI18n.sameNameSiblingsAreNotAllowed;
throw new RepositorySourceException(getSourceName(), msg.text(getSourceName(), request));
}
- // TODO
- // if (!segment.getName().getNamespaceUri().equals(defaultNamespaceUri)) {
- // I18n msg = SVNRepositoryConnectorI18n.onlyTheDefaultNamespaceIsAllowed;
- // throw new RepositorySourceException(getSourceName(), msg.text(getSourceName(), request));
- // }
}
}
@@ -1046,4 +1303,30 @@
}
return kind;
}
+
+ /**
+ * Checks that the collection of {@code properties} only contains properties with allowable names.
+ *
+ * @param properties
+ * @param validPropertyNames
+ * @throws RepositorySourceException if {@code properties} contains a
+ * @see #ALLOWABLE_PROPERTIES_FOR_CONTENT
+ * @see #ALLOWABLE_PROPERTIES_FOR_FILE_OR_FOLDER
+ */
+ protected void ensureValidProperties( Collection<Property> properties,
+ Set<Name> validPropertyNames ) {
+ List<String> invalidNames = new LinkedList<String>();
+ NamespaceRegistry registry = getExecutionContext().getNamespaceRegistry();
+
+ for (Property property : properties) {
+ if (!validPropertyNames.contains(property.getName())) {
+ invalidNames.add(property.getName().getString(registry));
+ }
+ }
+
+ if (!invalidNames.isEmpty()) {
+ throw new RepositorySourceException(this.getSourceName(),
+ SVNRepositoryConnectorI18n.invalidPropertyNames.text(invalidNames.toString()));
+ }
+ }
}
Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java 2009-12-29 22:46:08 UTC (rev 1489)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositorySource.java 2009-12-29 22:46:45 UTC (rev 1490)
@@ -62,7 +62,7 @@
* The first serialized version of this source. Version {@value} .
*/
private static final long serialVersionUID = 1L;
-
+
protected static final String SOURCE_NAME = "sourceName";
protected static final String SVN_REPOSITORY_ROOT_URL = "repositoryRootURL";
protected static final String SVN_USERNAME = "username";
@@ -165,7 +165,7 @@
* @param url - the url location.
* @throws IllegalArgumentException If svn url is null or empty
*/
- public void setRepositoryRootURL( String url ) {
+ public synchronized void setRepositoryRootURL( String url ) {
CheckArg.isNotEmpty(url, "RepositoryRootURL");
this.repositoryRootURL = url;
}
@@ -177,7 +177,7 @@
/**
* @param username
*/
- public void setUsername( String username ) {
+ public synchronized void setUsername( String username ) {
this.username = username;
}
@@ -188,7 +188,7 @@
/**
* @param password
*/
- public void setPassword( String password ) {
+ public synchronized void setPassword( String password ) {
this.password = password;
}
@@ -278,6 +278,29 @@
capabilities.supportsEvents(), allowWorkspaceCreation,
capabilities.supportsReferences());
}
+
+ /**
+ * Get whether this source allows updates.
+ *
+ * @return true if this source allows updates by clients, or false if no updates are allowed
+ * @see #setUpdatesAllowed(boolean)
+ */
+ public boolean areUpdatesAllowed() {
+ return capabilities.supportsUpdates();
+ }
+
+ /**
+ * Set whether this source allows updates to data within workspaces
+ *
+ * @param allowUpdates true if this source allows updates to data within workspaces clients, or false if updates are not
+ * allowed.
+ * @see #areUpdatesAllowed()
+ */
+ public synchronized void setUpdatesAllowed( boolean allowUpdates ) {
+ capabilities = new RepositorySourceCapabilities(capabilities.supportsSameNameSiblings(), allowUpdates,
+ capabilities.supportsEvents(), capabilities.supportsCreatingWorkspaces(),
+ capabilities.supportsReferences());
+ }
/**
* {@inheritDoc}
Modified: trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java
===================================================================
--- trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java 2009-12-29 22:46:08 UTC (rev 1489)
+++ trunk/extensions/dna-connector-svn/src/main/java/org/jboss/dna/connector/svn/SVNRepositoryUtil.java 2009-12-29 22:46:45 UTC (rev 1490)
@@ -1,3 +1,26 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.dna.connector.svn;
import java.util.Collection;
@@ -66,7 +89,7 @@
kind = repository.checkPath(path, revisionNumber);
} catch (SVNException e) {
- throw new RepositorySourceException(sourceName, e.getMessage());
+ return null;
}
return kind;
}
14 years, 4 months