jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r698501 - in /jackrabbit/sandbox/jcrutil: ./ .settings/ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/jcrutil/ src/main/resources/ src/main/resources/META-INF/ src/test/ src/test/java/ src/test/java/org/ src/test/java/o...
Date Wed, 24 Sep 2008 10:08:45 GMT
Author: jukka
Date: Wed Sep 24 03:08:44 2008
New Revision: 698501

URL: http://svn.apache.org/viewvc?rev=698501&view=rev
Log:
JCR-1724: Jackrabbit utilities

jcrutil component contributed by Jason Thrasher.

Added:
    jackrabbit/sandbox/jcrutil/
    jackrabbit/sandbox/jcrutil/.classpath   (with props)
    jackrabbit/sandbox/jcrutil/.project   (with props)
    jackrabbit/sandbox/jcrutil/.settings/
    jackrabbit/sandbox/jcrutil/.settings/org.eclipse.jdt.core.prefs
    jackrabbit/sandbox/jcrutil/pom.xml   (with props)
    jackrabbit/sandbox/jcrutil/repository.xml   (with props)
    jackrabbit/sandbox/jcrutil/src/
    jackrabbit/sandbox/jcrutil/src/main/
    jackrabbit/sandbox/jcrutil/src/main/java/
    jackrabbit/sandbox/jcrutil/src/main/java/org/
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java   (with props)
    jackrabbit/sandbox/jcrutil/src/main/resources/
    jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/
    jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml   (with props)
    jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml   (with props)
    jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties   (with props)
    jackrabbit/sandbox/jcrutil/src/test/
    jackrabbit/sandbox/jcrutil/src/test/java/
    jackrabbit/sandbox/jcrutil/src/test/java/org/
    jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/
    jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java   (with props)
    jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java   (with props)
    jackrabbit/sandbox/jcrutil/src/test/resources/
    jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml   (with props)

Added: jackrabbit/sandbox/jcrutil/.classpath
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/.classpath?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/.classpath (added)
+++ jackrabbit/sandbox/jcrutil/.classpath Wed Sep 24 03:08:44 2008
@@ -0,0 +1,43 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/java"/>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
+  <classpathentry kind="src" path="src/test/resources" output="target/test-classes" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/backport-util-concurrent/backport-util-concurrent/3.0/backport-util-concurrent-3.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.1/commons-collections-3.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.1/commons-httpclient-3.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.4/commons-io-1.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.0.4/commons-logging-1.0.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/commons-vfs/commons-vfs/1.0/commons-vfs-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/derby/derby/10.2.1.6/derby-10.2.1.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/sf/ehcache/ehcache/1.3.0/ehcache-1.3.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/fontbox/fontbox/0.1.0/fontbox-0.1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-api/1.5-SNAPSHOT/jackrabbit-api-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-core/1.5-SNAPSHOT/jackrabbit-core-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-jcr-commons/1.5-SNAPSHOT/jackrabbit-jcr-commons-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-jcr-server/1.5-SNAPSHOT/jackrabbit-jcr-server-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-spi/1.5-SNAPSHOT/jackrabbit-spi-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-spi-commons/1.5-SNAPSHOT/jackrabbit-spi-commons-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-text-extractors/1.5-SNAPSHOT/jackrabbit-text-extractors-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-webdav/1.5-SNAPSHOT/jackrabbit-webdav-1.5-SNAPSHOT.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/jcl104-over-slf4j/1.4.3/jcl104-over-slf4j-1.4.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/javax/jcr/jcr/1.0/jcr-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jempbox/jempbox/0.2.0/jempbox-0.2.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/java/dev/jets3t/jets3t/0.6.1/jets3t-0.6.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/sf/jsr107cache/jsr107cache/1.0/jsr107cache-1.0.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.13/log4j-1.2.13.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/lucene/lucene-core/2.3.2/lucene-core-2.3.2.jar"/>
+  <classpathentry kind="var" path="M2_REPO/net/sourceforge/nekohtml/nekohtml/1.9.7/nekohtml-1.9.7.jar"/>
+  <classpathentry kind="var" path="M2_REPO/pdfbox/pdfbox/0.7.3/pdfbox-0.7.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi/3.0.2-FINAL/poi-3.0.2-FINAL.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-scratchpad/3.0.2-FINAL/poi-scratchpad-3.0.2-FINAL.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.4.3/slf4j-api-1.4.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-log4j12/1.4.3/slf4j-log4j12-1.4.3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.8.1/xercesImpl-2.8.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.3.03/xml-apis-1.3.03.jar"/>
+</classpath>
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/.classpath
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/.project
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/.project?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/.project (added)
+++ jackrabbit/sandbox/jcrutil/.project Wed Sep 24 03:08:44 2008
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>jcrutil</name>
+  <comment/>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/.project
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/.settings/org.eclipse.jdt.core.prefs?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/.settings/org.eclipse.jdt.core.prefs (added)
+++ jackrabbit/sandbox/jcrutil/.settings/org.eclipse.jdt.core.prefs Wed Sep 24 03:08:44 2008
@@ -0,0 +1,5 @@
+#Sun Sep 21 18:15:40 PDT 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: jackrabbit/sandbox/jcrutil/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/pom.xml?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/pom.xml (added)
+++ jackrabbit/sandbox/jcrutil/pom.xml Wed Sep 24 03:08:44 2008
@@ -0,0 +1,116 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+                      http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.jcrutil</groupId>
+  <artifactId>jcrutil</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>jcrutil</name>
+  
+  <repositories>
+    <repository>
+	  <id>jets3t</id>
+	  <name>jets3t</name>
+	  <url>http://jets3t.s3.amazonaws.com/maven2/</url>
+	</repository>
+	<repository>
+	  <id>apache-snapshots</id>
+	  <name>apache-snapshots</name>
+	  <url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+	</repository>
+  </repositories>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
+      <version>1.4.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <version>1.4.3</version>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jcl104-over-slf4j</artifactId>
+      <version>1.4.3</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.jcr</groupId>
+      <artifactId>jcr</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-vfs</groupId>
+      <artifactId>commons-vfs</artifactId>
+      <version>1.0</version>
+    </dependency>
+    <dependency>
+      <groupId>net.java.dev.jets3t</groupId>
+      <artifactId>jets3t</artifactId>
+      <version>0.6.1</version>
+    </dependency>
+    <dependency>
+      <groupId>net.sf.ehcache</groupId>
+      <artifactId>ehcache</artifactId>
+      <version>1.3.0</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-api</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-core</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-commons</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-spi</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-spi-commons</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-text-extractors</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jackrabbit</groupId>
+      <artifactId>jackrabbit-jcr-server</artifactId>
+      <version>1.5-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+</project>

Propchange: jackrabbit/sandbox/jcrutil/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/repository.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/repository.xml?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/repository.xml (added)
+++ jackrabbit/sandbox/jcrutil/repository.xml Wed Sep 24 03:08:44 2008
@@ -0,0 +1,151 @@
+<?xml version="1.0"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<!DOCTYPE Repository PUBLIC "-//The Apache Software Foundation//DTD Jackrabbit 1.5//EN"
+                            "http://jackrabbit.apache.org/dtd/repository-1.5.dtd">
+<!-- Example Repository Configuration File
+     Used by
+     - org.apache.jackrabbit.core.config.RepositoryConfigTest.java
+     -
+-->
+<Repository>
+    <!--
+        virtual file system where the repository stores global state
+        (e.g. registered namespaces, custom node types, etc.)
+    -->
+    <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+        <param name="path" value="${rep.home}/repository"/>
+    </FileSystem>
+
+    <!--
+        security configuration
+    -->
+    <Security appName="Jackrabbit">
+        <!--
+            security manager:
+            class: FQN of class implementing the JackrabbitSecurityManager interface
+        -->
+        <SecurityManager class="org.apache.jackrabbit.core.security.simple.SimpleSecurityManager" workspaceName="security">
+            <!--
+            workspace access:
+            class: FQN of class implementing the WorkspaceAccessManager interface
+            -->
+            <!-- <WorkspaceAccessManager class="..."/> -->
+            <!-- <param name="config" value="${rep.home}/security.xml"/> -->
+        </SecurityManager>
+
+        <!--
+            access manager:
+            class: FQN of class implementing the AccessManager interface
+        -->
+        <AccessManager class="org.apache.jackrabbit.core.security.simple.SimpleAccessManager">
+            <!-- <param name="config" value="${rep.home}/access.xml"/> -->
+        </AccessManager>
+
+        <LoginModule class="org.apache.jackrabbit.core.security.simple.SimpleLoginModule">
+           <!-- anonymous user id -->
+           <param name="anonymousId" value="anonymous"/>
+           <!-- administrator user id (default value if param is missing is 'admin') -->
+           <param name="adminId" value="admin"/>
+           <!--
+              default user name to be used instead of the anonymous user
+              when no login credentials are provided (unset by default)
+           -->
+           <!-- <param name="defaultUserId" value="superuser"/> -->
+        </LoginModule>
+    </Security>
+
+    <!--
+        location of workspaces root directory and name of default workspace
+    -->
+    <Workspaces rootPath="${rep.home}/workspaces" defaultWorkspace="default"/>
+    <!--
+        workspace configuration template:
+        used to create the initial workspace if there's no workspace yet
+    -->
+    <Workspace name="${wsp.name}">
+        <!--
+            virtual file system of the workspace:
+            class: FQN of class implementing the FileSystem interface
+        -->
+        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${wsp.home}"/>
+        </FileSystem>
+        <!--
+            persistence manager of the workspace:
+            class: FQN of class implementing the PersistenceManager interface
+        -->
+        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
+          <param name="url" value="jdbc:derby:${wsp.home}/db;create=true"/>
+          <param name="schemaObjectPrefix" value="${wsp.name}_"/>
+        </PersistenceManager>
+        <!--
+            Search index and the file system it uses.
+            class: FQN of class implementing the QueryHandler interface
+        -->
+        <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+            <param name="path" value="${wsp.home}/index"/>
+            <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+            <param name="extractorPoolSize" value="2"/>
+            <param name="supportHighlighting" value="true"/>
+        </SearchIndex>
+    </Workspace>
+
+    <!--
+        Configures the versioning
+    -->
+    <Versioning rootPath="${rep.home}/version">
+        <!--
+            Configures the filesystem to use for versioning for the respective
+            persistence manager
+        -->
+        <FileSystem class="org.apache.jackrabbit.core.fs.local.LocalFileSystem">
+            <param name="path" value="${rep.home}/version" />
+        </FileSystem>
+
+        <!--
+            Configures the persistence manager to be used for persisting version state.
+            Please note that the current versioning implementation is based on
+            a 'normal' persistence manager, but this could change in future
+            implementations.
+        -->
+        <PersistenceManager class="org.apache.jackrabbit.core.persistence.bundle.DerbyPersistenceManager">
+          <param name="url" value="jdbc:derby:${rep.home}/version/db;create=true"/>
+          <param name="schemaObjectPrefix" value="version_"/>
+        </PersistenceManager>
+    </Versioning>
+
+    <!--
+        Search index for content that is shared repository wide
+        (/jcr:system tree, contains mainly versions)
+    -->
+    <SearchIndex class="org.apache.jackrabbit.core.query.lucene.SearchIndex">
+        <param name="path" value="${rep.home}/repository/index"/>
+        <param name="textFilterClasses" value="org.apache.jackrabbit.extractor.MsWordTextExtractor,org.apache.jackrabbit.extractor.MsExcelTextExtractor,org.apache.jackrabbit.extractor.MsPowerPointTextExtractor,org.apache.jackrabbit.extractor.PdfTextExtractor,org.apache.jackrabbit.extractor.OpenOfficeTextExtractor,org.apache.jackrabbit.extractor.RTFTextExtractor,org.apache.jackrabbit.extractor.HTMLTextExtractor,org.apache.jackrabbit.extractor.XMLTextExtractor"/>
+        <param name="extractorPoolSize" value="2"/>
+        <param name="supportHighlighting" value="true"/>
+    </SearchIndex>
+    <!--
+    <DataStore class="org.jcrutil.S3DataStore">
+        <param name="awsAccessKey" value="" />
+        <param name="awsSecretKey" value="" />
+        <param name="bucketName" value="" />
+        <param name="minModifiedDate" value="0" />
+        <param name="minRecordLength" value="0" />
+    </DataStore>
+    -->
+</Repository>

Propchange: jackrabbit/sandbox/jcrutil/repository.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,404 @@
+/*
+ * JcrFileObject.java
+ */
+package org.jcrutil;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.PathNotFoundException;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.provider.AbstractFileObject;
+import org.apache.commons.vfs.provider.GenericFileName;
+import org.apache.commons.vfs.provider.URLFileName;
+import org.apache.commons.vfs.util.MonitorOutputStream;
+import org.apache.jackrabbit.api.jsr283.security.AccessControlManager;
+import org.apache.jackrabbit.api.jsr283.security.Privilege;
+import org.apache.jackrabbit.core.SessionImpl;
+import org.apache.jackrabbit.core.security.authorization.PrivilegeRegistry;
+import org.apache.jackrabbit.server.io.MimeResolver;
+
+/**
+ * A JCR base FileObject for VFS
+ * 
+ * @author scott
+ */
+public class JcrFileObject extends AbstractFileObject implements FileObject {
+    /** The Log */
+    private static Log log = LogFactory.getLog(JcrFileObject.class);
+
+    /** The MimeResolver */
+    private static MimeResolver MIME_RESOLVER = new MimeResolver();
+    
+    /** The FileSystem */
+    private JcrFileSystem jcrFs;
+
+    /** The FileName */
+    private GenericFileName gfName;
+
+    /** The Node represented by this FileObject */
+    private Node node;
+
+    /**
+     * Create a new FileObject
+     * 
+     * @param node
+     * @param name
+     * @param fs
+     */
+    protected JcrFileObject(Node node, GenericFileName name, JcrFileSystem fs) {
+        super(name, fs);
+        log.debug("Creating JcrFileObject: " + name.getPath());
+        this.gfName = name;
+        this.jcrFs = fs;
+        this.node = node;
+    }
+
+    /**
+     * Create a new FileObject
+     * 
+     * @param name
+     * @param fs
+     */
+    protected JcrFileObject(GenericFileName name, JcrFileSystem fs) {
+        this(null, name, fs);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected long doGetContentSize() throws Exception {
+        log.debug("JcrFileObject: doGetContentSize: " + gfName.getPath());
+        return node.getNode("jcr:content").getProperty("jcr:data").getLength();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected InputStream doGetInputStream() throws Exception {
+        log.debug("JcrFileObject: doGetInputStream: " + gfName.getPath());
+        return node.getNode("jcr:content").getProperty("jcr:data").getStream();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected OutputStream doGetOutputStream(boolean bAppend) throws Exception {
+        log.debug("JcrFileObject: doGetOutputStream: " + gfName.getPath());
+        return new JcrOutputStream(getFileSystem().getFileSystemManager().resolveFile("tmp://jcr-tmp-" + UUID.randomUUID()));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected FileType doGetType() throws Exception {
+        return JcrFileObject.getFileType(node);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected String[] doListChildren() throws Exception {
+        log.debug("JcrFileObject: doListChildren: " + gfName.getPath());
+        // Use doListChildrenResolved instead
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected FileObject[] doListChildrenResolved() throws Exception {
+        log.debug("JcrFileObject: doListChildrenResolved: " + gfName.getPath());
+
+        List<FileObject> children = new ArrayList<FileObject>();
+        NodeIterator iter = node.getNodes();
+        while (iter.hasNext()) {
+            Node child = iter.nextNode();
+
+            FileType type = JcrFileObject.getFileType(child);
+            log.debug("JcrFileObject: doListChildrenResolved: ChildNode: " + node.getPath());
+            
+            if (type == null) {
+                continue;
+            }
+
+            URLFileName ufn = new URLFileName(gfName.getScheme(), gfName.getHostName(), gfName.getPort(), gfName
+                    .getDefaultPort(), gfName.getUserName(), gfName.getPassword(), child.getPath(), type, null);
+
+            children.add(new JcrFileObject(child, ufn, jcrFs));
+        }
+
+        int numItems = children.size();
+        FileObject[] childArray = new FileObject[numItems];
+        childArray = children.toArray(childArray);
+
+        return childArray;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doAttach() throws Exception {
+        log.debug("JcrFileObject: doAttach: " + gfName.getPath());
+
+        // check if already attached
+        if (node != null) {
+            return;
+        }
+
+        Session session = jcrFs.getSession();
+        Node root = session.getRootNode();
+
+        try {
+            String pathName = gfName.getPath();
+            if (pathName.startsWith("/")) {
+                pathName = pathName.substring(1);
+            }
+
+            if (pathName.length() > 0) {
+                node = root.getNode(pathName);
+            } else {
+                node = root;
+            }
+
+        } catch (PathNotFoundException e) {
+            node = null;
+        }
+        
+        log.debug("JcrFileObject: doAttach: Type: " + JcrFileObject.getFileType(node));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doDetach() throws Exception {
+        log.debug("JcrFileObject: doDetach: " + gfName.getPath());
+        node = null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doCreateFolder() throws Exception {
+        log.debug("JcrFileObject: doCreateFolder: " + gfName.getPath());
+        JcrFileObject parent = (JcrFileObject) getParent();
+        FileType parentType = parent.getType();
+        if (!FileType.FOLDER.equals(parentType)) {
+            throw new IOException("Invalid parent node type: " + parentType);
+        }
+
+        FileType type = getType();
+        if (FileType.IMAGINARY.equals(type)) {
+            Node folderNode = parent.getNode().addNode(getName().getBaseName(), "nt:folder");
+            JcrFileObject.this.node = folderNode;
+        } else {
+            throw new IOException("Invalid node type: " + type);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doDelete() throws Exception {
+        log.debug("JcrFileObject: doDelete: " + gfName.getPath());
+        node.remove();
+        jcrFs.getSession().save();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doRename(FileObject newFile) throws Exception {
+        log.debug("JcrFileObject: doRename: " + gfName.getPath());
+        jcrFs.getSession().move(node.getPath(), newFile.getName().getPath());
+        jcrFs.getSession().save();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected long doGetLastModifiedTime() throws Exception {
+        String type = node.getProperty("jcr:primaryType").getString();
+        if ("nt:file".equals(type)) {
+            return node.getNode("jcr:content").getProperty("jcr:lastModified").getDate().getTimeInMillis();
+        } else if ("nt:folder".equals(type)) {
+            return node.getProperty("jcr:created").getDate().getTimeInMillis();
+        } else {
+            log.info("Unable to get time for: " + node.getPath());
+        }
+        
+        return 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected void doSetLastModifiedTime(final long modtime) throws Exception {
+        String type = node.getProperty("jcr:primaryType").getString();
+        if ("nt:file".equals(type)) {
+            Calendar lastModified = Calendar.getInstance();
+            lastModified.setTimeInMillis(modtime);
+            node.getNode("jcr:content").setProperty("jcr:lastModified", lastModified);
+            jcrFs.getSession().save();
+        } else {
+            log.info("Unable to set time for: " + node.getPath());
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected Map doGetAttributes() throws Exception {
+        log.debug("JcrFileObject: doGetAttributes: " + gfName.getPath());
+        // TODO
+        return Collections.EMPTY_MAP;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean doIsReadable() throws Exception {
+        log.debug("JcrFileObject: doIsReadable: " + gfName.getPath());
+        SessionImpl sess = (SessionImpl) jcrFs.getSession();
+        AccessControlManager acm = sess.getAccessControlManager();
+        PrivilegeRegistry pr = new PrivilegeRegistry(sess);
+        return acm.hasPrivileges(getName().getPath(), pr.getPrivileges(PrivilegeRegistry.READ));
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected boolean doIsWriteable() throws Exception {
+        log.debug("JcrFileObject: doIsWriteable: " + gfName.getPath());
+        SessionImpl sess = (SessionImpl) jcrFs.getSession();
+        AccessControlManager acm = sess.getAccessControlManager();
+        PrivilegeRegistry pr = new PrivilegeRegistry(sess);
+        return acm.hasPrivileges(getName().getPath(), pr.getPrivileges(PrivilegeRegistry.WRITE));
+    }
+
+    // get/set
+
+    /**
+     * @return the node
+     */
+    public Node getNode() {
+        return node;
+    }
+
+    // utility
+
+    /**
+     * Get FileType of <code>node</code>
+     * 
+     * @param node The Node
+     */
+    public static FileType getFileType(Node node) throws RepositoryException {
+        if (node == null) {
+            return FileType.IMAGINARY;
+        }
+
+        String type = node.getPrimaryNodeType().getName();
+        if ("nt:folder".equals(type) || "rep:root".equals(type)) {
+            return FileType.FOLDER;
+        } else if ("nt:file".equals(type) || "nt:linkedFile".equals(type)) {
+            return FileType.FILE;
+        } else {
+            log.info("Unknown node type: " + type);
+        }
+
+        return null;
+    }
+
+    /**
+     * OutputStream that uses a temp file
+     * 
+     * @author scott
+     */
+    private class JcrOutputStream extends MonitorOutputStream {
+        /** The temp file */
+        private final FileObject tmpFile;
+
+        /**
+         * Create JcrOutputStream
+         * 
+         * @param tmpFile
+         * @throws FileSystemException
+         */
+        public JcrOutputStream(FileObject tmpFile) throws FileSystemException {
+            super(tmpFile.getContent().getOutputStream());
+            log.debug("JcrOutputStream.constructor: " + gfName.getPath());
+            this.tmpFile = tmpFile;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        protected void onClose() throws IOException {
+            try {
+                log.debug("JcrOutputStream.onClose: " + gfName.getPath());
+                
+                JcrFileObject parent = (JcrFileObject) getParent();
+                FileType parentType = parent.getType();
+                if (!FileType.FOLDER.equals(parentType)) {
+                    throw new IOException("Invalid parent node type: " + parentType);
+                }
+                
+                Node resNode = null;
+                if (FileType.IMAGINARY.equals(doGetType())) {
+                    Node fileNode = parent.getNode().addNode(getName().getBaseName(), "nt:file");
+                    JcrFileObject.this.node = fileNode;
+                    resNode = fileNode.addNode("jcr:content", "nt:unstructured");
+                } else {
+                    resNode = JcrFileObject.this.node.getNode("jcr:content");
+                }
+
+                Calendar lastModified = Calendar.getInstance();
+                resNode.setProperty("jcr:mimeType", MIME_RESOLVER.getMimeType(getName().getBaseName()));
+                resNode.setProperty("jcr:data", new BufferedInputStream(tmpFile.getContent().getInputStream()));
+                resNode.setProperty("jcr:lastModified", lastModified);
+                jcrFs.getSession().save();
+
+            } catch (Exception e) {
+                throw new IOException(e.getMessage());
+            } finally {
+                tmpFile.close();
+                tmpFile.delete();
+            }
+        }
+    }
+
+}

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileObject.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,140 @@
+/*
+ * JcrFileProvider.java
+ */
+package org.jcrutil;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.vfs.Capability;
+import org.apache.commons.vfs.FileName;
+import org.apache.commons.vfs.FileSystem;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileSystemOptions;
+import org.apache.commons.vfs.UserAuthenticationData;
+import org.apache.commons.vfs.provider.AbstractOriginatingFileProvider;
+import org.apache.commons.vfs.provider.FileProvider;
+import org.apache.commons.vfs.provider.GenericFileName;
+import org.apache.commons.vfs.provider.http.HttpFileNameParser;
+import org.apache.commons.vfs.util.UserAuthenticatorUtils;
+import org.apache.jackrabbit.core.TransientRepository;
+
+/**
+ * A JCR based provider for VFS
+ * 
+ * @author scott
+ */
+public class JcrFileProvider extends AbstractOriginatingFileProvider implements FileProvider {
+    private static Log LOG = LogFactory.getLog(JcrFileProvider.class);
+    
+    /** Filesystem capabilities */
+    protected final static Collection capabilities = Collections.unmodifiableCollection(Arrays.asList(new Capability[]{
+            Capability.ATTRIBUTES, Capability.CREATE, Capability.DELETE, Capability.GET_LAST_MODIFIED, Capability.GET_TYPE,
+            Capability.LIST_CHILDREN, Capability.RANDOM_ACCESS_READ, Capability.READ_CONTENT, Capability.RENAME,
+            Capability.URI, Capability.WRITE_CONTENT}));
+
+    /** UserAuthenticationData */
+    public final static UserAuthenticationData.Type[] AUTHENTICATOR_TYPES = new UserAuthenticationData.Type[]{
+            UserAuthenticationData.USERNAME, UserAuthenticationData.PASSWORD};
+
+    /**
+     * Create new JcrFileProvider
+     */
+    public JcrFileProvider() {
+        super();
+        LOG.debug("Creating new JcrFileProvider");
+        setFileNameParser(HttpFileNameParser.getInstance());
+    }
+
+    /**
+     * Create the FileSystem
+     * 
+     * @param fileName The FileName
+     * @param options The FileSystemOptions
+     * @return The FileSystem
+     */
+    protected FileSystem doCreateFileSystem(FileName fileName, FileSystemOptions options) throws FileSystemException {
+        UserAuthenticationData authData = null;
+        GenericFileName genericName = (GenericFileName) fileName;
+        Repository repository = null;
+        Session session = null;
+
+        try {
+            repository = getRepository();
+
+            authData = UserAuthenticatorUtils.authenticate(options, AUTHENTICATOR_TYPES);
+            char[] userName = UserAuthenticatorUtils.getData(authData, UserAuthenticationData.USERNAME, UserAuthenticatorUtils
+                    .toChar(genericName.getUserName()));
+            char[] pass = UserAuthenticatorUtils.getData(authData, UserAuthenticationData.PASSWORD, UserAuthenticatorUtils
+                    .toChar(genericName.getPassword()));
+
+            if (userName == null) {
+                userName = new char[]{};
+            }
+
+            if (pass == null) {
+                pass = new char[]{};
+            }
+
+            Credentials cred = new SimpleCredentials(new String(userName), pass);
+            session = repository.login(cred, genericName.getHostName());
+        } catch (Exception e) {
+            throw new FileSystemException("Unable to connect to repository.", e);
+        }
+
+        return new JcrFileSystem(session, fileName, null, options);
+    }
+
+    /**
+     * Get Collection of Capabilities
+     * 
+     * @return Collection of Capabilities
+     */
+    public Collection getCapabilities() {
+        return capabilities;
+    }
+
+    // Repository
+    private static Repository repository;
+
+    public static Repository getRepository() throws IOException, NamingException, RepositoryException {
+        LOG.debug("getRepository");
+        
+        repository = getJNDIRepository();
+        
+        if (repository == null) {
+            repository = new TransientRepository();
+        }
+        
+        return repository;
+    }
+    
+    public static Repository getJNDIRepository() throws RepositoryException {
+        Repository r = null;
+        
+        try {
+            InitialContext context = new InitialContext();
+            Context environment = (Context) context.lookup("java:comp/env");
+            r = (Repository) environment.lookup("jcr/repository");
+            
+            LOG.debug("Found repository: " + r);
+        } catch (NamingException ne) {
+            LOG.warn("Unable to locate repository via JNDI: " + ne);
+        }
+        
+        return r;
+    }
+}

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,74 @@
+/*
+ * JcrFileSystem.java
+ */
+package org.jcrutil;
+
+import java.util.Collection;
+
+import javax.jcr.Session;
+
+import org.apache.commons.vfs.FileName;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystem;
+import org.apache.commons.vfs.FileSystemOptions;
+import org.apache.commons.vfs.provider.AbstractFileSystem;
+import org.apache.commons.vfs.provider.GenericFileName;
+
+/**
+ * A JCR based FileSystem for VFS
+ * @author scott
+ *
+ */
+public class JcrFileSystem extends AbstractFileSystem implements FileSystem {
+
+    /** The session */
+    private Session session;
+
+    /**
+     * Create a JcrFileSystem
+     * @param repository The repository
+     * @param session The session
+     * @param rootName The root name
+     * @param parentLayer The parent layer
+     * @param fileSystemOptions The options
+     */
+    protected JcrFileSystem(Session session, FileName rootName, FileObject parentLayer,
+            FileSystemOptions fileSystemOptions) {
+        super(rootName, parentLayer, fileSystemOptions);
+        this.session = session;
+    }
+
+    /**
+     * Add capabilities of this <code>FileSystem</code> to
+     * <code>capabilities</code>.
+     * @param capabilities A Collection of capabilities
+     */
+    @Override
+    protected void addCapabilities(Collection capabilities) {
+        capabilities.addAll(JcrFileProvider.capabilities);
+    }
+
+    /**
+     * Create a new FileObject
+     * @param fileName The FileName
+     */
+    @Override
+    protected FileObject createFile(FileName fileName) throws Exception {
+        return new JcrFileObject((GenericFileName) fileName, this);
+    }
+
+    /**
+     * @return the session
+     */
+    public Session getSession() {
+        return session;
+    }
+    
+    public void close() {
+    	super.close();
+    	if (session != null) {
+    		session.logout();
+    	}
+    }
+
+}

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/JcrFileSystem.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,106 @@
+/*
+ * S3DataRecord.java
+ */
+package org.jcrutil;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Date;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.core.data.AbstractDataRecord;
+import org.apache.jackrabbit.core.data.DataIdentifier;
+import org.apache.jackrabbit.core.data.DataRecord;
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.impl.rest.httpclient.RestS3Service;
+import org.jets3t.service.model.S3Bucket;
+import org.jets3t.service.model.S3Object;
+
+public class S3DataRecord extends AbstractDataRecord implements DataRecord {
+    /** The Log */
+    private static Log LOG = LogFactory.getLog(S3DataRecord.class);
+    
+    /** The S3Object */
+    private S3Object s3Object;
+    
+    /** The DataStore */
+    private S3DataStore dataStore;
+    
+    /** The DataIdentifier */
+    private DataIdentifier identifier;
+    
+    /**
+     * Create new DataRecord
+     * @param identifier The DataIdentifier
+     * @param s3Object The S3Object
+     */
+    public S3DataRecord(S3DataStore dataStore, DataIdentifier identifier, S3Object s3Object) {
+        super(identifier);
+        this.dataStore = dataStore;
+        this.identifier = identifier;
+        this.s3Object = s3Object;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getLastModified() {
+        Date lastMod = s3Object.getLastModifiedDate();
+        if (lastMod != null)
+            return lastMod.getTime();
+        
+        return 0;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public long getLength() throws DataStoreException {
+        return s3Object.getContentLength();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public InputStream getStream() throws DataStoreException {
+        LOG.debug("getStream: " + identifier.toString());
+        InputStream is = null;
+        
+        try {
+            Cache s3oContentCache = CacheManager.getInstance().getCache("s3oContentCache");
+            Element elem = s3oContentCache.get(s3Object.getKey());
+            if (elem != null) {
+                String path = (String) elem.getValue();
+                File tmp = new File(path);
+                if (tmp.exists()) {
+                    is = new BufferedInputStream(new FileInputStream(tmp));
+                }
+            }
+            
+            if (is == null) {
+                S3Service s3Service = new RestS3Service(dataStore.getAwsCredentials());
+                s3Object = s3Service.getObject(new S3Bucket(dataStore.getBucketName()), identifier.toString());
+                is = s3Object.getDataInputStream();
+            }
+        } catch (Exception se) {
+            throw new DataStoreException(se);
+        }
+        
+        return is;
+    }
+
+    /**
+     * @return the s3Object
+     */
+    public S3Object getS3Object() {
+        return s3Object;
+    }
+}

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataRecord.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,342 @@
+/*
+ * S3DataStore.java
+ */
+package org.jcrutil;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.ref.WeakReference;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.WeakHashMap;
+
+import javax.jcr.RepositoryException;
+
+import net.sf.ehcache.Cache;
+import net.sf.ehcache.CacheManager;
+import net.sf.ehcache.Element;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.core.data.DataIdentifier;
+import org.apache.jackrabbit.core.data.DataRecord;
+import org.apache.jackrabbit.core.data.DataStore;
+import org.apache.jackrabbit.core.data.DataStoreException;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.S3ServiceException;
+import org.jets3t.service.impl.rest.httpclient.RestS3Service;
+import org.jets3t.service.model.S3Bucket;
+import org.jets3t.service.model.S3Object;
+import org.jets3t.service.security.AWSCredentials;
+import org.jets3t.service.utils.Mimetypes;
+
+public class S3DataStore implements DataStore {
+    /** The Log */
+    private static Log LOG = LogFactory.getLog(S3DataStore.class);
+
+    /** Cached credentials */
+    protected AWSCredentials awsCredentials;
+
+    /** Config parameter awsAccessKey */
+    protected String awsAccessKey;
+
+    /** Config parameter awsSecretKey */
+    protected String awsSecretKey;
+
+    /** Config parameter bucketName */
+    protected String bucketName;
+
+    /** Config parameter minModifiedDate */
+    protected long minModifiedDate;
+
+    /** Config parameter minRecordLength */
+    protected int minRecordLength;
+
+    /** The S3Service */
+    private S3Service s3Service;
+
+    /** S3Object cache */
+    // private Cache s3oCache;
+    /**
+     * All data identifiers that are currently in use are in this set until they
+     * are garbage collected.
+     */
+    protected Map inUse = Collections.synchronizedMap(new WeakHashMap());
+
+    /**
+     * Create a new DataStore
+     */
+    public S3DataStore() {
+        LOG.debug("Creating S3DataStore");
+    }
+
+    // start DataStore methods
+
+    /**
+     * {@inheritDoc}
+     */
+    public DataRecord addRecord(InputStream stream) throws DataStoreException {
+        DataIdentifier identifier = null;
+        S3Object s3o = null;
+
+        try {
+            String uuid = UUID.randomUUID().toString();
+            LOG.debug("Adding DataRecord: " + uuid);
+
+            File tmp = File.createTempFile("s3-", ".tmp");
+            tmp.deleteOnExit();
+            
+            InputStream in = new BufferedInputStream(stream, 4096);
+            OutputStream out = new BufferedOutputStream(new FileOutputStream(tmp), 4096);
+            int i = 0;
+            byte[] buf = new byte[4096];
+            while ((i = in.read(buf)) != -1) {
+                out.write(buf, 0, i);
+            }
+            
+            out.close();
+            
+            Cache s3oContentCache = CacheManager.getInstance().getCache("s3oContentCache");
+            s3oContentCache.put(new Element(uuid, tmp.getAbsolutePath()));
+            
+            S3DataTransfer dt = new S3DataTransfer(s3Service, bucketName, uuid, tmp);
+            new Thread(dt).start();
+            
+            S3Bucket s3b = new S3Bucket(bucketName);
+            s3o = new S3Object(s3b, uuid);
+            s3o.setContentLength(tmp.length());
+            s3o.setLastModifiedDate(new Date(tmp.lastModified()));
+            s3o.setContentType(Mimetypes.getInstance().getMimetype(tmp));
+            
+            Cache s3oCache = CacheManager.getInstance().getCache("s3oCache");
+            s3oCache.put(new Element(uuid, s3o));
+
+            identifier = new DataIdentifier(uuid);
+            usesIdentifier(identifier);
+        } catch (Exception e) {
+            throw new DataStoreException(e);
+        }
+
+        return new S3DataRecord(this, identifier, s3o);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void clearInUse() {
+        LOG.debug("clearInUse");
+        inUse.clear();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void close() throws DataStoreException {
+        LOG.debug("close");
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int deleteAllOlderThan(long min) throws DataStoreException {
+        LOG.debug("deleteAllOlderThan");
+        int deleted = 0;
+
+        for (Iterator i = getAllIdentifiers(); i.hasNext();) {
+            S3DataRecord rec = (S3DataRecord) i.next();
+            if (rec.getLastModified() < min) {
+                deleteRecord(new DataIdentifier(rec.getS3Object().getKey()));
+                deleted++;
+            }
+        }
+
+        return deleted;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Iterator getAllIdentifiers() throws DataStoreException {
+        LOG.debug("getAllIdentifiers");
+        return new S3DataStoreIterator(this, awsCredentials, bucketName);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public int getMinRecordLength() {
+        LOG.debug("getMinRecordLength");
+        return minRecordLength;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public DataRecord getRecord(DataIdentifier identifier) throws DataStoreException {
+        LOG.debug("getRecord: " + identifier);
+
+        try {
+            String ident = identifier.toString();
+            Cache s3oCache = CacheManager.getInstance().getCache("s3oCache");
+            Element elem = s3oCache.get(ident);
+
+            S3Object s3o = null;
+            if (elem != null) {
+                LOG.debug("getRecord cache hit: " + ident);
+                s3o = (S3Object) elem.getValue();
+            } else {
+                LOG.debug("getRecord adding to cache: " + ident);
+                s3o = s3Service.getObjectDetails(new S3Bucket(bucketName), ident);
+                s3oCache.put(new Element(ident, s3o));
+            }
+
+            usesIdentifier(identifier);
+
+            if (minModifiedDate > 0) {
+                Date lmd = s3o.getLastModifiedDate();
+                if (lmd.getTime() < minModifiedDate) {
+                    s3o.setLastModifiedDate(new Date());
+                    s3Service.updateObjectMetadata(bucketName, s3o);
+                    s3oCache.put(new Element(ident, s3o));
+                }
+            }
+
+            return new S3DataRecord(this, identifier, s3o);
+        } catch (S3ServiceException se) {
+            throw new DataStoreException(se);
+        }
+    }
+
+    /**
+     * Delete data record
+     * 
+     * @param identifier The DataIdentifier
+     */
+    public void deleteRecord(DataIdentifier identifier) throws DataStoreException {
+        LOG.debug("deleteRecord: " + identifier);
+
+        try {
+            s3Service.deleteObject(new S3Bucket(bucketName), identifier.toString());
+        } catch (S3ServiceException se) {
+            throw new DataStoreException(se);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void init(String homeDir) throws RepositoryException {
+        LOG.debug("Init...");
+
+        try {
+            awsCredentials = new AWSCredentials(awsAccessKey, awsSecretKey);
+            s3Service = new RestS3Service(awsCredentials);
+            LOG.debug("Max http connections: "
+                    + s3Service.getJetS3tProperties().getStringProperty("httpclient.max-connections", "Unknown"));
+
+            if (!s3Service.isBucketAccessible(bucketName)) {
+                LOG.debug("Creating bucket: " + bucketName);
+                s3Service.createBucket(bucketName);
+            }
+        } catch (S3ServiceException se) {
+            throw new RepositoryException(se);
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void updateModifiedDateOnAccess(long before) {
+        LOG.debug("updateModifiedDateOnAccess");
+        minModifiedDate = before;
+    }
+
+    // end DataStore methods
+
+    /**
+     * Add WeakReference to inUse Map
+     * 
+     * @param identifier The DataIdentifier
+     */
+    private void usesIdentifier(DataIdentifier identifier) {
+        inUse.put(identifier, new WeakReference(identifier));
+    }
+
+    /**
+     * @return the awsAccessKey
+     */
+    public String getAwsAccessKey() {
+        return awsAccessKey;
+    }
+
+    /**
+     * @param awsAccessKey the awsAccessKey to set
+     */
+    public void setAwsAccessKey(String awsAccessKey) {
+        this.awsAccessKey = awsAccessKey;
+    }
+
+    /**
+     * @return the awsSecretKey
+     */
+    public String getAwsSecretKey() {
+        return awsSecretKey;
+    }
+
+    /**
+     * @param awsSecretKey the awsSecretKey to set
+     */
+    public void setAwsSecretKey(String awsSecretKey) {
+        this.awsSecretKey = awsSecretKey;
+    }
+
+    /**
+     * @return the minModifiedDate
+     */
+    public long getMinModifiedDate() {
+        return minModifiedDate;
+    }
+
+    /**
+     * @param minModifiedDate the minModifiedDate to set
+     */
+    public void setMinModifiedDate(long minModifiedDate) {
+        this.minModifiedDate = minModifiedDate;
+    }
+
+    /**
+     * @param minRecordLength the minRecordLength to set
+     */
+    public void setMinRecordLength(int minRecordLength) {
+        this.minRecordLength = minRecordLength;
+    }
+
+    /**
+     * @return the bucketName
+     */
+    public String getBucketName() {
+        return bucketName;
+    }
+
+    /**
+     * @param bucketName the bucketName to set
+     */
+    public void setBucketName(String bucketName) {
+        this.bucketName = bucketName;
+    }
+
+    /**
+     * @return the awsCredentials
+     */
+    public AWSCredentials getAwsCredentials() {
+        return awsCredentials;
+    }
+
+}

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,38 @@
+/*
+ * S3DataStoreIterator.java
+ */
+package org.jcrutil;
+
+import java.util.Iterator;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.jackrabbit.core.data.DataIdentifier;
+import org.jets3t.service.model.S3Object;
+import org.jets3t.service.security.AWSCredentials;
+
+public class S3DataStoreIterator implements Iterator {
+    private static Log LOG = LogFactory.getLog(S3DataStoreIterator.class);
+    
+    private S3DataStore dataStore;
+    private S3Iterator iterator;
+    
+    public S3DataStoreIterator(S3DataStore dataStore, AWSCredentials awsCredentials, String bucketName) {
+        this.dataStore = dataStore;
+        iterator = new S3Iterator(awsCredentials, bucketName);
+    }
+
+    public boolean hasNext() {
+        return iterator.hasNext();
+    }
+
+    public Object next() {
+        S3Object s3o = (S3Object) iterator.next();
+        LOG.debug("Next object is: " + s3o.getKey());
+        return new S3DataRecord(dataStore, new DataIdentifier(s3o.getKey()), s3o);
+    }
+
+    public void remove() {
+        iterator.remove();
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataStoreIterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,47 @@
+/*
+ * S3DataTransfer.java
+ */
+package org.jcrutil;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.model.S3Bucket;
+import org.jets3t.service.model.S3Object;
+
+public class S3DataTransfer implements Runnable {
+    private static Log LOG = LogFactory.getLog(S3DataTransfer.class);
+    private S3Service s3Service;
+    private String bucketName;
+    private String uuid;
+    private File tmp;
+    
+    public S3DataTransfer(S3Service s3Service, String bucketName, String uuid, File tmp) {
+        this.s3Service = s3Service;
+        this.bucketName = bucketName;
+        this.uuid = uuid;
+        this.tmp = tmp;
+    }
+
+    public void run() {
+        try {
+            LOG.debug("Starting data transfer: " + uuid);
+            S3Bucket s3b = new S3Bucket(bucketName);
+            S3Object s3o = new S3Object(s3b, tmp);
+            s3o.setKey(uuid);
+            s3Service.putObject(s3b, s3o);
+            
+            s3o.setDataInputFile(null);
+            if (!tmp.delete()) {
+                LOG.warn("Unable to delete tmp file: " + tmp.getAbsolutePath());
+            }
+            
+            LOG.debug("Finished data transfer: " + uuid);
+        } catch (Exception e) {
+            LOG.error(e);
+        }
+    }
+
+}
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3DataTransfer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java (added)
+++ jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,131 @@
+/*
+ * S3Iterator.java
+ */
+package org.jcrutil;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jets3t.service.S3ObjectsChunk;
+import org.jets3t.service.S3Service;
+import org.jets3t.service.S3ServiceException;
+import org.jets3t.service.impl.rest.httpclient.RestS3Service;
+import org.jets3t.service.security.AWSCredentials;
+
+public class S3Iterator implements Iterator {
+    /** The Log */
+    private static Log LOG = LogFactory.getLog(S3Iterator.class);
+    
+    /** The credentials */
+    private AWSCredentials awsCredentials;
+    
+    /** The bucket name */
+    private String bucketName;
+    
+    /** The chunk size */
+    private int chunkSize;
+    
+    /** The current chunk */
+    private S3ObjectsChunk currentChunk;
+    
+    /** Iterator for current chunk */
+    private Iterator currentIterator;
+    
+    /** The last key */
+    private String lastKey;
+    
+    /** Indicates if iterator has been initialized */
+    private boolean initDone;
+    
+    /**
+     * Create a new S3Iterator
+     * @param awsCredentials The credentials
+     * @param bucketName The bucket name
+     */
+    public S3Iterator(AWSCredentials awsCredentials, String bucketName) {
+        this(awsCredentials, bucketName, 100);
+    }
+    
+    /**
+     * Create a new S3Iterator
+     * @param awsCredentials The credentials
+     * @param bucketName The bucket name
+     * @param size The chunk size
+     */
+    public S3Iterator(AWSCredentials awsCredentials, String bucketName, int size) {
+        this.awsCredentials = awsCredentials;
+        this.bucketName = bucketName;
+        this.chunkSize = size;
+        this.initDone = false;
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    public boolean hasNext() {
+        if (!initDone) {
+            init();
+        }
+        
+        boolean hasNext = currentIterator.hasNext();
+        if (!hasNext) {
+            if (lastKey == null) {
+                return false;
+            }
+            
+            getNext();
+            hasNext = currentIterator.hasNext();
+            if (!hasNext) {
+                return false;
+            }
+        }
+        
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object next() {
+        if (!hasNext()) {
+            throw new NoSuchElementException();
+        }
+        
+        return currentIterator.next();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public void remove() {
+        throw new UnsupportedOperationException("Remove not supported.");
+    }
+    
+    /**
+     * Initialize the iterator
+     */
+    private void init() {
+        getNext();
+        initDone = true;
+    }
+
+    /**
+     * Get next results
+     * @param s3Service
+     * @throws S3ServiceException
+     */
+    private void getNext() {
+        try {
+            LOG.debug("Getting next iterator, last key: " + lastKey);
+            S3Service s3Service = new RestS3Service(awsCredentials);
+            currentChunk = s3Service.listObjectsChunked(bucketName, null, null, chunkSize, lastKey);
+            currentIterator = Arrays.asList(currentChunk.getObjects()).iterator();
+            lastKey = currentChunk.getPriorLastKey();
+        } catch (S3ServiceException se) {
+            LOG.error(se);
+        }
+    }
+}
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/src/main/java/org/jcrutil/S3Iterator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml (added)
+++ jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml Wed Sep 24 03:08:44 2008
@@ -0,0 +1,5 @@
+<providers>
+  <provider class-name="org.jcrutil.JcrFileProvider">
+    <scheme name="jcr"/>
+  </provider>
+</providers>

Propchange: jackrabbit/sandbox/jcrutil/src/main/resources/META-INF/vfs-providers.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml (added)
+++ jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml Wed Sep 24 03:08:44 2008
@@ -0,0 +1,26 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:noNamespaceSchemaLocation="ehcache.xsd">
+    <diskStore path="java.io.tmpdir" />
+
+    <defaultCache maxElementsInMemory="10000" eternal="false"
+        timeToIdleSeconds="120" timeToLiveSeconds="120" overflowToDisk="true"
+        diskSpoolBufferSizeMB="30" maxElementsOnDisk="10000000"
+        diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
+        memoryStoreEvictionPolicy="LRU" />
+
+    <cache name="s3oCache" maxElementsInMemory="10000"
+        maxElementsOnDisk="1000" eternal="false" overflowToDisk="true"
+        diskSpoolBufferSizeMB="20" timeToIdleSeconds="120"
+        timeToLiveSeconds="120" memoryStoreEvictionPolicy="LRU" />
+        
+    <cache name="s3oContentCache" maxElementsInMemory="10000"
+        maxElementsOnDisk="1000" eternal="false" overflowToDisk="true"
+        diskSpoolBufferSizeMB="20" timeToIdleSeconds="900"
+        timeToLiveSeconds="900" memoryStoreEvictionPolicy="LRU">
+    </cache>
+
+    <cache name="workspaceAccessCache" maxElementsInMemory="10000"
+        maxElementsOnDisk="1000" eternal="false" overflowToDisk="true"
+        diskSpoolBufferSizeMB="20" timeToIdleSeconds="120"
+        timeToLiveSeconds="120" memoryStoreEvictionPolicy="LRU" />
+</ehcache>
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/src/main/resources/ehcache.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties (added)
+++ jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties Wed Sep 24 03:08:44 2008
@@ -0,0 +1,73 @@
+#########################
+# Low-level configuration of jets3t toolkit behaviour.
+#
+# For detailed documentation, please see:
+# http://jets3t.s3.amazonaws.com/toolkit/configuration.html
+#
+# Any properties set in this file will affect all applications using the 
+# JetS3t library.
+#########################
+
+###
+# GUI application properties
+###
+gui.verboseErrorDialog=true
+
+###
+# Upload properties for applications.
+###
+uploads.storeEmptyDirectories=true
+
+###
+# Download properties for applications.
+###
+downloads.restoreLastModifiedDate=false
+
+###
+# S3Service properties
+###
+s3service.https-only=true
+s3service.max-thread-count=4
+s3service.admin-max-thread-count=10
+s3service.stream-retry-buffer-size=131072
+s3service.internal-error-retry-max=5
+s3service.default-bucket-location=US
+s3service.s3-endpoint=s3.amazonaws.com
+s3service.disable-dns-buckets=false
+
+#s3service.ignore-exceptions-in-multi=false
+
+###
+# REST/HTTP HttpClient Implementation properties
+###
+httpclient.connection-timeout-ms=60000
+httpclient.socket-timeout-ms=60000
+httpclient.max-connections=100
+httpclient.stale-checking-enabled=true
+httpclient.retry-max=5
+#httpclient.useragent=My User Agent String
+#httpclient.read-throttle=50
+httpclient.proxy-autodetect=true
+#httpclient.proxy-host=
+#httpclient.proxy-port=
+
+# TCP window size hints for kernel 
+#httpclient.socket-receive-buffer=65536
+#httpclient.socket-send-buffer=65536
+
+###
+# File/Object comparison properties
+###
+#filecomparer.use-md5-files=true
+#filecomparer.generate-md5-files=true
+#filecomparer.skip-upload-of-md5-files=true
+#filecomparer.ignore-panic-dir-placeholders=true
+
+###
+# Encryption Algorithm
+#
+# Note that some cryptography options will only be available
+# if the Java Cryptography Extension (JCE) Unlimited Strength 
+# Jurisdiction Policy Files are installed.
+###
+crypto.algorithm=PBEWithMD5AndDES

Propchange: jackrabbit/sandbox/jcrutil/src/main/resources/jets3t.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java (added)
+++ jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,59 @@
+/*
+ * S3DataStoreTest.java
+ */
+package org.jcrutil;
+
+import javax.jcr.Repository;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+import javax.jcr.Node;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.jackrabbit.core.TransientRepository;
+
+import junit.framework.TestCase;
+
+public class S3DataStoreTest extends TestCase {
+    private static Log log = LogFactory.getLog(S3DataStoreTest.class);
+    private Repository repo;
+    private Session session;
+    
+    public void testFileOperations() throws Exception {
+        log.debug("Starting S3DataStoreTest.testFileOperations");
+        
+        try {
+            Node root = session.getRootNode();
+
+            // Store content
+            Node node1 = root.addNode("node1");
+            Node node2 = root.addNode("node2");
+            Node node3 = node1.addNode("node3");
+            node3.setProperty("message", "Hello, World!");
+            session.save();
+
+            // Retrieve content
+            Node node = root.getNode("node1/node3");
+            System.out.println(node.getPath());
+            System.out.println(node.getProperty("message").getString());
+
+            // Remove content
+            root.getNode("node1").remove();
+            session.save();
+        } finally {
+            session.logout();
+        }
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        repo = new TransientRepository("repository.xml", "repository");
+        session = repo.login(new SimpleCredentials("username", "password".toCharArray()));
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+}

Propchange: jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/S3DataStoreTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java (added)
+++ jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java Wed Sep 24 03:08:44 2008
@@ -0,0 +1,109 @@
+/*
+ * VfsTest.java
+ */
+package org.jcrutil;
+
+import java.io.OutputStream;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.vfs.FileObject;
+import org.apache.commons.vfs.FileSystem;
+import org.apache.commons.vfs.FileSystemManager;
+import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.Selectors;
+import org.apache.commons.vfs.VFS;
+import org.apache.commons.vfs.provider.FileProvider;
+
+public class VfsTest extends TestCase {
+    private static Log log = LogFactory.getLog(VfsTest.class);
+    private FileObject root;
+    
+    public void testFileOperations() throws Exception {
+        log.debug("Starting VfsTest.testFileOperations");
+        
+        // look up name
+        FileObject file = root.resolveFile("file1.txt");
+        assertTrue(FileType.IMAGINARY.equals(file.getType()));
+        assertTrue(!file.exists());
+        
+        // create
+        file.createFile();
+        assertTrue(file.exists());
+        
+        // write
+        String content = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
+        
+        OutputStream os = file.getContent().getOutputStream();
+        os.write(content.getBytes());
+        file.getContent().close();
+        
+        long size = file.getContent().getSize();
+        assertTrue(size == content.length());
+        
+        // copy
+        FileObject file2 = root.resolveFile("file2.txt");
+        assertTrue(!file2.exists());
+        file2.copyFrom(file, Selectors.SELECT_SELF);
+        assertTrue(file2.exists());
+        
+        long size2 = file2.getContent().getSize();
+        assertTrue(size2 == size);
+        
+        // delete
+        assertTrue(file.delete());
+        assertTrue(file2.delete());
+    }
+    
+    public void testFolderOperations() throws Exception {
+        log.debug("Starting VfsTest.testFolderOperations");
+        
+        // look up name
+        FileObject folder = root.resolveFile("/asdf");
+        assertTrue(FileType.IMAGINARY.equals(folder.getType()));
+        assertTrue(!folder.exists());
+        
+        // create
+        folder.createFolder();
+        assertTrue(folder.exists());
+        
+        // add file
+        FileObject file = root.resolveFile("/asdf/tmp.txt");
+        OutputStream os = file.getContent().getOutputStream();
+        os.write(new byte[] {'a','a','a','a','a','a','a','a','a','a'});
+        file.getContent().close();
+        
+        // add subdirectory
+        FileObject folder2 = root.resolveFile("/asdf/asdf");
+        folder2.createFolder();
+        assertTrue(folder2.exists());
+        
+        // delete
+        assertTrue(folder2.delete());
+        assertTrue(file.delete());
+        assertTrue(folder.delete());
+    }
+    
+    public void testProviderClass() throws Exception {
+        Class clazz = this.getClass().getClassLoader().loadClass("org.jcrutil.JcrFileProvider");
+        Object instance = clazz.newInstance();
+        FileProvider fp = (FileProvider)instance;
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        root = VFS.getManager().resolveFile( "jcr://user:pass@default/" );
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+        
+        // the filesystem must be closed for others to use the JCR url
+        FileSystem fs = root.getFileSystem();
+        FileSystemManager fsm = fs.getFileSystemManager();
+        fsm.closeFileSystem(fs);        
+    }
+    
+}

Propchange: jackrabbit/sandbox/jcrutil/src/test/java/org/jcrutil/VfsTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml?rev=698501&view=auto
==============================================================================
--- jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml (added)
+++ jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml Wed Sep 24 03:08:44 2008
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+    <appender name="console" class="org.apache.log4j.ConsoleAppender">
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m (%F, line %L)%n"/>
+        </layout>
+    </appender>
+
+    <appender name="jcrutil" class="org.apache.log4j.FileAppender">
+        <param name="File" value="jcrutil.log"/>
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m (%F, line %L)%n"/>
+        </layout>
+    </appender>
+
+    <root>
+        <level value="info" />
+        <appender-ref ref="jcrutil"/>
+    </root>
+    
+    <logger name="org.jcrutil" additivity="false">
+        <level value="debug"/>
+        <appender-ref ref="jcrutil"/>
+    </logger>
+    
+</log4j:configuration>
\ No newline at end of file

Propchange: jackrabbit/sandbox/jcrutil/src/test/resources/log4j.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message