jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1564687 [6/6] - in /jackrabbit/trunk: ./ jackrabbit-aws-ext/ jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ jackrabbit-aws-ext/src/main/java/org/apache/jackrabbit/aws/ext/ds/ jackrabbit-aws-ext/src/test/java/org/apache/jac...
Date Wed, 05 Feb 2014 09:27:23 GMT
Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/Oracle10R1ConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/Oracle10R1ConnectionHelper.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/Oracle10R1ConnectionHelper.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/Oracle10R1ConnectionHelper.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,168 @@
+/*
+ * 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.core.util.db;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Method;
+import java.sql.Blob;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.sql.DataSource;
+
+import org.apache.commons.io.IOUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The connection helper for Oracle databases of version up to 10.1. It has special blob handling.
+ */
+public final class Oracle10R1ConnectionHelper extends OracleConnectionHelper {
+
+    /**
+     * the default logger
+     */
+    private static Logger log = LoggerFactory.getLogger(Oracle10R1ConnectionHelper.class);
+
+    private Class<?> blobClass;
+
+    private Integer durationSessionConstant;
+
+    private Integer modeReadWriteConstant;
+
+    /**
+     * @param dataSrc the {@code DataSource} on which this helper acts
+     * @param block whether to block on connection loss until the db is up again
+     */
+    public Oracle10R1ConnectionHelper(DataSource dataSrc, boolean block) {
+        super(dataSrc, block);
+    }
+
+    /**
+     * Retrieve the <code>oracle.sql.BLOB</code> class via reflection, and initialize the values for the
+     * <code>DURATION_SESSION</code> and <code>MODE_READWRITE</code> constants defined there.
+     * 
+     * @see oracle.sql.BLOB#DURATION_SESSION
+     * @see oracle.sql.BLOB#MODE_READWRITE
+     */
+    @Override
+    public void init() throws Exception {
+        super.init();
+        // initialize oracle.sql.BLOB class & constants
+
+        // use the Connection object for using the exact same
+        // class loader that the Oracle driver was loaded with
+        Connection con = null;
+        try {
+            con = dataSource.getConnection();
+            blobClass = con.getClass().getClassLoader().loadClass("oracle.sql.BLOB");
+            durationSessionConstant = new Integer(blobClass.getField("DURATION_SESSION").getInt(null));
+            modeReadWriteConstant = new Integer(blobClass.getField("MODE_READWRITE").getInt(null));
+        } finally {
+            if (con != null) {
+                DbUtility.close(con, null, null);
+            }
+        }
+    }
+
+    /**
+     * Wraps any input-stream parameters in temporary blobs and frees these again after the statement
+     * has been executed.
+     * 
+     * {@inheritDoc}
+     */
+    @Override
+    protected PreparedStatement execute(PreparedStatement stmt, Object[] params) throws SQLException {
+        List<Blob> tmpBlobs = new ArrayList<Blob>();
+        try {
+            for (int i = 0; params != null && i < params.length; i++) {
+                Object p = params[i];
+                if (p instanceof StreamWrapper) {
+                    StreamWrapper wrapper = (StreamWrapper) p;
+                    Blob tmp = createTemporaryBlob(stmt.getConnection(), wrapper.getStream());
+                    tmpBlobs.add(tmp);
+                    stmt.setBlob(i + 1, tmp);
+                } else if (p instanceof InputStream) {
+                    Blob tmp = createTemporaryBlob(stmt.getConnection(), (InputStream) p);
+                    tmpBlobs.add(tmp);
+                    stmt.setBlob(i + 1, tmp);
+                } else {
+                    stmt.setObject(i + 1, p);
+                }
+            }
+            stmt.execute();
+            return stmt;
+        } catch (Exception e) {
+            throw new SQLException(e.getMessage());
+        } finally {
+            for (Blob blob : tmpBlobs) {
+                try {
+                    freeTemporaryBlob(blob);
+                } catch (Exception e) {
+                    log.warn("Could not close temporary blob", e);
+                }
+            }
+        }
+    }
+
+    /**
+     * Creates a temporary oracle.sql.BLOB instance via reflection and spools the contents of the specified
+     * stream.
+     */
+    private Blob createTemporaryBlob(Connection con, InputStream in) throws Exception {
+        /*
+         * BLOB blob = BLOB.createTemporary(con, false, BLOB.DURATION_SESSION);
+         * blob.open(BLOB.MODE_READWRITE); OutputStream out = blob.getBinaryOutputStream(); ... out.flush();
+         * out.close(); blob.close(); return blob;
+         */
+        Method createTemporary =
+            blobClass.getMethod("createTemporary", new Class[]{Connection.class, Boolean.TYPE, Integer.TYPE});
+        Object blob =
+            createTemporary.invoke(null, new Object[]{ConnectionFactory.unwrap(con), Boolean.FALSE,
+                    durationSessionConstant});
+        Method open = blobClass.getMethod("open", new Class[]{Integer.TYPE});
+        open.invoke(blob, new Object[]{modeReadWriteConstant});
+        Method getBinaryOutputStream = blobClass.getMethod("getBinaryOutputStream", new Class[0]);
+        OutputStream out = (OutputStream) getBinaryOutputStream.invoke(blob);
+        try {
+            IOUtils.copy(in, out);
+        } finally {
+            try {
+                out.flush();
+            } catch (IOException ioe) {
+            }
+            out.close();
+        }
+        Method close = blobClass.getMethod("close", new Class[0]);
+        close.invoke(blob);
+        return (Blob) blob;
+    }
+
+    /**
+     * Frees a temporary oracle.sql.BLOB instance via reflection.
+     */
+    private void freeTemporaryBlob(Blob blob) throws Exception {
+        // blob.freeTemporary();
+        Method freeTemporary = blobClass.getMethod("freeTemporary", new Class[0]);
+        freeTemporary.invoke(blob);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/OracleConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/OracleConnectionHelper.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/OracleConnectionHelper.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/OracleConnectionHelper.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,82 @@
+/*
+ * 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.core.util.db;
+
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.SQLException;
+
+import javax.sql.DataSource;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * The connection helper for Oracle databases of version 10.2 and later.
+ */
+public class OracleConnectionHelper extends ConnectionHelper {
+
+    /**
+     * the default logger
+     */
+    private static Logger log = LoggerFactory.getLogger(OracleConnectionHelper.class);
+
+    /**
+     * @param dataSrc the {@code DataSource} on which this helper acts
+     * @param block whether to block on connection loss until the db is up again
+     */
+    public OracleConnectionHelper(DataSource dataSrc, boolean block) {
+        super(dataSrc, true, block);
+    }
+
+    /**
+     * Initializes the helper: checks for valid driver version.
+     * Subclasses that override this method should still call it!
+     * 
+     * @throws Exception on error
+     */
+    public void init() throws Exception {
+         // check driver version
+        Connection connection = dataSource.getConnection();
+        try {
+            DatabaseMetaData metaData = connection.getMetaData();
+            if (metaData.getDriverMajorVersion() < 10) {
+                // Oracle drivers prior to version 10 only support
+                // writing BLOBs up to 32k in size...
+                log.warn("Unsupported driver version detected: "
+                        + metaData.getDriverName()
+                        + " v" + metaData.getDriverVersion());
+            }
+        } catch (SQLException e) {
+            log.warn("Can not retrieve driver version", e);
+        } finally {
+            DbUtility.close(connection, null, null);
+        }
+    }
+
+    /**
+     * Since Oracle only supports table names up to 30 characters in
+     * length illegal characters are simply replaced with "_" rather than
+     * escaping them with "_x0000_".
+     *
+     * {@inheritDoc}
+     */
+    @Override
+    protected final void replaceCharacter(StringBuilder escaped, char c) {
+        escaped.append("_");
+    }
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/PostgreSQLConnectionHelper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/PostgreSQLConnectionHelper.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/PostgreSQLConnectionHelper.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/PostgreSQLConnectionHelper.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,35 @@
+/*
+ * 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.core.util.db;
+
+import javax.sql.DataSource;
+
+
+/**
+ * The connection helper for PSQL databases. It has special fetch size handling.
+ */
+public final class PostgreSQLConnectionHelper extends ConnectionHelper {
+
+    /**
+     * @param dataSrc the {@code DataSource} on which this helper acts
+     * @param block whether to block on connection loss until the db is up again
+     */
+    public PostgreSQLConnectionHelper(DataSource dataSrc, boolean block) {
+        super(dataSrc, false, block, 10000);
+    }
+
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/ResultSetWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/ResultSetWrapper.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/ResultSetWrapper.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/ResultSetWrapper.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,70 @@
+/*
+ * 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.core.util.db;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.Statement;
+
+
+/**
+ * This is a dynamic proxy in order to support both Java 5 and 6.
+ */
+public final class ResultSetWrapper implements InvocationHandler {
+
+    private final Connection connection;
+
+    private final Statement statement;
+
+    private final ResultSet resultSet;
+
+    /**
+     * Creates a new {@code ResultSet} proxy which closes the given {@code Connection} and
+     * {@code Statement} if it is closed.
+     * 
+     * @param con the associated {@code Connection}
+     * @param stmt the associated {@code Statement}
+     * @param rs the {@code ResultSet} which backs the proxy
+     * @return a {@code ResultSet} proxy
+     */
+    public static final ResultSet newInstance(Connection con, Statement stmt, ResultSet rs) {
+        ResultSetWrapper proxy = new ResultSetWrapper(con, stmt, rs);
+        return (ResultSet) Proxy.newProxyInstance(rs.getClass().getClassLoader(),
+            new Class<?>[]{ResultSet.class}, proxy);
+    }
+
+    private ResultSetWrapper(Connection con, Statement stmt, ResultSet rs) {
+        connection = con;
+        statement = stmt;
+        resultSet = rs;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
+        if ("close".equals(m.getName())) {
+            DbUtility.close(connection, statement, resultSet);
+            return null;
+        } else {
+            return m.invoke(resultSet, args);
+        }
+    }
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/StreamWrapper.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/StreamWrapper.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/StreamWrapper.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/util/db/StreamWrapper.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,96 @@
+/*
+ * 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.core.util.db;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.SQLException;
+
+import org.apache.jackrabbit.core.data.db.TempFileInputStream;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class StreamWrapper {
+
+    static Logger log = LoggerFactory.getLogger(StreamWrapper.class);
+
+    private InputStream stream;
+    private final long size;
+
+    /**
+     * Creates a wrapper for the given InputStream that can
+     * safely be passed as a parameter to the {@link ConnectionHelper#exec(String, Object...)},
+     * {@link ConnectionHelper#exec(String, Object[], boolean, int)} and
+     * {@link ConnectionHelper#update(String, Object[])} methods.
+     * If the wrapped Stream is a {@link TempFileInputStream} it will be wrapped again by a {@link BufferedInputStream}.
+     * 
+     * @param in the InputStream to wrap
+     * @param size the size of the input stream
+     */
+    public StreamWrapper(InputStream in, long size) {
+        this.stream = in;
+        this.size = size;
+    }
+    
+    public InputStream getStream() {
+        if (stream instanceof TempFileInputStream) {
+            return new BufferedInputStream(stream);
+        }
+        return stream;
+    }
+    
+    public long getSize() {
+        return size;
+    }
+
+    /**
+     * Cleans up the internal Resources
+     */
+	public void cleanupResources() {
+        if (stream instanceof TempFileInputStream) {
+        	try {
+        		stream.close();
+        		((TempFileInputStream) stream).deleteFile();
+        	} catch (IOException e) {
+        		log.warn("Unable to cleanup the TempFileInputStream");
+        	}
+        }
+	}
+
+    /**
+     * Resets the internal InputStream that it could be re-read.<br>
+     * Is used from {@link RetryManager} if a {@link SQLException} has occurred.<br>
+     * At the moment only a {@link TempFileInputStream} can be reseted.
+     * 
+     * @return returns true if it was able to reset the Stream
+     */
+    public boolean resetStream() {
+    	if (stream instanceof TempFileInputStream) {
+    		try {
+	    		TempFileInputStream tempFileInputStream = (TempFileInputStream) stream;
+	    		// Close it if it is not already closed ...
+	    		tempFileInputStream.close();
+    			stream = new TempFileInputStream(tempFileInputStream.getFile(), true);
+    			return true;
+    		} catch (Exception e) {
+    			log.warn("Failed to create a new TempFileInputStream", e);
+    		}
+    	}
+    	return false;
+	}
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/InternalXAResource.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/InternalXAResource.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/InternalXAResource.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/InternalXAResource.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,72 @@
+/*
+ * 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.data.core;
+
+
+
+/**
+ * Interface implemented by resources that provide XA functionality.
+ */
+public interface InternalXAResource {
+
+    /**
+     * Associate this resource with a transaction. All further operations on
+     * the object should be interpreted as part of this transaction and changes
+     * recorded in some attribute of the transaction context.
+     * @param tx transaction context, if <code>null</code> disassociate
+     */
+    void associate(TransactionContext tx);
+
+    /**
+     * Invoked before one of the {@link #prepare}, {@link #commit} or
+     * {@link #rollback} method is called.
+     * @param tx transaction context
+     */
+    void beforeOperation(TransactionContext tx);
+
+    /**
+     * Prepare transaction. The transaction is identified by a transaction
+     * context.
+     * @param tx transaction context
+     * @throws TransactionException if an error occurs
+     */
+    void prepare(TransactionContext tx) throws TransactionException;
+
+    /**
+     * Commit transaction. The transaction is identified by a transaction
+     * context. If the method throws, other resources get their changes
+     * rolled back.
+     * @param tx transaction context
+     * @throws TransactionException if an error occurs
+     */
+    void commit(TransactionContext tx) throws TransactionException;
+
+    /**
+     * Rollback transaction. The transaction is identified by a transaction
+     * context.
+     * @param tx transaction context.
+     */
+    void rollback(TransactionContext tx) throws TransactionException;
+
+    /**
+     * Invoked after one of the {@link #prepare}, {@link #commit} or
+     * {@link #rollback} method has been called.
+     * @param tx transaction context
+     */
+    void afterOperation(TransactionContext tx);
+
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionContext.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionContext.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionContext.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionContext.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,376 @@
+/*
+ * 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.data.core;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.transaction.xa.XAException;
+import javax.transaction.xa.Xid;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Represents the transaction on behalf of the component that wants to
+ * explicitly demarcate transaction boundaries. After having been prepared,
+ * schedules a task that rolls back the transaction if some time passes without
+ * any further action. This will guarantee that global objects locked by one
+ * of the resources' {@link InternalXAResource#prepare} method, are eventually
+ * unlocked.
+ */
+public class TransactionContext {
+
+    /**
+     * Logger instance.
+     */
+    private static final Logger log = LoggerFactory.getLogger(TransactionContext.class);
+
+    private static final int STATUS_PREPARING = 1;
+    private static final int STATUS_PREPARED = 2;
+    private static final int STATUS_COMMITTING = 3;
+    private static final int STATUS_COMMITTED = 4;
+    private static final int STATUS_ROLLING_BACK = 5;
+    private static final int STATUS_ROLLED_BACK = 6;
+
+    /**
+     * The per thread associated Xid
+     */
+    private static final ThreadLocal<Xid> CURRENT_XID = new ThreadLocal<Xid>();
+
+    /**
+     * Transactional resources.
+     */
+    private final InternalXAResource[] resources;
+
+    /**
+    * The Xid
+    */
+   private final Xid xid;
+
+    /**
+     * Transaction attributes.
+     */
+    private final Map<String, Object> attributes = new HashMap<String, Object>();
+
+    /**
+     * Status.
+     */
+    private int status;
+
+    /**
+     * Flag indicating whether the association is currently suspended.
+     */
+    private boolean suspended;
+
+    /**
+     * Create a new instance of this class.
+     *
+     * @param xid associated xid
+     * @param resources transactional resources
+     */
+    public TransactionContext(Xid xid, InternalXAResource[] resources) {
+        this.xid = xid;
+        this.resources = resources;
+    }
+
+    /**
+     * Set an attribute on this transaction. If the value specified is
+     * <code>null</code>, it is semantically equivalent to
+     * {@link #removeAttribute}.
+     *
+     * @param name  attribute name
+     * @param value attribute value
+     */
+    public void setAttribute(String name, Object value) {
+        if (value == null) {
+            removeAttribute(name);
+        }
+        attributes.put(name, value);
+    }
+
+    /**
+     * Return an attribute value on this transaction.
+     *
+     * @param name attribute name
+     * @return attribute value, <code>null</code> if no attribute with that
+     *         name exists
+     */
+    public Object getAttribute(String name) {
+        return attributes.get(name);
+    }
+
+    /**
+     * Remove an attribute on this transaction.
+     *
+     * @param name attribute name
+     */
+    public void removeAttribute(String name) {
+        attributes.remove(name);
+    }
+
+    /**
+     * Prepare the transaction identified by this context. Prepares changes on
+     * all resources. If some resource reports an error on prepare,
+     * automatically rollback changes on all other resources. Throw exception
+     * at the end if errors were found.
+     *
+     * @throws XAException if an error occurs
+     */
+    public synchronized void prepare() throws XAException {
+        bindCurrentXid();
+        status = STATUS_PREPARING;
+        beforeOperation();
+
+        TransactionException txe = null;
+        for (int i = 0; i < resources.length; i++) {
+            try {
+                resources[i].prepare(this);
+            } catch (TransactionException e) {
+                txe = e;
+                break;
+            } catch (Exception e) {
+                txe = new TransactionException("Error while preparing resource " + resources, e);
+                break;
+            }
+        }
+
+        afterOperation();
+        status = STATUS_PREPARED;
+
+        if (txe != null) {
+            // force immediate rollback on error.
+            try {
+                rollback();
+            } catch (XAException e) {
+                /* ignore */
+            }
+            XAException e = new XAException(XAException.XA_RBOTHER);
+            e.initCause(txe);
+            throw e;
+        }
+    }
+
+    /**
+     * Commit the transaction identified by this context. Commits changes on
+     * all resources. If some resource reports an error on commit,
+     * automatically rollback changes on all other resources. Throw
+     * exception at the end if some commit failed.
+     *
+     * @throws XAException if an error occurs
+     */
+    public synchronized void commit() throws XAException {
+        if (status == STATUS_ROLLED_BACK) {
+            throw new XAException(XAException.XA_HEURRB);
+        }
+
+        boolean heuristicCommit = false;
+        bindCurrentXid();
+        status = STATUS_COMMITTING;
+        beforeOperation();
+
+        TransactionException txe = null;
+        for (int i = 0; i < resources.length; i++) {
+            InternalXAResource resource = resources[i];
+            if (txe != null) {
+                try {
+                    resource.rollback(this);
+                } catch (Exception e) {
+                    log.warn("Unable to rollback changes on " + resource, e);
+                }
+            } else {
+                try {
+                    resource.commit(this);
+                    heuristicCommit = true;
+                } catch (TransactionException e) {
+                    txe = e;
+                } catch (Exception e) {
+                    txe = new TransactionException("Error while committing resource " + resource, e);
+                }
+            }
+        }
+        afterOperation();
+        status = STATUS_COMMITTED;
+
+        cleanCurrentXid();
+
+        if (txe != null) {
+            XAException e = null;
+            if (heuristicCommit) {
+                e = new XAException(XAException.XA_HEURMIX);
+            } else {
+                e = new XAException(XAException.XA_HEURRB);
+            }
+            e.initCause(txe);
+            throw e;
+        }
+    }
+
+    /**
+     * Rollback the transaction identified by this context. Rolls back changes
+     * on all resources. Throws exception at the end if errors were found.
+     * @throws XAException if an error occurs
+     */
+    public synchronized void rollback() throws XAException {
+        if (status == STATUS_ROLLED_BACK) {
+            throw new XAException(XAException.XA_RBOTHER);
+        }
+        bindCurrentXid();
+        status = STATUS_ROLLING_BACK;
+        beforeOperation();
+
+        int errors = 0;
+        for (int i = 0; i < resources.length; i++) {
+            InternalXAResource resource = resources[i];
+            try {
+                resource.rollback(this);
+            } catch (Exception e) {
+                log.warn("Unable to rollback changes on " + resource, e);
+                errors++;
+            }
+        }
+        afterOperation();
+        status = STATUS_ROLLED_BACK;
+
+        cleanCurrentXid();
+
+        if (errors != 0) {
+            throw new XAException(XAException.XA_RBOTHER);
+        }
+    }
+
+    /**
+     * Invoke all of the registered resources' {@link InternalXAResource#beforeOperation}
+     * methods.
+     */
+    private void beforeOperation() {
+        for (int i = 0; i < resources.length; i++) {
+            resources[i].beforeOperation(this);
+        }
+    }
+
+    /**
+     * Invoke all of the registered resources' {@link InternalXAResource#afterOperation}
+     * methods.
+     */
+    private void afterOperation() {
+        for (int i = 0; i < resources.length; i++) {
+            resources[i].afterOperation(this);
+        }
+    }
+
+    /**
+     * Return a flag indicating whether the association is suspended.
+     *
+     * @return <code>true</code> if the association is suspended;
+     *         <code>false</code> otherwise
+     */
+    public boolean isSuspended() {
+        return suspended;
+    }
+
+    /**
+     * Set a flag indicating whether the association is suspended.
+     *
+     * @param suspended flag whether that the association is suspended.
+     */
+    public void setSuspended(boolean suspended) {
+        this.suspended = suspended;
+    }
+
+    /**
+     * Helper Method to bind the {@link Xid} associated with this {@link TransactionContext}
+     * to the {@link #CURRENT_XID} ThreadLocal.
+     */
+    private void bindCurrentXid() {
+        CURRENT_XID.set(xid);
+    }
+
+    /**
+     * Helper Method to clean the {@link Xid} associated with this {@link TransactionContext}
+     * from the {@link #CURRENT_XID} ThreadLocal.
+     */
+    private void cleanCurrentXid() {
+        CURRENT_XID.set(null);
+    }
+
+    /**
+     * Returns the {@link Xid} bind to the {@link #CURRENT_XID} ThreadLocal
+     * @return current Xid or null
+     */
+    private static Xid getCurrentXid() {
+        return CURRENT_XID.get();
+    }
+
+    /**
+     * Returns the current thread identifier. The identifier is either the
+     * current thread instance or the global transaction identifier wrapped 
+     * in a {@link XidWrapper}, when running under a transaction.
+     *
+     * @return current thread identifier
+     */
+    public static Object getCurrentThreadId() {
+        Xid xid = TransactionContext.getCurrentXid();
+        if (xid != null) {
+            return new XidWrapper(xid.getGlobalTransactionId());
+        } else {
+            return Thread.currentThread();
+        }
+    }
+
+    /**
+     * Compares the given thread identifiers for equality.
+     *
+     * @see #getCurrentThreadId()
+     */
+    public static boolean isSameThreadId(Object a, Object b) {
+        if (a == b) {
+            return true;
+        } else if (a != null) {
+        	return a.equals(b);
+        } else {
+            return false;
+        }
+    }
+    
+    /**
+     * Wrapper around a global transaction id (byte[]) 
+     * that handles hashCode and equals in a proper way.
+     */
+    private static class XidWrapper {
+    	private byte[] gtid;
+    	
+    	public XidWrapper(byte[] gtid) {
+    		this.gtid = gtid;
+    	}
+
+        @Override
+        public boolean equals(Object other) {
+            if (!(other instanceof XidWrapper)) {
+                return false;
+            }
+            return Arrays.equals((byte[]) gtid, ((XidWrapper)other).gtid);
+        }
+
+        @Override
+        public int hashCode() {
+            return Arrays.hashCode(gtid);
+        }
+    }
+
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionException.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionException.java?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionException.java (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/data/core/TransactionException.java Wed Feb  5 09:27:20 2014
@@ -0,0 +1,44 @@
+/*
+ * 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.data.core;
+
+/**
+ * TransactionException is thrown when some operation inside the transaction
+ * fails.
+ */
+public class TransactionException extends Exception {
+
+    /**
+     * Creates an instance of this class. Takes a detail message as parameter.
+     *
+     * @param message message
+     */
+    public TransactionException(String message) {
+        super(message);
+    }
+
+    /**
+     * Creates an instance of this class. Takes a message and a root throwable
+     * as parameter.
+     *
+     * @param message   message
+     * @param rootCause root throwable
+     */
+    public TransactionException(String message, Throwable rootCause) {
+        super(message, rootCause);
+    }
+}

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/azure.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/azure.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/azure.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/azure.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,17 @@
+#  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.
+
+driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA IMAGE)

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/db2.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/db2.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/db2.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/db2.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,17 @@
+#  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.
+
+driver=COM.ibm.db2.jdbc.net.DB2Driver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY NOT NULL, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA BLOB(1000M)) 

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/derby.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/derby.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/derby.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/derby.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,17 @@
+#  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.
+
+# Tested with Apache Derby 10.3.1.4 on Windows XP (2007-12-11)
+driver=org.apache.derby.jdbc.EmbeddedDriver
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/h2.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/h2.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/h2.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/h2.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,18 @@
+#  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.
+
+# Tested with H2 1.0.63 on Windows XP (2007-12-11)
+driver=org.h2.Driver
+storeStream=-1
\ No newline at end of file

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/ingres.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/ingres.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/ingres.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/ingres.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,17 @@
+#  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.
+
+driver=com.ingres.jdbc.IngresDriver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY NOT NULL, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA LONG BYTE) 

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mssql.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mssql.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mssql.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mssql.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,17 @@
+#  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.
+
+driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA IMAGE)

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mysql.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mysql.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mysql.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/mysql.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,19 @@
+#  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.
+
+# Tested with MySQL 5.0.27-community-nt on Windows XP (2007-12-11)
+# currently, the objects must fit in memory
+driver=com.mysql.jdbc.Driver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA BLOB(2147483647))

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/oracle.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/oracle.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/oracle.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/oracle.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,18 @@
+#  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.
+
+# Tested with Oracle Database 10g Release 10.2.0.1.0 on Windows XP (2008-04-29)
+driver=oracle.jdbc.OracleDriver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH NUMBER, LAST_MODIFIED NUMBER, DATA BLOB)

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/postgresql.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/postgresql.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/postgresql.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/postgresql.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,20 @@
+#  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.
+
+# Tested with PostgreSQL 8.2.4 on Windows XP (2007-12-11)
+# currently, the objects must fit in memory
+driver=org.postgresql.Driver
+table=datastore
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA BYTEA)

Added: jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/sqlserver.properties
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/sqlserver.properties?rev=1564687&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/sqlserver.properties (added)
+++ jackrabbit/trunk/jackrabbit-data/src/main/resources/org/apache/jackrabbit/core/data/db/sqlserver.properties Wed Feb  5 09:27:20 2014
@@ -0,0 +1,18 @@
+#  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.
+
+# Tested with Microsoft SQL Server 2005 4 on Windows XP (2007-12-11)
+driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
+createTable=CREATE TABLE ${tablePrefix}${table}(ID VARCHAR(255) PRIMARY KEY, LENGTH BIGINT, LAST_MODIFIED BIGINT, DATA IMAGE)

Modified: jackrabbit/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/pom.xml?rev=1564687&r1=1564686&r2=1564687&view=diff
==============================================================================
--- jackrabbit/trunk/pom.xml (original)
+++ jackrabbit/trunk/pom.xml Wed Feb  5 09:27:20 2014
@@ -40,6 +40,7 @@
     <module>jackrabbit-api</module>
     <module>jackrabbit-jcr-commons</module>
     <module>jackrabbit-jcr-tests</module>
+    <module>jackrabbit-data</module>
     <module>jackrabbit-core</module>
     <module>jackrabbit-webdav</module>
     <module>jackrabbit-jcr-server</module>



Mime
View raw message