Return-Path: X-Original-To: apmail-jackrabbit-commits-archive@www.apache.org Delivered-To: apmail-jackrabbit-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1FC1985A3 for ; Fri, 9 Sep 2011 15:30:40 +0000 (UTC) Received: (qmail 94395 invoked by uid 500); 9 Sep 2011 15:30:39 -0000 Delivered-To: apmail-jackrabbit-commits-archive@jackrabbit.apache.org Received: (qmail 94298 invoked by uid 500); 9 Sep 2011 15:30:39 -0000 Mailing-List: contact commits-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list commits@jackrabbit.apache.org Received: (qmail 94291 invoked by uid 99); 9 Sep 2011 15:30:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 15:30:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 09 Sep 2011 15:30:31 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id A66D623889E7; Fri, 9 Sep 2011 15:30:09 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1167249 - in /jackrabbit/sandbox/microkernel/src/main: java/org/apache/jackrabbit/mk/server/ resources/org/apache/jackrabbit/mk/server/ Date: Fri, 09 Sep 2011 15:30:08 -0000 To: commits@jackrabbit.apache.org From: dpfister@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110909153009.A66D623889E7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dpfister Date: Fri Sep 9 15:30:07 2011 New Revision: 1167249 URL: http://svn.apache.org/viewvc?rev=1167249&view=rev Log: HTTP interface to microkernel Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java (with props) jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java (with props) jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java (with props) jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java (with props) jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png (with props) jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css (with props) Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java (added) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java Fri Sep 9 15:30:07 2011 @@ -0,0 +1,45 @@ +/* + * 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.mk.server; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.jackrabbit.mk.util.IOUtils; + +/** + * File servlet that will deliver static resources. + */ +class FileServlet implements Servlet { + + public void service(Request request, Response response) throws IOException { + String file = request.getFile(); + if (file.endsWith("/")) { + file += "index.html"; + } + InputStream in = FileServlet.class.getResourceAsStream(file.substring(1)); + if (in != null) { + int ext = file.lastIndexOf('.'); + if (ext != -1) { + response.setContentTypeByExtension(file.substring(ext + 1)); + } + IOUtils.copy(in, response.getOutputStream()); + } else { + response.setStatusCode(404); + } + } +} Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/FileServlet.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java (added) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java Fri Sep 9 15:30:07 2011 @@ -0,0 +1,127 @@ +package org.apache.jackrabbit.mk.server; + +import java.io.IOException; +import java.io.PrintStream; +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; + +import org.apache.jackrabbit.mk.api.MicroKernel; +import org.apache.jackrabbit.mk.api.MicroKernelException; + +class MicroKernelServlet implements Servlet { + + private final AtomicReference mkref; + + public MicroKernelServlet(AtomicReference mkref) { + this.mkref = mkref; + } + + public void service(Request request, Response response) throws IOException { + String file = request.getFile(); + int dotIndex = file.indexOf('.'); + if (dotIndex == -1) { + dotIndex = file.length(); + } + Command command = COMMANDS.get(file.substring(1, dotIndex)); + if (command != null) { + MicroKernel mk = mkref.get(); + if (mk != null) { + try { + command.execute(mk, request, response); + } catch (MicroKernelException e) { + response.setStatusCode(500); + e.printStackTrace(new PrintStream(response.getOutputStream())); + } + return; + } + } + response.setStatusCode(404); + } + + private static interface Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException; + + } + + private static final Map COMMANDS = new HashMap(); + + static { + COMMANDS.put("getHeadRevision", new GetHeadRevision()); + COMMANDS.put("getRevisions", new GetRevisions()); + COMMANDS.put("getJournal", new GetJournal()); + COMMANDS.put("getNodes", new GetNodes()); + COMMANDS.put("commit", new Commit()); + } + + static class GetHeadRevision implements Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException { + + response.getOutputStream().write(mk.getHeadRevision().getBytes()); + } + } + + static class GetRevisions implements Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException { + + long since = request.getParameter("since", 0L); + int maxEntries = request.getParameter("max_entries", 10); + + response.getOutputStream().write(mk.getRevisions(since, maxEntries).getBytes()); + } + } + + static class GetJournal implements Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException { + + String headRevision = mk.getHeadRevision(); + + String fromRevisionId = request.getParameter("from_revision_id", headRevision); + String toRevisionId = request.getParameter("to_revision_id", headRevision); + + response.getOutputStream().write(mk.getJournal(fromRevisionId, toRevisionId).getBytes()); + } + } + + static class GetNodes implements Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException { + + String headRevision = mk.getHeadRevision(); + + String path = request.getParameter("path", "/"); + String revisionId = request.getParameter("revision_id", headRevision); + int depth = request.getParameter("depth", 1); + long offset = request.getParameter("offset", 0L); + int count = request.getParameter("count", -1); + + response.getOutputStream().write(mk.getNodes(path, revisionId, depth, offset, count).getBytes()); + } + } + + static class Commit implements Command { + + public void execute(MicroKernel mk, Request request, Response response) + throws IOException, MicroKernelException { + + String headRevision = mk.getHeadRevision(); + + String path = request.getParameter("path", "/"); + String jsonDiff = request.getParameter("json_diff"); + String revisionId = request.getParameter("revision_id", headRevision); + String message = request.getParameter("message"); + + String newRevision = mk.commit(path, jsonDiff, revisionId, message); + response.getOutputStream().write(newRevision.getBytes()); + } + } +} Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/MicroKernelServlet.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java (added) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java Fri Sep 9 15:30:07 2011 @@ -0,0 +1,258 @@ +/* + * 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.mk.server; + +import java.io.ByteArrayOutputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLDecoder; +import java.util.HashMap; +import java.util.Map; + +import org.apache.jackrabbit.mk.util.IOUtils; + +class Request { + + private InputStream in; + private final String method; + private final String file; + private String queryString; + private final Map headers; + private Map params; + private boolean chunked; + private InputStreamImpl reqIn; + + private Request(String method, String uri, Map headers, InputStream in) { + this.method = method; + + int index = uri.lastIndexOf('?'); + if (index == -1) { + file = uri; + } else { + file = uri.substring(0, index); + queryString = uri.substring(index + 1); + } + + this.headers = headers; + this.in = in; + } + + public static Request parse(InputStream in) throws IOException { + String requestLine = readLine(in); + + String[] parts = requestLine.split(" "); + if (parts.length != 3) { + return null; + } + String method = parts[0]; + String uri = parts[1]; + + Map headers = new HashMap(); + + for (;;) { + String headerLine = readLine(in); + if (headerLine.length() == 0) { + break; + } + parts = headerLine.split(":"); + if (parts.length == 2) { + headers.put(parts[0].trim(), parts[1].trim()); + } + } + return new Request(method, uri, headers, in); + } + + /** + * Read a single line, terminated by a CR LF combination from the socket + * input. + * + * @return line + * @throws IOException if an I/O error occurs + */ + private static String readLine(InputStream in) throws IOException { + StringBuilder line = new StringBuilder(128); + + for (;;) { + int c = in.read(); + switch (c) { + case '\r': + // swallow + break; + case '\n': + return line.toString(); + case -1: + throw new EOFException(); + default: + line.append((char) c); + } + } + } + + public String getMethod() { + return method; + } + + public String getFile() { + return file; + } + + public String getContentType() { + return headers.get("Content-Type"); + } + + public int getContentLength() { + String s = headers.get("Content-Length"); + if (s != null) { + try { + return Integer.parseInt(s); + } catch (RuntimeException e) { + /* ignore */ + } + } + return -1; + } + + public String getQueryString() { + return queryString; + } + + public String getParameter(String name) throws IOException { + if (params == null) { + params = new HashMap(); + + String contentType = getContentType(); + if ("application/x-www-form-urlencoded".equals(contentType)) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + IOUtils.copy(getInputStream(), out); + collectParameters(out.toString(), params); + } + } + return params.get(name); + } + + public String getParameter(String name, String defaultValue) throws IOException { + String s = getParameter(name); + if (s != null) { + return s; + } + return defaultValue; + } + + public int getParameter(String name, int defaultValue) throws IOException { + String s = getParameter(name); + if (s != null) { + try { + return Integer.parseInt(s); + } catch (RuntimeException e) { + /* ignore */ + } + } + return defaultValue; + } + + public long getParameter(String name, long defaultValue) throws IOException { + String s = getParameter(name); + if (s != null) { + try { + return Long.parseLong(s); + } catch (RuntimeException e) { + /* ignore */ + } + } + return defaultValue; + } + + private static void collectParameters(String s, Map map) { + for (String param : s.split("&")) { + String[] nv = param.split("="); + if (nv.length == 2) { + map.put(URLDecoder.decode(nv[0]), URLDecoder.decode(nv[1])); + } + } + } + + public InputStream getInputStream() throws IOException { + if (reqIn == null) { + // TODO: handle chunked + int contentLength = getContentLength(); + if (contentLength == -1) { + contentLength = 0; + } + reqIn = new InputStreamImpl(contentLength); + } + return reqIn; + } + + private int readChunk(byte[] b, int off, int len) throws IOException { + if (in == null) { + return -1; + } + if (chunked) { + // TODO: handle chunked + return -1; + } else { + return in.read(b, off, len); + } + } + + void finish() { + // TODO finish reading input stream if bytes are left + + in = null; + } + + /** + * Internal InputStream passed to servlet handlers. + */ + private class InputStreamImpl extends InputStream { + + private final int limit; + private int count; + + public InputStreamImpl(int limit) { + this.limit = limit; + } + + @Override + public int read() throws IOException { + if (count < limit) { + byte[] b = new byte[1]; + if (readChunk(b, 0, b.length) == 1) { + count++; + return b[1] & 0xff; + } + } + return -1; + } + + @Override + public int read(byte[] b, int off, int len) throws IOException { + if (count < limit) { + if (limit - count < len) { + len = limit - count; + } + int n = readChunk(b, off, len); + if (n > 0) { + count += n; + } + return n; + } + return -1; + } + } +} Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Request.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java (added) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java Fri Sep 9 15:30:07 2011 @@ -0,0 +1,223 @@ +/* + * 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.mk.server; + +import java.io.IOException; +import java.io.OutputStream; +import java.util.HashMap; + +import org.apache.jackrabbit.mk.util.IOUtils; + +class Response { + + private OutputStream out; + private boolean headersSent; + private boolean committed; + private boolean chunked; + private int statusCode; + private String contentType; + private OutputStreamImpl respOut; + + public Response(OutputStream out) { + this.out = out; + } + + /** + * Return the status message associated with a status code. + * + * @param sc status code + * @return associated status message + */ + private static String getStatusMsg(int sc) { + switch (sc) { + case 200: + return "OK"; + case 400: + return "Bad request"; + case 404: + return "Not found"; + default: + return "Internal server error"; + } + } + + private void sendHeaders() throws IOException { + if (headersSent) { + return; + } + + headersSent = true; + + int sc = this.statusCode; + if (sc == 0) { + sc = 200; + } + String msg = getStatusMsg(sc); + if (sc != 200 && respOut == null) { + /* Generate standard message for errors */ + String body = String.format( + "" + + "" + + "%d %s" + + "" + + "

%s

" + + "", sc, msg, msg); + setContentType("text/html"); + getOutputStream().write(body.getBytes()); + } + + writeLine(String.format("HTTP/1.1 %d %s", sc, msg)); + + if (respOut != null) { + if (committed) { + writeLine(String.format("Content-Length: %d", respOut.getCount())); + } else { + chunked = true; + writeLine("Transfer-Encoding: chunked"); + } + } + if (contentType != null) { + writeLine(String.format("Content-Type: %s", contentType)); + } + writeLine("Connection: Close"); + writeLine(""); + } + + public void finish() throws IOException { + committed = true; + + try { + sendHeaders(); + IOUtils.closeQuietly(respOut); + } finally { + out = null; + } + } + + private void writeLine(String s) throws IOException { + if (out != null) { + out.write(s.getBytes()); + out.write("\r\n".getBytes()); + } + } + + private void writeChunk(byte[] b, int off, int len) throws IOException { + sendHeaders(); + + if (out != null) { + if (chunked) { + out.write(String.format("%04X\r\n", len).getBytes()); + } + out.write(b, off, len); + if (chunked) { + out.write(("\r\n").getBytes()); + } + } + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public void setContentTypeByExtension(String ext) { + String contentType = MIME_TYPES.get(ext); + if (contentType == null) { + contentType = "application/octet-stream"; + } + setContentType(contentType); + } + + + private static final HashMap MIME_TYPES = new HashMap(); + + static { + MIME_TYPES.put("html", "text/html"); + MIME_TYPES.put("css", "text/css"); + MIME_TYPES.put("js", "application/javascript"); + MIME_TYPES.put("json", "application/json"); + MIME_TYPES.put("png", "image/png"); + } + + public OutputStream getOutputStream() { + if (respOut == null) { + respOut = new OutputStreamImpl(); + } + return respOut; + } + + public void setStatusCode(int sc) { + this.statusCode = sc; + } + + /** + * Internal OutputStream passed to servlet handlers. + */ + private class OutputStreamImpl extends OutputStream { + + private final byte[] buf = new byte[8192]; + private int count; + + /** + * Return the number of valid bytes in the buffer. + * + * @return number of bytes + */ + public int getCount() { + return count; + } + + @Override + public void write(int b) throws IOException { + if (count == buf.length) { + writeChunk(buf, 0, count); + count = 0; + } + buf[count++] = (byte) b; + } + + @Override + public void write(byte[] b, int off, int len) throws IOException { + if (len + count > buf.length) { + if (count > 0) { + writeChunk(buf, 0, count); + count = 0; + } + } + if (len > buf.length) { + writeChunk(b, off, len); + } else { + System.arraycopy(b, off, buf, count, len); + count += len; + } + } + + @Override + public void flush() throws IOException { + if (count > 0) { + writeChunk(buf, 0, count); + count = 0; + } + } + + @Override + public void close() throws IOException { + flush(); + + writeChunk(buf, 0, 0); + } + } +} Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Response.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java (added) +++ jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java Fri Sep 9 15:30:07 2011 @@ -0,0 +1,24 @@ +/* + * 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.mk.server; + +import java.io.IOException; + +interface Servlet { + + public void service(Request request, Response response) throws IOException; +} Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/java/org/apache/jackrabbit/mk/server/Servlet.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png?rev=1167249&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/bg-body.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,41 @@ + + +µicroKernel prototype: commit + + + + + + +
+

Write Operations: commit

+
+ + + + + + + + + + + + + + + + + +
Path
JSON Diff +
Revision ID
Message
  +
+
+

+ +

+ +
+ + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/commit.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js Fri Sep 9 15:30:07 2011 @@ -0,0 +1,2 @@ +document.write(''); + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/footer.js ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,23 @@ + + +µicroKernel prototype: getHeadRevision + + + + + + +
+

Revision Operations: getHeadRevision

+
+ +
  +
+
+

+ +

+ +
+ + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getHeadRevision.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,31 @@ + + +µicroKernel prototype: getJournal + + + + + + +
+

Revision Operations: getJournal

+
+ + + + + + + + + +
From Revision ID
To Revision ID
  +
+
+

+ +

+ +
+ + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getJournal.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,43 @@ + + +µicroKernel prototype: getNodes + + + + + + +
+

Read Operations: getNodes

+
+ + + + + + + + + + + + + + + + + + + + + +
Path
Revision ID
Depth
Offset
Count
  +
+
+

+ +

+ +
+ + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getNodes.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,31 @@ + + +µicroKernel prototype: getRevisions + + + + + + +
+

Revision Operations: getRevisions

+
+ + + + + + + + + +
Since
Max Entries
  +
+
+

+ +

+ +
+ + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/getRevisions.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js Fri Sep 9 15:30:07 2011 @@ -0,0 +1 @@ +document.write('
µicrokernel
prototype
'); Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/header.js ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html Fri Sep 9 15:30:07 2011 @@ -0,0 +1,33 @@ + + +µicroKernel prototype + + + + + + +
+

+

Revision Operations

+ getHeadRevision
+ getRevisions
+ waitForCommit
+ getJournal
+ +

Read Operations

+ nodeExists
+ getNodes
+ +

Write Operations

+ commit
+ +

Blob Operations

+ getLength
+ read
+ write
+

+
+ + + Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/index.html ------------------------------------------------------------------------------ svn:eol-style = native Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png?rev=1167249&view=auto ============================================================================== Binary file - no diff available. Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/logo.png ------------------------------------------------------------------------------ svn:mime-type = application/octet-stream Added: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css?rev=1167249&view=auto ============================================================================== --- jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css (added) +++ jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css Fri Sep 9 15:30:07 2011 @@ -0,0 +1,150 @@ +body { + background: #eee url(bg-body.png) top center repeat-y; + color: #333; + font-family: Georgia, Times New Roman; + margin: 0 auto 0; + padding: 0; +} + +.logo { + float: right; +} + +.twocols { + background: #eee url(bg-twocols.png) top center repeat-y; +} + +a, a:visited { + color: #58a; + text-decoration: none; +} + +a:hover { + background-color: #ffc; + text-decoration: underline; +} + +img { + border-style: none; +} + +.header { + background: #fff; + margin: 0 auto 0; + text-align: left; + padding: 9px 0 29px 0; + width: 960px; + border-top: 10px solid #ccc; +} + +.header a { + font-family: Helvetica, Verdana; + letter-spacing: -1px; + font-size: 31px; + font-weight: bold; + color: #58a; + text-decoration: none; + padding: 0 10px 0 0; + margin: 0; +} + +.header a:hover { + color: #69d; + text-decoration: underline; +} + +.leftcol { + width: 440px; + margin: 0 20px 0 0; + padding: 5px 0 5px 0; +} + +.rightcol { + width: 440px; + margin: 0 20px 0 0; + padding: 5px 0 5px 0; +} + +.formtable { + margin-top: 20px; + width: 600px; + padding: 0; + clear: both; +} + +.formtable td { + padding: 5px; + width: 300px; + border-top: dotted #ddd 1px; +} + +.formtable input.text { + width: 300px; +} + + +.content { + width: 960px; + margin: 0 auto 0; + padding: 0; + clear: both; +} + +.content p { + padding: 0 0 15px 0; + margin: 0; + line-height: 20px; + font-size: 14px; +} + +.content p img { + float: left; + border: none; + margin-right: 15px; + margin-bottom: 10px; +} + +.content h1 { + border-top: 2px solid olive; + color: #58a; + font-family: Helvetica,Verdana; + font-size: 18px; + font-weight: bold; + line-height: 20px; + margin: 0; + padding: 5px 0; +} + +.content h1 a { + color: #58a; + margin-left: -5px; + padding: 0 10px 0 5px; + text-decoration: none; +} + +.content h1 a:hover { + background-color: #ffc; + color: #68b; +} + +.content h2 { + color: olive; + font-size: 12px; + font-family: Helvetica, Verdana; + font-weight: bold; + margin: 20px 0 5px 0; + padding: 3px 0 3px 0; + border-top: 2px solid olive; + border-bottom: 1px dotted #ccc; +} + +.footer { + font-size: 12px; + background: #fff; + width: 960px; + margin: 0 auto 0; + padding: 10px 0 10px 0; + text-align: left; + border-top: 1px solid #ccc; + clear: both; +} \ No newline at end of file Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css ------------------------------------------------------------------------------ svn:eol-style = native Propchange: jackrabbit/sandbox/microkernel/src/main/resources/org/apache/jackrabbit/mk/server/main.css ------------------------------------------------------------------------------ svn:keywords = Author Date Id Revision Rev Url