incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bdelacre...@apache.org
Subject svn commit: r1513913 - in /sling/whiteboard/bdelacretaz: bdelacretaz-oak-server/ bdelacretaz-oak-server/src/ bdelacretaz-oak-server/src/main/ bdelacretaz-oak-server/src/main/java/ bdelacretaz-oak-server/src/main/java/org/ bdelacretaz-oak-server/src/mai...
Date Wed, 14 Aug 2013 14:51:24 GMT
Author: bdelacretaz
Date: Wed Aug 14 14:51:24 2013
New Revision: 1513913

URL: http://svn.apache.org/r1513913
Log:
SLING-3016 - OakRepositoryIT added, using a vaguely functional Oak-based repository

Added:
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/   (with props)
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml   (with props)
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
  (with props)
    sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
  (with props)
    sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
  (with props)

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed Aug 14 14:51:24 2013
@@ -0,0 +1,15 @@
+target
+sling
+bin
+logs
+jackrabbit
+derby.log
+*.iml
+*.ipr
+*.iws
+.settings
+.project
+.classpath
+.externalToolBuilders
+maven-eclipse.xml
+

Added: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml?rev=1513913&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml (added)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml Wed Aug 14 14:51:24 2013
@@ -0,0 +1,154 @@
+<?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>15</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>org.apache.sling.whiteboard.bdelacretaz.oak.server</artifactId>
+    <version>0.0.1-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <name>Apache Sling WHITEBOARD PROTOTYPE Oak Server</name>
+    <description>
+        This bundle provides a WHITEBOARD PROTOTYPE SlingRepository based on Apache Oak.
+    </description>
+
+    <properties>
+        <sling.java.version>6</sling.java.version>
+    </properties>
+
+    <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>
+                        <Import-Package>
+                          org.apache.jackrabbit.test;resolution:=optional,
+                          com.mongodb;resolution:=optional,
+                          org.apache.jackrabbit.oak.security.user;resolution:=optional,
+                          *
+                        </Import-Package>
+                        <Private-Package>
+                            org.apache.sling.oak.server.*
+                        </Private-Package>
+                        <Embed-Transitive>true</Embed-Transitive>
+                        <Embed-Dependency>
+                            <!-- TODO embeds should'n be needed... -->            
                   
+                            oak-jcr,
+                            oak-core;inline=org/apache/jackrabbit/oak/security/authentication/user/**

+                        </Embed-Dependency>
+                    </instructions>
+                </configuration>                
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-jcr</artifactId>
+            <version>0.8</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.jackrabbit</groupId>
+            <artifactId>oak-core</artifactId>
+            <version>0.8</version>
+            <scope>provided</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.api</artifactId>
+            <version>2.3.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.api</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.jcr.base</artifactId>
+            <version>2.1.2</version>
+            <scope>provided</scope>
+        </dependency>
+
+        <!-- OSGi Libraries not included here -->
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.osgi</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+        </dependency>
+        
+        <!-- servlet API for the web console plugin -->
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>biz.aQute</groupId>
+            <artifactId>bndlib</artifactId>
+        </dependency>
+ 
+        <!-- testing -->
+        <!--  using mockito because its a bit more relaxed and makes it easier to maintain
+              the test cases if dependencies change -->
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-all</artifactId>
+            <version>1.8.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+        	<groupId>org.slf4j</groupId>
+        	<artifactId>slf4j-simple</artifactId>
+  		<scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+        </dependency>
+    </dependencies>
+</project>

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java?rev=1513913&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
(added)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
Wed Aug 14 14:51:24 2013
@@ -0,0 +1,101 @@
+/*
+ * 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 SF 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.oak.server;
+
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.jcr.SimpleCredentials;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.jackrabbit.oak.jcr.Jcr;
+import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;
+import org.apache.jackrabbit.oak.spi.security.SecurityProvider;
+import org.apache.sling.jcr.api.SlingRepository;
+import org.apache.sling.jcr.base.AbstractNamespaceMappingRepository;
+import org.osgi.service.component.ComponentContext;
+
+/**
+ * A Sling repository implementation that wraps the Oak OSGi repository
+ * implementation from the Oak project.
+ */
+@Component(immediate = true, metatype = true)
+@Service(value = { SlingRepository.class, Repository.class })
+public class SlingRepositoryImpl extends AbstractNamespaceMappingRepository
+        implements SlingRepository {
+
+    private Repository oakRepository;
+    
+    @Activate
+    protected void activate(ComponentContext ctx) {
+        final SecurityProvider sp = new OpenSecurityProvider();
+        // TODO barebones setup for now...might not provide much functionality.
+        // TODO for a simple config (tar persistence) we could use the SegmentNodeStoreService
+        oakRepository = new Jcr().with(sp).createRepository();
+    }
+    
+    @Override
+    public String getDescriptor(String key) {
+        return oakRepository.getDescriptor(key);
+    }
+
+    @Override
+    public String[] getDescriptorKeys() {
+        return oakRepository.getDescriptorKeys();
+    }
+
+    @Override
+    public Session login() throws LoginException, RepositoryException {
+        return oakRepository.login();
+    }
+
+    @Override
+    public Session login(Credentials creds, String workspace) throws LoginException,
+            NoSuchWorkspaceException, RepositoryException {
+        return oakRepository.login(creds, workspace);
+    }
+
+    @Override
+    public Session login(Credentials creds) throws LoginException,
+            RepositoryException {
+        return oakRepository.login(creds);
+    }
+
+    @Override
+    public Session login(String workspace) throws LoginException,
+            NoSuchWorkspaceException, RepositoryException {
+        return oakRepository.login(workspace);
+    }
+
+    @Override
+    public String getDefaultWorkspace() {
+        return null;
+    }
+
+    @Override
+    public Session loginAdministrative(String workspace) throws RepositoryException {
+        // TODO use configurable credentials
+        final SimpleCredentials creds = new SimpleCredentials("admin", "admin".toCharArray());
+        return login(creds, workspace);
+    }
+}
\ No newline at end of file

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/SlingRepositoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java?rev=1513913&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
(added)
+++ sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
Wed Aug 14 14:51:24 2013
@@ -0,0 +1,5 @@
+/**
+ * Contains in implementation of a SlingRepository based on Apache Oak.
+ * The package is not exported.
+ */
+package org.apache.sling.oak.server;

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/bdelacretaz/bdelacretaz-oak-server/src/main/java/org/apache/sling/oak/server/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java?rev=1513913&view=auto
==============================================================================
--- sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
(added)
+++ sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
Wed Aug 14 14:51:24 2013
@@ -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 SF 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.repository.it;
+
+import static org.junit.Assert.fail;
+import static org.ops4j.pax.exam.CoreOptions.junitBundles;
+import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
+import static org.ops4j.pax.exam.CoreOptions.options;
+import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.when;
+
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerClass;
+
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerClass.class)
+public class OakRepositoryIT extends SlingRepositoryITBase {
+
+    @org.ops4j.pax.exam.Configuration
+    public Option[] config() {
+        final String localRepo = System.getProperty("maven.repo.local", "");
+
+        return options(
+                when( localRepo.length() > 0 ).useOptions(
+                        systemProperty("org.ops4j.pax.url.mvn.localRepository").value(localRepo)
+                ),
+                mavenBundle("org.apache.sling", "org.apache.sling.fragment.xml", "1.0.2"),
+                mavenBundle("org.apache.sling", "org.apache.sling.fragment.transaction",
"1.0.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.fragment.activation", "1.0.2"),
+                mavenBundle("org.apache.sling", "org.apache.sling.fragment.ws", "1.0.2"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.log", "3.0.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.logservice", "1.0.2"),
+
+                mavenBundle("org.slf4j", "slf4j-api", "1.6.4"),
+                mavenBundle("org.slf4j", "jcl-over-slf4j", "1.6.4"),
+                mavenBundle("org.slf4j", "log4j-over-slf4j", "1.6.4"),
+
+                mavenBundle("commons-io", "commons-io", "1.4"),
+                mavenBundle("commons-fileupload", "commons-fileupload", "1.2.2"),
+                mavenBundle("commons-collections", "commons-collections", "3.2.1"),
+                mavenBundle("commons-codec", "commons-codec", "1.6"),
+                mavenBundle("commons-lang", "commons-lang", "2.5"),
+
+                mavenBundle("org.apache.geronimo.bundles", "commons-httpclient", "3.1_1"),
+                mavenBundle("org.apache.tika", "tika-core", "1.2"),
+                mavenBundle("org.apache.tika", "tika-bundle", "1.2"),
+
+                mavenBundle("org.apache.felix", "org.apache.felix.http.jetty", "2.2.0"),
+                mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.2.14"),
+                mavenBundle("org.apache.felix", "org.apache.felix.scr", "1.6.2"),
+                mavenBundle("org.apache.felix", "org.apache.felix.configadmin", "1.6.0"),
+                mavenBundle("org.apache.felix", "org.apache.felix.inventory", "1.0.0"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.osgi", "2.2.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.json", "2.0.6"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.mime", "2.1.4"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.classloader", "1.3.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.scheduler", "2.3.4"),
+                mavenBundle("org.apache.sling", "org.apache.sling.commons.threads", "3.1.0"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.launchpad.api", "1.1.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.auth.core", "1.1.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.discovery.api", "1.0.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.discovery.standalone",
"1.0.0"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.api", "2.4.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.settings", "1.2.2"),
+                mavenBundle("org.apache.sling", "org.apache.sling.resourceresolver", "1.0.6"),
+                mavenBundle("org.apache.sling", "org.apache.sling.adapter", "2.1.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.resource", "2.2.6"),
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.classloader", "3.1.12"),
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.contentloader", "2.1.2"),
+                mavenBundle("org.apache.sling", "org.apache.sling.engine", "2.2.6"),
+
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.jcr-wrapper", "2.0.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.api", "2.1.0"),
+                mavenBundle("org.apache.sling", "org.apache.sling.jcr.base", "2.1.2"),
+                
+                // Oak
+                mavenBundle("org.apache.sling", "org.apache.sling.whiteboard.bdelacretaz.oak.server",
"0.0.1-SNAPSHOT"),
+                mavenBundle("com.google.guava", "guava", "13.0.1"),
+                mavenBundle("com.google.code.findbugs", "jsr305", "2.0.0"),
+                mavenBundle("org.apache.jackrabbit", "jackrabbit-api", "2.7.0"),
+                mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-commons", "2.7.0"),
+                mavenBundle("org.apache.jackrabbit", "jackrabbit-jcr-rmi", "2.4.2"),
+                mavenBundle("org.apache.jackrabbit", "oak-core", "0.8"),
+                //mavenBundle("org.apache.jackrabbit", "oak-jcr", "0.8"),
+                mavenBundle("org.apache.jackrabbit", "oak-commons", "0.8"),
+                mavenBundle("org.apache.jackrabbit", "oak-mk", "0.8"),
+                mavenBundle("org.apache.jackrabbit", "oak-mk-api", "0.8"),
+                mavenBundle("org.apache.jackrabbit", "oak-mk-remote", "0.8"),
+
+                // Testing
+                mavenBundle("org.apache.sling", "org.apache.sling.testing.tools", "1.0.6"),
+                mavenBundle("org.apache.httpcomponents", "httpcore-osgi", "4.1.2"),
+                mavenBundle("org.apache.httpcomponents", "httpclient-osgi", "4.1.2"),
+
+                junitBundles()
+           );
+    }
+
+    protected void doCheckRepositoryDescriptors() {
+        final String propName = "jcr.repository.name";
+        final String name = repository.getDescriptor(propName);
+        final String expected = "Oak";
+        if(!name.contains(expected)) {
+            fail("Expected repository descriptor " + propName + " to contain " 
+                    + expected + ", failed (descriptor=" + name + ")");
+        }
+    }
+}

Propchange: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/whiteboard/bdelacretaz/it-repository/src/test/java/org/apache/sling/jcr/repository/it/OakRepositoryIT.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message