jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r1205121 - in /jackrabbit/trunk: jackrabbit-jcr-server/ jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/ jackrabbit-jcr-server/src/main/resources/ jackrabbit-jcr-server/src/main/resources/OSGI-INF/ jackrabbit...
Date Tue, 22 Nov 2011 18:35:27 GMT
Author: jukka
Date: Tue Nov 22 18:35:25 2011
New Revision: 1205121

URL: http://svn.apache.org/viewvc?rev=1205121&view=rev
Log:
JCR-3142: Create OSGi Bundles from jackrabbit-webdav and jackrabbit-jcr-server libraries

Patch by Felix Meschberger

Added:
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/
    jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/metatype.properties
Modified:
    jackrabbit/trunk/jackrabbit-jcr-server/pom.xml
    jackrabbit/trunk/jackrabbit-webdav/pom.xml

Modified: jackrabbit/trunk/jackrabbit-jcr-server/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/pom.xml?rev=1205121&r1=1205120&r2=1205121&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-jcr-server/pom.xml Tue Nov 22 18:35:25 2011
@@ -32,6 +32,7 @@
   <artifactId>jackrabbit-jcr-server</artifactId>
   <name>Jackrabbit JCR Server</name>
   <description>WebDAV server implementations for JCR</description>
+  <packaging>bundle</packaging>
 
   <build>
     <plugins>
@@ -45,6 +46,41 @@
           <argLine>-Xmx128m -enableassertions</argLine>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+        <version>1.7.2</version>
+        <executions>
+            <execution>
+              <id>generate-scr-scrdescriptor</id>
+              <goals>
+                <goal>scr</goal>
+              </goals>
+              <configuration>
+                <properties>
+                  <service.vendor>The Apache Software Foundation</service.vendor>
+              </properties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+        <configuration>
+          <instructions>
+            <Export-Package>
+              !*
+            </Export-Package>
+            <Private-Package>
+              org.apache.jackrabbit.server.*,
+              org.apache.jackrabbit.webdav.jcr.*,
+              org.apache.jackrabbit.webdav.simple
+            </Private-Package>
+          </instructions>
+        </configuration>
+      </plugin>
     </plugins>
   </build>
 
@@ -125,6 +161,21 @@
       <groupId>commons-fileupload</groupId>
       <artifactId>commons-fileupload</artifactId>
     </dependency>
+    
+    <!-- OSGi support -->
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
+      <version>4.0.0</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.scr.annotations</artifactId>
+      <version>1.6.0</version>
+      <scope>provided</scope>
+    </dependency>
+    
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>

Added: jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java?rev=1205121&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/java/org/apache/jackrabbit/server/remoting/davex/DavexServletService.java
Tue Nov 22 18:35:25 2011
@@ -0,0 +1,100 @@
+/*
+ * 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.server.remoting.davex;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.jcr.Repository;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.jackrabbit.webdav.server.AbstractWebdavServlet;
+import org.apache.jackrabbit.webdav.util.CSRFUtil;
+import org.osgi.service.http.HttpService;
+import org.slf4j.LoggerFactory;
+
+@Component(metatype = true, label = "%dav.name", description = "%dav.description")
+@Properties({
+    @Property(name = "service.description", value = "Apache Jackrabbit JcrRemoting Servlet"),
+    @Property(name = JcrRemotingServlet.INIT_PARAM_AUTHENTICATE_HEADER, value = AbstractWebdavServlet.DEFAULT_AUTHENTICATE_HEADER),
+    @Property(name = JcrRemotingServlet.INIT_PARAM_CSRF_PROTECTION, value = CSRFUtil.DISABLED),
+    @Property(name = JcrRemotingServlet.INIT_PARAM_MISSING_AUTH_MAPPING, value = "") })
+public class DavexServletService extends JcrRemotingServlet {
+
+    /** Serial version UID */
+    private static final long serialVersionUID = -8588285209666835376L;
+
+    private static final String DEFAULT_ALIAS = "/server";
+
+    @Property(value = DEFAULT_ALIAS)
+    private static final String PARAM_ALIAS = "alias";
+
+    @Reference
+    private Repository repository;
+
+    @Reference
+    private HttpService httpService;
+
+    private String alias;
+
+    @Override
+    protected Repository getRepository() {
+        return repository;
+    }
+
+    @SuppressWarnings("unused")
+    @Activate
+    private void activate(Map<String, ?> config) {
+        String alias;
+        Object aliasPar = config.get(PARAM_ALIAS);
+        if (aliasPar == null) {
+            alias = DEFAULT_ALIAS;
+        } else {
+            alias = aliasPar.toString();
+            if (alias.length() == 0) {
+                alias = DEFAULT_ALIAS;
+            }
+        }
+
+        Hashtable<String, ?> initparams = new Hashtable<String, Object>(config);
+        initparams.remove(PARAM_ALIAS);
+
+        try {
+            this.httpService.registerServlet(alias, this, initparams, null);
+            this.alias = alias;
+        } catch (Exception e) {
+            LoggerFactory.getLogger(getClass()).error("activate: Failed registering DavEx
Servlet at " + alias, e);
+        }
+    }
+
+    @SuppressWarnings("unused")
+    @Deactivate
+    private void deactivate() {
+        if (this.alias != null) {
+            this.httpService.unregister(alias);
+            this.alias = null;
+        }
+    }
+
+}

Added: jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/metatype.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1205121&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/metatype.properties
(added)
+++ jackrabbit/trunk/jackrabbit-jcr-server/src/main/resources/OSGI-INF/metatype/metatype.properties
Tue Nov 22 18:35:25 2011
@@ -0,0 +1,58 @@
+#
+#  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.
+#
+
+
+#
+# This file contains localization strings for configuration labels and
+# descriptions as used in the metatype.xml descriptor generated by the
+# the SCR plugin
+
+dav.name = Apache Jackrabbit DavEx Servlet
+dav.description = The DavEx Servlet allows direct access to the \
+ complete Repository.
+
+alias.name = Root Path
+alias.description = The root path at which the DavEx Servlet is \
+ accessible. The default value is "/server".
+
+missing-auth-mapping.name = Missing Credentials Handling 
+missing-auth-mapping.description = Defines how a missing authorization \
+ header should be handled. If this property is missing, a 401 response \
+ is generated. This is suiteable for clients (eg. webdav clients) for \
+ which sending a proper authorization header is not possible if the \
+ server never sent a 401. If this property is present with an empty \
+ value, null-credentials are returned, thus forcing an null login \
+ on the repository. If this propert is present with the value \
+ 'guestcredentials' java.jcr.GuestCredentials are used to login to the \
+ repository. If this property has a 'user:password' value, the \
+ respective simple credentials are generated.
+
+authenticate-header.name = Realm>
+authenticate-header.description = Defines the value of the \
+ 'WWW-Authenticate' header. Default is 'Basic realm="Jackrabbit Webdav Server"'.
+ 
+csrf-protection.name = CSRF Protection
+csrf-protection.description = Configuration of referrer based CSRF \
+ protection. If config is not configured or empty string the default \
+ behaviour is to allow only requests with an empty referrer header or a \
+ referrer host equal to the server host. A comma separated list of \
+ additional allowed referrer hosts which are valid in addition to default \
+ behaviour (see above). The value "disabled" may be used to disable the \
+ referrer checking altogether. The default is "disabled" assuming that \
+ a site-wide CSRF protection filter is installed.

Modified: jackrabbit/trunk/jackrabbit-webdav/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-webdav/pom.xml?rev=1205121&r1=1205120&r2=1205121&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-webdav/pom.xml (original)
+++ jackrabbit/trunk/jackrabbit-webdav/pom.xml Tue Nov 22 18:35:25 2011
@@ -30,12 +30,18 @@
     <relativePath>../jackrabbit-parent/pom.xml</relativePath>
   </parent>
   <artifactId>jackrabbit-webdav</artifactId>
+  <packaging>bundle</packaging>
   <name>Jackrabbit WebDAV Library</name>
   <description>Generic WebDAV Library</description>
 
   <build>
     <plugins>
       <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-bundle-plugin</artifactId>
+        <extensions>true</extensions>
+      </plugin>
+      <plugin>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
           <includes>



Mime
View raw message