diff --git a/jOOQ/src/main/java/org/jooq/Configuration.java b/jOOQ/src/main/java/org/jooq/Configuration.java
index 7884981d1a..9bb4287c24 100644
--- a/jOOQ/src/main/java/org/jooq/Configuration.java
+++ b/jOOQ/src/main/java/org/jooq/Configuration.java
@@ -69,37 +69,9 @@ import org.jooq.conf.Settings;
public interface Configuration extends Serializable {
// -------------------------------------------------------------------------
- // Getters
+ // Custom data
// -------------------------------------------------------------------------
- /**
- * Retrieve the configured dialect.
- */
- SQLDialect dialect();
-
- /**
- * Get this configuration's underlying connection provider.
- */
- ConnectionProvider connectionProvider();
-
- /**
- * Get this configuration's underlying record mapper provider.
- */
- RecordMapperProvider recordMapperProvider();
-
- /**
- * Retrieve the configured schema mapping.
- *
- * @deprecated - 2.0.5 - Use {@link #settings()} instead
- */
- @Deprecated
- SchemaMapping schemaMapping();
-
- /**
- * Retrieve the runtime configuration settings.
- */
- Settings settings();
-
/**
* Get all custom data from this Configuration.
*
@@ -154,13 +126,52 @@ public interface Configuration extends Serializable {
*/
Object data(Object key, Object value);
+ // -------------------------------------------------------------------------
+ // Getters
+ // -------------------------------------------------------------------------
+
/**
- * Get the configured ExecuteListenerProvider from this
+ * Get this configuration's underlying connection provider.
+ */
+ ConnectionProvider connectionProvider();
+
+ /**
+ * Get this configuration's underlying record mapper provider.
+ */
+ RecordMapperProvider recordMapperProvider();
+
+ /**
+ * Get the configured RecordListenerProviders from this
+ * configuration.
+ *
+ * This method allows for retrieving the configured
+ * RecordListenerProvider from this configuration. The
+ * providers will provide jOOQ with {@link RecordListener} instances. These
+ * instances receive record manipulation notification events every time jOOQ
+ * executes queries. jOOQ makes no assumptions about the internal state of
+ * these listeners, i.e. listener instances may
+ *
+ *
share this Configuration's lifecycle (i.e. that of a
+ * JDBC Connection, or that of a transaction)
+ *
share the lifecycle of an RecordContext (i.e. that of a
+ * single record manipulation)
+ *
follow an entirely different lifecycle.
+ *
+ *
+ * @return The configured set of record listeners.
+ * @see RecordListenerProvider
+ * @see RecordListener
+ * @see RecordContext
+ */
+ RecordListenerProvider[] recordListenerProviders();
+
+ /**
+ * Get the configured ExecuteListenerProviders from this
* configuration.
*
* This method allows for retrieving the configured
* ExecuteListenerProvider from this configuration. The
- * provider will provide jOOQ with {@link ExecuteListener} instances. These
+ * providers will provide jOOQ with {@link ExecuteListener} instances. These
* instances receive execution lifecycle notification events every time jOOQ
* executes queries. jOOQ makes no assumptions about the internal state of
* these listeners, i.e. listener instances may
@@ -183,22 +194,28 @@ public interface Configuration extends Serializable {
*/
ExecuteListenerProvider[] executeListenerProviders();
+ /**
+ * Retrieve the configured schema mapping.
+ *
+ * @deprecated - 2.0.5 - Use {@link #settings()} instead
+ */
+ @Deprecated
+ SchemaMapping schemaMapping();
+
+ /**
+ * Retrieve the configured dialect.
+ */
+ SQLDialect dialect();
+
+ /**
+ * Retrieve the runtime configuration settings.
+ */
+ Settings settings();
+
// -------------------------------------------------------------------------
// Setters
// -------------------------------------------------------------------------
- /**
- * Change this configuration to hold a new dialect.
- *
- * This method is not thread-safe and should not be used in globally
- * available Configuration objects.
- *
- * @param newDialect The new dialect to be contained in the changed
- * configuration.
- * @return The changed configuration.
- */
- Configuration set(SQLDialect newDialect);
-
/**
* Change this configuration to hold a new connection provider.
*
@@ -224,16 +241,16 @@ public interface Configuration extends Serializable {
Configuration set(RecordMapperProvider newRecordMapperProvider);
/**
- * Change this configuration to hold a new settings.
+ * Change this configuration to hold a new record listener providers.
*
* This method is not thread-safe and should not be used in globally
* available Configuration objects.
*
- * @param newSettings The new settings to be contained in the changed
- * configuration.
+ * @param newRecordListenerProviders The new record listener providers to
+ * be contained in the changed configuration.
* @return The changed configuration.
*/
- Configuration set(Settings newSettings);
+ Configuration set(RecordListenerProvider... newRecordListenerProviders);
/**
* Change this configuration to hold a new execute listener providers.
@@ -247,6 +264,30 @@ public interface Configuration extends Serializable {
*/
Configuration set(ExecuteListenerProvider... newExecuteListenerProviders);
+ /**
+ * Change this configuration to hold a new dialect.
+ *
+ * This method is not thread-safe and should not be used in globally
+ * available Configuration objects.
+ *
+ * @param newDialect The new dialect to be contained in the changed
+ * configuration.
+ * @return The changed configuration.
+ */
+ Configuration set(SQLDialect newDialect);
+
+ /**
+ * Change this configuration to hold a new settings.
+ *
+ * This method is not thread-safe and should not be used in globally
+ * available Configuration objects.
+ *
+ * @param newSettings The new settings to be contained in the changed
+ * configuration.
+ * @return The changed configuration.
+ */
+ Configuration set(Settings newSettings);
+
// -------------------------------------------------------------------------
// Derivation methods
// -------------------------------------------------------------------------
@@ -259,15 +300,6 @@ public interface Configuration extends Serializable {
*/
Configuration derive();
- /**
- * Create a derived configuration from this one, with a new dialect.
- *
- * @param newDialect The new dialect to be contained in the derived
- * configuration.
- * @return The derived configuration.
- */
- Configuration derive(SQLDialect newDialect);
-
/**
* Create a derived configuration from this one, with a new connection
* provider.
@@ -289,16 +321,17 @@ public interface Configuration extends Serializable {
Configuration derive(RecordMapperProvider newRecordMapperProvider);
/**
- * Create a derived configuration from this one, with new settings.
+ * Create a derived configuration from this one, with new record listener
+ * providers.
*
- * @param newSettings The new settings to be contained in the derived
- * configuration.
+ * @param newRecordListenerProviders The new record listener providers to
+ * be contained in the derived configuration.
* @return The derived configuration.
*/
- Configuration derive(Settings newSettings);
+ Configuration derive(RecordListenerProvider... newRecordListenerProviders);
/**
- * Create a derived configuration from this one, with a new execute listener
+ * Create a derived configuration from this one, with new execute listener
* providers.
*
* @param newExecuteListenerProviders The new execute listener providers to
@@ -307,4 +340,21 @@ public interface Configuration extends Serializable {
*/
Configuration derive(ExecuteListenerProvider... newExecuteListenerProviders);
+ /**
+ * Create a derived configuration from this one, with a new dialect.
+ *
+ * @param newDialect The new dialect to be contained in the derived
+ * configuration.
+ * @return The derived configuration.
+ */
+ Configuration derive(SQLDialect newDialect);
+
+ /**
+ * Create a derived configuration from this one, with new settings.
+ *
+ * @param newSettings The new settings to be contained in the derived
+ * configuration.
+ * @return The derived configuration.
+ */
+ Configuration derive(Settings newSettings);
}
diff --git a/jOOQ/src/main/java/org/jooq/RecordContext.java b/jOOQ/src/main/java/org/jooq/RecordContext.java
new file mode 100644
index 0000000000..3c52d0885f
--- /dev/null
+++ b/jOOQ/src/main/java/org/jooq/RecordContext.java
@@ -0,0 +1,147 @@
+/**
+ * Copyright (c) 2009-2013, Lukas Eder, lukas.eder@gmail.com
+ * All rights reserved.
+ *
+ * This software is licensed to you under the Apache License, Version 2.0
+ * (the "License"); You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * . Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * . Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * . Neither the name "jOOQ" nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.jooq;
+
+import java.util.Map;
+
+/**
+ * A context object for {@link UpdatableRecord} manipulation passed to
+ * registered {@link RecordListener}'s.
+ *
+ * @author Lukas Eder
+ */
+public interface RecordContext {
+
+ /**
+ * Get all custom data from this RecordContext.
+ *
+ * This is custom data that was previously set to the record context using
+ * {@link #data(Object, Object)}. Use custom data if you want to pass data
+ * between events received by a {@link RecordListener}.
+ *
+ * Unlike {@link Configuration#data()}, these data's lifecycle only matches
+ * that of a single record manipulation.
+ *
+ * @return The custom data. This is never null
+ * @see RecordListener
+ */
+ Map