Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id F339F100B0 for ; Sat, 10 Aug 2013 05:55:53 +0000 (UTC) Received: (qmail 20549 invoked by uid 500); 10 Aug 2013 05:55:53 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 20493 invoked by uid 500); 10 Aug 2013 05:55:51 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 20446 invoked by uid 99); 10 Aug 2013 05:55:50 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 05:55:50 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Aug 2013 05:55:45 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 752462388CA3; Sat, 10 Aug 2013 05:54:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1512568 [31/39] - in /jackrabbit/commons/filevault/trunk: ./ parent/ vault-cli/ vault-cli/src/ vault-cli/src/main/ vault-cli/src/main/appassembler/ vault-cli/src/main/assembly/ vault-cli/src/main/java/ vault-cli/src/main/java/org/ vault-cl... Date: Sat, 10 Aug 2013 05:53:54 -0000 To: commits@jackrabbit.apache.org From: tripod@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130810055417.752462388CA3@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/MD5Test.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/MD5Test.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/MD5Test.java (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/MD5Test.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,80 @@ +/* + * 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. + */ + +package org.apache.jackrabbit.vault.util; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +import junit.framework.TestCase; + +/** + * MD5Test... + */ +public class MD5Test extends TestCase { + + private static String testData = "Hello, World"; + private static String testString = "82bb413746aee42f89dea2b59614f9ef"; + private static long testMSB = 0x82bb413746aee42fL; + private static long testLSB = 0x89dea2b59614f9efL; + private static byte[] testBytes = new byte[]{ + (byte) 0x82, (byte) 0xbb, (byte) 0x41, (byte) 0x37, + (byte) 0x46, (byte) 0xae, (byte) 0xe4, (byte) 0x2f, + (byte) 0x89, (byte) 0xde, (byte) 0xa2, (byte) 0xb5, + (byte) 0x96, (byte) 0x14, (byte) 0xf9, (byte) 0xef + }; + + public void testCreateLong() { + MD5 md5 = new MD5(testMSB, testLSB); + assertEquals(testString, md5.toString()); + assertEquals(testBytes, md5.getBytes()); + } + + public void testCreateBytes() { + MD5 md5 = new MD5(testBytes); + assertEquals(testString, md5.toString()); + assertEquals(testMSB, md5.getMsb()); + assertEquals(testLSB, md5.getLsb()); + } + + public void testCreateString() { + MD5 md5 = new MD5(testString); + assertEquals(testMSB, md5.getMsb()); + assertEquals(testLSB, md5.getLsb()); + } + + public void testSmall() { + MD5 md5 = new MD5(0, 0); + assertEquals("00000000000000000000000000000000", md5.toString()); + } + + + public void testDigest() throws IOException { + InputStream in = new ByteArrayInputStream(testData.getBytes()); + MD5 md5 = MD5.digest(in); + assertEquals(testString, md5.toString()); + } + + private void assertEquals(byte[] expected, byte[] result) { + for (int i=0; i< expected.length; i++) { + if (expected[i] != result[i]) { + fail("expected: " + expected[i] + " but was:" + result[i]); + } + } + } +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathComparatorTest.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathComparatorTest.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathComparatorTest.java (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathComparatorTest.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,40 @@ +/* + * 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. + */ + +package org.apache.jackrabbit.vault.util; + +import junit.framework.TestCase; + +/** + * PathComparatorTest... + * + */ +public class PathComparatorTest extends TestCase { + + public void test() { + doTest("/a", "/a", 0); + doTest("/a", "/b", -1); + doTest("/a1foo", "/a/foo", -1); + doTest("/a/b/c1foo", "/a/b/c/foo", -1); + } + + private void doTest(String left, String right, int result) { + PathComparator c = new PathComparator(); + int test = c.compare(left, right); + assertEquals(left + " <> " + right, result, test); + } +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathUtilTest.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathUtilTest.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathUtilTest.java (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PathUtilTest.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,51 @@ +/* + * 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. + */ + +package org.apache.jackrabbit.vault.util; + +import junit.framework.TestCase; + +/** + * PathUtilTest... + */ +public class PathUtilTest extends TestCase { + + public void testRelPathEquals() { + assertEquals(".", PathUtil.getRelativeFilePath( + "/libs/components", + "/libs/components", "/")); } + + public void testRelPathSub() { + assertEquals("text", PathUtil.getRelativeFilePath( + "/libs/components", + "/libs/components/text", "/")); } + + public void testRelPathParent() { + assertEquals("../..", PathUtil.getRelativeFilePath( + "/libs/components/text", + "/libs", "/")); } + + public void testRelPathSibling() { + assertEquals("../image", PathUtil.getRelativeFilePath( + "/libs/components/text", + "/libs/components/image", "/")); } + + public void testWindowRelPath() { + assertEquals("foo\\bar", PathUtil.getRelativeFilePath( + "c:\\test\\root", + "c:\\test\\root\\foo\\bar", "\\")); } +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PlatformNameTest.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PlatformNameTest.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PlatformNameTest.java (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/PlatformNameTest.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,64 @@ +/* + * 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. + */ + +package org.apache.jackrabbit.vault.util; + +import java.util.HashMap; +import java.util.Map; + +import junit.framework.TestCase; + +/** + * PlatformNameTest... + * + */ +public class PlatformNameTest extends TestCase { + + private Map names = new HashMap(); + + + protected void setUp() throws Exception { + names.put("test.jpg", "test.jpg"); + names.put("cq:content", "_cq_content"); + names.put("cq:test_image.jpg", "_cq_test_image.jpg"); + names.put("test_image.jpg", "test_image.jpg"); + names.put("_testimage.jpg", "_testimage.jpg"); + names.put("_test_image.jpg", "__test_image.jpg"); + names.put("cq:test:image.jpg", "_cq_test%3aimage.jpg"); + names.put("_cq_:test.jpg", "__cq_%3atest.jpg"); + names.put("_cq:test.jpg", "_cq%3atest.jpg"); + names.put("cq_:test.jpg", "cq_%3atest.jpg"); + names.put("_", "_"); + names.put(":", "%3a"); + names.put(":test", "%3atest"); + } + + public void testToPlatform() { + for (String repName: names.keySet()) { + String pfName = names.get(repName); + assertEquals("Repo("+repName+")->Platform", pfName, PlatformNameFormat.getPlatformName(repName)); + } + } + + public void testToRepo() { + for (String repName: names.keySet()) { + String pfName = names.get(repName); + assertEquals("Platform("+pfName+")->Repo", repName, PlatformNameFormat.getRepositoryName(pfName)); + } + } + +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/SHA1Test.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/SHA1Test.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/SHA1Test.java (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/java/org/apache/jackrabbit/vault/util/SHA1Test.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,82 @@ +/* + * 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. + */ + +package org.apache.jackrabbit.vault.util; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; + +import junit.framework.TestCase; + +/** + * MD5Test... + */ +public class SHA1Test extends TestCase { + + private static String testData = "Hello, World\n"; + private static String testString = "4ab299c8ad6ed14f31923dd94f8b5f5cb89dfb54"; + private static int[] testInts = new int[]{0x4ab299c8, 0xad6ed14f, 0x31923dd9, 0x4f8b5f5c, 0xb89dfb54}; + private static byte[] testBytes = new byte[]{ + (byte) 0x4a, (byte) 0xb2, (byte) 0x99, (byte) 0xc8, + (byte) 0xad, (byte) 0x6e, (byte) 0xd1, (byte) 0x4f, + (byte) 0x31, (byte) 0x92, (byte) 0x3d, (byte) 0xd9, + (byte) 0x4f, (byte) 0x8b, (byte) 0x5f, (byte) 0x5c, + (byte) 0xb8, (byte) 0x9d, (byte) 0xfb, (byte) 0x54 + }; + + public void testCreateInt() { + SHA1 sha = new SHA1(testInts[0], testInts[1], testInts[2], testInts[3], testInts[4]); + assertEquals(testString, sha.toString()); + assertEquals(testBytes, sha.getBytes()); + } + + public void testCreateBytes() { + SHA1 sha = new SHA1(testBytes); + for (int i=0; iPathUtilTest... + */ +public class TreeTest extends TestCase { + + private Tree tree; + + private String[] paths = { + "/test/a", + "/test/b", + "/test/c", + "/test/d/dd", + }; + @Override + protected void setUp() throws Exception { + tree = new Tree(); + for (String path: paths) { + tree.put(path, path); + } + } + + public void testCommonRootPath() { + assertEquals("Root Path", "/test", tree.getRootPath()); + } + + public void testIteration() { + int i = 0; + for (String path: tree.map().keySet()) { + assertEquals("Entry", paths[i++], path); + } + assertEquals("Too many entries", paths.length, i); + } + + public void testGetNop() { + assertNull("/test/e should not exist", tree.getNode("/test/e")); + testTreeOk(); + } + + public void testTreeOk() { + assertEquals("Tree Size", paths.length, tree.map().keySet().size()); + int i=0; + for (String path: tree.map().keySet()) { + assertEquals("Entry", paths[i++], path); + } + } + + public void testSimple() { + Tree t = new Tree(); + t.put("/content/en/foo", "foo"); + assertEquals("/content/en/foo", t.getRootPath()); + } + +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/auth.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/auth.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/auth.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/auth.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/entries.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/entries.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/entries.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/entries.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/repository.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/repository.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/repository.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/repository.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/deepmixintest.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/deepmixintest.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/deepmixintest.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/double_properties.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/double_properties.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/double_properties.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_testnode.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_testnode.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_testnode.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo_bar.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo_bar.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/empty_tmp_foo_bar.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/external_hook.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/external_hook.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/external_hook.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/filtered_package.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/filtered_package.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/filtered_package.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/fullcoverage.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/fullcoverage.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/fullcoverage.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_a.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_a.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_a.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_bc.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_bc.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/group_with_bc.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/invalid_hook.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/invalid_hook.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/invalid_hook.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_a.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_a.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_a.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_merge.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_merge.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_merge.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_preserve.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_preserve.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/mode_ac_test_b_preserve.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_1.0.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_1.0.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_1.0.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_2.0.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_2.0.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/package_2.0.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/privileges.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/privileges.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/privileges.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/subtest.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/subtest.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/subtest.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tags.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tags.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tags.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/test_hook.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/test_hook.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/test_hook.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/testrootimport.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/testrootimport.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/testrootimport.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_minimal.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_minimal.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_minimal.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_nofilter.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_nofilter.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_foo_bar_test_nofilter.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_no_properties.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_no_properties.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_no_properties.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_deep.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_deep.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_deep.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_folders.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_folders.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_test_folders.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_testpage_jcr_content.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_testpage_jcr_content.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/tmp_testpage_jcr_content.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/unfiltered_package.zip URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/unfiltered_package.zip?rev=1512568&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/org/apache/jackrabbit/vault/packaging/integration/testpackages/unfiltered_package.zip ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/settings.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/settings.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/settings.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-core/src/test/resources/settings.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,33 @@ + + + + + + + + \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-davex/pom.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-davex/pom.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-davex/pom.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-davex/pom.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,114 @@ + + + 4.0.0 + + + + + org.apache.jackrabbit.vault + parent + ../parent/pom.xml + 3.0.0-SNAPSHOT + + + + + + vault-davex + 3.0.0-SNAPSHOT + jar + + Apache Jackrabbit FileVault JCR Remoting Service + + + + + + scm:svn:http://svn.apache.org/repos/asf/jackrabbit/commons/filevault/trunk/vault-davex + scm:svn:https://svn.apache.org/repos/asf/jackrabbit/commons/filevault/trunk/vault-davex + http://svn.apache.org/viewvc/asf/jackrabbit/commons/filevault/trunk/vault-davex + + + + + + + + org.apache.jackrabbit.vault + org.apache.jackrabbit.vault + 3.0.0-SNAPSHOT + + + org.apache.jackrabbit + jackrabbit-jcr-commons + + + org.apache.jackrabbit + jackrabbit-jcr-client + + + org.apache.jackrabbit + jackrabbit-spi-commons + + + org.apache.jackrabbit + jackrabbit-jcr2spi + + + org.apache.jackrabbit + jackrabbit-spi2dav + + + + + org.apache.jackrabbit + jackrabbit-webdav + + + + org.slf4j + jcl-over-slf4j + + + + + commons-io + commons-io + 2.4 + + + org.slf4j + jcl-over-slf4j + 1.5.8 + compile + + + + + javax.jcr + jcr + + + + + org.slf4j + slf4j-api + + + + Added: jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java (added) +++ jackrabbit/commons/filevault/trunk/vault-davex/src/main/java/org/apache/jackrabbit/vault/davex/DAVExRepositoryFactory.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,161 @@ +/* + * 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. + */ +package org.apache.jackrabbit.vault.davex; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.jcr.NamespaceException; +import javax.jcr.Repository; +import javax.jcr.RepositoryException; + +import org.apache.commons.httpclient.Header; +import org.apache.commons.httpclient.params.DefaultHttpParams; +import org.apache.commons.httpclient.params.DefaultHttpParamsFactory; +import org.apache.commons.httpclient.params.HostParams; +import org.apache.commons.httpclient.params.HttpParams; +import org.apache.commons.httpclient.params.HttpParamsFactory; +import org.apache.commons.io.FileUtils; +import org.apache.jackrabbit.client.RepositoryFactoryImpl; +import org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory; +import org.apache.jackrabbit.spi.Path; +import org.apache.jackrabbit.spi.commons.conversion.PathResolver; +import org.apache.jackrabbit.spi.commons.logging.WriterLogWriterProvider; +import org.apache.jackrabbit.spi2davex.BatchReadConfig; +import org.apache.jackrabbit.spi2davex.Spi2davexRepositoryServiceFactory; +import org.apache.jackrabbit.vault.fs.api.RepositoryAddress; +import org.apache.jackrabbit.vault.fs.api.RepositoryFactory; + +/** + * DAVExRepositoryFactory... + */ +public class DAVExRepositoryFactory implements RepositoryFactory { + + /** + * Name of the system property that controls the default depth for retrieving + * nodes via spi2davex + */ + public static final String PARAM_JCR_REMOTING_DEPTH = "jcr.remoting.depth"; + + /** + * Name of the system property that controls the spi log. + */ + public static final String PARAM_JCR_REMOTING_SPILOG = "jcr.remoting.spilog"; + + private static final Set SCHEMES = new HashSet(); + static { + SCHEMES.add("http"); + } + + public Set getSupportedSchemes() { + return SCHEMES; + } + + public Repository createRepository(RepositoryAddress address) + throws RepositoryException { + if (!SCHEMES.contains(address.getSpecificURI().getScheme())) { + return null; + } + try { + // get uri without credentials + URI uri = address.getSpecificURI(); + if (uri.getUserInfo() != null) { + try { + uri = new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(), uri.getQuery(), uri.getFragment()); + } catch (URISyntaxException e) { + // ignore + } + } + Map parameters = new HashMap(); + parameters.put(Jcr2spiRepositoryFactory.PARAM_REPOSITORY_SERVICE_FACTORY, Spi2davexRepositoryServiceFactory.class.getName()); + parameters.put(Jcr2spiRepositoryFactory.PARAM_ITEM_CACHE_SIZE, Integer.getInteger(PARAM_JCR_REMOTING_DEPTH, 128)); + parameters.put(Spi2davexRepositoryServiceFactory.PARAM_REPOSITORY_URI, uri.toString()); + DefaultBatchReadConfig br = new DefaultBatchReadConfig(); + br.setDefaultDepth(Integer.getInteger(PARAM_JCR_REMOTING_DEPTH, 4)); + br.setDepth("/", 2); + br.setDepth("/jcr:system", 1); + parameters.put(Spi2davexRepositoryServiceFactory.PARAM_BATCHREAD_CONFIG, br); + String file = System.getProperty(PARAM_JCR_REMOTING_SPILOG); + if (file != null) { + WriterLogWriterProvider provider = new WriterLogWriterProvider( + new OutputStreamWriter(FileUtils.openOutputStream(new File(file))) + ); + parameters.put( + Jcr2spiRepositoryFactory.PARAM_LOG_WRITER_PROVIDER, + provider + ); + } + + // set default params for httpclient that will be used in jackrabbit's webdav client + // this is to provide a referer header for all POST and PUT requests. + DefaultHttpParams.setHttpParamsFactory(new MyHttpParamsFactory()); + + System.out.printf("Connecting via JCR remoting to %s%n", address.getSpecificURI().toString()); + return new RepositoryFactoryImpl().getRepository(parameters); + } catch (IOException e) { + throw new RepositoryException(e); + } + } +} + +class DefaultBatchReadConfig implements BatchReadConfig { + + public static final int DEPTH_INFINITE = -1; + + private final Map depthMap = new HashMap(); + + private int defaultDepth = 0; + + public int getDepth(Path path, PathResolver resolver) throws NamespaceException { + String jcrPath = resolver.getJCRPath(path); + Integer depth = depthMap.get(jcrPath); + return depth == null ? defaultDepth : depth; + } + + public void setDepth(String path, int depth) { + depthMap.put(path, depth); + } + + public void setDefaultDepth(int defaultDepth) { + this.defaultDepth = defaultDepth; + } +} + +class MyHttpParamsFactory implements HttpParamsFactory { + + private final HttpParams params; + + MyHttpParamsFactory() { + params = new DefaultHttpParamsFactory().getDefaultParams(); + List
headers = new ArrayList
(); + headers.add(new Header("Referer", "about:blank")); + params.setParameter(HostParams.DEFAULT_HEADERS, headers); + } + + public HttpParams getDefaultParams() { + return params; + } +} \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-davex/src/main/resources/META-INF/services/com.day.jcr.vault.fs.api.RepositoryFactory URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-davex/src/main/resources/META-INF/services/com.day.jcr.vault.fs.api.RepositoryFactory?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-davex/src/main/resources/META-INF/services/com.day.jcr.vault.fs.api.RepositoryFactory (added) +++ jackrabbit/commons/filevault/trunk/vault-davex/src/main/resources/META-INF/services/com.day.jcr.vault.fs.api.RepositoryFactory Sat Aug 10 05:53:42 2013 @@ -0,0 +1,4 @@ +# +# registers the DAV Ex Repository Factory +# +org.apache.jackrabbit.vault.davex.DAVExRepositoryFactory \ No newline at end of file Added: jackrabbit/commons/filevault/trunk/vault-diff/pom.xml URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-diff/pom.xml?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-diff/pom.xml (added) +++ jackrabbit/commons/filevault/trunk/vault-diff/pom.xml Sat Aug 10 05:53:42 2013 @@ -0,0 +1,131 @@ + + + + + 4.0.0 + + + + + org.apache.jackrabbit.vault + parent + ../parent/pom.xml + 3.0.0-SNAPSHOT + + + + + + vault-diff + Apache Jackrabbit FileVault Diff (Diff utilities) + Provides Classes for diff and diff3. + + 3.0.0-SNAPSHOT + bundle + + + + + + + commons-io + commons-io + 1.3.1 + test + + + junit + junit + 3.8.1 + test + + + + + + + + scm:svn:http://svn.apache.org/repos/asf/jackrabbit/commons/filevault/trunk/vault-diff + scm:svn:https://svn.apache.org/repos/asf/jackrabbit/commons/filevault/trunk/vault-diff + http://svn.apache.org/viewvc/asf/jackrabbit/commons/filevault/trunk/vault-diff + + + + + + + + + + org.apache.felix + maven-bundle-plugin + true + + + jackrabbit-commons + + org.apache.jackrabbit.vault.util.diff.*;version=1.0.1 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.4 + 1.4 + 1.4 + true + false + true + false + + + + + org.apache.maven.plugins + maven-surefire-plugin + + false + + + + org.apache.maven.plugins + maven-release-plugin + 2.0-beta-5 + + #4208 - [maven-release] (RTC ok) : + + + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + 1.4 + + + + + Added: jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/ChangeListener.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/ChangeListener.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/ChangeListener.java (added) +++ jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/ChangeListener.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,77 @@ +/* + * 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. + */ +package org.apache.jackrabbit.vault.util.diff; + +/** + * Listener that is called for each line in a document. + * See {@link DocumentDiff#showChanges(ChangeListener, int)} for details. + */ +public interface ChangeListener { + + /** + * Invoked before the iteration over the changes start. + * @param left the left document + * @param right the right document + */ + void onDocumentsStart(Document left, Document right); + + /** + * Invoked after the iteration over the changes finished. + * @param left the left document + * @param right the right document + */ + void onDocumentsEnd(Document left, Document right); + + /** + * Invoked before a change starts. + * @param leftElem the index of the left element of this change. + * @param leftLen the number of changed left elements. + * @param rightElem the index of the right element of this change. + * @param rightLen the number of changed right elements. + */ + void onChangeStart(int leftElem, int leftLen, int rightElem, int rightLen); + + /** + * Invoked after a change finished. + */ + void onChangeEnd(); + + /** + * Invoked for an unmodified element + * @param leftIdx the index of the left element + * @param rightIdx the index of the right element + * @param elem the element + */ + void onUnmodified(int leftIdx, int rightIdx, Document.Element elem); + + /** + * Invoked for a deleted element + * @param leftIdx the index of the left element + * @param rightIdx the index of the right element + * @param elem the element + */ + void onDeleted(int leftIdx, int rightIdx, Document.Element elem); + + /** + * Invoked for an inserted element + * @param leftIdx the index of the left element + * @param rightIdx the index of the right element + * @param elem the element + */ + void onInserted(int leftIdx, int rightIdx, Document.Element elem); + +} Added: jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/DefaultChangeListener.java URL: http://svn.apache.org/viewvc/jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/DefaultChangeListener.java?rev=1512568&view=auto ============================================================================== --- jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/DefaultChangeListener.java (added) +++ jackrabbit/commons/filevault/trunk/vault-diff/src/main/java/org/apache/jackrabbit/vault/util/diff/DefaultChangeListener.java Sat Aug 10 05:53:42 2013 @@ -0,0 +1,118 @@ +/* + * 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. + */ +package org.apache.jackrabbit.vault.util.diff; + +import java.io.PrintWriter; + +/** + * Provides a default output for a diff. + */ +public class DefaultChangeListener implements ChangeListener { + + /** + * the output writer + */ + private final PrintWriter out; + + /** + * debug flag + */ + private boolean debug; + + /** + * Creates a new default change listener that will write to the given + * writer. + * @param out the writer + */ + public DefaultChangeListener(PrintWriter out) { + this.out = out; + } + + /** + * Creates a new default change listener that will write to the given + * writer. if debug is true the line numbers are also included + * in the output. + * + * @param out the writer + * @param debug flag + */ + public DefaultChangeListener(PrintWriter out, boolean debug) { + this.out = out; + this.debug = debug; + } + + /** + * {@inheritDoc} + */ + public void onDocumentsStart(Document left, Document right) { + out.println("Start Diff"); + } + + /** + * {@inheritDoc} + */ + public void onDocumentsEnd(Document left, Document right) { + out.println("End Diff"); + } + + /** + * {@inheritDoc} + */ + public void onChangeStart(int leftLine, int leftLen, int rightLine, int rightLen) { + out.println("@@ -" + (leftLine+1) + "," + leftLen + " +" + (rightLine+1) + "," + rightLen + " @@"); + } + + /** + * {@inheritDoc} + */ + public void onChangeEnd() { + out.flush(); + } + + /** + * {@inheritDoc} + */ + public void onUnmodified(int leftLine, int rightLine, Document.Element text) { + if (debug) { + out.print("(" + (leftLine+1) + "," + (rightLine+1) + ") "); + } + out.println(text); + } + + /** + * {@inheritDoc} + */ + public void onDeleted(int leftLine, int rightLine, Document.Element text) { + if (debug) { + out.print("(" + (leftLine+1) + "," + (rightLine+1) + ") "); + } + out.print("-"); + out.println(text); + } + + /** + * {@inheritDoc} + */ + public void onInserted(int leftLine, int rightLine, Document.Element text) { + if (debug) { + out.print("(" + (leftLine+1) + "," + (rightLine+1) + ") "); + } + out.print("+"); + out.println(text); + } + +}