sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r612506 - in /incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/sling/ src/main/java/org/apache/sling/jcr/ src/main/java/org/apach...
Date Wed, 16 Jan 2008 16:51:57 GMT
Author: fmeschbe
Date: Wed Jan 16 08:51:50 2008
New Revision: 612506

URL: http://svn.apache.org/viewvc?rev=612506&view=rev
Log:
SLING-150 Add support for Jackrabbit Simple WebDAV

Added:
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/   (with props)
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml   (with props)
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
  (with props)
    incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/resources/

Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Jan 16 08:51:50 2008
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings

Added: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml?rev=612506&view=auto
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml (added)
+++ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml Wed Jan 16 08:51:50 2008
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.sling</groupId>
+        <artifactId>sling</artifactId>
+        <version>1-incubator-SNAPSHOT</version>
+        <relativePath>../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.jcr.webdav</artifactId>
+    <packaging>bundle</packaging>
+    <version>2.0.0-incubator-SNAPSHOT</version>
+
+    <name>Sling - Simple WebDAV Access to repositories</name>
+    <description>
+        Bundle to access JCR repositories over WebDAV
+    </description>
+
+    <scm>
+        <connection>
+            scm:svn:http://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav
+        </connection>
+        <developerConnection>
+            scm:svn:https://svn.apache.org/repos/asf/incubator/sling/trunk/jcr/webdav
+        </developerConnection>
+        <url>
+            http://svn.apache.org/viewvc/incubator/sling/trunk/jcr/webdav
+        </url>
+    </scm>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Category>sling,jcr</Bundle-Category>
+                        <!-- No Export-Package -->
+                        <Private-Package>
+                            org.apache.sling.jcr.webdav,
+                            org.apache.jackrabbit.webdav.simple,
+                            org.apache.jackrabbit.server,
+                            org.apache.jackrabbit.server.io,
+                            org.apache.jackrabbit.server.jcr,
+                            org.apache.jackrabbit.webdav.*, ,
+                            org.apache.xml.serialize,
+                            org.apache.xerces.*
+                        </Private-Package>
+                        <Import-Package>
+                            javax.transaction.xa; javax.xml.*;
+                            org.apache.xml.resolver.*;org.w3c.*;
+                            org.xml.sax.*;resolution:=optional,
+                            !sun.*,*
+                        </Import-Package>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.api</artifactId>
+            <version>2.0.0-incubator-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-jcr-server</artifactId>
+            <version>1.4</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>jackrabbit-webdav</artifactId>
+            <version>1.4</version>
+            <scope>compile</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+        </dependency>
+
+        <!-- OSGi Libraries -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi_R4_core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>osgi_R4_compendium</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java?rev=612506&view=auto
==============================================================================
--- incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
(added)
+++ incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
Wed Jan 16 08:51:50 2008
@@ -0,0 +1,115 @@
+/*
+ * 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.sling.jcr.webdav;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import javax.jcr.Repository;
+import javax.servlet.ServletException;
+
+import org.apache.jackrabbit.webdav.simple.SimpleWebdavServlet;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+
+/**
+ * The <code>SimpleWebDavServlet</code>
+ * 
+ * @scr.component
+ */
+public class SimpleWebDavServlet extends SimpleWebdavServlet {
+
+    /** @scr.property value="/dav" */
+    private static final String PROP_CONTEXT = "dav.root";
+
+    /** @scr.property value="Sling WebDAV" */
+    private static final String PROP_REALM = "dav.realm";
+
+    private static final String DEFAULT_CONTEXT = "/dav";
+
+    /** @scr.reference */
+    private HttpService httpService;
+
+    /** @scr.reference */
+    private SlingRepository repository;
+
+    // the alias under which the servlet is registered, null if not
+    private String contextPath;
+
+    @Override
+    public Repository getRepository() {
+        return repository;
+    }
+
+    // ---------- SCR integration ----------------------------------------------
+
+    protected void activate(ComponentContext componentContext) {
+        Dictionary<?, ?> props = componentContext.getProperties();
+
+        String context = getString(props, PROP_CONTEXT, DEFAULT_CONTEXT);
+
+        Dictionary<String, String> initparams = new Hashtable<String, String>();
+
+        initparams.put(INIT_PARAM_RESOURCE_PATH_PREFIX, context);
+
+        String value = getString(props, PROP_REALM, null);
+        if (value != null) {
+            initparams.put(INIT_PARAM_AUTHENTICATE_HEADER, "Basic Realm=\""
+                + value + "\"");
+        }
+
+//        value = getString(props, INIT_PARAM_MISSING_AUTH_MAPPING, null);
+//        if (value != null) {
+//            initparams.put(INIT_PARAM_MISSING_AUTH_MAPPING, value);
+//        }
+
+        try {
+            httpService.registerServlet(context, this, initparams, null);
+
+            // set the contextPath field to signal successfull registration
+            this.contextPath = context;
+
+        } catch (NamespaceException ne) {
+            // context collision
+
+        } catch (ServletException se) {
+            // servlet initialization failure
+
+        }
+    }
+
+    protected void deactivate(ComponentContext context) {
+        if (contextPath != null) {
+            httpService.unregister(contextPath);
+            contextPath = null;
+        }
+    }
+
+    // ---------- internal -----------------------------------------------------
+
+    private String getString(Dictionary<?, ?> props, String name,
+            String defaultValue) {
+        Object propValue = props.get(name);
+        return (propValue instanceof String)
+                ? (String) propValue
+                : defaultValue;
+    }
+}

Propchange: incubator/sling/whiteboard/fmeschbe/resource/jcr/webdav/src/main/java/org/apache/sling/jcr/webdav/SimpleWebDavServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message