Author: fmeschbe
Date: Thu Nov 25 11:40:59 2010
New Revision: 1039009
URL: http://svn.apache.org/viewvc?rev=1039009&view=rev
Log:
Add Prototype of Jackrabbit DavEx repository access
Added:
sling/whiteboard/fmeschbe/jcr.davex.client/ (with props)
sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml (with props)
sling/whiteboard/fmeschbe/jcr.davex.client/src/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
(with props)
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties
(with props)
Propchange: sling/whiteboard/fmeschbe/jcr.davex.client/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Nov 25 11:40:59 2010
@@ -0,0 +1,4 @@
+.classpath
+.project
+target
+.settings
Added: sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml
URL:
http://svn.apache.org/viewvc/sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml?rev=1039009&view=auto
==============================================================================
--- sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml (added)
+++ sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml Thu Nov 25 11:40:59 2010
@@ -0,0 +1,200 @@
+<?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>10-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>org.apache.sling.jcr.jackrabbit.davex.client</artifactId>
+ <packaging>bundle</packaging>
+ <version>0.0.1-SNAPSHOT</version>
+
+ <name>Apache Sling Jackrabbit DavEx Client Repository</name>
+ <description>
+ Bundle exposing a Repository attached using Jackrabbit WebDavEx
+ as an OSGi Service.
+ </description>
+
+ <!--
+ <scm>
+
<connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server</connection>
+
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/bundles/jcr/jackrabbit-server</developerConnection>
+
<url>http://svn.apache.org/viewvc/sling/trunk/bundles/jcr/jackrabbit-server</url>
+ </scm>
+ -->
+
+ <build>
+ <plugins>
+ <!-- generate the SCR descriptors -->
+ <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,jackrabbit
+ </Bundle-Category>
+ <Private-Package>
+
org.apache.sling.jcr.jackrabbit.davex.client.internal
+ </Private-Package>
+ <Import-Package>
+ !org.apache.xml.*,
+ *
+ </Import-Package>
+
+ <!-- Embedd some libraries -->
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ jackrabbit-jcr-server;
+ jackrabbit-jcr2spi;
+ jackrabbit-spi2dav;
+ jackrabbit-webdav;
+ inline=org/apache/jackrabbit/**
+ </Embed-Dependency>
+ <_removeheaders>
+ Embed-Dependency,
+ Embed-Transitive,
+ Private-Package,
+ Include-Resource
+ </_removeheaders>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.jcr</groupId>
+ <artifactId>jcr</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.jcr.api</artifactId>
+ <version>2.0.6</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.jcr.base</artifactId>
+ <version>2.1.1-SNAPSHOT</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>org.apache.sling.commons.osgi</artifactId>
+ <version>2.0.6</version>
+ <scope>compile</scope>
+ </dependency>
+
+ <!-- The core repository implementation -->
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-api</artifactId>
+ <version>2.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Requirements for DavEx: Provided as bundles -->
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr-commons</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-spi</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-spi-commons</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Requirements for DavEx: Embedded here -->
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr-server</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-jcr2spi</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-spi2dav</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.jackrabbit</groupId>
+ <artifactId>jackrabbit-webdav</artifactId>
+ <version>2.1.1</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- OSGi Libraries -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <!-- DS Annotations -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.scr.annotations</artifactId>
+ </dependency>
+
+ </dependencies>
+
+</project>
Propchange: sling/whiteboard/fmeschbe/jcr.davex.client/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added:
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
URL:
http://svn.apache.org/viewvc/sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java?rev=1039009&view=auto
==============================================================================
---
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
(added)
+++
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
Thu Nov 25 11:40:59 2010
@@ -0,0 +1,130 @@
+/*
+ * 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.jackrabbit.davex.client.internal;
+
+import java.util.Dictionary;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.jcr.Repository;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.jackrabbit.jcr2spi.Jcr2spiRepositoryFactory;
+import org.apache.jackrabbit.jcr2spi.RepositoryImpl;
+import org.apache.jackrabbit.jcr2spi.config.RepositoryConfig;
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.spi.RepositoryServiceFactory;
+import org.apache.jackrabbit.spi.commons.conversion.PathResolver;
+import org.apache.jackrabbit.spi2davex.BatchReadConfig;
+import org.apache.jackrabbit.spi2davex.Spi2davexRepositoryServiceFactory;
+import org.apache.sling.commons.osgi.OsgiUtil;
+import org.apache.sling.jcr.base.AbstractSlingRepository;
+import org.osgi.framework.Constants;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The <code>DavExClientRepository</code> TODO
+ */
+...@component(metatype = true, policy = ConfigurationPolicy.REQUIRE,
configurationFactory = false, label = "%repository.name", description =
"%repository.description", name =
"org.apache.sling.jcr.jackrabbit.davex.client.internal.DavExClientRepository")
+...@properties({
+ @Property(name = Constants.SERVICE_VENDOR, value = "The Apache Software
Foundation"),
+ @Property(name = Constants.SERVICE_DESCRIPTION, value = "Jackrabbit
WebDavEx Repository Service") })
+public class DavExClientRepository extends AbstractSlingRepository {
+
+ /** default log */
+ private final Logger log = LoggerFactory.getLogger(getClass());
+
+ private static final String PARAM_REPOSITORY_URI =
"org.apache.jackrabbit.repository.uri";
+
+ private static final String DEFAULT_REPOSITORY_URI =
"http://localhost:8080/jackrabbit/server";
+
+ private static final int DEFAULT_BATCHREAD_CONFIG = 0;
+
+ private static final int DEFAULT_ITEMINFO_CACHE_SIZE = 5000;
+
+ @Property(name = PARAM_REPOSITORY_URI, value = DEFAULT_REPOSITORY_URI)
+ private String davExUrl;
+
+ @Property(name = Spi2davexRepositoryServiceFactory.PARAM_BATCHREAD_CONFIG,
intValue = DEFAULT_BATCHREAD_CONFIG)
+ private int batchReadDepth;
+
+ @Property(name =
Spi2davexRepositoryServiceFactory.PARAM_ITEMINFO_CACHE_SIZE, intValue =
DEFAULT_ITEMINFO_CACHE_SIZE)
+ private int itemInfoCacheSize;
+
+ @Override
+ protected void activate(ComponentContext componentContext) throws
Exception {
+
+ @SuppressWarnings("unchecked")
+ Dictionary<String, ?> props = componentContext.getProperties();
+
+ davExUrl = OsgiUtil.toString(props.get(PARAM_REPOSITORY_URI),
+ DEFAULT_REPOSITORY_URI);
+ batchReadDepth = OsgiUtil.toInteger(
+
props.get(Spi2davexRepositoryServiceFactory.PARAM_BATCHREAD_CONFIG),
+ DEFAULT_BATCHREAD_CONFIG);
+ itemInfoCacheSize = OsgiUtil.toInteger(
+
props.get(Spi2davexRepositoryServiceFactory.PARAM_ITEMINFO_CACHE_SIZE),
+ DEFAULT_ITEMINFO_CACHE_SIZE);
+
+ super.activate(componentContext);
+ }
+
+ @Override
+ protected Repository acquireRepository() {
+ // prepare the DavEx connection configuration
+ Map<String, Object> props = new HashMap<String, Object>();
+ props.put(Spi2davexRepositoryServiceFactory.PARAM_REPOSITORY_URI,
+ davExUrl);
+
+ if (itemInfoCacheSize > 0) {
+ props.put(
+ Spi2davexRepositoryServiceFactory.PARAM_ITEMINFO_CACHE_SIZE,
+ itemInfoCacheSize);
+ }
+
+ // Ensure we read one level of children
+ BatchReadConfig brc = new BatchReadConfig() {
+ public int getDepth(Path path, PathResolver resolver) {
+ return batchReadDepth;
+ }
+ };
+ props.put(Spi2davexRepositoryServiceFactory.PARAM_BATCHREAD_CONFIG,
brc);
+
+ try {
+ RepositoryServiceFactory factory = new
Spi2davexRepositoryServiceFactory();
+ RepositoryConfig config = new
Jcr2spiRepositoryFactory.RepositoryConfigImpl(
+ factory, props);
+ return RepositoryImpl.create(config);
+ } catch (Throwable t) {
+ log.error("Failed to Create Remote Repository", t);
+ }
+
+ return null;
+ }
+
+ @Override
+ protected void disposeRepository(Repository repository) {
+ // nothing to do, just drop the reference
+ }
+}
Propchange:
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/java/org/apache/sling/jcr/jackrabbit/davex/client/internal/DavExClientRepository.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision Rev Url
Added:
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties
URL:
http://svn.apache.org/viewvc/sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties?rev=1039009&view=auto
==============================================================================
---
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties
(added)
+++
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties
Thu Nov 25 11:40:59 2010
@@ -0,0 +1,86 @@
+#
+# 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 Sling SCR plugin
+
+repository.name = Apache Sling Jackrabbit DavEx Client Repository
+repository.description = Configuration to connect to a remote JCR repository \
+ exposed over Jackrabbit WebDavEx transport. The connected repository is \
+ exposed to the framework as javax.jcr.Repository and \
+ org.apache.sling.jcr.api.SlingRepository service.
+
+org.apache.jackrabbit.repository.uri.name = Remote Repository URL
+org.apache.jackrabbit.repository.uri.description = URL to access the remote
JCR \
+ repository exposed over Jackrabbit WebDavEx transport. The default value is \
+ "http://localhost:8080/jackrabbit/server" which is the default URL under
which \
+ Jackrabbit itself is exposed over WebDavEx. The value of this property (or \
+ the default value) is exposed as a service registration property.
+
+admin.name.name = Administator
+admin.name.description = The user name of the administrative user. This user \
+ name is used to implement the SlingRepository.loginAdministrative(String) \
+ method. It is intended for this user to provide full read/write access to \
+ repository.
+
+admin.password.name = Administrator Password
+admin.password.description = Password for the administrative user.
+
+anonymous.name.name = Anonymous
+anonymous.name.description = The user name of the anonymous user. This user \
+ name is used to implement the Repository.login methods without a Credentials \
+ instance.
+
+anonymous.password.name = Anonymous Password
+anonymous.password.description = Password for the anonymous user.
+
+defaultWorkspace.name = Default Workspace
+defaultWorkspace.description = Name of the workspace to use by default if not \
+ is given in any of the login methods. This name is used to implement the \
+ SlingRepository.getDefaultWorkspace() method. If this name is empty, a null \
+ value is used in JCR calls so that the default workspace provided by the \
+ JCR repository is used.
+
+poll.active.name = Poll Intervall Active
+poll.active.description = The interval in seconds between two consecutive \
+ checks whether the repository is still accessbible, once it has been
acquired.\
+ The default value is 10 seconds, the minimum allowed value is 2 seconds, \
+ smaller values are corected to the minimum.
+
+poll.inactive.name = Poll Intervall Inactive
+poll.inactive.description = The interval in seconds between two consecutive \
+ checks whether the repository has become accessbible if the repository is \
+ not immediately accessible or connection to the repository has been lost. \
+ The default value is 10 seconds, the minimum allowed value is 2 seconds, \
+ smaller values are corected to the minimum.
+
+org.apache.jackrabbit.spi2davex.BatchReadConfig.name = Batch Depth
+org.apache.jackrabbit.spi2davex.BatchReadConfig.description = The tree depth \
+ to retrieve items in batches when accessing a node. The default value is zero
\
+ indicating to just retrieve the node and its properties.
+
+org.apache.jackrabbit.spi2davex.ItemInfoCacheSize.name = Size of Item Cache
+org.apache.jackrabbit.spi2davex.ItemInfoCacheSize.description = Number of
items \
+ to cache on the client side for improved performance. The default value is
5000 \
+ and should probably only be modified if you experience serious performance \
+ issues and can provided enough Java Heap memory.
+
+
\ No newline at end of file
Propchange:
sling/whiteboard/fmeschbe/jcr.davex.client/src/main/resources/OSGI-INF/metatype/metatype.properties
------------------------------------------------------------------------------
svn:eol-style = native