You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by re...@apache.org on 2015/05/21 14:12:13 UTC

svn commit: r1680841 [6/6] - in /jackrabbit/branches/2.0: jackrabbit-api/src/main/java/org/apache/jackrabbit/api/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/management/ jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/ jac...

Modified: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java Thu May 21 12:12:11 2015
@@ -1,66 +1,66 @@
-/*
- * 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.spi.commons.namespace;
-
-import javax.jcr.NamespaceException;
-import javax.jcr.NamespaceRegistry;
-import javax.jcr.RepositoryException;
-
-/**
- * Namespace resolver based on the repository-wide namespace mappings
- * stored in a namespace registry.
- */
-public class RegistryNamespaceResolver implements NamespaceResolver {
-
-    /**
-     * Namespace registry
-     */
-    private final NamespaceRegistry registry;
-
-    /**
-     * Creates a new namespace resolver based on the given namespace registry.
-     * 
-     * @param registry namespace registry
-     */
-    public RegistryNamespaceResolver(NamespaceRegistry registry) {
-        this.registry = registry;
-    }
-
-    public String getPrefix(String uri) throws NamespaceException {
-        try {
-            return registry.getPrefix(uri);
-        } catch (RepositoryException e) {
-            if (!(e instanceof NamespaceException)) {
-                e = new NamespaceException(
-                        "Failed to resolve namespace URI: " + uri, e);
-            }
-            throw (NamespaceException) e;
-        }
-    }
-
-    public String getURI(String prefix) throws NamespaceException {
-        try {
-            return registry.getURI(prefix);
-        } catch (RepositoryException e) {
-            if (!(e instanceof NamespaceException)) {
-                e = new NamespaceException(
-                        "Failed to resolve namespace prefix: " + prefix, e);
-            }
-            throw (NamespaceException) e;
-        }
-    }
-}
+/*
+ * 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.spi.commons.namespace;
+
+import javax.jcr.NamespaceException;
+import javax.jcr.NamespaceRegistry;
+import javax.jcr.RepositoryException;
+
+/**
+ * Namespace resolver based on the repository-wide namespace mappings
+ * stored in a namespace registry.
+ */
+public class RegistryNamespaceResolver implements NamespaceResolver {
+
+    /**
+     * Namespace registry
+     */
+    private final NamespaceRegistry registry;
+
+    /**
+     * Creates a new namespace resolver based on the given namespace registry.
+     * 
+     * @param registry namespace registry
+     */
+    public RegistryNamespaceResolver(NamespaceRegistry registry) {
+        this.registry = registry;
+    }
+
+    public String getPrefix(String uri) throws NamespaceException {
+        try {
+            return registry.getPrefix(uri);
+        } catch (RepositoryException e) {
+            if (!(e instanceof NamespaceException)) {
+                e = new NamespaceException(
+                        "Failed to resolve namespace URI: " + uri, e);
+            }
+            throw (NamespaceException) e;
+        }
+    }
+
+    public String getURI(String prefix) throws NamespaceException {
+        try {
+            return registry.getURI(prefix);
+        } catch (RepositoryException e) {
+            if (!(e instanceof NamespaceException)) {
+                e = new NamespaceException(
+                        "Failed to resolve namespace prefix: " + prefix, e);
+            }
+            throw (NamespaceException) e;
+        }
+    }
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/namespace/RegistryNamespaceResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeType.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/AbstractNodeTypeManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/NodeTypeDefinitionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/main/java/org/apache/jackrabbit/spi/commons/value/AbstractQValueFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/conversion/DummyIdentifierResolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/NodeDefinitionTemplateImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/PropertyDefinitionTemplateImplTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/nodetype/TestAll.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/query/sql2/ParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi-commons/src/test/java/org/apache/jackrabbit/spi/commons/value/ValueFormatTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-spi/src/test/java/org/apache/jackrabbit/spi/QValueTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java Thu May 21 12:12:11 2015
@@ -1,283 +1,283 @@
-/*
- * 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.standalone;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Options;
-import org.apache.commons.cli.ParseException;
-import org.apache.commons.io.IOUtils;
-import org.apache.jackrabbit.core.RepositoryCopier;
-import org.apache.jackrabbit.core.config.RepositoryConfig;
-import org.apache.jackrabbit.servlet.jackrabbit.JackrabbitRepositoryServlet;
-import org.apache.log4j.FileAppender;
-import org.apache.log4j.Layout;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
-import org.apache.log4j.PatternLayout;
-import org.mortbay.jetty.Connector;
-import org.mortbay.jetty.NCSARequestLog;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.bio.SocketConnector;
-import org.mortbay.jetty.handler.RequestLogHandler;
-import org.mortbay.jetty.servlet.ServletHolder;
-import org.mortbay.jetty.webapp.WebAppContext;
-
-/**
- *
- */
-public class Main {
-
-    /**
-     * @param args
-     */
-    public static void main(String[] args) throws Exception {
-        new Main(args).run();
-    }
-
-    private final Options options = new Options();
-
-    private final CommandLine command;
-
-    private final RequestLogHandler accessLog = new RequestLogHandler();
-
-    private final WebAppContext webapp = new WebAppContext();
-
-    private final Connector connector = new SocketConnector();
-
-    private final Server server = new Server();
-
-    private Main(String[] args) throws ParseException {
-        options.addOption("?", "help", false, "print this message");
-        options.addOption("n", "notice", false, "print copyright notices");
-        options.addOption("l", "license", false, "print license information");
-        options.addOption(
-                "b", "backup", false, "create a backup of the repository");
-
-        options.addOption("q", "quiet", false, "disable console output");
-        options.addOption("d", "debug", false, "enable debug logging");
-
-        options.addOption("h", "host", true, "IP address of the HTTP server");
-        options.addOption("p", "port", true, "TCP port of the HTTP server (8080)");
-        options.addOption("f", "file", true, "location of this jar file");
-        options.addOption("r", "repo", true, "repository directory (jackrabbit)");
-        options.addOption("c", "conf", true, "repository configuration file");
-        options.addOption(
-                "R", "backup-repo", true,
-                "backup repository directory (jackrabbit-backupN)");
-        options.addOption(
-                "C", "backup-conf", true,
-                "backup repository configuration file");
-
-        command = new GnuParser().parse(options, args);
-    }
-
-    public void run() throws Exception {
-        String defaultFile = "jackrabbit-standalone.jar";
-        URL location =
-            Main.class.getProtectionDomain().getCodeSource().getLocation();
-        if (location != null && "file".equals(location.getProtocol())) {
-            File file = new File(location.getPath());
-            if (file.isFile()) {
-                defaultFile = location.getPath();
-            }
-        }
-        File file = new File(command.getOptionValue("file", defaultFile));
-
-        if (command.hasOption("help")) {
-            HelpFormatter formatter = new HelpFormatter();
-            formatter.printHelp("java -jar " + file.getName(), options, true);
-        } else if (command.hasOption("notice")) {
-            copyToOutput("/META-INF/NOTICE.txt");
-        } else if (command.hasOption("license")) {
-            copyToOutput("/META-INF/LICENSE.txt");
-        } else {
-            message("Welcome to Apache Jackrabbit!");
-            message("-------------------------------");
-
-            File repository =
-                new File(command.getOptionValue("repo", "jackrabbit"));
-            message("Using repository directory " + repository);
-            repository.mkdirs();
-            File tmp = new File(repository, "tmp");
-            tmp.mkdir();
-            File log = new File(repository, "log");
-            log.mkdir();
-
-            message("Writing log messages to " + log);
-            prepareServerLog(log);
-
-            if (command.hasOption("backup")) {
-                backup(repository);
-            } else {
-                message("Starting the server...");
-                prepareWebapp(file, repository, tmp);
-                accessLog.setHandler(webapp);
-                prepareAccessLog(log);
-                server.setHandler(accessLog);
-                prepareConnector();
-                server.addConnector(connector);
-                prepareShutdown();
-
-                try {
-                    server.start();
-
-                    String host = connector.getHost();
-                    if (host == null) {
-                        host = "localhost";
-                    }
-                    message("Apache Jackrabbit is now running at "
-                            +"http://" + host + ":" + connector.getPort() + "/");
-                } catch (Throwable t) {
-                    System.err.println(
-                            "Unable to start the server: " + t.getMessage());
-                    System.exit(1);
-                }
-            }
-        }
-    }
-
-    private void backup(File sourceDir) throws Exception {
-        RepositoryConfig source;
-        if (command.hasOption("conf")) {
-            source = RepositoryConfig.create(
-                    new File(command.getOptionValue("conf")), sourceDir);
-        } else {
-            source = RepositoryConfig.create(sourceDir);
-        }
-
-        File targetDir;
-        if (command.hasOption("backup-repo")) {
-            targetDir = new File(command.getOptionValue("backup-repo"));
-        } else {
-            int i = 1;
-            do {
-                targetDir = new File("jackrabbit-backup" + i++);
-            } while (targetDir.exists());
-        }
-
-        RepositoryConfig target;
-        if (command.hasOption("backup-conf")) {
-            target = RepositoryConfig.install(
-                    new File(command.getOptionValue("backup-conf")), targetDir);
-        } else {
-            target = RepositoryConfig.install(targetDir);
-        }
-
-        message("Creating a repository copy in " + targetDir);
-        RepositoryCopier.copy(source, target);
-        message("The repository has been successfully copied.");
-    }
-
-    private void prepareServerLog(File log)
-            throws IOException {
-        Layout layout =
-            new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n");
-
-        Logger jackrabbitLog = Logger.getRootLogger();
-        jackrabbitLog.addAppender(new FileAppender(
-                layout, new File(log, "jackrabbit.log").getPath()));
-
-        Logger jettyLog = Logger.getLogger("org.mortbay.log");
-        jettyLog.addAppender(new FileAppender(
-                layout, new File(log, "jetty.log").getPath()));
-        jettyLog.setAdditivity(false);
-
-        if (command.hasOption("debug")) {
-            jackrabbitLog.setLevel(Level.DEBUG);
-            jettyLog.setLevel(Level.DEBUG);
-        } else {
-            jackrabbitLog.setLevel(Level.INFO);
-            jettyLog.setLevel(Level.INFO);
-        }
-
-        System.setProperty(
-                "derby.stream.error.file",
-                new File(log, "derby.log").getPath());
-    }
-
-    private void prepareAccessLog(File log) {
-        NCSARequestLog ncsa = new NCSARequestLog(
-                new File(log, "access.log.yyyy_mm_dd").getPath());
-        ncsa.setFilenameDateFormat("yyyy-MM-dd");
-        accessLog.setRequestLog(ncsa);
-    }
-
-    private void prepareWebapp(File file, File repository, File tmp) {
-        webapp.setContextPath("/");
-        webapp.setWar(file.getPath());
-        webapp.setExtractWAR(false);
-        webapp.setTempDirectory(tmp);
-
-        ServletHolder servlet =
-            new ServletHolder(JackrabbitRepositoryServlet.class);
-        servlet.setInitOrder(1);
-        servlet.setInitParameter("repository.home", repository.getPath());
-        String conf = command.getOptionValue("conf");
-        if (conf != null) {
-            servlet.setInitParameter("repository.config", conf);
-        }
-        webapp.addServlet(servlet, "/repository.properties");
-    }
-
-    private void prepareConnector() {
-        String port = command.getOptionValue("port", "8080");
-        connector.setPort(Integer.parseInt(port));
-        String host = command.getOptionValue("host");
-        if (host != null) {
-            connector.setHost(host);
-        }
-    }
-
-    private void prepareShutdown() {
-        Runtime.getRuntime().addShutdownHook(new Thread() {
-            public void run() {
-                try {
-                    message("Shutting down the server...");
-                    server.stop();
-                    server.join();
-                    message("-------------------------------");
-                    message("Goodbye from Apache Jackrabbit!");
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-    }
-
-    private void message(String message) {
-        if (!command.hasOption("quiet")) {
-            System.out.println(message);
-        }
-    }
-
-    private void copyToOutput(String resource) throws IOException {
-        InputStream stream = Main.class.getResourceAsStream(resource);
-        try {
-            IOUtils.copy(stream, System.out);
-        } finally {
-            stream.close();
-        }
-    }
-
-}
+/*
+ * 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.standalone;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.commons.cli.CommandLine;
+import org.apache.commons.cli.GnuParser;
+import org.apache.commons.cli.HelpFormatter;
+import org.apache.commons.cli.Options;
+import org.apache.commons.cli.ParseException;
+import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.core.RepositoryCopier;
+import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.servlet.jackrabbit.JackrabbitRepositoryServlet;
+import org.apache.log4j.FileAppender;
+import org.apache.log4j.Layout;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PatternLayout;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.NCSARequestLog;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.bio.SocketConnector;
+import org.mortbay.jetty.handler.RequestLogHandler;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+/**
+ *
+ */
+public class Main {
+
+    /**
+     * @param args
+     */
+    public static void main(String[] args) throws Exception {
+        new Main(args).run();
+    }
+
+    private final Options options = new Options();
+
+    private final CommandLine command;
+
+    private final RequestLogHandler accessLog = new RequestLogHandler();
+
+    private final WebAppContext webapp = new WebAppContext();
+
+    private final Connector connector = new SocketConnector();
+
+    private final Server server = new Server();
+
+    private Main(String[] args) throws ParseException {
+        options.addOption("?", "help", false, "print this message");
+        options.addOption("n", "notice", false, "print copyright notices");
+        options.addOption("l", "license", false, "print license information");
+        options.addOption(
+                "b", "backup", false, "create a backup of the repository");
+
+        options.addOption("q", "quiet", false, "disable console output");
+        options.addOption("d", "debug", false, "enable debug logging");
+
+        options.addOption("h", "host", true, "IP address of the HTTP server");
+        options.addOption("p", "port", true, "TCP port of the HTTP server (8080)");
+        options.addOption("f", "file", true, "location of this jar file");
+        options.addOption("r", "repo", true, "repository directory (jackrabbit)");
+        options.addOption("c", "conf", true, "repository configuration file");
+        options.addOption(
+                "R", "backup-repo", true,
+                "backup repository directory (jackrabbit-backupN)");
+        options.addOption(
+                "C", "backup-conf", true,
+                "backup repository configuration file");
+
+        command = new GnuParser().parse(options, args);
+    }
+
+    public void run() throws Exception {
+        String defaultFile = "jackrabbit-standalone.jar";
+        URL location =
+            Main.class.getProtectionDomain().getCodeSource().getLocation();
+        if (location != null && "file".equals(location.getProtocol())) {
+            File file = new File(location.getPath());
+            if (file.isFile()) {
+                defaultFile = location.getPath();
+            }
+        }
+        File file = new File(command.getOptionValue("file", defaultFile));
+
+        if (command.hasOption("help")) {
+            HelpFormatter formatter = new HelpFormatter();
+            formatter.printHelp("java -jar " + file.getName(), options, true);
+        } else if (command.hasOption("notice")) {
+            copyToOutput("/META-INF/NOTICE.txt");
+        } else if (command.hasOption("license")) {
+            copyToOutput("/META-INF/LICENSE.txt");
+        } else {
+            message("Welcome to Apache Jackrabbit!");
+            message("-------------------------------");
+
+            File repository =
+                new File(command.getOptionValue("repo", "jackrabbit"));
+            message("Using repository directory " + repository);
+            repository.mkdirs();
+            File tmp = new File(repository, "tmp");
+            tmp.mkdir();
+            File log = new File(repository, "log");
+            log.mkdir();
+
+            message("Writing log messages to " + log);
+            prepareServerLog(log);
+
+            if (command.hasOption("backup")) {
+                backup(repository);
+            } else {
+                message("Starting the server...");
+                prepareWebapp(file, repository, tmp);
+                accessLog.setHandler(webapp);
+                prepareAccessLog(log);
+                server.setHandler(accessLog);
+                prepareConnector();
+                server.addConnector(connector);
+                prepareShutdown();
+
+                try {
+                    server.start();
+
+                    String host = connector.getHost();
+                    if (host == null) {
+                        host = "localhost";
+                    }
+                    message("Apache Jackrabbit is now running at "
+                            +"http://" + host + ":" + connector.getPort() + "/");
+                } catch (Throwable t) {
+                    System.err.println(
+                            "Unable to start the server: " + t.getMessage());
+                    System.exit(1);
+                }
+            }
+        }
+    }
+
+    private void backup(File sourceDir) throws Exception {
+        RepositoryConfig source;
+        if (command.hasOption("conf")) {
+            source = RepositoryConfig.create(
+                    new File(command.getOptionValue("conf")), sourceDir);
+        } else {
+            source = RepositoryConfig.create(sourceDir);
+        }
+
+        File targetDir;
+        if (command.hasOption("backup-repo")) {
+            targetDir = new File(command.getOptionValue("backup-repo"));
+        } else {
+            int i = 1;
+            do {
+                targetDir = new File("jackrabbit-backup" + i++);
+            } while (targetDir.exists());
+        }
+
+        RepositoryConfig target;
+        if (command.hasOption("backup-conf")) {
+            target = RepositoryConfig.install(
+                    new File(command.getOptionValue("backup-conf")), targetDir);
+        } else {
+            target = RepositoryConfig.install(targetDir);
+        }
+
+        message("Creating a repository copy in " + targetDir);
+        RepositoryCopier.copy(source, target);
+        message("The repository has been successfully copied.");
+    }
+
+    private void prepareServerLog(File log)
+            throws IOException {
+        Layout layout =
+            new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n");
+
+        Logger jackrabbitLog = Logger.getRootLogger();
+        jackrabbitLog.addAppender(new FileAppender(
+                layout, new File(log, "jackrabbit.log").getPath()));
+
+        Logger jettyLog = Logger.getLogger("org.mortbay.log");
+        jettyLog.addAppender(new FileAppender(
+                layout, new File(log, "jetty.log").getPath()));
+        jettyLog.setAdditivity(false);
+
+        if (command.hasOption("debug")) {
+            jackrabbitLog.setLevel(Level.DEBUG);
+            jettyLog.setLevel(Level.DEBUG);
+        } else {
+            jackrabbitLog.setLevel(Level.INFO);
+            jettyLog.setLevel(Level.INFO);
+        }
+
+        System.setProperty(
+                "derby.stream.error.file",
+                new File(log, "derby.log").getPath());
+    }
+
+    private void prepareAccessLog(File log) {
+        NCSARequestLog ncsa = new NCSARequestLog(
+                new File(log, "access.log.yyyy_mm_dd").getPath());
+        ncsa.setFilenameDateFormat("yyyy-MM-dd");
+        accessLog.setRequestLog(ncsa);
+    }
+
+    private void prepareWebapp(File file, File repository, File tmp) {
+        webapp.setContextPath("/");
+        webapp.setWar(file.getPath());
+        webapp.setExtractWAR(false);
+        webapp.setTempDirectory(tmp);
+
+        ServletHolder servlet =
+            new ServletHolder(JackrabbitRepositoryServlet.class);
+        servlet.setInitOrder(1);
+        servlet.setInitParameter("repository.home", repository.getPath());
+        String conf = command.getOptionValue("conf");
+        if (conf != null) {
+            servlet.setInitParameter("repository.config", conf);
+        }
+        webapp.addServlet(servlet, "/repository.properties");
+    }
+
+    private void prepareConnector() {
+        String port = command.getOptionValue("port", "8080");
+        connector.setPort(Integer.parseInt(port));
+        String host = command.getOptionValue("host");
+        if (host != null) {
+            connector.setHost(host);
+        }
+    }
+
+    private void prepareShutdown() {
+        Runtime.getRuntime().addShutdownHook(new Thread() {
+            public void run() {
+                try {
+                    message("Shutting down the server...");
+                    server.stop();
+                    server.join();
+                    message("-------------------------------");
+                    message("Goodbye from Apache Jackrabbit!");
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+    }
+
+    private void message(String message) {
+        if (!command.hasOption("quiet")) {
+            System.out.println(message);
+        }
+    }
+
+    private void copyToOutput(String resource) throws IOException {
+        InputStream stream = Main.class.getResourceAsStream(resource);
+        try {
+            IOUtils.copy(stream, System.out);
+        } finally {
+            stream.close();
+        }
+    }
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-standalone/src/main/java/org/apache/jackrabbit/standalone/Main.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/BootstrapConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/JcrApiNotFoundException.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/JcrApiNotFoundException.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/JcrApiNotFoundException.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/JcrApiNotFoundException.java Thu May 21 12:12:11 2015
@@ -1,38 +1,38 @@
-/*
- * 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.j2ee;
-
-/**
- * Exception for signaling that the JCR API is not available.
- */
-public class JcrApiNotFoundException extends ServletExceptionWithCause {
-
-    /**
-     * Serial version UID
-     */
-    private static final long serialVersionUID = -6439777923943394980L;
-
-    /**
-     * Creates an exception to signal that the JCR API is not available.
-     *
-     * @param e the specific exception that indicates the lack of the JCR API
-     */
-    public JcrApiNotFoundException(ClassNotFoundException e) {
-        super("JCR API (jcr-1.0.jar) not available in the classpath", e);
-    }
-
-}
+/*
+ * 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.j2ee;
+
+/**
+ * Exception for signaling that the JCR API is not available.
+ */
+public class JcrApiNotFoundException extends ServletExceptionWithCause {
+
+    /**
+     * Serial version UID
+     */
+    private static final long serialVersionUID = -6439777923943394980L;
+
+    /**
+     * Creates an exception to signal that the JCR API is not available.
+     *
+     * @param e the specific exception that indicates the lack of the JCR API
+     */
+    public JcrApiNotFoundException(ClassNotFoundException e) {
+        super("JCR API (jcr-1.0.jar) not available in the classpath", e);
+    }
+
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-webapp/src/main/java/org/apache/jackrabbit/j2ee/JcrApiNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/bind/BindServletRequest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/bind/BindServletRequest.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/bind/BindServletRequest.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/bind/BindServletRequest.java Thu May 21 12:12:11 2015
@@ -1,65 +1,65 @@
-/*
- * 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.webdav.bind;
-
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.DavResourceLocator;
-
-/**
- * <code>BindServletRequest</code> provides extension useful for functionality
- * related to BIND specification.
- */
-public interface BindServletRequest {
-
-    /**
-     * Returns the {@link RebindInfo} present with the request
-     *
-     * @return {@link RebindInfo} object
-     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
-     */
-    public RebindInfo getRebindInfo() throws DavException;
-
-    /**
-     * Returns the {@link UnbindInfo} present with the request
-     *
-     * @return {@link UnbindInfo} object
-     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
-     */
-    public UnbindInfo getUnbindInfo() throws DavException;
-
-    /**
-     * Returns the {@link BindInfo} present with the request
-     *
-     * @return {@link BindInfo} object
-     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
-     */
-    public BindInfo getBindInfo() throws DavException;
-
-    /**
-     * Parses a href and returns the path of the resource.
-     *
-     * @return path of the resource identified by the href.
-     */
-    public DavResourceLocator getHrefLocator(String href) throws DavException;
-
-    /**
-     * Returns the path of the member resource of the request resource which is identified by the segment parameter.
-     *
-     * @return path of internal member resource.
-     */
-    public DavResourceLocator getMemberLocator(String segment);
-}
+/*
+ * 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.webdav.bind;
+
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.DavResourceLocator;
+
+/**
+ * <code>BindServletRequest</code> provides extension useful for functionality
+ * related to BIND specification.
+ */
+public interface BindServletRequest {
+
+    /**
+     * Returns the {@link RebindInfo} present with the request
+     *
+     * @return {@link RebindInfo} object
+     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
+     */
+    public RebindInfo getRebindInfo() throws DavException;
+
+    /**
+     * Returns the {@link UnbindInfo} present with the request
+     *
+     * @return {@link UnbindInfo} object
+     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
+     */
+    public UnbindInfo getUnbindInfo() throws DavException;
+
+    /**
+     * Returns the {@link BindInfo} present with the request
+     *
+     * @return {@link BindInfo} object
+     * @throws org.apache.jackrabbit.webdav.DavException in case of an invalid or missing request body
+     */
+    public BindInfo getBindInfo() throws DavException;
+
+    /**
+     * Parses a href and returns the path of the resource.
+     *
+     * @return path of the resource identified by the href.
+     */
+    public DavResourceLocator getHrefLocator(String href) throws DavException;
+
+    /**
+     * Returns the path of the member resource of the request resource which is identified by the segment parameter.
+     *
+     * @return path of internal member resource.
+     */
+    public DavResourceLocator getMemberLocator(String segment);
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/bind/BindServletRequest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/RebindMethod.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/RebindMethod.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/RebindMethod.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/RebindMethod.java Thu May 21 12:12:11 2015
@@ -1,52 +1,52 @@
-/*
- * 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.webdav.client.methods;
-
-import org.apache.jackrabbit.webdav.bind.RebindInfo;
-import org.apache.jackrabbit.webdav.DavServletResponse;
-
-import java.io.IOException;
-
-/**
- * <code>RebindMethod</code> replaces a binding to a resource (atomic version of move).
- */
-public class RebindMethod extends DavMethodBase {
-
-    public RebindMethod(String uri, RebindInfo info) throws IOException {
-        super(uri);
-        setRequestBody(info);
-    }
-
-    //---------------------------------------------------------< HttpMethod >---
-    /**
-     * @see org.apache.commons.httpclient.HttpMethod#getName()
-     */
-    public String getName() {
-        return "REBIND";
-    }
-
-    //------------------------------------------------------< DavMethodBase >---
-    /**
-     *
-     * @param statusCode
-     * @return true if status code is 200 (existing binding was overwritten) or 201 (new binding created).
-     */
-    protected boolean isSuccess(int statusCode) {
-        return statusCode == DavServletResponse.SC_CREATED || statusCode == DavServletResponse.SC_OK;
-    }
-}
-
+/*
+ * 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.webdav.client.methods;
+
+import org.apache.jackrabbit.webdav.bind.RebindInfo;
+import org.apache.jackrabbit.webdav.DavServletResponse;
+
+import java.io.IOException;
+
+/**
+ * <code>RebindMethod</code> replaces a binding to a resource (atomic version of move).
+ */
+public class RebindMethod extends DavMethodBase {
+
+    public RebindMethod(String uri, RebindInfo info) throws IOException {
+        super(uri);
+        setRequestBody(info);
+    }
+
+    //---------------------------------------------------------< HttpMethod >---
+    /**
+     * @see org.apache.commons.httpclient.HttpMethod#getName()
+     */
+    public String getName() {
+        return "REBIND";
+    }
+
+    //------------------------------------------------------< DavMethodBase >---
+    /**
+     *
+     * @param statusCode
+     * @return true if status code is 200 (existing binding was overwritten) or 201 (new binding created).
+     */
+    protected boolean isSuccess(int statusCode) {
+        return statusCode == DavServletResponse.SC_CREATED || statusCode == DavServletResponse.SC_OK;
+    }
+}
+

Propchange: jackrabbit/branches/2.0/jackrabbit-webdav/src/main/java/org/apache/jackrabbit/webdav/client/methods/RebindMethod.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/branches/2.0/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.0/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java?rev=1680841&r1=1680840&r2=1680841&view=diff
==============================================================================
--- jackrabbit/branches/2.0/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java (original)
+++ jackrabbit/branches/2.0/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java Thu May 21 12:12:11 2015
@@ -1,118 +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.webdav.server;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.HttpException;
-import org.apache.commons.httpclient.UsernamePasswordCredentials;
-import org.apache.commons.httpclient.auth.AuthScope;
-import org.apache.commons.httpclient.methods.HeadMethod;
-import org.apache.commons.httpclient.methods.PutMethod;
-import org.apache.jackrabbit.webdav.DavException;
-import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
-import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
-
-/**
- * Test cases for RFC 4918 Destination header functionality
- * (see <a href="http://www.webdav.org/specs/rfc4918.html#rfc.section.10.3">RFC 4918, Section 10.3</a>
- * <p>
- * Required system properties:
- * <ul>
- *   <li>webdav.test.url</li>
- *   <li>webdav.test.username</li>
- *   <li>webdav.test.password</li>
- * </ul>
- */
-
-public class RFC4918DestinationHeaderTest extends TestCase {
-
-    private String root;
-    private URI uri;
-    private String username, password;
-    private HttpClient client;
-    
-    protected void setUp() throws Exception {
-        this.uri = URI.create(System.getProperty("webdav.test.url"));
-        this.root = this.uri.toASCIIString();
-        if (!this.root.endsWith("/")) {
-            this.root += "/";
-        }
-        this.username = System.getProperty(("webdav.test.username"), "");
-        this.password = System.getProperty(("webdav.test.password"), "");
-        this.client = new HttpClient();
-        this.client.getState().setCredentials(
-                new AuthScope(this.uri.getHost(), this.uri.getPort()),
-                new UsernamePasswordCredentials(this.username, this.password));
-        super.setUp();
-    }
-
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-    
-    public void testMove() throws HttpException, IOException, DavException, URISyntaxException {
-
-        String testuri = this.root + "movetest";
-        String destinationuri = testuri + "2";
-        String destinationpath = new URI(destinationuri).getRawPath();
-        // make sure the scheme is removed
-        assertTrue(destinationpath.indexOf(":") < 0);
-        
-        int status;
-        try {
-            PutMethod put = new PutMethod(testuri);
-            status = this.client.executeMethod(put);
-            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
-
-            // try to move outside the servlet's name space
-            MoveMethod move = new MoveMethod(testuri, "/foobar", true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 403);
-
-            // try a relative path
-            move = new MoveMethod(testuri, "foobar", true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 400);
-
-            move = new MoveMethod(testuri, destinationpath, true);
-            status = this.client.executeMethod(move);
-            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
-            
-            HeadMethod head = new HeadMethod(destinationuri);
-            status = this.client.executeMethod(head);
-            assertTrue("status: " + status, status == 200);
-
-            head = new HeadMethod(testuri);
-            status = this.client.executeMethod(head);
-            assertTrue("status: " + status, status == 404);
-
-        } finally {
-            DeleteMethod delete = new DeleteMethod(testuri);
-            status = this.client.executeMethod(delete);
-            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
-            delete = new DeleteMethod(destinationuri);
-            status = this.client.executeMethod(delete);
-            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
-        }
-    }
-}
+/*
+ * 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.webdav.server;
+
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.methods.PutMethod;
+import org.apache.jackrabbit.webdav.DavException;
+import org.apache.jackrabbit.webdav.client.methods.DeleteMethod;
+import org.apache.jackrabbit.webdav.client.methods.MoveMethod;
+
+/**
+ * Test cases for RFC 4918 Destination header functionality
+ * (see <a href="http://www.webdav.org/specs/rfc4918.html#rfc.section.10.3">RFC 4918, Section 10.3</a>
+ * <p>
+ * Required system properties:
+ * <ul>
+ *   <li>webdav.test.url</li>
+ *   <li>webdav.test.username</li>
+ *   <li>webdav.test.password</li>
+ * </ul>
+ */
+
+public class RFC4918DestinationHeaderTest extends TestCase {
+
+    private String root;
+    private URI uri;
+    private String username, password;
+    private HttpClient client;
+    
+    protected void setUp() throws Exception {
+        this.uri = URI.create(System.getProperty("webdav.test.url"));
+        this.root = this.uri.toASCIIString();
+        if (!this.root.endsWith("/")) {
+            this.root += "/";
+        }
+        this.username = System.getProperty(("webdav.test.username"), "");
+        this.password = System.getProperty(("webdav.test.password"), "");
+        this.client = new HttpClient();
+        this.client.getState().setCredentials(
+                new AuthScope(this.uri.getHost(), this.uri.getPort()),
+                new UsernamePasswordCredentials(this.username, this.password));
+        super.setUp();
+    }
+
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+    
+    public void testMove() throws HttpException, IOException, DavException, URISyntaxException {
+
+        String testuri = this.root + "movetest";
+        String destinationuri = testuri + "2";
+        String destinationpath = new URI(destinationuri).getRawPath();
+        // make sure the scheme is removed
+        assertTrue(destinationpath.indexOf(":") < 0);
+        
+        int status;
+        try {
+            PutMethod put = new PutMethod(testuri);
+            status = this.client.executeMethod(put);
+            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
+
+            // try to move outside the servlet's name space
+            MoveMethod move = new MoveMethod(testuri, "/foobar", true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 403);
+
+            // try a relative path
+            move = new MoveMethod(testuri, "foobar", true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 400);
+
+            move = new MoveMethod(testuri, destinationpath, true);
+            status = this.client.executeMethod(move);
+            assertTrue("status: " + status, status == 200 || status == 201 || status == 204);
+            
+            HeadMethod head = new HeadMethod(destinationuri);
+            status = this.client.executeMethod(head);
+            assertTrue("status: " + status, status == 200);
+
+            head = new HeadMethod(testuri);
+            status = this.client.executeMethod(head);
+            assertTrue("status: " + status, status == 404);
+
+        } finally {
+            DeleteMethod delete = new DeleteMethod(testuri);
+            status = this.client.executeMethod(delete);
+            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
+            delete = new DeleteMethod(destinationuri);
+            status = this.client.executeMethod(delete);
+            assertTrue("status: " + status, status == 200 || status == 204 || status == 404);
+        }
+    }
+}

Propchange: jackrabbit/branches/2.0/jackrabbit-webdav/src/test/java/org/apache/jackrabbit/webdav/server/RFC4918DestinationHeaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native