DERBY-6856: Remove deprecation warnings related to Observer/Observable by adding Derby implementations of the observable behavior.

git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/trunk@1746066 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents b/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents
index d0df6bf..03cf081 100644
--- a/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents
+++ b/java/build/org/apache/derbyBuild/lastgoodjarcontents/insane.derby.jar.lastcontents
@@ -202,6 +202,8 @@
 org.apache.derby.iapi.services.locks.ShExQual.class
 org.apache.derby.iapi.services.locks.VirtualLockTable.class
 org.apache.derby.iapi.services.memory.LowMemory.class
+org.apache.derby.iapi.services.monitor.DerbyObservable.class
+org.apache.derby.iapi.services.monitor.DerbyObserver.class
 org.apache.derby.iapi.services.monitor.ModuleControl.class
 org.apache.derby.iapi.services.monitor.ModuleFactory.class
 org.apache.derby.iapi.services.monitor.ModuleSupportable.class
diff --git a/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents b/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents
index e22d45a..afb19da 100644
--- a/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents
+++ b/java/build/org/apache/derbyBuild/lastgoodjarcontents/sane.derby.jar.lastcontents
@@ -203,6 +203,8 @@
 org.apache.derby.iapi.services.locks.ShExQual.class
 org.apache.derby.iapi.services.locks.VirtualLockTable.class
 org.apache.derby.iapi.services.memory.LowMemory.class
+org.apache.derby.iapi.services.monitor.DerbyObservable.class
+org.apache.derby.iapi.services.monitor.DerbyObserver.class
 org.apache.derby.iapi.services.monitor.ModuleControl.class
 org.apache.derby.iapi.services.monitor.ModuleFactory.class
 org.apache.derby.iapi.services.monitor.ModuleSupportable.class
diff --git a/java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java b/java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java
index 76b871c..a852dcc 100644
--- a/java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java
+++ b/java/client/org/apache/derby/jdbc/BasicClientXADataSource40.java
@@ -21,7 +21,9 @@
 
 package org.apache.derby.jdbc;
 
+import java.sql.ShardingKeyBuilder;
 import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import javax.sql.XAConnection;
 import javax.sql.XADataSource;
 
@@ -56,4 +58,11 @@
 
         return getXAConnectionMinion(user, password);
     }
+
+    /** Added by Java 9 */
+    public ShardingKeyBuilder createShardingKeyBuilder()
+        throws SQLException
+    {
+        throw new java.sql.SQLFeatureNotSupportedException();
+    }
 }
diff --git a/java/client/org/apache/derby/jdbc/ClientXADataSource.java b/java/client/org/apache/derby/jdbc/ClientXADataSource.java
index a559e8e..a3fd7ee 100644
--- a/java/client/org/apache/derby/jdbc/ClientXADataSource.java
+++ b/java/client/org/apache/derby/jdbc/ClientXADataSource.java
@@ -21,6 +21,9 @@
 
 package org.apache.derby.jdbc;
 
+import java.sql.ShardingKeyBuilder;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import java.sql.SQLException;
 import javax.sql.XAConnection;
 
@@ -66,4 +69,11 @@
     public XAConnection getXAConnection(String user, String password) throws SQLException {
         return getXAConnectionMinion(user, password);
     }    
+
+    /** Added by Java 9 */
+    public ShardingKeyBuilder createShardingKeyBuilder()
+        throws SQLException
+    {
+        throw new java.sql.SQLFeatureNotSupportedException();
+    }
 }
diff --git a/java/client/org/apache/derby/jdbc/ClientXADataSource40.java b/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
index 77a54c9..84946d9 100644
--- a/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
+++ b/java/client/org/apache/derby/jdbc/ClientXADataSource40.java
@@ -21,6 +21,9 @@
 
 package org.apache.derby.jdbc;
 
+import java.sql.ShardingKeyBuilder;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import javax.sql.XADataSource;
 
 /**
@@ -35,5 +38,12 @@
 public class ClientXADataSource40 extends ClientXADataSource
     implements XADataSource /* compile-time check for 4.1 extension */
 {
-   private static final long serialVersionUID = -3463444509507830926L;
+    private static final long serialVersionUID = -3463444509507830926L;
+
+    /** Added by Java 9 */
+    public ShardingKeyBuilder createShardingKeyBuilder()
+        throws SQLException
+    {
+        throw new java.sql.SQLFeatureNotSupportedException();
+    }
 }
diff --git a/java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java b/java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java
index 60d6ac1..0331e60 100644
--- a/java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java
+++ b/java/client/org/apache/derby/jdbc/ClientXADataSourceInterface.java
@@ -21,6 +21,9 @@
 
 package org.apache.derby.jdbc;
 
+import java.sql.ShardingKeyBuilder;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
 import javax.sql.XADataSource;
 
 /**
@@ -28,4 +31,11 @@
  */
 public interface ClientXADataSourceInterface
     extends ClientDataSourceInterface, XADataSource {
+
+    /** Added by Java 9 */
+    public default ShardingKeyBuilder createShardingKeyBuilder()
+        throws SQLException
+    {
+        throw new java.sql.SQLFeatureNotSupportedException();
+    }
 }
diff --git a/java/engine/org/apache/derby/iapi/services/monitor/DerbyObservable.java b/java/engine/org/apache/derby/iapi/services/monitor/DerbyObservable.java
new file mode 100644
index 0000000..7d0e867
--- /dev/null
+++ b/java/engine/org/apache/derby/iapi/services/monitor/DerbyObservable.java
@@ -0,0 +1,134 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.services.monitor.DerbyObservable
+
+   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.derby.iapi.services.monitor;
+
+import java.util.Vector;
+
+/**
+ * <p>
+ * Created to provide the Observable behavior which Derby has depended
+ * on since Java 1.2 but which as deprecated in JDK 9 build 118. A DerbyObservable
+ * is an object whose state changes are being tracked.
+ * </p>
+ */
+public class DerbyObservable
+{
+    //////////////////////////////////////////////////////////////////////
+    //
+    // STATE
+    //
+    //////////////////////////////////////////////////////////////////////
+  
+    private boolean _hasChanged = false;
+    private Vector<DerbyObserver> _observers;
+
+    //////////////////////////////////////////////////////////////////////
+    //
+    // CONSTRUCTORS
+    //
+    //////////////////////////////////////////////////////////////////////
+  
+    /** No-arg constructor */
+    public DerbyObservable() { _observers = new Vector<DerbyObserver>(); }
+
+    //////////////////////////////////////////////////////////////////////
+    //
+    // PUBLIC BEHAVIOR
+    //
+    //////////////////////////////////////////////////////////////////////
+  
+    /**
+     * Add another observer who wants to be told about changes to this object.
+     *
+     * @param observer The object which wants to be notified when this object changes
+     *
+     * @throw IllegalArgumentException If the argument is bad (e.g., null)
+     */
+    public void addObserver(DerbyObserver observer)
+    {
+      if (observer == null) { throw new IllegalArgumentException("Null arguments not allowed."); }
+
+      if (!_observers.contains(observer)) { _observers.addElement(observer); }
+    }
+
+    /**
+     * Return the number of observers who are watching this object.
+     *
+     * @return The number of watchers
+     */
+    public int countObservers() { return _observers.size(); }
+
+    /**
+     * Remove a specific observer from the list of watchers. Null is ignored.
+     *
+     * @param observer The observer to remove.
+     */
+    public void deleteObserver(DerbyObserver observer) { _observers.removeElement(observer); }
+
+    /**
+     * This method is equivalent to notifyObservers(null);
+     */
+    public void notifyObservers() { notifyObservers(null); }
+  
+    /**
+     * If this object has changed, then notify all observers. Pass
+     * them this object and the extraInfo. This object is then marked
+     * as unchanged again.
+     *
+     * @param extraInfo Extra information to be passed to the observer's callback method.
+     */
+    public void notifyObservers(Object extraInfo)
+    {
+        // Shield the observers from further changes to the list of watchers
+        DerbyObserver[] cachedObservers;
+
+        synchronized (this)
+        {
+            if (!_hasChanged) { return; }
+            
+            cachedObservers = new DerbyObserver[_observers.size()];
+            _observers.toArray(cachedObservers);
+            _hasChanged = false;
+        }
+
+        int lastIndex = cachedObservers.length - 1;
+        for (int idx = lastIndex; idx >= 0; idx--)
+        {
+            cachedObservers[idx].update(this, extraInfo);
+        }
+    }
+  
+    //////////////////////////////////////////////////////////////////////
+    //
+    // PROTECTED BEHAVIOR TO BE CALLED BY SUBCLASSES
+    //
+    //////////////////////////////////////////////////////////////////////
+  
+    /**
+     * When the object state changes, the object calls this method
+     * in order to flag that fact. After this method has been called,
+     * then the notifyObservers() will wake up the observers which are
+     * watching this object.
+     */
+    protected void setChanged() { _hasChanged = true; }
+  
+}
diff --git a/java/engine/org/apache/derby/iapi/services/monitor/DerbyObserver.java b/java/engine/org/apache/derby/iapi/services/monitor/DerbyObserver.java
new file mode 100644
index 0000000..5905959
--- /dev/null
+++ b/java/engine/org/apache/derby/iapi/services/monitor/DerbyObserver.java
@@ -0,0 +1,41 @@
+/*
+
+   Derby - Class org.apache.derby.iapi.services.monitor.DerbyObserver
+
+   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.derby.iapi.services.monitor;
+
+/**
+ * <p>
+ * Created to provide the Observable behavior which Derby has depended
+ * on since Java 1.2 but which as deprecated in JDK 9 build 118. A DerbyObserver
+ * is an object which registers it interest in being notified when events occur.
+ * </p>
+ */
+public interface DerbyObserver
+{
+    /**
+     * This is the callback method which is invoked when a change happens
+     * to the object which is being observed.
+     *
+     * @param observable The object which is being observed
+     * @param extraInfo Extra information being passed to the callback
+     */
+    public void update(DerbyObservable observable, Object extraInfo);
+}
diff --git a/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java b/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
index 89b7f56..089b4ce 100644
--- a/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
+++ b/java/engine/org/apache/derby/iapi/store/raw/xact/RawTransaction.java
@@ -24,6 +24,7 @@
 import org.apache.derby.iapi.store.raw.ContainerKey;
 
 import org.apache.derby.iapi.services.locks.LockFactory;
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
 
 import org.apache.derby.iapi.store.raw.data.DataFactory;
 import org.apache.derby.iapi.store.raw.Compensation;
@@ -39,8 +40,6 @@
 import org.apache.derby.iapi.util.ByteArray;
 import org.apache.derby.iapi.services.io.DynamicByteArrayOutputStream;
 
-import java.util.Observable;
-
 import org.apache.derby.iapi.services.io.LimitObjectInput;
 
 /**
@@ -64,7 +63,8 @@
 	@see java.util.Observer
 */
 
-public abstract class RawTransaction extends Observable implements Transaction {
+public abstract class RawTransaction extends DerbyObservable implements Transaction
+{
 
 	public static final Integer		COMMIT =             0;
 	public static final Integer		ABORT =              1;
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java b/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
index bb426fd..1bb17e8 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/BaseContainerHandle.java
@@ -25,6 +25,8 @@
 
 import org.apache.derby.iapi.services.locks.Lockable;
 import org.apache.derby.iapi.services.locks.VirtualLockTable;
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
+import org.apache.derby.iapi.services.monitor.DerbyObserver;
 import org.apache.derby.shared.common.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.store.access.SpaceInfo;
@@ -45,15 +47,13 @@
 import org.apache.derby.catalog.UUID;
 
 import java.util.Hashtable;
-import java.util.Observable;
-import java.util.Observer;
 import java.util.Properties;
 
 /**
 	A handle to an open container, implememts RawContainerHandle.
 	<P>
-	This class is an Observer to observe RawTransactions
-	and is also a Observable to
+	This class is a DerbyObserver to observe RawTransactions
+	and is also a DerbyObservable to
 	handle the list of pages accessed thorough this handle.
 	<BR>
 	This class implements Lockable (defined to be ContainerHandle) and is
@@ -62,8 +62,8 @@
 	<BR> MT - Mutable - Immutable identity - Thread Aware
 */
 
-public class BaseContainerHandle extends Observable 
-    implements RawContainerHandle, Observer 
+public class BaseContainerHandle extends DerbyObservable 
+    implements RawContainerHandle, DerbyObserver 
 {
 
 	/*
@@ -687,7 +687,7 @@
 
 
 	/*
-	**	Methods of Observer
+	**	Methods of DerbyObserver
 	*/
 
 	/**
@@ -695,7 +695,7 @@
 
 		@see Observer#update
 	*/
-	public void update(Observable obj, Object arg) 
+	public void update(DerbyObservable obj, Object arg) 
     {
 		if (SanityManager.DEBUG) 
         {
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java b/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
index 23aa0f7..37f1db7 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/BasePage.java
@@ -30,6 +30,8 @@
 
 import org.apache.derby.iapi.services.io.LimitObjectInput;
 import org.apache.derby.iapi.services.io.TypedFormat;
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
+import org.apache.derby.iapi.services.monitor.DerbyObserver;
 
 import org.apache.derby.iapi.error.StandardException;
 
@@ -51,8 +53,6 @@
 import java.io.OutputStream;
 import java.io.ObjectInput;
 
-import java.util.Observer;
-import java.util.Observable;
 
 
 /**
@@ -76,7 +76,7 @@
  **/
 
 
-abstract class BasePage implements Page, Observer, TypedFormat
+abstract class BasePage implements Page, DerbyObserver, TypedFormat
 {
 
 	/**
@@ -1638,7 +1638,7 @@
 		@see Observer#update
 	*/
 
-	public void update(Observable obj, Object arg) {
+	public void update(DerbyObservable obj, Object arg) {
 
 		if (SanityManager.DEBUG) {
 			SanityManager.ASSERT(isLatched());
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/ContainerActionOnCommit.java b/java/engine/org/apache/derby/impl/store/raw/data/ContainerActionOnCommit.java
index f7129eb..f819033 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/ContainerActionOnCommit.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/ContainerActionOnCommit.java
@@ -21,17 +21,16 @@
 
 package org.apache.derby.impl.store.raw.data;
 
+import org.apache.derby.iapi.services.monitor.DerbyObserver;
 import org.apache.derby.iapi.store.raw.ContainerKey;
 
-import java.util.Observer;
-
 /**
 	An Observer that can be attached to a transaction to
 	implement some action when the transaction
 	commits or rollsback in some way.
 */
 
-abstract class ContainerActionOnCommit implements Observer {
+abstract class ContainerActionOnCommit implements DerbyObserver {
 
 	protected ContainerKey identity;
 
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/DropOnCommit.java b/java/engine/org/apache/derby/impl/store/raw/data/DropOnCommit.java
index 73dab87..fa40f2f 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/DropOnCommit.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/DropOnCommit.java
@@ -21,6 +21,7 @@
 
 package org.apache.derby.impl.store.raw.data;
 
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
 
 import org.apache.derby.iapi.store.raw.ContainerHandle;
 import org.apache.derby.iapi.store.raw.ContainerLock;
@@ -41,8 +42,6 @@
 import org.apache.derby.shared.common.sanity.SanityManager;
 import org.apache.derby.iapi.store.raw.ContainerKey;
 
-import java.util.Observable;
-
 /**
 	Drop a table on a commit or abort
 */
@@ -71,7 +70,7 @@
 
 		@see java.util.Observer#update
 	*/
-	public void update(Observable obj, Object arg) {
+	public void update(DerbyObservable obj, Object arg) {
 
 		if (SanityManager.DEBUG) {
 			if (arg == null)
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java b/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
index 366633c..5923b30 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/StreamFileContainerHandle.java
@@ -22,6 +22,8 @@
 package org.apache.derby.impl.store.raw.data;
 
 import org.apache.derby.iapi.services.locks.Lockable;
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
+import org.apache.derby.iapi.services.monitor.DerbyObserver;
 import org.apache.derby.shared.common.sanity.SanityManager;
 import org.apache.derby.iapi.error.StandardException;
 import org.apache.derby.iapi.store.raw.StreamContainerHandle;
@@ -34,8 +36,6 @@
 
 import org.apache.derby.catalog.UUID;
 
-import java.util.Observable;
-import java.util.Observer;
 import java.util.Properties;
 
 /**
@@ -47,7 +47,7 @@
 */
 
 final class StreamFileContainerHandle 
-    implements  StreamContainerHandle, Observer 
+    implements  StreamContainerHandle, DerbyObserver 
 {
 
 	/*
@@ -213,7 +213,7 @@
 
 		@see Observer#update
 	*/
-	public void update(Observable obj, Object arg) 
+	public void update(DerbyObservable obj, Object arg) 
     {
 		if (SanityManager.DEBUG) {
 			if (arg == null)
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/SyncOnCommit.java b/java/engine/org/apache/derby/impl/store/raw/data/SyncOnCommit.java
index 03f0cfd..3ae9f4b 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/SyncOnCommit.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/SyncOnCommit.java
@@ -21,6 +21,8 @@
 
 package org.apache.derby.impl.store.raw.data;
 
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
+
 import org.apache.derby.iapi.store.raw.ContainerHandle;
 import org.apache.derby.iapi.store.raw.ContainerLock;
 import org.apache.derby.iapi.store.raw.Page;
@@ -40,8 +42,6 @@
 
 import org.apache.derby.shared.common.sanity.SanityManager;
 
-import java.util.Observable;
-
 /**
 	Flush all pages for a table on a commit
 */
@@ -53,7 +53,7 @@
 		super(identity);
 	}
 
-	public void update(Observable obj, Object arg) {
+	public void update(DerbyObservable obj, Object arg) {
 
 		if (SanityManager.DEBUG) {
 			if (arg == null)
diff --git a/java/engine/org/apache/derby/impl/store/raw/data/TruncateOnCommit.java b/java/engine/org/apache/derby/impl/store/raw/data/TruncateOnCommit.java
index eb467b9..5e529ef 100644
--- a/java/engine/org/apache/derby/impl/store/raw/data/TruncateOnCommit.java
+++ b/java/engine/org/apache/derby/impl/store/raw/data/TruncateOnCommit.java
@@ -21,6 +21,8 @@
 
 package org.apache.derby.impl.store.raw.data;
 
+import org.apache.derby.iapi.services.monitor.DerbyObservable;
+
 import org.apache.derby.iapi.store.raw.ContainerHandle;
 import org.apache.derby.iapi.store.raw.ContainerLock;
 import org.apache.derby.iapi.store.raw.Page;
@@ -40,8 +42,6 @@
 
 import org.apache.derby.shared.common.sanity.SanityManager;
 
-import java.util.Observable;
-
 /**
 	Truncate a temp table on a commit, abort or rollback to savepoint
 */
@@ -64,7 +64,7 @@
 		}
 	}
 
-	public void update(Observable obj, Object arg) {
+	public void update(DerbyObservable obj, Object arg) {
 		if (SanityManager.DEBUG) {
 			if (arg == null)
 				SanityManager.THROWASSERT("still on observer list " + this);
diff --git a/java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java b/java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java
index 93c8996..91fd396 100644
--- a/java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java
+++ b/java/engine/org/apache/derby/jdbc/EmbeddedXADataSourceInterface.java
@@ -21,12 +21,24 @@
 
 package org.apache.derby.jdbc;
 
+import java.sql.ShardingKeyBuilder;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+
 import org.apache.derby.iapi.jdbc.ResourceAdapter;
 
 
 /**
  * Common interface of Derby embedded XA data sources.
  */
-public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource {
-    ResourceAdapter getResourceAdapter();
+public interface EmbeddedXADataSourceInterface extends EmbeddedDataSourceInterface, javax.sql.XADataSource
+{
+    public ResourceAdapter getResourceAdapter();
+
+    /** Added by Java 9 */
+    public default ShardingKeyBuilder createShardingKeyBuilder()
+        throws SQLException
+    {
+        throw new java.sql.SQLFeatureNotSupportedException();
+    }
 }