You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by ju...@apache.org on 2014/01/23 20:09:57 UTC

svn commit: r1560788 - in /jackrabbit/oak/trunk: oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/ oak-doc/ oak-doc/src/site/markdown/ oak-doc/src/site/markdown/security/ oak-http/ oak-mk-perf/ oak-run/

Author: jukka
Date: Thu Jan 23 19:09:56 2014
New Revision: 1560788

URL: http://svn.apache.org/r1560788
Log:
add missing svn:eol-style settings

Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java   (contents, props changed)
    jackrabbit/oak/trunk/oak-doc/README.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/blobstore.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/dev_getting_started.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_accesscontrol.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_authentication.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_permission.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_principal.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_privileges.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_user.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/dos_and_donts.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/downloads.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/from_here.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/index.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/known_issues.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/license.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/microkernel.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/mongomk.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/overview.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/participating.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/permission_eval.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/use_getting_started.md   (props changed)
    jackrabbit/oak/trunk/oak-doc/src/site/markdown/when_things_go_wrong.md   (props changed)
    jackrabbit/oak/trunk/oak-http/README.md   (props changed)
    jackrabbit/oak/trunk/oak-mk-perf/README.md   (props changed)
    jackrabbit/oak/trunk/oak-run/README.md   (props changed)

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java?rev=1560788&r1=1560787&r2=1560788&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java (original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java Thu Jan 23 19:09:56 2014
@@ -1,237 +1,237 @@
-/*
- * 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.plugins.rdbpersistence;
-
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.ArrayList;
-
-import javax.sql.DataSource;
-
-import org.apache.jackrabbit.mk.api.MicroKernelException;
-import org.apache.jackrabbit.mk.blobs.AbstractBlobStore;
-import org.apache.jackrabbit.mk.util.StringUtils;
-
-public class RDBBlobStore extends AbstractBlobStore {
-
-    /**
-     * Creates a {@linkplain RDBBlobStore} instance using an embedded H2
-     * database in in-memory mode.
-     */
-    public RDBBlobStore() {
-        try {
-            String jdbcurl = "jdbc:h2:mem:oaknodes";
-            Connection connection = DriverManager.getConnection(jdbcurl, "sa", "");
-            initialize(connection);
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB blob store", ex);
-        }
-    }
-
-    /**
-     * Creates a {@linkplain RDBBlobStore} instance using the provided JDBC
-     * connection information.
-     */
-    public RDBBlobStore(String jdbcurl, String username, String password) {
-        try {
-            Connection connection = DriverManager.getConnection(jdbcurl, username, password);
-            initialize(connection);
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB blob store", ex);
-        }
-    }
-
-    /**
-     * Creates a {@linkplain RDBBlobStore} instance using the provided
-     * {@link DataSource}.
-     */
-    public RDBBlobStore(DataSource ds) {
-        try {
-            initialize(ds.getConnection());
-        } catch (Exception ex) {
-            throw new MicroKernelException("initializing RDB blob store", ex);
-        }
-    }
-
-    public void dispose() {
-        try {
-            this.connection.close();
-            this.connection = null;
-        } catch (SQLException ex) {
-            throw new MicroKernelException(ex);
-        }
-    }
-
-    private Connection connection;
-
-    private void initialize(Connection con) throws Exception {
-        con.setAutoCommit(false);
-
-        Statement stmt = con.createStatement();
-        stmt.execute("create table if not exists datastore_meta" + "(id varchar primary key, level int, lastMod bigint)");
-        stmt.execute("create table if not exists datastore_data" + "(id varchar primary key, data binary)");
-        stmt.close();
-
-        con.commit();
-
-        this.connection = con;
-    }
-
-    private long minLastModified;
-
-    @Override
-    protected void storeBlock(byte[] digest, int level, byte[] data) throws SQLException {
-        try {
-            String id = StringUtils.convertBytesToHex(digest);
-            long now = System.currentTimeMillis();
-            PreparedStatement prep = connection.prepareStatement("update datastore_meta set lastMod = ? where id = ?");
-            int count;
-            try {
-                prep.setLong(1, now);
-                prep.setString(2, id);
-                count = prep.executeUpdate();
-            } finally {
-                prep.close();
-            }
-            if (count == 0) {
-                try {
-                    prep = connection.prepareStatement("insert into datastore_data(id, data) values(?, ?)");
-                    try {
-                        prep.setString(1, id);
-                        prep.setBytes(2, data);
-                        prep.execute();
-                    } finally {
-                        prep.close();
-                    }
-                } catch (SQLException e) {
-                    // already exists - ok
-                }
-                try {
-                    prep = connection.prepareStatement("insert into datastore_meta(id, level, lastMod) values(?, ?, ?)");
-                    try {
-                        prep.setString(1, id);
-                        prep.setInt(2, level);
-                        prep.setLong(3, now);
-                        prep.execute();
-                    } finally {
-                        prep.close();
-                    }
-                } catch (SQLException e) {
-                    // already exists - ok
-                }
-            }
-        } finally {
-            connection.commit();
-        }
-    }
-
-    @Override
-    protected byte[] readBlockFromBackend(BlockId blockId) throws Exception {
-        try {
-            PreparedStatement prep = connection.prepareStatement("select data from datastore_data where id = ?");
-            try {
-                String id = StringUtils.convertBytesToHex(blockId.getDigest());
-                prep.setString(1, id);
-                ResultSet rs = prep.executeQuery();
-                if (!rs.next()) {
-                    throw new IOException("Datastore block " + id + " not found");
-                }
-                byte[] data = rs.getBytes(1);
-                // System.out.println("    read block " + id + " blockLen: " +
-                // data.length + " [0]: " + data[0]);
-                if (blockId.getPos() == 0) {
-                    return data;
-                }
-                int len = (int) (data.length - blockId.getPos());
-                if (len < 0) {
-                    return new byte[0];
-                }
-                byte[] d2 = new byte[len];
-                System.arraycopy(data, (int) blockId.getPos(), d2, 0, len);
-                return d2;
-            } finally {
-                prep.close();
-            }
-        } finally {
-            connection.commit();
-        }
-    }
-
-    @Override
-    public void startMark() throws Exception {
-        minLastModified = System.currentTimeMillis();
-        markInUse();
-    }
-
-    @Override
-    protected boolean isMarkEnabled() {
-        return minLastModified != 0;
-    }
-
-    @Override
-    protected void mark(BlockId blockId) throws Exception {
-        try {
-            if (minLastModified == 0) {
-                return;
-            }
-            String id = StringUtils.convertBytesToHex(blockId.getDigest());
-            PreparedStatement prep = connection
-                    .prepareStatement("update datastore_meta set lastMod = ? where id = ? and lastMod < ?");
-            prep.setLong(1, System.currentTimeMillis());
-            prep.setString(2, id);
-            prep.setLong(3, minLastModified);
-            prep.executeUpdate();
-            prep.close();
-        } finally {
-            connection.commit();
-        }
-    }
-
-    @Override
-    public int sweep() throws Exception {
-        try {
-            int count = 0;
-            PreparedStatement prep = connection.prepareStatement("select id from datastore_meta where lastMod < ?");
-            prep.setLong(1, minLastModified);
-            ResultSet rs = prep.executeQuery();
-            ArrayList<String> ids = new ArrayList<String>();
-            while (rs.next()) {
-                ids.add(rs.getString(1));
-            }
-            prep = connection.prepareStatement("delete from datastore_meta where id = ?");
-            PreparedStatement prepData = connection.prepareStatement("delete from datastore_data where id = ?");
-            for (String id : ids) {
-                prep.setString(1, id);
-                prep.execute();
-                prepData.setString(1, id);
-                prepData.execute();
-                count++;
-            }
-            prepData.close();
-            prep.close();
-            minLastModified = 0;
-            return count;
-        } finally {
-            connection.commit();
-        }
-    }
-}
+/*
+ * 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.plugins.rdbpersistence;
+
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+
+import javax.sql.DataSource;
+
+import org.apache.jackrabbit.mk.api.MicroKernelException;
+import org.apache.jackrabbit.mk.blobs.AbstractBlobStore;
+import org.apache.jackrabbit.mk.util.StringUtils;
+
+public class RDBBlobStore extends AbstractBlobStore {
+
+    /**
+     * Creates a {@linkplain RDBBlobStore} instance using an embedded H2
+     * database in in-memory mode.
+     */
+    public RDBBlobStore() {
+        try {
+            String jdbcurl = "jdbc:h2:mem:oaknodes";
+            Connection connection = DriverManager.getConnection(jdbcurl, "sa", "");
+            initialize(connection);
+        } catch (Exception ex) {
+            throw new MicroKernelException("initializing RDB blob store", ex);
+        }
+    }
+
+    /**
+     * Creates a {@linkplain RDBBlobStore} instance using the provided JDBC
+     * connection information.
+     */
+    public RDBBlobStore(String jdbcurl, String username, String password) {
+        try {
+            Connection connection = DriverManager.getConnection(jdbcurl, username, password);
+            initialize(connection);
+        } catch (Exception ex) {
+            throw new MicroKernelException("initializing RDB blob store", ex);
+        }
+    }
+
+    /**
+     * Creates a {@linkplain RDBBlobStore} instance using the provided
+     * {@link DataSource}.
+     */
+    public RDBBlobStore(DataSource ds) {
+        try {
+            initialize(ds.getConnection());
+        } catch (Exception ex) {
+            throw new MicroKernelException("initializing RDB blob store", ex);
+        }
+    }
+
+    public void dispose() {
+        try {
+            this.connection.close();
+            this.connection = null;
+        } catch (SQLException ex) {
+            throw new MicroKernelException(ex);
+        }
+    }
+
+    private Connection connection;
+
+    private void initialize(Connection con) throws Exception {
+        con.setAutoCommit(false);
+
+        Statement stmt = con.createStatement();
+        stmt.execute("create table if not exists datastore_meta" + "(id varchar primary key, level int, lastMod bigint)");
+        stmt.execute("create table if not exists datastore_data" + "(id varchar primary key, data binary)");
+        stmt.close();
+
+        con.commit();
+
+        this.connection = con;
+    }
+
+    private long minLastModified;
+
+    @Override
+    protected void storeBlock(byte[] digest, int level, byte[] data) throws SQLException {
+        try {
+            String id = StringUtils.convertBytesToHex(digest);
+            long now = System.currentTimeMillis();
+            PreparedStatement prep = connection.prepareStatement("update datastore_meta set lastMod = ? where id = ?");
+            int count;
+            try {
+                prep.setLong(1, now);
+                prep.setString(2, id);
+                count = prep.executeUpdate();
+            } finally {
+                prep.close();
+            }
+            if (count == 0) {
+                try {
+                    prep = connection.prepareStatement("insert into datastore_data(id, data) values(?, ?)");
+                    try {
+                        prep.setString(1, id);
+                        prep.setBytes(2, data);
+                        prep.execute();
+                    } finally {
+                        prep.close();
+                    }
+                } catch (SQLException e) {
+                    // already exists - ok
+                }
+                try {
+                    prep = connection.prepareStatement("insert into datastore_meta(id, level, lastMod) values(?, ?, ?)");
+                    try {
+                        prep.setString(1, id);
+                        prep.setInt(2, level);
+                        prep.setLong(3, now);
+                        prep.execute();
+                    } finally {
+                        prep.close();
+                    }
+                } catch (SQLException e) {
+                    // already exists - ok
+                }
+            }
+        } finally {
+            connection.commit();
+        }
+    }
+
+    @Override
+    protected byte[] readBlockFromBackend(BlockId blockId) throws Exception {
+        try {
+            PreparedStatement prep = connection.prepareStatement("select data from datastore_data where id = ?");
+            try {
+                String id = StringUtils.convertBytesToHex(blockId.getDigest());
+                prep.setString(1, id);
+                ResultSet rs = prep.executeQuery();
+                if (!rs.next()) {
+                    throw new IOException("Datastore block " + id + " not found");
+                }
+                byte[] data = rs.getBytes(1);
+                // System.out.println("    read block " + id + " blockLen: " +
+                // data.length + " [0]: " + data[0]);
+                if (blockId.getPos() == 0) {
+                    return data;
+                }
+                int len = (int) (data.length - blockId.getPos());
+                if (len < 0) {
+                    return new byte[0];
+                }
+                byte[] d2 = new byte[len];
+                System.arraycopy(data, (int) blockId.getPos(), d2, 0, len);
+                return d2;
+            } finally {
+                prep.close();
+            }
+        } finally {
+            connection.commit();
+        }
+    }
+
+    @Override
+    public void startMark() throws Exception {
+        minLastModified = System.currentTimeMillis();
+        markInUse();
+    }
+
+    @Override
+    protected boolean isMarkEnabled() {
+        return minLastModified != 0;
+    }
+
+    @Override
+    protected void mark(BlockId blockId) throws Exception {
+        try {
+            if (minLastModified == 0) {
+                return;
+            }
+            String id = StringUtils.convertBytesToHex(blockId.getDigest());
+            PreparedStatement prep = connection
+                    .prepareStatement("update datastore_meta set lastMod = ? where id = ? and lastMod < ?");
+            prep.setLong(1, System.currentTimeMillis());
+            prep.setString(2, id);
+            prep.setLong(3, minLastModified);
+            prep.executeUpdate();
+            prep.close();
+        } finally {
+            connection.commit();
+        }
+    }
+
+    @Override
+    public int sweep() throws Exception {
+        try {
+            int count = 0;
+            PreparedStatement prep = connection.prepareStatement("select id from datastore_meta where lastMod < ?");
+            prep.setLong(1, minLastModified);
+            ResultSet rs = prep.executeQuery();
+            ArrayList<String> ids = new ArrayList<String>();
+            while (rs.next()) {
+                ids.add(rs.getString(1));
+            }
+            prep = connection.prepareStatement("delete from datastore_meta where id = ?");
+            PreparedStatement prepData = connection.prepareStatement("delete from datastore_data where id = ?");
+            for (String id : ids) {
+                prep.setString(1, id);
+                prep.execute();
+                prepData.setString(1, id);
+                prepData.execute();
+                count++;
+            }
+            prepData.close();
+            prep.close();
+            minLastModified = 0;
+            return count;
+        } finally {
+            connection.commit();
+        }
+    }
+}

Propchange: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/rdbpersistence/RDBBlobStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/README.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/blobstore.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/dev_getting_started.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_accesscontrol.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_authentication.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_permission.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_principal.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_privileges.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/differences_user.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/dos_and_donts.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/downloads.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/from_here.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/index.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/known_issues.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/license.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/microkernel.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/mongomk.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/overview.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/participating.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/query.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/security/permission_eval.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/use_getting_started.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-doc/src/site/markdown/when_things_go_wrong.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-http/README.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-mk-perf/README.md
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jackrabbit/oak/trunk/oak-run/README.md
------------------------------------------------------------------------------
    svn:eol-style = native