diff --git a/jdk/src/share/classes/com/sun/rowset/RowSetFactoryImpl.java b/jdk/src/share/classes/com/sun/rowset/RowSetFactoryImpl.java
new file mode 100644
index 00000000000..6f1c0fa385e
--- /dev/null
+++ b/jdk/src/share/classes/com/sun/rowset/RowSetFactoryImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.rowset;
+
+import java.sql.SQLException;
+import javax.sql.rowset.CachedRowSet;
+import javax.sql.rowset.FilteredRowSet;
+import javax.sql.rowset.JdbcRowSet;
+import javax.sql.rowset.JoinRowSet;
+import javax.sql.rowset.WebRowSet;
+import javax.sql.rowset.RowSetFactory;
+
+/**
+ * This is the implementation specific class for the
+ * javax.sql.rowset.spi.RowSetFactory
. This is the platform
+ * default implementation for the Java SE platform.
+ *
+ * @author Lance Andersen
+ *
+ *
+ * @version 1.7
+ */
+public final class RowSetFactoryImpl implements RowSetFactory {
+
+ public CachedRowSet createCachedRowSet() throws SQLException {
+ return new com.sun.rowset.CachedRowSetImpl();
+ }
+
+ public FilteredRowSet createFilteredRowSet() throws SQLException {
+ return new com.sun.rowset.FilteredRowSetImpl();
+ }
+
+
+ public JdbcRowSet createJdbcRowSet() throws SQLException {
+ return new com.sun.rowset.JdbcRowSetImpl();
+ }
+
+ public JoinRowSet createJoinRowSet() throws SQLException {
+ return new com.sun.rowset.JoinRowSetImpl();
+ }
+
+ public WebRowSet createWebRowSet() throws SQLException {
+ return new com.sun.rowset.WebRowSetImpl();
+ }
+
+}
diff --git a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
index c03d5534345..2a60bb3b7e7 100644
--- a/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
+++ b/jdk/src/share/classes/javax/sql/rowset/CachedRowSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -644,10 +644,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* of execute
that takes a ResultSet
object.
*
* @param data the ResultSet
object containing the data
- * to be read into this CachedRowSet
object
+ * to be read into this CachedRowSet
object
* @throws SQLException if a null ResultSet
object is supplied
- * or this CachedRowSet
object cannot
- * retrieve the associated ResultSetMetaData
object
+ * or this CachedRowSet
object cannot
+ * retrieve the associated ResultSetMetaData
object
* @see #execute
* @see java.sql.ResultSet
* @see java.sql.ResultSetMetaData
@@ -674,10 +674,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* to commit outstanding updates, those updates are lost.
*
* @param conn a standard JDBC Connection
object with valid
- * properties
+ * properties
* @throws SQLException if an invalid Connection
object is supplied
- * or an error occurs in establishing the connection to the
- * data source
+ * or an error occurs in establishing the connection to the
+ * data source
* @see #populate
* @see java.sql.Connection
*/
@@ -736,8 +736,8 @@ public interface CachedRowSet extends RowSet, Joinable {
*
* @throws SQLException if the cursor is on the insert row
* @throws SyncProviderException if the underlying
- * synchronization provider's writer fails to write the updates
- * back to the data source
+ * synchronization provider's writer fails to write the updates
+ * back to the data source
* @see #acceptChanges(java.sql.Connection)
* @see javax.sql.RowSetWriter
* @see javax.sql.rowset.spi.SyncFactory
@@ -807,8 +807,8 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param con a standard JDBC Connection
object
* @throws SQLException if the cursor is on the insert row
* @throws SyncProviderException if the underlying
- * synchronization provider's writer fails to write the updates
- * back to the data source
+ * synchronization provider's writer fails to write the updates
+ * back to the data source
* @see #acceptChanges()
* @see javax.sql.RowSetWriter
* @see javax.sql.rowset.spi.SyncFactory
@@ -867,7 +867,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* the rowset's Java VM resources.
*
* @throws SQLException if an error occurs flushing the contents of this
- * CachedRowSet
object
+ * CachedRowSet
object
* @see javax.sql.RowSetListener#rowSetChanged
* @see java.sql.ResultSet#close
*/
@@ -948,9 +948,9 @@ public interface CachedRowSet extends RowSet, Joinable {
*
* @param idx an int
identifying the column to be checked for updates
* @return true
if the designated column has been visibly updated;
- * false
otherwise
+ * false
otherwise
* @throws SQLException if the cursor is on the insert row, before the first row,
- * or after the last row
+ * or after the last row
* @see java.sql.DatabaseMetaData#updatesAreDetected
*/
public boolean columnUpdated(int idx) throws SQLException;
@@ -963,9 +963,9 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param columnName a String
object giving the name of the
* column to be checked for updates
* @return true
if the column has been visibly updated;
- * false
otherwise
+ * false
otherwise
* @throws SQLException if the cursor is on the insert row, before the first row,
- * or after the last row
+ * or after the last row
* @see java.sql.DatabaseMetaData#updatesAreDetected
*/
public boolean columnUpdated(String columnName) throws SQLException;
@@ -1003,7 +1003,7 @@ public interface CachedRowSet extends RowSet, Joinable {
*
*
* @return a Collection
object that contains the values in
- * each row in this CachedRowSet
object
+ * each row in this CachedRowSet
object
* @throws SQLException if an error occurs generating the collection
* @see #toCollection(int)
* @see #toCollection(String)
@@ -1030,10 +1030,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param column an int
indicating the column whose values
* are to be represented in a Collection
object
* @return a Collection
object that contains the values
- * stored in the specified column of this CachedRowSet
- * object
+ * stored in the specified column of this CachedRowSet
+ * object
* @throws SQLException if an error occurs generating the collection or
- * an invalid column id is provided
+ * an invalid column id is provided
* @see #toCollection
* @see #toCollection(String)
*/
@@ -1059,10 +1059,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param column a String
object giving the name of the
* column whose values are to be represented in a collection
* @return a Collection
object that contains the values
- * stored in the specified column of this CachedRowSet
- * object
+ * stored in the specified column of this CachedRowSet
+ * object
* @throws SQLException if an error occurs generating the collection or
- * an invalid column id is provided
+ * an invalid column id is provided
* @see #toCollection
* @see #toCollection(int)
*/
@@ -1100,7 +1100,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @return the SyncProvider
object that was set when the rowset
* was instantiated, or if none was was set, the default provider
* @throws SQLException if an error occurs while returning the
- * SyncProvider
object
+ * SyncProvider
object
* @see #setSyncProvider
*/
public SyncProvider getSyncProvider() throws SQLException;
@@ -1127,7 +1127,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param provider a String
object giving the fully qualified class
* name of a SyncProvider
implementation
* @throws SQLException if an error occurs while attempting to reset the
- * SyncProvider
implementation
+ * SyncProvider
implementation
* @see #getSyncProvider
*/
public void setSyncProvider(String provider) throws SQLException;
@@ -1152,9 +1152,9 @@ public interface CachedRowSet extends RowSet, Joinable {
* object to the rowset.
*
* @param md a RowSetMetaData
object containing
- * metadata about the columns in this CachedRowSet
object
+ * metadata about the columns in this CachedRowSet
object
* @throws SQLException if invalid metadata is supplied to the
- * rowset
+ * rowset
*/
public void setMetaData(RowSetMetaData md) throws SQLException;
@@ -1183,7 +1183,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @return a ResultSet
object that contains the original value for
* this CachedRowSet
object
* @throws SQLException if an error occurs producing the
- * ResultSet
object
+ * ResultSet
object
*/
public ResultSet getOriginal() throws SQLException;
@@ -1217,7 +1217,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* A call to setOriginalRow
is irreversible.
*
* @throws SQLException if there is no current row or an error is
- * encountered resetting the contents of the original row
+ * encountered resetting the contents of the original row
* @see #getOriginalRow
*/
public void setOriginalRow() throws SQLException;
@@ -1326,7 +1326,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* as this CachedRowSet
object and that has a cursor over
* the same data
* @throws SQLException if an error occurs or cloning is not
- * supported in the underlying platform
+ * supported in the underlying platform
* @see javax.sql.RowSetEvent
* @see javax.sql.RowSetListener
*/
@@ -1344,10 +1344,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* established must be maintained.
*
* @return a new RowSet
object that is a deep copy
- * of this CachedRowSet
object and is
- * completely independent of this CachedRowSet
object
+ * of this CachedRowSet
object and is
+ * completely independent of this CachedRowSet
object
* @throws SQLException if an error occurs in generating the copy of
- * the of this CachedRowSet
object
+ * the of this CachedRowSet
object
* @see #createShared
* @see #createCopySchema
* @see #createCopyNoConstraints
@@ -1396,10 +1396,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* in the copy.
*
* @return a new CachedRowSet
object that is a deep copy
- * of this CachedRowSet
object and is
- * completely independent of this CachedRowSet
object
+ * of this CachedRowSet
object and is
+ * completely independent of this CachedRowSet
object
* @throws SQLException if an error occurs in generating the copy of
- * the of this CachedRowSet
object
+ * the of this CachedRowSet
object
* @see #createCopy
* @see #createShared
* @see #createCopySchema
@@ -1445,7 +1445,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @return true
if deleted rows are visible;
* false
otherwise
* @throws SQLException if a rowset implementation is unable to
- * to determine whether rows marked for deletion are visible
+ * to determine whether rows marked for deletion are visible
* @see #setShowDeleted
*/
public boolean getShowDeleted() throws SQLException;
@@ -1467,7 +1467,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param b true
if deleted rows should be shown;
* false
otherwise
* @exception SQLException if a rowset implementation is unable to
- * to reset whether deleted rows should be visible
+ * to reset whether deleted rows should be visible
* @see #getShowDeleted
*/
public void setShowDeleted(boolean b) throws SQLException;
@@ -1523,9 +1523,12 @@ public interface CachedRowSet extends RowSet, Joinable {
* set to false, the changes will not be committed until one of the
* CachedRowSet
interface transaction methods is called.
*
+ * @deprecated Because this field is final (it is part of an interface),
+ * its value cannot be changed.
* @see #commit
* @see #rollback
*/
+ @Deprecated
public static final boolean COMMIT_ON_ACCEPT_CHANGES = true;
/**
@@ -1562,10 +1565,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param startRow the position in the ResultSet
from where to start
* populating the records in this CachedRowSet
* @param rs the ResultSet
object containing the data
- * to be read into this CachedRowSet
object
+ * to be read into this CachedRowSet
object
* @throws SQLException if a null ResultSet
object is supplied
- * or this CachedRowSet
object cannot
- * retrieve the associated ResultSetMetaData
object
+ * or this CachedRowSet
object cannot
+ * retrieve the associated ResultSetMetaData
object
* @see #execute
* @see #populate(ResultSet)
* @see java.sql.ResultSet
@@ -1620,3 +1623,4 @@ public interface CachedRowSet extends RowSet, Joinable {
public boolean previousPage() throws SQLException;
}
+
diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetFactory.java b/jdk/src/share/classes/javax/sql/rowset/RowSetFactory.java
new file mode 100644
index 00000000000..71d2ec531cf
--- /dev/null
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetFactory.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.sql.rowset;
+
+import java.sql.SQLException;
+
+/**
+ * An interface that defines the implementation of a factory that is used
+ * to obtain different types of {@code RowSet} implementations.
+ *
+ * @author Lance Andersen
+ * @since 1.7
+ */
+public interface RowSetFactory{
+
+ /**
+ *
Creates a new instance of a CachedRowSet.
+ * + * @return A new instance of a CachedRowSet. + * + * @throws SQLException if a CachedRowSet cannot + * be created. + * + * @since 1.7 + */ + public CachedRowSet createCachedRowSet() throws SQLException; + + /** + *Creates a new instance of a FilteredRowSet.
+ * + * @return A new instance of a FilteredRowSet. + * + * @throws SQLException if a FilteredRowSet cannot + * be created. + * + * @since 1.7 + */ + public FilteredRowSet createFilteredRowSet() throws SQLException; + + /** + *Creates a new instance of a JdbcRowSet.
+ * + * @return A new instance of a JdbcRowSet. + * + * @throws SQLException if a JdbcRowSet cannot + * be created. + * + * @since 1.7 + */ + public JdbcRowSet createJdbcRowSet() throws SQLException; + + /** + *Creates a new instance of a JoinRowSet.
+ * + * @return A new instance of a JoinRowSet. + * + * @throws SQLException if a JoinRowSet cannot + * be created. + * + * @since 1.7 + */ + public JoinRowSet createJoinRowSet() throws SQLException; + + /** + *Creates a new instance of a WebRowSet.
+ * + * @return A new instance of a WebRowSet. + * + * @throws SQLException if a WebRowSet cannot + * be created. + * + * @since 1.7 + */ + public WebRowSet createWebRowSet() throws SQLException; + +} \ No newline at end of file diff --git a/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java new file mode 100644 index 00000000000..1a84161ce15 --- /dev/null +++ b/jdk/src/share/classes/javax/sql/rowset/RowSetProvider.java @@ -0,0 +1,305 @@ +/* + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package javax.sql.rowset; + +import java.security.AccessController; +import java.security.PrivilegedAction; +import java.sql.SQLException; +import java.util.ServiceLoader; +import javax.sql.rowset.RowSetFactory; + +/** + * A factory API that enables applications to obtain a + * {@code RowSetFactory} implementation that can be used to create different + * types of {@code RowSet} implementations. + *+ * Example: + *
+ *+ * RowSetFactory aFactory = RowSetProvider.newFactory(); + * CachedRowSet crs = aFactory.createCachedRowSet(); + * ... + * RowSetFactory rsf = RowSetProvider.newFactory("com.sun.rowset.RowSetFactoryImpl", null); + * WebRowSet wrs = rsf.createWebRowSet(); + *+ *
+ * Tracing of this class may be enabled by setting the System property + * {@code javax.sql.rowset.RowSetFactory.debug} to any value but {@code false}. + *
+ * + * @author Lance Andersen + * @since 1.7 + */ +public class RowSetProvider { + + private static final String ROWSET_DEBUG_PROPERTY = "javax.sql.rowset.RowSetProvider.debug"; + private static final String ROWSET_FACTORY_IMPL = "com.sun.rowset.RowSetFactoryImpl"; + private static final String ROWSET_FACTORY_NAME = "javax.sql.rowset.RowSetFactory"; + /** + * Internal debug flag. + */ + private static boolean debug = true; + + + static { + // Check to see if the debug property is set + String val = getSystemProperty(ROWSET_DEBUG_PROPERTY); + // Allow simply setting the prop to turn on debug + debug = val != null && !"false".equals(val); + } + + + protected RowSetProvider () { + } + + /** + *Creates a new instance of a RowSetFactory
+ * implementation. This method uses the following
+ * look up order to determine
+ * the RowSetFactory
implementation class to load:
RowSetFactory
instance.
+ * Once an application has obtained a reference to a {@code RowSetFactory}, + * it can use the factory to obtain RowSet instances.
+ * + * @return New instance of aRowSetFactory
+ *
+ * @throws SQLException if the default factory class cannot be loaded,
+ * instantiated. The cause will be set to actual Exception
+ *
+ * @see ServiceLoader
+ * @since 1.7
+ */
+ public static RowSetFactory newFactory()
+ throws SQLException {
+ // Use the system property first
+ RowSetFactory factory = null;
+ String factoryClassName = null;
+ try {
+ trace("Checking for Rowset System Property...");
+ factoryClassName = getSystemProperty(ROWSET_FACTORY_NAME);
+ if (factoryClassName != null) {
+ trace("Found system property, value=" + factoryClassName);
+ factory = (RowSetFactory) getFactoryClass(factoryClassName, null, true).newInstance();
+ }
+ } catch (ClassNotFoundException e) {
+ throw new SQLException(
+ "RowSetFactory: " + factoryClassName + " not found", e);
+ } catch (Exception e) {
+ throw new SQLException(
+ "RowSetFactory: " + factoryClassName + " could not be instantiated: " + e,
+ e);
+ }
+
+ // Check to see if we found the RowSetFactory via a System property
+ if (factory == null) {
+ // If the RowSetFactory is not found via a System Property, now
+ // look it up via the ServiceLoader API and if not found, use the
+ // Java SE default.
+ factory = loadViaServiceLoader();
+ factory =
+ factory == null ? newFactory(ROWSET_FACTORY_IMPL, null) : factory;
+ }
+ return (factory);
+ }
+
+ /**
+ * Creates a new instance of a RowSetFactory
from the
+ * specified factory class name.
+ * This function is useful when there are multiple providers in the classpath.
+ * It gives more control to the application as it can specify which provider
+ * should be loaded.
Once an application has obtained a reference to a RowSetFactory
+ * it can use the factory to obtain RowSet instances.
javax.sql.rowset.RowSetFactory
.
+ *
+ * @param cl ClassLoader
used to load the factory
+ * class. If null
current Thread
's context
+ * classLoader is used to load the factory class.
+ *
+ * @return New instance of a RowSetFactory
+ *
+ * @throws SQLException if factoryClassName
is
+ * null
, or the factory class cannot be loaded, instantiated.
+ *
+ * @see #newFactory()
+ *
+ * @since 1.7
+ */
+ public static RowSetFactory newFactory(String factoryClassName, ClassLoader cl)
+ throws SQLException {
+
+ trace("***In newInstance()");
+ try {
+ Class providerClass = getFactoryClass(factoryClassName, cl, false);
+ RowSetFactory instance = (RowSetFactory) providerClass.newInstance();
+ if (debug) {
+ trace("Created new instance of " + providerClass +
+ " using ClassLoader: " + cl);
+ }
+ return instance;
+ } catch (ClassNotFoundException x) {
+ throw new SQLException(
+ "Provider " + factoryClassName + " not found", x);
+ } catch (Exception x) {
+ throw new SQLException(
+ "Provider " + factoryClassName + " could not be instantiated: " + x,
+ x);
+ }
+ }
+
+ /*
+ * Returns the class loader to be used.
+ * @return The ClassLoader to use.
+ *
+ */
+ static private ClassLoader getContextClassLoader() throws SecurityException {
+ return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
+
+ public Object run() {
+ ClassLoader cl = null;
+
+ cl = Thread.currentThread().getContextClassLoader();
+
+ if (cl == null) {
+ cl = ClassLoader.getSystemClassLoader();
+ }
+
+ return cl;
+ }
+ });
+ }
+
+ /**
+ * Attempt to load a class using the class loader supplied. If that fails
+ * and fall back is enabled, the current (i.e. bootstrap) class loader is
+ * tried.
+ *
+ * If the class loader supplied is null
, first try using the
+ * context class loader followed by the current class loader.
+ * @return The class which was loaded
+ */
+ static private Class getFactoryClass(String factoryClassName, ClassLoader cl,
+ boolean doFallback) throws ClassNotFoundException {
+ try {
+ if (cl == null) {
+ cl = getContextClassLoader();
+ if (cl == null) {
+ throw new ClassNotFoundException();
+ } else {
+ return cl.loadClass(factoryClassName);
+ }
+ } else {
+ return cl.loadClass(factoryClassName);
+ }
+ } catch (ClassNotFoundException e) {
+ if (doFallback) {
+ // Use current class loader
+ return Class.forName(factoryClassName, true, RowSetFactory.class.getClassLoader());
+ } else {
+ throw e;
+ }
+ }
+ }
+
+ /**
+ * Use the ServiceLoader mechanism to load the default RowSetFactory
+ * @return default RowSetFactory Implementation
+ */
+ static private RowSetFactory loadViaServiceLoader() {
+ RowSetFactory theFactory = null;
+ trace("***in loadViaServiceLoader()");
+ for (RowSetFactory factory : ServiceLoader.load(javax.sql.rowset.RowSetFactory.class)) {
+ trace(" Loading done by the java.util.ServiceLoader :" + factory.getClass().getName());
+ theFactory = factory;
+ break;
+ }
+ return theFactory;
+
+ }
+
+ /**
+ * Returns the requested System Property. If a {@code SecurityException}
+ * occurs, just return NULL
+ * @param propName - System property to retreive
+ * @return The System property value or NULL if the property does not exist
+ * or a {@code SecurityException} occurs.
+ */
+ static private String getSystemProperty(final String propName) {
+ String property = null;
+ try {
+ property = (String) AccessController.doPrivileged(new PrivilegedAction() {
+
+ public Object run() {
+ return System.getProperty(propName);
+ }
+ });
+ } catch (SecurityException se) {
+ if (debug) {
+ se.printStackTrace();
+ }
+ }
+ return property;
+ }
+
+ /**
+ * Debug routine which will output tracing if the System Property
+ * -Djavax.sql.rowset.RowSetFactory.debug is set
+ * @param msg - The debug message to display
+ */
+ private static void trace(String msg) {
+ if (debug) {
+ System.err.println("###RowSets: " + msg);
+ }
+ }
+}
diff --git a/jdk/src/share/classes/javax/sql/rowset/package.html b/jdk/src/share/classes/javax/sql/rowset/package.html
index 41d00d565b5..8b905cd63aa 100644
--- a/jdk/src/share/classes/javax/sql/rowset/package.html
+++ b/jdk/src/share/classes/javax/sql/rowset/package.html
@@ -5,7 +5,7 @@