提交 47d30ba4 编写于 作者: L lancea

6843995: RowSet 1.1 updates

Reviewed-by: darcy, valeriep
上级 ffe3a8bf
/*
* 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
* <code>javax.sql.rowset.spi.RowSetFactory</code>. 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();
}
}
/*
* 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 <code>execute</code> that takes a <code>ResultSet</code> object.
*
* @param data the <code>ResultSet</code> object containing the data
* to be read into this <code>CachedRowSet</code> object
* to be read into this <code>CachedRowSet</code> object
* @throws SQLException if a null <code>ResultSet</code> object is supplied
* or this <code>CachedRowSet</code> object cannot
* retrieve the associated <code>ResultSetMetaData</code> object
* or this <code>CachedRowSet</code> object cannot
* retrieve the associated <code>ResultSetMetaData</code> 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 <code>Connection</code> object with valid
* properties
* properties
* @throws SQLException if an invalid <code>Connection</code> 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 <code>Connection</code> 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
* <code>CachedRowSet</code> object
* <code>CachedRowSet</code> object
* @see javax.sql.RowSetListener#rowSetChanged
* @see java.sql.ResultSet#close
*/
......@@ -948,9 +948,9 @@ public interface CachedRowSet extends RowSet, Joinable {
*
* @param idx an <code>int</code> identifying the column to be checked for updates
* @return <code>true</code> if the designated column has been visibly updated;
* <code>false</code> otherwise
* <code>false</code> 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 <code>String</code> object giving the name of the
* column to be checked for updates
* @return <code>true</code> if the column has been visibly updated;
* <code>false</code> otherwise
* <code>false</code> 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 {
* <P>
*
* @return a <code>Collection</code> object that contains the values in
* each row in this <code>CachedRowSet</code> object
* each row in this <code>CachedRowSet</code> 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 <code>int</code> indicating the column whose values
* are to be represented in a <code>Collection</code> object
* @return a <code>Collection</code> object that contains the values
* stored in the specified column of this <code>CachedRowSet</code>
* object
* stored in the specified column of this <code>CachedRowSet</code>
* 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 <code>String</code> object giving the name of the
* column whose values are to be represented in a collection
* @return a <code>Collection</code> object that contains the values
* stored in the specified column of this <code>CachedRowSet</code>
* object
* stored in the specified column of this <code>CachedRowSet</code>
* 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 <code>SyncProvider</code> 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
* <code>SyncProvider</code> object
* <code>SyncProvider</code> object
* @see #setSyncProvider
*/
public SyncProvider getSyncProvider() throws SQLException;
......@@ -1127,7 +1127,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @param provider a <code>String</code> object giving the fully qualified class
* name of a <code>SyncProvider</code> implementation
* @throws SQLException if an error occurs while attempting to reset the
* <code>SyncProvider</code> implementation
* <code>SyncProvider</code> 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 <code>RowSetMetaData</code> object containing
* metadata about the columns in this <code>CachedRowSet</code> object
* metadata about the columns in this <code>CachedRowSet</code> 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 <code>ResultSet</code> object that contains the original value for
* this <code>CachedRowSet</code> object
* @throws SQLException if an error occurs producing the
* <code>ResultSet</code> object
* <code>ResultSet</code> object
*/
public ResultSet getOriginal() throws SQLException;
......@@ -1217,7 +1217,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* A call to <code>setOriginalRow</code> 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 <code>CachedRowSet</code> 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 <code>RowSet</code> object that is a deep copy
* of this <code>CachedRowSet</code> object and is
* completely independent of this <code>CachedRowSet</code> object
* of this <code>CachedRowSet</code> object and is
* completely independent of this <code>CachedRowSet</code> object
* @throws SQLException if an error occurs in generating the copy of
* the of this <code>CachedRowSet</code> object
* the of this <code>CachedRowSet</code> object
* @see #createShared
* @see #createCopySchema
* @see #createCopyNoConstraints
......@@ -1396,10 +1396,10 @@ public interface CachedRowSet extends RowSet, Joinable {
* in the copy.
*
* @return a new <code>CachedRowSet</code> object that is a deep copy
* of this <code>CachedRowSet</code> object and is
* completely independent of this <code>CachedRowSet</code> object
* of this <code>CachedRowSet</code> object and is
* completely independent of this <code>CachedRowSet</code> object
* @throws SQLException if an error occurs in generating the copy of
* the of this <code>CachedRowSet</code> object
* the of this <code>CachedRowSet</code> object
* @see #createCopy
* @see #createShared
* @see #createCopySchema
......@@ -1445,7 +1445,7 @@ public interface CachedRowSet extends RowSet, Joinable {
* @return <code>true</code> if deleted rows are visible;
* <code>false</code> 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 <code>true</code> if deleted rows should be shown;
* <code>false</code> 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 <b>not</b> be committed until one of the
* <code>CachedRowSet</code> 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 <code>ResultSet</code> from where to start
* populating the records in this <code>CachedRowSet</code>
* @param rs the <code>ResultSet</code> object containing the data
* to be read into this <code>CachedRowSet</code> object
* to be read into this <code>CachedRowSet</code> object
* @throws SQLException if a null <code>ResultSet</code> object is supplied
* or this <code>CachedRowSet</code> object cannot
* retrieve the associated <code>ResultSetMetaData</code> object
* or this <code>CachedRowSet</code> object cannot
* retrieve the associated <code>ResultSetMetaData</code> 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;
}
/*
* 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{
/**
* <p>Creates a new instance of a CachedRowSet.</p>
*
* @return A new instance of a CachedRowSet.
*
* @throws SQLException if a CachedRowSet cannot
* be created.
*
* @since 1.7
*/
public CachedRowSet createCachedRowSet() throws SQLException;
/**
* <p>Creates a new instance of a FilteredRowSet.</p>
*
* @return A new instance of a FilteredRowSet.
*
* @throws SQLException if a FilteredRowSet cannot
* be created.
*
* @since 1.7
*/
public FilteredRowSet createFilteredRowSet() throws SQLException;
/**
* <p>Creates a new instance of a JdbcRowSet.</p>
*
* @return A new instance of a JdbcRowSet.
*
* @throws SQLException if a JdbcRowSet cannot
* be created.
*
* @since 1.7
*/
public JdbcRowSet createJdbcRowSet() throws SQLException;
/**
* <p>Creates a new instance of a JoinRowSet.</p>
*
* @return A new instance of a JoinRowSet.
*
* @throws SQLException if a JoinRowSet cannot
* be created.
*
* @since 1.7
*/
public JoinRowSet createJoinRowSet() throws SQLException;
/**
* <p>Creates a new instance of a WebRowSet.</p>
*
* @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
/*
* 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.
* <p>
* Example:
* </p>
* <pre>
* RowSetFactory aFactory = RowSetProvider.newFactory();
* CachedRowSet crs = aFactory.createCachedRowSet();
* ...
* RowSetFactory rsf = RowSetProvider.newFactory("com.sun.rowset.RowSetFactoryImpl", null);
* WebRowSet wrs = rsf.createWebRowSet();
* </pre>
*<p>
* Tracing of this class may be enabled by setting the System property
* {@code javax.sql.rowset.RowSetFactory.debug} to any value but {@code false}.
* </p>
*
* @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 () {
}
/**
* <p>Creates a new instance of a <code>RowSetFactory</code>
* implementation. This method uses the following
* look up order to determine
* the <code>RowSetFactory</code> implementation class to load:</p>
* <ul>
* <li>
* The System property {@code javax.sql.rowset.RowsetFactory}. For example:
* <ul>
* <li>
* -Djavax.sql.rowset.RowsetFactory=com.sun.rowset.RowSetFactoryImpl
* </li>
* </ul>
* <li>
* The ServiceLocator API. The ServiceLocator API will look
* for a classname in the file
* {@code META-INF/services/javax.sql.rowset.RowSetFactory}
* in jars available to the runtime. For example, to have the the RowSetFactory
* implementation {@code com.sun.rowset.RowSetFactoryImpl } loaded, the
* entry in {@code META-INF/services/javax.sql.rowset.RowSetFactory} would be:
* <ul>
* <li>
* {@code com.sun.rowset.RowSetFactoryImpl }
* </li>
* </ul>
* </li>
* <li>
* Platform default <code>RowSetFactory</code> instance.
* </li>
* </ul>
*
* <p>Once an application has obtained a reference to a {@code RowSetFactory},
* it can use the factory to obtain RowSet instances.</p>
*
* @return New instance of a <code>RowSetFactory</code>
*
* @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);
}
/**
* <p>Creates a new instance of a <code>RowSetFactory</code> 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.</p>
*
* <p>Once an application has obtained a reference to a <code>RowSetFactory</code>
* it can use the factory to obtain RowSet instances.</p>
*
* @param factoryClassName fully qualified factory class name that
* provides an implementation of <code>javax.sql.rowset.RowSetFactory</code>.
*
* @param cl <code>ClassLoader</code> used to load the factory
* class. If <code>null</code> current <code>Thread</code>'s context
* classLoader is used to load the factory class.
*
* @return New instance of a <code>RowSetFactory</code>
*
* @throws SQLException if <code>factoryClassName</code> is
* <code>null</code>, 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 <code>null</code>, 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);
}
}
}
......@@ -5,7 +5,7 @@
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<!--
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
......@@ -78,7 +78,7 @@ object provides a fully updatable and scrollable tabular
data structure as defined in the JDBC 3.0 specification.
<p>
<li><a href="CachedRowSet.html">
<b><code>CachedRowSet</code><sup><font size=-2>TM></font></sup</b></a>
<b><code>CachedRowSet</code>&trade;</b></a>
- A <tt>CachedRowSet</tt> object is a JavaBeans<sup><font size=-2>TM</font></sup>
component that is scrollable, updatable, serializable, and generally disconnected from
the source of its data. A <tt>CachedRowSet</tt> object
......@@ -148,7 +148,12 @@ href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
<p>
<ul>
<li><b>3.1 Role of the <code>BaseRowSet</code> Class</b>
<li><b>3.1 Constructor</b>
<p>
All <code>RowSet</code> implementations <strong>must</strong> provide a
no-argument constructor.
</li>
<li><b>3.2 Role of the <code>BaseRowSet</code> Class</b>
<p>
A compliant JDBC <code>RowSet</code> implementation <b>must</b> implement one or more
standard interfaces specified in this package and and <b>may</b> extend the
......@@ -215,7 +220,7 @@ by compliant implementations.<br>
</table>
</blockquote>
<p>
<li><b>3.2 Connected RowSet Requirements</b>
<li><b>3.3 Connected RowSet Requirements</b>
<p>
The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
be connected to the originating data source. Implementations of the <code>JdbcRowSet</code>
......@@ -229,7 +234,7 @@ supply their needs by virtue of the presence of an underlying updatable and scro
<p>
<li>
<b>3.3 Disconnected RowSet Requirements</b>
<b>3.4 Disconnected RowSet Requirements</b>
<p>
A disconnected <code>RowSet</code> object, such as a <code>CachedRowSet</code> object,
<b>should</b> delegate
......@@ -244,7 +249,7 @@ synchronization is required. A disconnected <code>RowSet</code> object should
therefore ensure that no
extraneous references remain on the <code>Connection</code> object.
<p>
<li><b>3.4 Role of RowSetMetaDataImpl</b>
<li><b>3.5 Role of RowSetMetaDataImpl</b>
<p>
The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
<a href="../RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter
......@@ -252,7 +257,7 @@ method implementations for metadata for both connected and disconnected
<code>RowSet</code> objects. All implementations are free to use this standard
implementation but are not required to do so.
<p>
<li><b>3.5 RowSetWarning Class</b>
<li><b>3.6 RowSetWarning Class</b>
<p>
The <code>RowSetWarning</code> class provides warnings that can be set
on <code>RowSet</code> implementations.
......@@ -270,7 +275,7 @@ on it, and so on until there are no more warnings.
<P>
<li><b>3.6 The Joinable Interface</b>
<li><b>3.7 The Joinable Interface</b>
<P>
The <code>Joinable</code> interface provides both connected and disconnected
<code>RowSet</code> objects with the capability to be added to a
......@@ -278,7 +283,14 @@ The <code>Joinable</code> interface provides both connected and disconnected
A <code>RowSet</code> object that has implemented the <code>Joinable</code>
interface can set a match column, retrieve a match column, or unset a match column.
A <code>JoinRowSet</code> object can then use the <code>RowSet</code> object's
match column as a basis for adding the <code>RowSet</code> object.
match column as a basis for adding the <code>RowSet</code> object.
</li>
<li><b>3.8 The RowSetFactory Interface</b>
<p>
A <code>RowSetFactory</code> implementation <strong>must</strong>
be provided.
</li>
</ul>
<h3><a name="relspec">4.0 Related Specifications</a></h3>
......
/*
* Copyright (c) 2003, 2004, 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
......@@ -344,7 +344,7 @@ public abstract class SyncProvider {
* source without checking the validity of any data.
*
*/
public static int GRADE_NONE = 1;
public static final int GRADE_NONE = 1;
/**
* Indicates a low level optimistic synchronization grade with
......@@ -354,7 +354,7 @@ public abstract class SyncProvider {
* returning this grade will check only rows that have changed.
*
*/
public static int GRADE_CHECK_MODIFIED_AT_COMMIT = 2;
public static final int GRADE_CHECK_MODIFIED_AT_COMMIT = 2;
/**
* Indicates a high level optimistic synchronization grade with
......@@ -364,7 +364,7 @@ public abstract class SyncProvider {
* returning this grade will check all rows, including rows that have not
* changed.
*/
public static int GRADE_CHECK_ALL_AT_COMMIT = 3;
public static final int GRADE_CHECK_ALL_AT_COMMIT = 3;
/**
* Indicates a pessimistic synchronization grade with
......@@ -374,7 +374,7 @@ public abstract class SyncProvider {
* implementation returning this grade will lock the row in the originating
* data source.
*/
public static int GRADE_LOCK_WHEN_MODIFIED = 4;
public static final int GRADE_LOCK_WHEN_MODIFIED = 4;
/**
* Indicates the most pessimistic synchronization grade with
......@@ -384,47 +384,47 @@ public abstract class SyncProvider {
* table affected by the original statement used to populate a
* <code>RowSet</code> object.
*/
public static int GRADE_LOCK_WHEN_LOADED = 5;
public static final int GRADE_LOCK_WHEN_LOADED = 5;
/**
* Indicates that no locks remain on the originating data source. This is the default
* lock setting for all <code>SyncProvider</code> implementations unless
* otherwise directed by a <code>RowSet</code> object.
*/
public static int DATASOURCE_NO_LOCK = 1;
public static final int DATASOURCE_NO_LOCK = 1;
/**
* Indicates that a lock is placed on the rows that are touched by the original
* SQL statement used to populate the <code>RowSet</code> object
* that is using this <code>SyncProvider</code> object.
*/
public static int DATASOURCE_ROW_LOCK = 2;
public static final int DATASOURCE_ROW_LOCK = 2;
/**
* Indicates that a lock is placed on all tables that are touched by the original
* SQL statement used to populate the <code>RowSet</code> object
* that is using this <code>SyncProvider</code> object.
*/
public static int DATASOURCE_TABLE_LOCK = 3;
public static final int DATASOURCE_TABLE_LOCK = 3;
/**
* Indicates that a lock is placed on the entire data source that is the source of
* data for the <code>RowSet</code> object
* that is using this <code>SyncProvider</code> object.
*/
public static int DATASOURCE_DB_LOCK = 4;
public static final int DATASOURCE_DB_LOCK = 4;
/**
* Indicates that a <code>SyncProvider</code> implementation
* supports synchronization between a <code>RowSet</code> object and
* the SQL <code>VIEW</code> used to populate it.
*/
public static int UPDATABLE_VIEW_SYNC = 5;
public static final int UPDATABLE_VIEW_SYNC = 5;
/**
* Indicates that a <code>SyncProvider</code> implementation
* does <B>not</B> support synchronization between a <code>RowSet</code>
* object and the SQL <code>VIEW</code> used to populate it.
*/
public static int NONUPDATABLE_VIEW_SYNC = 6;
public static final int NONUPDATABLE_VIEW_SYNC = 6;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册