APIdia Launch Partner
Top Description Fields Constructors Methods
javax.sql.rowset

public Class RowSetProvider

extends Object
Class Inheritance
Imports
java.sql.SQLException, java.util.ServiceConfigurationError, .ServiceLoader

A factory API that enables applications to obtain a RowSetFactory implementation that can be used to create different types of 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 javax.sql.rowset.RowSetFactory.debug to any value but false.

Author
Lance Andersen
Since
1.7

Field Summary

Modifier and TypeField and Description
private static boolean
debug

Internal debug flag.

private static final String
private static final String
private static final String

Constructor Summary

AccessConstructor and Description
protected
RowSetProvider()

RowSetProvider constructor

Method Summary

Modifier and TypeMethod and Description
private static RowSetFactory
private static ClassLoader
private static Class<?>

Returns:

The class which was loaded
getFactoryClass
(String factoryClassName, ClassLoader cl, boolean doFallback)

Attempt to load a class using the class loader supplied.

private static RowSetFactory

Returns:

default RowSetFactory Implementation
loadViaServiceLoader
()

Use the ServiceLoader mechanism to load the default RowSetFactory

public static RowSetFactory

Returns:

New instance of a RowSetFactory
newFactory
()

Creates a new instance of a RowSetFactory implementation.

public static RowSetFactory

Returns:

New instance of a RowSetFactory
newFactory
(String
fully qualified factory class name that provides an implementation of javax.sql.rowset.RowSetFactory.
factoryClassName
,
ClassLoader
ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.
cl
)

Creates a new instance of a RowSetFactory from the specified factory class name.

private static void
trace(String
- The debug message to display
msg
)

Debug routine which will output tracing if the System Property -Djavax.sql.rowset.RowSetFactory.debug is set

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

debugback to summary
private static boolean debug

Internal debug flag.

ROWSET_DEBUG_PROPERTYback to summary
private static final String ROWSET_DEBUG_PROPERTY
ROWSET_FACTORY_IMPLback to summary
private static final String ROWSET_FACTORY_IMPL
ROWSET_FACTORY_NAMEback to summary
private static final String ROWSET_FACTORY_NAME

Constructor Detail

RowSetProviderback to summary
protected RowSetProvider()

RowSetProvider constructor

Method Detail

defaultRowSetFactoryback to summary
private static RowSetFactory defaultRowSetFactory()
getContextClassLoaderback to summary
private static ClassLoader getContextClassLoader()
getFactoryClassback to summary
private static Class<?> getFactoryClass(String factoryClassName, ClassLoader cl, boolean doFallback) throws ClassNotFoundException

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.

Returns:Class<?>

The class which was loaded

loadViaServiceLoaderback to summary
private static RowSetFactory loadViaServiceLoader() throws SQLException

Use the ServiceLoader mechanism to load the default RowSetFactory

Returns:RowSetFactory

default RowSetFactory Implementation

newFactoryback to summary
public static RowSetFactory newFactory() throws SQLException

Creates a new instance of a RowSetFactory implementation. This method uses the following look up order to determine the RowSetFactory implementation class to load:

  • The System property javax.sql.rowset.RowSetFactory. For example:
    • -Djavax.sql.rowset.RowSetFactory=com.sun.rowset.RowSetFactoryImpl
  • The ServiceLoader API. The ServiceLoader API will look for a class name in the file META-INF/services/javax.sql.rowset.RowSetFactory in jars available to the runtime. For example, to have the RowSetFactory implementation com.sun.rowset.RowSetFactoryImpl loaded, the entry in META-INF/services/javax.sql.rowset.RowSetFactory would be:
    • com.sun.rowset.RowSetFactoryImpl
  • Platform default RowSetFactory instance.

Once an application has obtained a reference to a RowSetFactory, it can use the factory to obtain RowSet instances.

Returns:RowSetFactory

New instance of a RowSetFactory

Exceptions
SQLException:
if the default factory class cannot be loaded, instantiated. The cause will be set to actual Exception
Since
1.7
See Also
ServiceLoader
newFactoryback to summary
public static RowSetFactory newFactory(String factoryClassName, ClassLoader cl) throws SQLException

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.

Parameters
factoryClassName:String

fully qualified factory class name that provides an implementation of javax.sql.rowset.RowSetFactory.

cl:ClassLoader

ClassLoader used to load the factory class. If null current Thread's context classLoader is used to load the factory class.

Returns:RowSetFactory

New instance of a RowSetFactory

Exceptions
SQLException:
if factoryClassName is null, or the factory class cannot be loaded, instantiated.
Since
1.7
See Also
newFactory()
traceback to summary
private static void trace(String msg)

Debug routine which will output tracing if the System Property -Djavax.sql.rowset.RowSetFactory.debug is set

Parameters
msg:String

- The debug message to display