diff --git README.md README.md index 445a900..12ec1cc 100644 --- README.md +++ README.md @@ -60,6 +60,7 @@ The build consists of the following main components: - oak-lucene - Lucene-based query index - oak-run - runnable jar packaging - oak-pojosr - integration with PojoSR + - oak-segment-tar - TarMK API and implementation - oak-upgrade - tooling for upgrading Jackrabbit repositories to Oak - oak-it - integration tests - oak-it/osgi - integration tests for OSGi diff --git oak-doc/src/site/markdown/construct.md oak-doc/src/site/markdown/construct.md index 029b42d..aa04fb4 100644 --- oak-doc/src/site/markdown/construct.md +++ oak-doc/src/site/markdown/construct.md @@ -31,8 +31,9 @@ To construct an in-memory repository, use: To use a tar file based Segment NodeStore backend, use: - FileStore fs = FileStore.newFileStore(new File("repository")).create(); - Repository repo = new Jcr(new SegmentNodeStore(fs)).createRepository(); + FileStore fs = FileStoreBuilder.fileStoreBuilder(new File("repository")).build(); + SegmentNodeStore ns = SegmentNodeStoreBuilders.builder(fs).build(); + Repository repo = new Jcr(new Oak(ns)).createRepository(); To use a MongoDB backend, use: diff --git oak-doc/src/site/markdown/dev_getting_started.md oak-doc/src/site/markdown/dev_getting_started.md index 118998d..93616e0 100644 --- oak-doc/src/site/markdown/dev_getting_started.md +++ oak-doc/src/site/markdown/dev_getting_started.md @@ -71,6 +71,7 @@ The build consists of the following main components: - oak-http - HTTP binding for Oak - oak-lucene - Lucene-based query index - oak-run - runnable jar packaging + - oak-segment-tar - TarMK API and implementation - oak-upgrade - tooling for upgrading Jackrabbit repositories to Oak - oak-it - integration tests - oak-it/osgi - integration tests for OSGi diff --git oak-doc/src/site/markdown/oak_api/overview.md oak-doc/src/site/markdown/oak_api/overview.md index 6064c88..a51de68 100644 --- oak-doc/src/site/markdown/oak_api/overview.md +++ oak-doc/src/site/markdown/oak_api/overview.md @@ -34,7 +34,7 @@ Oak API - [oak-solr-osgi](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-solr-osgi/) - [oak-auth-external](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-auth-external/) - [oak-auth-ldap](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-auth-ldap/) - - [oak-tarmk-standby](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-tarmk-standby/) + - [oak-segment-tar](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-segment-tar/) - [oak-authorization-cug](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-authorization-cug/) - [oak-remote](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-remote/) - [oak-exercise](http://www.javadoc.io/doc/org.apache.jackrabbit/oak-exercise/) diff --git oak-http/pom.xml oak-http/pom.xml index 876eff0..2d37061 100644 --- oak-http/pom.xml +++ oak-http/pom.xml @@ -66,11 +66,6 @@ ${project.version} - org.apache.jackrabbit - oak-segment - 1.6.0 - - org.apache.tika tika-core 1.1 diff --git oak-http/src/main/java/org/apache/jackrabbit/oak/http/segment/SegmentServlet.java oak-http/src/main/java/org/apache/jackrabbit/oak/http/segment/SegmentServlet.java deleted file mode 100644 index 5e768ef..0000000 --- oak-http/src/main/java/org/apache/jackrabbit/oak/http/segment/SegmentServlet.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.oak.http.segment; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.UUID; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServlet; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.apache.jackrabbit.oak.plugins.segment.RecordId; -import org.apache.jackrabbit.oak.plugins.segment.Segment; -import org.apache.jackrabbit.oak.plugins.segment.SegmentId; -import org.apache.jackrabbit.oak.plugins.segment.SegmentNodeState; -import org.apache.jackrabbit.oak.plugins.segment.SegmentStore; - -import com.google.common.io.ByteStreams; - -public abstract class SegmentServlet extends HttpServlet { - - protected abstract SegmentStore getSegmentStore(); - - private SegmentId getSegmentId(String info) { - try { - UUID uuid = UUID.fromString(info); - return getSegmentStore().getTracker().getSegmentId( - uuid.getMostSignificantBits(), - uuid.getLeastSignificantBits()); - } catch (IllegalArgumentException e) { - return null; - } - } - - private RecordId getRecordId(BufferedReader reader) throws IOException { - try { - return RecordId.fromString( - getSegmentStore().getTracker(), reader.readLine()); - } catch (IllegalArgumentException e) { - return null; - } - } - - @Override - protected void doGet( - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - String info = request.getPathInfo(); - if (info == null || info.equals("") || info.equals("/")) { - response.setContentType("text/plain; charset=UTF-8"); - SegmentNodeState head = getSegmentStore().getHead(); - response.getWriter().write(head.getRecordId().toString()); - } else if (info.startsWith("/")) { - doGetSegment(info.substring(1, info.length()), response); - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - } - - @Override - protected void doPut( - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - String info = request.getPathInfo(); - if (info == null || info.equals("") || info.equals("/")) { - RecordId id = getRecordId(request.getReader()); - if (id == null) { - response.sendError(HttpServletResponse.SC_BAD_REQUEST); - } else { - SegmentStore store = getSegmentStore(); - SegmentNodeState head = new SegmentNodeState(id); - if (store.setHead(store.getHead(), head)) { - response.setStatus(HttpServletResponse.SC_OK); - } else { - response.sendError(HttpServletResponse.SC_CONFLICT); - } - } - } else if (info.startsWith("/")) { - doPutSegment(info.substring(1, info.length()), request, response); - } else { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } - } - - private void doGetSegment( - String info, HttpServletResponse response) - throws ServletException, IOException { - SegmentId id = getSegmentId(info); - if (id == null) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; - } - - Segment segment = id.getSegment(); - if (segment == null) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; - } - - response.setContentType("application/octet-stream"); - segment.writeTo(response.getOutputStream()); - } - - private void doPutSegment( - String info, - HttpServletRequest request, HttpServletResponse response) - throws ServletException, IOException { - SegmentId id = getSegmentId(info); - if (id == null) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - } else if (getSegmentStore().containsSegment(id)) { - // can't modify an existing segment - response.sendError(HttpServletResponse.SC_FORBIDDEN); - } else { - // TODO: sanity check the segment data? - byte[] data = ByteStreams.toByteArray(request.getInputStream()); - getSegmentStore().writeSegment(id, data, 0, data.length); - response.setStatus(HttpServletResponse.SC_OK); - } - } - -} diff --git oak-pojosr/README.md oak-pojosr/README.md index c4ddc49..fb1829a 100644 --- oak-pojosr/README.md +++ oak-pojosr/README.md @@ -51,7 +51,7 @@ Where the configFile is json file capturing the required OSGi configuration "jaas.configProviderName": "FelixJaasProvider" }, "org.apache.jackrabbit.oak.jcr.osgi.RepositoryManager": {}, - "org.apache.jackrabbit.oak.plugins.segment.SegmentNodeStoreService" : {} + "org.apache.jackrabbit.oak.segment.SegmentNodeStoreService" : {} } [1]: https://code.google.com/p/pojosr/ diff --git oak-run/README.md oak-run/README.md index d816c3a..83c2e50 100644 --- oak-run/README.md +++ oak-run/README.md @@ -321,16 +321,16 @@ repository backend. The optional fixture argument allows to specify the repository implementation to be used. The following fixtures are currently supported: -| Fixture | Description | -|---------------|-------------------------------------------------------| -| Jackrabbit(*) | Jackrabbit with the default embedded Derby bundle PM | -| Oak-Memory | Oak with default in-memory storage | -| Oak-MemoryNS | Oak with default in-memory NodeStore | -| Oak-Mongo | Oak with the default Mongo backend | -| Oak-Mongo-DS | Oak with the default Mongo backend and DataStore | -| Oak-MongoNS | Oak with the Mongo NodeStore | -| Oak-Tar | Oak with the Tar backend (aka Segment NodeStore) | -| Oak-Tar-DS | Oak with the Tar backend and DataStore | +| Fixture | Description | +|----------------------|-------------------------------------------------------| +| Jackrabbit(*) | Jackrabbit with the default embedded Derby bundle PM | +| Oak-Memory | Oak with default in-memory storage | +| Oak-MemoryNS | Oak with default in-memory NodeStore | +| Oak-Mongo | Oak with the default Mongo backend | +| Oak-Mongo-DS | Oak with the default Mongo backend and DataStore | +| Oak-MongoNS | Oak with the Mongo NodeStore | +| Oak-Segment-Tar | Oak with the Tar backend (aka Segment NodeStore) | +| Oak-Segment-Tar-DS | Oak with the Tar backend and DataStore | Jackrabbit fixture requires [Oak Runnable JR2 jar](#jr2) @@ -351,7 +351,7 @@ Depending on the fixture the following options are available: Examples: $ java -jar oak-run-*.jar server - $ java -jar oak-run-*.jar server http://localhost:4503 Oak-Tar --base myOak + $ java -jar oak-run-*.jar server http://localhost:4503 Oak-Segment-Tar --base myOak $ java -jar oak-run-*.jar server http://localhost:4502 Oak-Mongo --db myOak --clusterIds c1,c2,c3 See the documentation in the `oak-http` component for details about the available functionality. @@ -440,8 +440,6 @@ Finally the benchmark runner supports the following repository fixtures: | Oak-MongoNS | Oak with the Mongo NodeStore | | Oak-Segment-Tar | Oak with the Segment Tar backend | | Oak-Segment-Tar-DS | Oak with the Segment Tar backend and DataStore | -| Oak-Tar | Oak with the Tar backend (deprecated) | -| Oak-Tar-DS | Oak with the Tar backend (deprecated) and DataStore | | Oak-RDB | Oak with the DocumentMK/RDB persistence | | Oak-RDB-DS | Oak with the DocumentMK/RDB persistence and DataStore | @@ -609,17 +607,17 @@ suites in the scalability command line, and oak-run will execute each suite in s Finally the scalability runner supports the following repository fixtures: -| Fixture | Description | -|---------------|----------------------------------------------------------------| -| Oak-Memory | Oak with default in-memory storage | -| Oak-MemoryNS | Oak with default in-memory NodeStore | -| Oak-Mongo | Oak with the default Mongo backend | -| Oak-Mongo-DS | Oak with the default Mongo backend and DataStore | -| Oak-MongoNS | Oak with the Mongo NodeStore | -| Oak-Tar | Oak with the Tar backend (aka Segment NodeStore) | -| Oak-Tar-DS | Oak with the Tar backend (aka Segment NodeStore) and DataStore | -| Oak-RDB | Oak with the DocumentMK/RDB persistence | -| Oak-RDB-DS | Oak with the DocumentMK/RDB persistence and DataStore | +| Fixture | Description | +|-----------------------|----------------------------------------------------------------| +| Oak-Memory | Oak with default in-memory storage | +| Oak-MemoryNS | Oak with default in-memory NodeStore | +| Oak-Mongo | Oak with the default Mongo backend | +| Oak-Mongo-DS | Oak with the default Mongo backend and DataStore | +| Oak-MongoNS | Oak with the Mongo NodeStore | +| Oak-Segment-Tar | Oak with the Tar backend (aka Segment NodeStore) | +| Oak-Segment-Tar-DS | Oak with the Tar backend (aka Segment NodeStore) and DataStore | +| Oak-RDB | Oak with the DocumentMK/RDB persistence | +| Oak-RDB-DS | Oak with the DocumentMK/RDB persistence and DataStore | (Note that for Oak-RDB, the required JDBC drivers either need to be embedded into oak-run, or be specified separately in the class path.)